.support-dock { right: max(64px, env(safe-area-inset-right)); }
.support-panel, .support-panel[hidden] {
  --mascot-unit: 812.5px;
  display: flex; flex-direction: column; isolation: isolate;
  background: transparent; box-shadow: none; overflow: visible;
  max-height: calc(100dvh - 280px);
}
.support-panel::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; background: #fbfaf8; pointer-events: none;
  box-shadow: 0 24px 64px rgb(16 23 19 / .16), 0 3px 14px rgb(16 23 19 / .08), inset 0 0 0 1px rgb(16 23 19 / .06);
}
.support-panel > :not(.support-mascot) { position: relative; z-index: 1; flex-shrink: 0; }
.support-panel > .support-messages { flex: 0 1 auto; min-height: 56px; max-height: 240px; }
.support-mascot {
  position: absolute; z-index: -2;
  top: calc(var(--mascot-unit) * -.23); left: 50%;
  width: calc(var(--mascot-unit) * .64); height: calc(var(--mascot-unit) * .74);
  transform: translateX(-50%); pointer-events: none;
  /* The opaque card surface at z-index -1 occludes the real model at its exact edge. */
}
.support-mascot[hidden] { display: none; }
.support-mascot-front { z-index: 0; filter: drop-shadow(0 1px 1px rgb(43 17 64 / .12)); }
.support-mascot model-viewer { display: block; width: 100%; height: 100%; pointer-events: none; --progress-bar-color: transparent; }
.support-panel[aria-hidden="false"] .support-mascot[data-ready="true"] { animation: support-mascot-peek 440ms cubic-bezier(.2,.75,.25,1) both; }
@keyframes support-mascot-peek {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (max-width: 760px) {
  .support-dock { right: max(12px, env(safe-area-inset-right)); }
  .support-panel, .support-panel[hidden] {
    position: absolute; right: 28px; bottom: 64px;
    width: calc(100vw - 112px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: calc(100dvh - 200px); padding: 18px; overflow: visible;
  }
  .support-panel-header { gap: 10px; }
  .support-panel-header h2 { font-size: 21px; }
  .support-message { max-width: 100%; }
}
@media (max-width: 360px) {
  .support-panel, .support-panel[hidden] { padding: 16px; }
  .support-panel-header h2 { font-size: 20px; }
  .support-prompts { gap: 5px; }
}
@media (max-height: 600px) {
  .support-prompts { display: none; }
  .support-panel > .support-messages { max-height: 80px; min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .support-panel[aria-hidden="false"] .support-mascot[data-ready="true"] { animation: none; }
}

.site-footer > .mascot-credit { grid-column: 1 / -1; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.site-footer > .mascot-credit a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* First opening: the mascot's short speech becomes the first chat message. */
.support-panel[data-intro="waiting"] .support-messages > :first-child,
.support-panel[data-intro="speaking"] .support-messages > :first-child { opacity: 0; }
.support-panel[data-intro="transfer"] .support-messages > :first-child {
  animation: support-message-arrive 760ms cubic-bezier(.22,.75,.2,1) both;
}
.support-panel > .support-mascot-speech {
  position: absolute; z-index: 3; left: calc(50% - 107px); top: calc(var(--mascot-unit) * -.14 - 52px);
  width: 214px; padding: 12px 16px; border-radius: 22px;
  background: #fbfaf8; color: #202923; font-size: 14px; font-weight: 650;
  line-height: 20px; box-shadow: 0 5px 20px rgb(36 16 59 / .12);
  pointer-events: none; transform-origin: top left;
  animation: support-speech-arrive 380ms cubic-bezier(.2,.75,.25,1) both;
}
.support-mascot-speech::before {
  content: ''; position: absolute; bottom: -5px; left: calc(50% - 6px);
  width: 12px; height: 12px; background: inherit; transform: rotate(45deg); border-radius: 3px;
}
@keyframes support-speech-arrive {
  from { opacity: 0; translate: 0 7px; scale: .94; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes support-message-arrive {
  0%, 30% { opacity: 0; transform: translateY(-12px); }
  100% { opacity: 1; transform: translateY(0); }
}
@media (max-width: 360px) {
  .support-panel > .support-mascot-speech { left: calc(50% - 97px); width: 194px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .support-panel .support-messages > :first-child { opacity: 1; animation: none; }
  .support-panel > .support-mascot-speech { display: none; }
}
