:root {
  --ember: #ff7a1a;
  --gold: #ffd166;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #05060a;
  overflow: hidden;
  font-family: 'Georgia', 'Baskerville', serif;
}

#experience {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

.stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---- Stage 1: intro cinematic ---- */
.stage-intro {
  background: #000;
  transition: opacity 0.9s ease;
}
.stage-intro.stage-hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.enter-button {
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  padding: 16px 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.6);
  background: rgba(10, 8, 4, 0.55);
  backdrop-filter: blur(6px);
  color: var(--gold);
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  opacity: 0;
  animation: fadeInPrompt 1s ease 1.4s forwards, gentlePulse 2.4s ease-in-out 2.4s infinite;
}

@keyframes fadeInPrompt {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes gentlePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.25); }
  50% { box-shadow: 0 0 0 14px rgba(255, 209, 102, 0); }
}

/* ---- Stage 2: interactive forest ---- */
.stage-forest {
  background: #05060a;
  opacity: 0;
  transition: opacity 1s ease;
}
.stage-forest.stage-visible {
  opacity: 1;
}

.forest-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.55) saturate(1.1);
  /* transform (scale + parallax drift) is set below, near the parallax rules */
}

.stage-forest {
  display: flex;
  align-items: center;
  justify-content: center;
}

.forest-frame {
  position: relative;
  /* CSS fallback only for the very first paint before JS runs (fitForestFrame
     in experience.js). aspect-ratio + max-width/max-height alone is NOT
     reliable here — combined with height:100% it can produce a frame box
     that doesn't actually match the image's aspect ratio, which silently
     breaks hotspot alignment. JS sets exact pixel width/height, which wins. */
  aspect-ratio: 1672 / 941;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  /* Phase 2A parallax target — JS sets --px/--py on mousemove (desktop only).
     Moving the whole frame (art + hotspot + atmosphere) together keeps the
     hotspot perfectly glued to Flixt's painted position at any offset. */
  transform: translate3d(calc(var(--px, 0) * 1px), calc(var(--py, 0) * 1px), 0);
  transition: transform 0.4s ease-out;
}

/* Backdrop drifts opposite and less than the frame for a subtle depth cue */
.forest-backdrop {
  transform: scale(1.15) translate3d(calc(var(--px, 0) * -0.4px), calc(var(--py, 0) * -0.4px), 0);
  transition: transform 0.4s ease-out;
}

.forest-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 9%;
  aspect-ratio: 1 / 1;
  min-width: 48px;
  min-height: 48px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.hotspot-pulse {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(255, 209, 102, 0.85);
  box-shadow: 0 0 0 6px rgba(255, 209, 102, 0.18), 0 0 24px rgba(255, 209, 102, 0.5);
  animation: hotspotPulse 2.2s ease-in-out infinite;
}

@keyframes hotspotPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.12); opacity: 1; }
}

.hotspot:hover .hotspot-pulse,
.hotspot:focus-visible .hotspot-pulse {
  border-color: #fff2c9;
  box-shadow: 0 0 0 8px rgba(255, 209, 102, 0.28), 0 0 34px rgba(255, 209, 102, 0.7);
}

/* Flixt's glow strengthens as the pointer approaches — toggled by JS */
.hotspot-flixt.is-near .hotspot-pulse {
  border-color: #fff8e6;
  box-shadow: 0 0 0 10px rgba(255, 209, 102, 0.32), 0 0 44px rgba(255, 209, 102, 0.85);
}

/* ---- Phase 2A: lightweight forest atmosphere ---- */
.forest-atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Soft warm glow breathing over the magical treehouse */
.forest-glow {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  pointer-events: none;
}

.forest-glow-tree {
  left: 54%;
  top: 30%;
  width: 16%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 209, 102, 0.55) 0%, rgba(255, 209, 102, 0.18) 45%, transparent 72%);
}

/* Faint mist hugging the lower/water part of the scene — kept low-opacity
   and low-height so it never obscures the painted characters or signage */
.forest-mist {
  position: absolute;
  bottom: -4%;
  width: 55%;
  height: 22%;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  filter: blur(18px);
  mix-blend-mode: screen;
  opacity: 0.5;
}
.forest-mist-left { left: -6%; }
.forest-mist-right { right: -6%; }

/* Fireflies — plain divs animated with CSS only (no per-frame JS) */
.firefly {
  position: absolute;
  left: calc(var(--x, 50) * 1%);
  top: calc(var(--y, 50) * 1%);
  width: var(--size, 5px);
  height: var(--size, 5px);
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d8 0%, #ffcf7a 45%, rgba(255, 176, 59, 0) 75%);
  box-shadow: 0 0 6px 2px rgba(255, 205, 120, 0.7);
  opacity: 0;
}

.firefly-near {
  box-shadow: 0 0 8px 3px rgba(255, 205, 120, 0.85);
}
#forestAtmosphere.is-near .firefly-near {
  box-shadow: 0 0 12px 5px rgba(255, 220, 150, 1);
}

/* Motion-safe fallback: gentle but static (no drifting/pulsing) */
.firefly { opacity: 0.5; }
.forest-glow-tree { opacity: 0.5; }
.forest-mist { opacity: 0.35; }

@media (prefers-reduced-motion: no-preference) {
  .firefly {
    animation: fireflyDrift var(--dur, 9s) ease-in-out var(--delay, 0s) infinite alternate;
  }
  #forestAtmosphere.is-near .firefly-near {
    animation-duration: calc(var(--dur, 9s) * 0.55);
  }
  .forest-glow-tree {
    animation: glowBreathe 7s ease-in-out infinite;
  }
  .forest-mist-left {
    animation: mistDriftLeft 28s ease-in-out infinite alternate;
  }
  .forest-mist-right {
    animation: mistDriftRight 32s ease-in-out infinite alternate;
  }
}

@keyframes fireflyDrift {
  0%   { transform: translate(0, 0); opacity: 0.15; }
  50%  { opacity: 0.9; }
  100% { transform: translate(calc(var(--dx, 18) * 1px), calc(var(--dy, -14) * 1px)); opacity: 0.35; }
}

@keyframes glowBreathe {
  0%, 100% { opacity: 0.35; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.65; transform: translate(-50%, -50%) scale(1.08); }
}

@keyframes mistDriftLeft {
  from { transform: translateX(0); opacity: 0.3; }
  to   { transform: translateX(3%); opacity: 0.5; }
}

@keyframes mistDriftRight {
  from { transform: translateX(0); opacity: 0.3; }
  to   { transform: translateX(-3%); opacity: 0.5; }
}

/* ---- Phase 3A: interactive owl ---------------------------------------- */
.owl-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 11%;
  min-width: 52px;
  min-height: 40px;
  aspect-ratio: 1408 / 1117;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  z-index: 3;
}

.owl-glow {
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 224, 160, 0.55) 0%, rgba(255, 200, 120, 0.2) 45%, transparent 72%);
  mix-blend-mode: screen;
  opacity: 0.35;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.owl-hotspot:hover .owl-glow,
.owl-hotspot:focus-visible .owl-glow,
.owl-hotspot.is-near .owl-glow {
  opacity: 0.75;
  transform: scale(1.15);
}

.owl-bob {
  display: block;
  width: 100%;
  height: 100%;
  transform: none;
}

.owl-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}

/* Occasional idle sparkles near the owl (rare, brief flashes) */
.owl-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d8 0%, #ffcf7a 50%, transparent 75%);
  box-shadow: 0 0 6px 2px rgba(255, 205, 120, 0.7);
  opacity: 0;
  pointer-events: none;
}
.owl-sparkle-1 { left: 12%; top: 8%; }
.owl-sparkle-2 { right: 8%; top: 52%; }

.owl-hotspot:hover .owl-sparkle-1,
.owl-hotspot:hover .owl-sparkle-2,
.owl-hotspot.is-near .owl-sparkle-1,
.owl-hotspot.is-near .owl-sparkle-2 {
  animation-duration: 1.6s;
}

/* Flight particle trail — plain children of the owl button, so they travel
   with it automatically as the parent's own position animates; no per-frame
   JS position tracking needed. */
.owl-trail { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.owl-trail .trail-particle {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff2c9 0%, #ffcf7a 50%, transparent 75%);
  box-shadow: 0 0 6px 2px rgba(255, 205, 120, 0.75);
  opacity: 0;
}

/* Motion-safe fallback (no preference set below = default): keep everything
   present but static/invisible until the no-preference block enables motion */
.owl-sparkle { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .owl-bob {
    animation: owlBob 3.4s ease-in-out infinite;
  }
  .owl-hotspot.is-flying .owl-bob {
    animation-duration: 0.32s;
  }
  .owl-glow {
    animation: glowBreathe 6s ease-in-out infinite;
  }
  .owl-sparkle-1 { animation: owlSparkle 7s ease-in-out infinite; animation-delay: 1.2s; }
  .owl-sparkle-2 { animation: owlSparkle 8.5s ease-in-out infinite; animation-delay: 4s; }

  .owl-hotspot.is-flying {
    animation: owlFlight 4s cubic-bezier(.35,.02,.3,1) forwards;
  }
  .owl-hotspot.is-flying.flying-backward {
    animation-direction: reverse;
  }
  .owl-hotspot.is-flying .trail-particle {
    animation: trailFade 0.7s ease-out infinite;
  }
  .owl-hotspot.is-flying .trail-particle:nth-child(2) { animation-delay: 0.12s; left: 42%; }
  .owl-hotspot.is-flying .trail-particle:nth-child(3) { animation-delay: 0.24s; left: 58%; top: 65%; }
  .owl-hotspot.is-flying .trail-particle:nth-child(4) { animation-delay: 0.36s; left: 46%; top: 70%; }
  .owl-hotspot.is-flying .trail-particle:nth-child(5) { animation-delay: 0.48s; left: 54%; top: 50%; }
}

/* Reduced motion: no curved flight — JS toggles this class for a plain
   fade-out/reposition/fade-in instead of the keyframe animation above */
.owl-hotspot.owl-fade {
  transition: opacity 0.4s ease;
  opacity: 0;
}

@keyframes owlBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-4%) rotate(2deg); }
}

@keyframes owlSparkle {
  0%, 88%, 100% { opacity: 0; transform: scale(0.5); }
  92%           { opacity: 0.9; transform: scale(1); }
}

@keyframes trailFade {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.6); }
  30%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate(-16px, 10px) scale(0.3); }
}

@keyframes owlFlight {
  0%   { left: 31%; top: 11%; transform: translate(-50%, -50%) rotate(0deg)   scale(1); }
  6%   { left: 31%; top: 12%; transform: translate(-50%, -50%) rotate(-3deg)  scale(0.94); }
  16%  { left: 34%; top: 8%;  transform: translate(-50%, -50%) rotate(-9deg)  scale(1.08); }
  38%  { left: 40%; top: 5%;  transform: translate(-50%, -50%) rotate(-6deg)  scale(1.1); }
  58%  { left: 46%; top: 4%;  transform: translate(-50%, -50%) rotate(2deg)   scale(1.1); }
  78%  { left: 50%; top: 9%;  transform: translate(-50%, -50%) rotate(9deg)   scale(1.05); }
  93%  { left: 52%; top: 18%; transform: translate(-50%, -50%) rotate(4deg)   scale(1.0); }
  100% { left: 53%; top: 23%; transform: translate(-50%, -50%) rotate(0deg)   scale(0.98); }
}

/* ---- Phase 3B: interactive squirrel ------------------------------------ */
.squirrel-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 9%;
  min-width: 50px;
  min-height: 46px;
  aspect-ratio: 1307 / 1203;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  z-index: 3;
}
.squirrel-hotspot:hover,
.squirrel-hotspot:focus-visible,
.squirrel-hotspot.is-near {
  transform: translate(-50%, -50%) scale(1.08);
}

.squirrel-glow {
  position: absolute;
  inset: -28%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 130, 0.55) 0%, rgba(255, 170, 100, 0.2) 45%, transparent 72%);
  mix-blend-mode: screen;
  opacity: 0.32;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.squirrel-hotspot:hover .squirrel-glow,
.squirrel-hotspot:focus-visible .squirrel-glow,
.squirrel-hotspot.is-near .squirrel-glow {
  opacity: 0.7;
}
.squirrel-hotspot.is-excited .squirrel-glow {
  opacity: 0.9;
}

.squirrel-idle {
  display: block;
  width: 100%;
  height: 100%;
  transform: none;
}

.squirrel-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
  /* Mirror so the pointing arm reads as reaching rightward/inward toward
     the treehouse, rather than off the left edge of the frame. */
  transform: scaleX(-1);
}

.squirrel-sparkle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d8 0%, #ffcf7a 50%, transparent 75%);
  box-shadow: 0 0 6px 2px rgba(255, 205, 120, 0.7);
  opacity: 0;
  pointer-events: none;
}
.squirrel-sparkle-1 { left: 6%; top: 8%; }
.squirrel-sparkle-2 { right: 12%; top: 58%; }

.squirrel-hotspot:hover .squirrel-sparkle-1,
.squirrel-hotspot:hover .squirrel-sparkle-2,
.squirrel-hotspot.is-near .squirrel-sparkle-1,
.squirrel-hotspot.is-near .squirrel-sparkle-2 {
  animation-duration: 1.5s;
}

/* Motion-safe fallback */
.squirrel-sparkle { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .squirrel-idle {
    animation: squirrelBreathe 3s ease-in-out infinite;
  }
  .squirrel-hotspot.is-hopping .squirrel-idle {
    animation-duration: 0.4s;
  }
  .squirrel-glow {
    animation: glowBreathe 5.5s ease-in-out infinite;
  }
  .squirrel-sparkle-1 { animation: owlSparkle 6.5s ease-in-out infinite; animation-delay: 0.8s; }
  .squirrel-sparkle-2 { animation: owlSparkle 7.5s ease-in-out infinite; animation-delay: 3s; }

  .squirrel-hotspot.is-hopping {
    animation: squirrelHop 3s ease-in-out;
  }
}

@keyframes squirrelBreathe {
  0%, 100% { transform: translateY(0) rotate(-1deg) scale(1); }
  50%      { transform: translateY(-2%) rotate(1deg) scale(1.02); }
}

@keyframes squirrelHop {
  0%   { left: 12%; top: 29%;   transform: translate(-50%, -50%) scale(1)    rotate(0deg); }
  8%   { left: 12%; top: 30%;   transform: translate(-50%, -50%) scale(0.94) rotate(0deg); }
  22%  { left: 16%; top: 26.5%; transform: translate(-50%, -50%) scale(1.1)  rotate(-4deg); }
  36%  { left: 18%; top: 28.5%; transform: translate(-50%, -50%) scale(1.0)  rotate(0deg); }
  52%  { left: 15%; top: 27%;   transform: translate(-50%, -50%) scale(1.06) rotate(3deg); }
  68%  { left: 13%; top: 29%;   transform: translate(-50%, -50%) scale(1.0)  rotate(0deg); }
  85%  { left: 12%; top: 28.5%; transform: translate(-50%, -50%) scale(1.03) rotate(0deg); }
  100% { left: 12%; top: 29%;   transform: translate(-50%, -50%) scale(1)    rotate(0deg); }
}

/* Sparkle trail from the squirrel's finger toward the treehouse — a fixed
   path of individually-placed, staggered particles (each just fades in
   place), not a single element translating across the screen. This reads
   fine as a gentle "look over there" cue even under reduced motion, so it
   is intentionally NOT gated behind the reduced-motion media query. */
.point-trail {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 2;
}
.point-particle {
  position: absolute;
  left: calc(var(--sx, 20) * 1%);
  top: calc(var(--sy, 27) * 1%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff2c9 0%, #ffcf7a 50%, transparent 75%);
  box-shadow: 0 0 8px 3px rgba(255, 205, 120, 0.8);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
}
.point-trail.is-active .point-particle {
  animation: pointParticleFade 1s ease-out forwards;
}

@keyframes pointParticleFade {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  25%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
}

/* ---- Phase 3C: interactive donkey --------------------------------------- */
.donkey-hotspot {
  position: absolute;
  /* bottom-center anchor (not the usual -50%,-50%) so left/top marks exactly
     where the hooves meet the ground, regardless of empty canvas space
     above the head/ears */
  transform: translate(-50%, -100%);
  width: 13%;
  min-width: 58px;
  min-height: 62px;
  aspect-ratio: 1211 / 1299;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  z-index: 3;
}
.donkey-hotspot:hover,
.donkey-hotspot:focus-visible,
.donkey-hotspot.is-near {
  transform: translate(-50%, -100%) scale(1.06);
}

.donkey-glow {
  position: absolute;
  inset: -24% -30% -6% -30%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 140, 0.5) 0%, rgba(255, 180, 110, 0.18) 45%, transparent 72%);
  mix-blend-mode: screen;
  opacity: 0.28;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.donkey-hotspot:hover .donkey-glow,
.donkey-hotspot:focus-visible .donkey-glow,
.donkey-hotspot.is-near .donkey-glow {
  opacity: 0.65;
}
.donkey-hotspot.is-excited .donkey-glow {
  opacity: 0.85;
}

.donkey-idle {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%; /* pivot at the hooves, not the center */
}

.donkey-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}

.donkey-sparkle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d8 0%, #ffcf7a 50%, transparent 75%);
  box-shadow: 0 0 6px 2px rgba(255, 205, 120, 0.7);
  opacity: 0;
  pointer-events: none;
}
.donkey-sparkle-1 { left: 10%; top: 30%; }
.donkey-sparkle-2 { right: 8%; top: 55%; }

.donkey-hotspot:hover .donkey-sparkle-1,
.donkey-hotspot:hover .donkey-sparkle-2,
.donkey-hotspot.is-near .donkey-sparkle-1,
.donkey-hotspot.is-near .donkey-sparkle-2 {
  animation-duration: 1.5s;
}

/* Hoof particles — plain children positioned near the ground line, so they
   travel naturally with the donkey during its little walk */
.donkey-hoof-particles { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.donkey-hoof-particles .hoof-particle {
  position: absolute;
  bottom: 2%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff2c9 0%, #ffcf7a 50%, transparent 75%);
  box-shadow: 0 0 7px 3px rgba(255, 205, 120, 0.8);
  opacity: 0;
}
.hoof-particle:nth-child(1) { left: 30%; }
.hoof-particle:nth-child(2) { left: 50%; }
.hoof-particle:nth-child(3) { left: 68%; }
.hoof-particle:nth-child(4) { left: 42%; }

/* Motion-safe fallback */
.donkey-sparkle { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .donkey-idle {
    animation: donkeyBreathe 4.2s ease-in-out infinite;
  }
  .donkey-glow {
    animation: glowBreathe 6.5s ease-in-out infinite;
  }
  .donkey-sparkle-1 { animation: owlSparkle 7s ease-in-out infinite; animation-delay: 1.5s; }
  .donkey-sparkle-2 { animation: owlSparkle 8s ease-in-out infinite; animation-delay: 4.2s; }

  .donkey-hotspot.is-walking {
    animation: donkeyWalk 4s ease-in-out;
  }
  .donkey-hotspot.is-walking .hoof-particle:nth-child(1) { animation: hoofPulse 0.6s ease-out 1.0s; }
  .donkey-hotspot.is-walking .hoof-particle:nth-child(2) { animation: hoofPulse 0.6s ease-out 1.9s; }
  .donkey-hotspot.is-walking .hoof-particle:nth-child(3) { animation: hoofPulse 0.6s ease-out 2.6s; }
  .donkey-hotspot.is-walking .hoof-particle:nth-child(4) { animation: hoofPulse 0.6s ease-out 3.3s; }
}

@keyframes donkeyBreathe {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.015) rotate(0.6deg); }
}

@keyframes donkeyWalk {
  0%   { left: 32%;   top: 52%; transform: translate(-50%, -100%) rotate(0deg)   scale(1); }
  5%   { left: 32%;   top: 52%; transform: translate(-50%, -100%) rotate(-3deg)  scale(1.02); }
  10%  { left: 32%;   top: 52%; transform: translate(-50%, -100%) rotate(3deg)   scale(1.02); }
  16%  { left: 32%;   top: 51.7%; transform: translate(-50%, -100%) rotate(0deg) scale(1.05); }
  26%  { left: 34%;   top: 52%; transform: translate(-50%, -100%) rotate(2deg)   scale(1.0); }
  40%  { left: 36%;   top: 52%; transform: translate(-50%, -100%) rotate(0deg)   scale(1.0); }
  54%  { left: 37.5%; top: 52%; transform: translate(-50%, -100%) rotate(-2deg)  scale(1.02); }
  70%  { left: 37%;   top: 52%; transform: translate(-50%, -100%) rotate(-2deg)  scale(1.03); }
  88%  { left: 34%;   top: 52%; transform: translate(-50%, -100%) rotate(1deg)   scale(1.0); }
  100% { left: 32%;   top: 52%; transform: translate(-50%, -100%) rotate(0deg)   scale(1); }
}

@keyframes hoofPulse {
  0%   { opacity: 0; transform: scale(0.5); }
  40%  { opacity: 0.9; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(0.7) translateY(4px); }
}

/* ---- Stage 3: character interaction ---- */
.stage-character {
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage-character.stage-visible {
  opacity: 1;
  pointer-events: auto;
}

.character-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.close-character {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.close-character:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* ---- Phase 2B: sound toggle — small, quiet, corner-only ---- */
.sound-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 209, 102, 0.35);
  background: rgba(8, 7, 4, 0.45);
  backdrop-filter: blur(4px);
  color: rgba(255, 230, 190, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.sound-toggle:hover,
.sound-toggle:focus-visible {
  opacity: 1;
  background: rgba(8, 7, 4, 0.65);
  border-color: rgba(255, 209, 102, 0.6);
}

.sound-icon {
  width: 18px;
  height: 18px;
}

.sound-mute-x { display: none; }

.sound-toggle.is-muted .sound-wave { display: none; }
.sound-toggle.is-muted .sound-mute-x { display: block; }

@media (max-width: 640px) {
  .sound-toggle { right: 12px; bottom: 12px; width: 36px; height: 36px; }
  .sound-icon { width: 16px; height: 16px; }
}

/* At very short/wide mobile letterbox ratios, the Flixt and donkey minimum
   touch-target floors (accessibility sizing) can invisibly overlap even
   though the artwork itself doesn't. Nudge the donkey's hotspot slightly
   right on small viewports only — same ground level, just clear of Flixt's
   tap target. Desktop/tablet position is untouched. */
@media (max-width: 480px) {
  #donkeyHotspot { left: 35% !important; }
  @keyframes donkeyWalk {
    0%   { left: 35%;   top: 52%; transform: translate(-50%, -100%) rotate(0deg)   scale(1); }
    5%   { left: 35%;   top: 52%; transform: translate(-50%, -100%) rotate(-3deg)  scale(1.02); }
    10%  { left: 35%;   top: 52%; transform: translate(-50%, -100%) rotate(3deg)   scale(1.02); }
    16%  { left: 35%;   top: 51.7%; transform: translate(-50%, -100%) rotate(0deg) scale(1.05); }
    26%  { left: 37%;   top: 52%; transform: translate(-50%, -100%) rotate(2deg)   scale(1.0); }
    40%  { left: 39%;   top: 52%; transform: translate(-50%, -100%) rotate(0deg)   scale(1.0); }
    54%  { left: 40.5%; top: 52%; transform: translate(-50%, -100%) rotate(-2deg)  scale(1.02); }
    70%  { left: 40%;   top: 52%; transform: translate(-50%, -100%) rotate(-2deg)  scale(1.03); }
    88%  { left: 37%;   top: 52%; transform: translate(-50%, -100%) rotate(1deg)   scale(1.0); }
    100% { left: 35%;   top: 52%; transform: translate(-50%, -100%) rotate(0deg)   scale(1); }
  }
}

[hidden] { display: none !important; }
