.site-mascot {
  --mascot-size: 196px;
  position: fixed;
  right: 84px;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  width: var(--mascot-size);
  aspect-ratio: 3 / 4;
  z-index: 20;
  pointer-events: none;
  isolation: isolate;
}
.mascot-character {
  position: absolute;
  inset: 0;
  background-image: url('assets/mascot-chair-turntable.png');
  background-size: 400% 200%;
  background-position: var(--sprite-x, 0%) var(--sprite-y, 0%);
  background-repeat: no-repeat;
  image-rendering: pixelated;
  transform: perspective(700px) rotateY(var(--turn-offset, 0deg));
  transform-origin: 50% 70%;
}
.mascot-shadow {
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 6%;
  height: 5%;
  background: #0064ff;
  opacity: .15;
  filter: blur(9px);
  z-index: -1;
}
.mascot-toggle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #3a4e6c;
  color: #c2d5f4;
  background: #111d30e6;
  pointer-events: auto;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .2s;
}
.site-mascot:hover .mascot-toggle, .mascot-toggle:focus-visible { opacity: 1; }
.mascot-toggle-icon { width: 10px; height: 12px; border-left: 3px solid; border-right: 3px solid; }
.site-mascot.is-paused .mascot-toggle-icon { border: 0; background: currentColor; clip-path: polygon(10% 0,100% 50%,10% 100%); }
body:has(dialog[open]) .site-mascot, .menu-open .site-mascot { visibility: hidden; }
@media (max-width: 767px) {
  .site-mascot { --mascot-size: 148px; right: 84px; bottom: 8px; }
  .mascot-toggle { width: 28px; height: 28px; }
}
@media (hover: none) { .mascot-toggle { opacity: .7; } }
@media (prefers-reduced-motion: reduce) {
  .mascot-character { transform: none; background-position: 0% 0%; }
  .mascot-toggle { display: none; }
}

/* Small alternating hand taps, clipped to each turntable view. */
.mascot-hands, .mascot-hand-sprite { position: absolute; inset: 0; }
.mascot-hands { pointer-events: none; }
.mascot-hands--left { clip-path: var(--hand-left, inset(100%)); }
.mascot-hands--right { clip-path: var(--hand-right, inset(100%)); }
.mascot-hand-sprite {
  background: url('assets/mascot-chair-turntable.png') var(--sprite-x, 0%) var(--sprite-y, 0%) / 400% 200% no-repeat;
  image-rendering: pixelated;
  animation: mascot-typing 1.15s steps(1, end) infinite;
}
.mascot-hands--right .mascot-hand-sprite { animation-delay: -.46s; }
@keyframes mascot-typing {
  0%, 24%, 49%, 72%, 100% { transform: translateY(0); }
  12%, 37%, 61% { transform: translateY(-1.5px); }
  84% { transform: translateY(-.75px); }
}
.site-mascot.is-paused .mascot-hand-sprite { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .mascot-hand-sprite { animation: none; } }
