.story-main { padding-block: 26px 60px; text-align: center; }
.story-main h1 { margin-bottom: .15em; }
.story-sub { color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 22px; }

/* ===== Stage ===== */
.stage {
  position: relative; width: min(960px, 94vw); margin-inline: auto;
  aspect-ratio: 960 / 560; border-radius: 26px; overflow: hidden;
  box-shadow: var(--shadow); background: #eaf4ff;
}
.stage svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.stage svg.scene.active { display: block; }
.stage.paused .scene * { animation-play-state: paused !important; }

/* ===== Controls ===== */
.controls {
  display: flex; align-items: center; gap: 14px;
  width: min(960px, 94vw); margin: 18px auto 0;
}
.play-btn {
  flex: none; width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--sun); color: #6b4e12; font-size: 1.6rem; line-height: 1;
  box-shadow: 0 10px 22px -8px rgba(245, 166, 35, .9); display: grid; place-items: center;
  transition: transform .12s;
}
.play-btn:active { transform: scale(.94); }
.progress {
  flex: 1; position: relative; height: 14px; border-radius: 999px;
  background: rgba(51,64,90,.12); cursor: pointer; touch-action: none;
}
.progress::before { /* bigger invisible hit area so it's easy to grab */
  content: ""; position: absolute; inset: -12px 0; border-radius: 999px;
}
.progress:focus-visible { outline: 3px solid var(--sun); outline-offset: 4px; }
.progress-fill {
  height: 100%; width: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--mint), var(--sun)); border-radius: 999px;
}
.progress-handle {
  position: absolute; top: 50%; left: 0;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  border: 3px solid var(--sun); box-shadow: 0 3px 8px -1px rgba(51,64,90,.55);
  transform: translate(-50%, -50%); pointer-events: none;
}
.replay-btn {
  flex: none; border: 0; cursor: pointer; font-family: inherit; font-weight: 700;
  background: #fff; color: var(--ink); padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow);
}
.music-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; font-size: 1.2rem; box-shadow: var(--shadow); display: grid; place-items: center;
  transition: transform .12s, opacity .2s;
}
.music-btn:active { transform: scale(.94); }
.music-btn.is-off { opacity: .45; }

/* ===== Caption, shown over the bottom of the film ===== */
.stage-caption {
  position: absolute; inset-inline: 0; bottom: 0; pointer-events: none;
  padding: 30px 20px 16px;
  background: linear-gradient(to top, rgba(22,30,54,.74), rgba(22,30,54,.30) 62%, transparent);
}
.stage-caption p {
  margin: 0; min-height: 1.4em; text-align: center; color: #fff; font-weight: 800;
  font-size: clamp(1rem, 2.7vw, 1.55rem); line-height: 1.35;
  text-shadow: 0 2px 10px rgba(0,0,0,.45);
}
.stage-caption .emoji { font-size: 1.3em; margin-inline-end: .3em; }

/* ========================================================================
   Animations — one-shots scale to each scene via var(--dur); loops are fixed
   ======================================================================== */
.float  { animation: floaty 3.2s ease-in-out infinite; }
.float2 { animation: floaty 3.8s ease-in-out infinite; }
.sway   { animation: sway 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }

@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes sway { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* crossfades timed within a scene */
.fadeOutMid { animation: fadeOutMid var(--dur) linear forwards; }
.fadeInMid  { animation: fadeInMid  var(--dur) linear forwards; }
@keyframes fadeOutMid { 0%,30% { opacity: 1; } 45%,100% { opacity: 0; } }
@keyframes fadeInMid  { 0%,32% { opacity: 0; } 47%,100% { opacity: 1; } }

.fadeInLate  { animation: fadeInLate var(--dur) linear forwards; }
.fadeOutLate { animation: fadeOutLate var(--dur) linear forwards; }
@keyframes fadeInLate  { 0%,48% { opacity: 0; } 62%,100% { opacity: 1; } }
@keyframes fadeOutLate { 0%,48% { opacity: 1; } 62%,100% { opacity: .28; } }

/* late swap — used when Nuni changes into the pyjamas */
.fadeOutEnd { animation: fadeOutEnd var(--dur) linear forwards; }
.fadeInEnd  { animation: fadeInEnd  var(--dur) linear forwards; }
@keyframes fadeOutEnd { 0%,58% { opacity: 1; } 72%,100% { opacity: 0; } }
@keyframes fadeInEnd  { 0%,60% { opacity: 0; } 74%,100% { opacity: 1; } }

.popIn { animation: popIn var(--dur) ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes popIn { 0%,18% { transform: scale(0); opacity: 0; } 30% { transform: scale(1.18); opacity: 1; } 40%,100% { transform: scale(1); opacity: 1; } }

.popInLate { animation: popInLate var(--dur) ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes popInLate { 0%,55% { transform: scale(0); opacity: 0; } 68% { transform: scale(1.2); opacity: 1; } 78%,100% { transform: scale(1); opacity: 1; } }

/* scene-specific one-shots */
.sunrise { animation: sunrise var(--dur) ease-out forwards; }
@keyframes sunrise { 0% { transform: translateY(70px); } 60%,100% { transform: translateY(0); } }

.headshake { animation: headshake 1.1s ease-in-out 3; transform-box: fill-box; transform-origin: center bottom; }
@keyframes headshake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }

.happyBounce { animation: happyBounce 0.7s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
@keyframes happyBounce { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-22px) scale(1.04); } }

.drive { animation: drive var(--dur) linear forwards; }
@keyframes drive { 0% { transform: translateX(-360px); } 100% { transform: translateX(430px); } }

.handoff { animation: handoff var(--dur) ease-in-out forwards; }
@keyframes handoff { 0%,25% { transform: translate(0,0); } 60%,100% { transform: translate(-300px, 30px); } }

.rollIn { animation: rollIn var(--dur) ease-out forwards; }
@keyframes rollIn { 0% { transform: translateX(320px); } 45%,100% { transform: translateX(0); } }

.maskDown { animation: maskDown var(--dur) ease-in-out forwards; }
@keyframes maskDown { 0%,25% { transform: translateY(-70px); opacity: .85; } 55%,100% { transform: translateY(0); opacity: 1; } }

.count { animation: count 2.6s ease-out infinite; }
@keyframes count { 0% { transform: translateY(20px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-70px); opacity: 0; } }

.heartbeat { stroke-dasharray: 600; animation: beat 2.2s linear infinite; }
@keyframes beat { from { stroke-dashoffset: 600; } to { stroke-dashoffset: 0; } }

.balloonUp  { animation: balloonUp 6s ease-in infinite; }
.balloonUp2 { animation: balloonUp 7.5s ease-in .8s infinite; }
.balloonUp3 { animation: balloonUp 6.8s ease-in 1.6s infinite; }
@keyframes balloonUp { 0% { transform: translate(0, 120px); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translate(-24px, -420px); opacity: 0; } }

.confetti { animation: confetti 2.4s linear infinite; }
@keyframes confetti { 0% { transform: translateY(-30px) rotate(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(320px) rotate(300deg); opacity: 0; } }

.pulse { animation: pulse 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
  .float, .float2, .sway, .headshake, .happyBounce, .count, .balloonUp, .balloonUp2, .balloonUp3, .confetti, .pulse { animation: none !important; }
}

@media (max-width: 560px) {
  .stage-caption { padding: 22px 14px 12px; }
  .play-btn { width: 56px; height: 56px; }
}
