:root {
  --ink: #1B1440;
  --ink-2: #2A2160;
  --cloud: #FFFFFF;
  --mango: #FFB020;
  --berry: #FF4F8B;
  --leaf: #19B37A;
  --sky: #2E6BFF;
  --soft: rgba(255, 255, 255, .72);
  --glass: rgba(27, 20, 64, .38);
  --font: var(--font-lang, 'Baloo 2'), 'Baloo 2', 'Noto Sans Devanagari', 'Nirmala UI', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  /* When the phone's own emoji font is too old to draw the newer emoji lessons use, emoji-fill.js
     adds .emoji-fill and those few code points come from the bundled font instead of a blank box. */
  --font-fill: 'Spark Emoji', var(--font-lang, 'Baloo 2'), 'Baloo 2', 'Noto Sans Devanagari', 'Nirmala UI', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

/* Noto Color Emoji (SIL OFL 1.1, web/vendor/spark-emoji-LICENSE.txt), cut down to the Emoji 13–16
   characters lessons use: 80 KB. unicode-range keeps every other character on the usual fonts. */
@font-face {
  font-family: 'Spark Emoji';
  src: url(vendor/spark-emoji.woff2) format('woff2');
  font-display: swap;
  unicode-range: U+1F6D6-1F6D7, U+1F6DD-1F6DF, U+1F6FC, U+1F7F0, U+1F90C, U+1F972, U+1F977-1F978,
    U+1F9A3-1F9A4, U+1F9AC, U+1F9CC, U+1FA70, U+1FA74-1FA77, U+1FA84-1FA86, U+1FA88, U+1FA8F, U+1FA95-1FA9F,
    U+1FAA1-1FAA5, U+1FAA7-1FAA8, U+1FAAA-1FAAB, U+1FAAD-1FAAE, U+1FAB0-1FAB2, U+1FAB4-1FAB7,
    U+1FAB9-1FABA, U+1FABC, U+1FAC0-1FAC4, U+1FACF-1FAD0, U+1FAD2-1FAD3, U+1FAD5-1FADB,
    U+1FAE0-1FAE1, U+1FAE4-1FAE5, U+1FAE7, U+1FAF1-1FAF4, U+1FAF6, U+1FAF8;
}
:root.emoji-fill { --font: var(--font-fill); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--cloud);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--mango); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Phone-shaped app on desktop, full-bleed on phones */
.app {
  position: relative;
  height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}
@media (min-width: 700px) {
  body {
    background:
      radial-gradient(40rem 30rem at 10% 10%, #3B2A9E 0, transparent 60%),
      radial-gradient(40rem 30rem at 90% 90%, #7A1F55 0, transparent 60%),
      var(--ink);
    display: grid;
    place-items: center;
  }
  .app { height: min(100dvh - 32px, 900px); width: 420px; border-radius: 36px; box-shadow: 0 0 0 10px #0c0822, 0 30px 80px rgba(0,0,0,.6); }
}

/* ───── Onboarding ───── */
.onboard {
  position: absolute; inset: 0; z-index: 30;
  overflow-y: auto;
  background:
    radial-gradient(circle at 20% 0%, #FF4F8B 0, transparent 45%),
    radial-gradient(circle at 100% 30%, #FFB020 0, transparent 40%),
    radial-gradient(circle at 0% 100%, #2E6BFF 0, transparent 50%),
    var(--ink);
}
.onboard-inner { padding: calc(28px + var(--safe-t)) 20px 32px; display: flex; flex-direction: column; gap: 12px; }
.spark-logo { width: 64px; height: 64px; border-radius: 22px; background: var(--mango); color: var(--ink); display: grid; place-items: center; font-size: 36px; rotate: -8deg; box-shadow: 0 6px 0 #C77F00; }
.spark-logo span { animation: twinkle 2.4s ease-in-out infinite; }
.onboard h1 { font-size: 2.1rem; line-height: 1.05; margin: 8px 0 4px; font-weight: 800; }
.onboard h2 { font-size: 1.2rem; margin: 14px 0 0; font-weight: 700; }
.age-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.age-pick button {
  border: 0; border-radius: 22px; padding: 14px 6px 10px;
  background: rgba(255,255,255,.12); display: grid; gap: 2px; justify-items: center;
  transition: transform .15s, background .15s;
}
.age-pick button .e { font-size: 2.4rem; line-height: 1; }
.age-pick button b { font-size: 1.3rem; }
.age-pick button small { opacity: .8; font-size: .8rem; }
/* "All ages" is the default, so it gets its own full-width row above the three bands. */
.age-pick button.all { grid-column: 1 / -1; grid-auto-flow: column; justify-content: center; align-items: center; gap: 10px; padding: 10px 14px; }
.age-pick button.all .e { font-size: 1.7rem; }
.age-pick button.all b { font-size: 1.1rem; }
.age-pick button[aria-checked="true"] { background: var(--cloud); color: var(--ink); transform: translateY(-3px) rotate(-2deg); box-shadow: 0 6px 0 var(--mango); }
.topic-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-pick button {
  border: 2px solid rgba(255,255,255,.25); background: transparent; border-radius: 999px;
  padding: 6px 14px 6px 10px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center;
}
.topic-pick button[aria-pressed="true"] { background: var(--c, var(--mango)); border-color: transparent; }
.big-cta {
  margin-top: 18px; border: 0; border-radius: 20px; padding: 14px 20px;
  background: var(--mango); color: var(--ink); font-size: 1.3rem; font-weight: 800;
  box-shadow: 0 6px 0 #C77F00; transition: transform .1s, box-shadow .1s, opacity .2s;
}
.big-cta:active { transform: translateY(4px); box-shadow: 0 2px 0 #C77F00; }
.big-cta:disabled { opacity: .45; }
.big-cta.small { margin: 0; font-size: 1.05rem; padding: 10px 18px; }
.ghost { border: 2px solid rgba(255,255,255,.35); background: none; border-radius: 16px; padding: 10px 16px; font-weight: 700; }

/* ───── Views ───── */
.view { position: absolute; inset: 0 0 calc(var(--tabbar) + var(--safe-b)) 0; }
.view-page { overflow-y: auto; padding: calc(18px + var(--safe-t)) 16px 24px; background: var(--ink); }
.view-page h1 { font-size: 2rem; margin: 0 0 12px; font-weight: 800; }
.view-page h2 { font-size: 1.2rem; margin: 22px 0 10px; }

.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #000; border-top: 1px solid rgba(255,255,255,.08);
}
.tabbar button { border: 0; background: none; display: grid; justify-items: center; align-content: center; gap: 0; opacity: .6; font-size: .78rem; }
.tabbar button span { font-size: 1.35rem; line-height: 1.1; filter: grayscale(1); }
.tabbar button.on { opacity: 1; }
.tabbar button.on span { filter: none; }

/* ───── Feed ───── */
.feed {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.feed::-webkit-scrollbar { display: none; }
.topbar {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  padding: calc(10px + var(--safe-t)) 12px 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(rgba(0,0,0,.35), transparent);
  pointer-events: none;
}
.feed-tabs { display: flex; gap: 14px; pointer-events: auto; }
.feed-tab { border: 0; background: none; font-weight: 800; font-size: 1.1rem; opacity: .65; padding: 4px 2px; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.feed-tab.on { opacity: 1; box-shadow: inset 0 -3px 0 var(--cloud); }
.topic-chip { background: rgba(0,0,0,.3); border-radius: 999px; padding: 2px 12px; box-shadow: none !important; }
.timer {
  position: absolute; right: 12px; top: calc(10px + var(--safe-t));
  pointer-events: auto; display: grid; place-items: center; width: 40px; height: 40px;
}
.timer .ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--mango) calc(var(--left, 1) * 360deg), rgba(255,255,255,.2) 0); mask: radial-gradient(circle, transparent 14px, #000 15px); }
.timer b { font-size: .85rem; font-weight: 800; }
.tap-start {
  position: absolute; inset: 0; z-index: 7; border: 0; background: rgba(10, 6, 30, .35);
  display: grid; place-content: center; justify-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem;
}
.tap-start .tri {
  width: 96px; height: 96px; border-radius: 50%; background: var(--mango); color: var(--ink);
  display: grid; place-items: center; font-size: 2.6rem; padding-left: 8px;
  box-shadow: 0 6px 0 #C77F00; animation: pulse 1.4s ease-in-out infinite;
}
.swipe-hint {
  position: absolute; z-index: 6; left: 50%; top: 22%; translate: -50% 0; margin: 0;
  background: rgba(0,0,0,.55); padding: 10px 16px; border-radius: 999px; font-weight: 700; white-space: nowrap;
  animation: hint 1.6s ease-in-out infinite; pointer-events: none;
}

.slide {
  position: relative; height: 100%; overflow: hidden;
  scroll-snap-align: start; scroll-snap-stop: always;
  background: linear-gradient(165deg, var(--bg1), var(--bg2));
  user-select: none;
}
.stage {
  position: absolute; inset: 0 0 18% 0;
  /* Actors are PLACED in percent of this box, so they must be SIZED from it too — see .actor. */
  container-type: inline-size;
}
.stage::before, .stage::after {
  /* soft shapes so every scene feels like a set, not a slide */
  content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.14);
  pointer-events: none; /* decoration: it sits over the bottom corner and must never eat a touch */
}
.stage::before { width: 70%; aspect-ratio: 1; left: -20%; top: 8%; }
.stage::after { width: 50%; aspect-ratio: 1; right: -12%; bottom: 4%; background: rgba(0,0,0,.08); }
/* The set: the place a lesson happens in. It sits under the actors, never takes a tap, and is
   drawn from shared/cinema.json, so the web and a React Native player show the same room. */
.set { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.set > i {
  /* one ambient thing — a cloud, a bubble, a falling leaf — drifting behind the lesson */
  position: absolute; translate: -50% -50%; font-style: normal;
  font-size: calc(var(--s) * min(3.3rem, 11.48cqw)); line-height: 1;
  opacity: var(--a); filter: blur(.4px);
  animation-duration: var(--dur); animation-delay: var(--d);
  animation-iteration-count: infinite; animation-timing-function: ease-in-out;
}
.set.twinkle::after {
  content: ''; position: absolute; inset: 0;
  background: inherit; mix-blend-mode: screen;
  animation: twinkle 4.5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }

.layer { position: absolute; inset: 0; animation: layer-in .35s ease-out both; }
.layer.out { animation: layer-out .35s cubic-bezier(0.23, 1, 0.32, 1) both; } /* leaves fast, so two scenes are never both half-visible */
/* The camera: one slow move per scene, and the set follows at a fraction of it so the picture
   has depth instead of sliding as one flat card. Both names come from cinema.json. */
.layer.cam, .set.cam {
  animation-duration: var(--cam-dur, 4s), .35s;
  animation-timing-function: cubic-bezier(.33,0,.4,1), ease-out;
  animation-fill-mode: both, both;
  animation-iteration-count: 1, 1;
}
.layer.cam { animation-name: var(--cam), var(--in, layer-in); }
.set.cam { animation-name: var(--cam-bg), none; }
.actor {
  position: absolute; translate: -50% -50%;
  /* One unit of `s` is 11.48% of the stage width: 3.3rem on the 460px stage the layout law was
     measured on. It used to be 3.3rem everywhere, while x and y are percentages — so on a 360px
     phone every emoji was a fifth wider, relative to its neighbours, than lessons were checked
     for, and rows that pass scripts/layout-check.py touched. The first line is the fallback for
     browsers without container units. */
  font-size: calc(var(--s) * 3.3rem);
  font-size: calc(var(--s) * min(3.3rem, 11.48cqw)); line-height: 1;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.18));
  animation-duration: .55s, 1.8s;
  animation-iteration-count: 1, infinite;
  animation-fill-mode: both, none;
  animation-timing-function: cubic-bezier(.3,1.6,.5,1), ease-in-out;
  animation-name: pop-in, none;
}
.actor.cover { pointer-events: none; z-index: 1; }
.actor.is-text {
  font-weight: 800; color: var(--cloud); white-space: nowrap;
  font-size: calc(var(--s) * 2.1rem);
  font-size: calc(var(--s) * min(2.1rem, 7.3cqw));
  -webkit-text-stroke: .06em var(--ink); paint-order: stroke fill;
  text-shadow: 0 .08em 0 var(--ink);
}
.fx-pop { animation-name: pop-in, none; }
.fx-bounce { animation-name: pop-in, bounce; }
.fx-float { animation-name: pop-in, float; animation-duration: .55s, 3s; }
.fx-spin { animation-name: pop-in, spin; animation-duration: .55s, 8s; animation-timing-function: cubic-bezier(.3,1.6,.5,1), linear; }
.fx-pulse { animation-name: pop-in, pulse; animation-duration: .55s, 1s; }
.fx-grow { animation-name: grow-in, none; animation-duration: 1.6s, 1s; animation-timing-function: ease-out; transform-origin: 50% 100%; }
.fx-wiggle { animation-name: pop-in, wiggle; animation-duration: .55s, .9s; transform-origin: 50% 82%; }
.fx-shake { animation-name: pop-in, shake; animation-duration: .55s, .8s; transform-origin: 50% 80%; }
.fx-sway { animation-name: pop-in, sway; animation-duration: .55s, 3s; transform-origin: 50% 88%; }
.fx-drift { animation-name: drift-in, float; animation-duration: 1.4s, 4s; animation-timing-function: ease-out, ease-in-out; }
.fx-orbit { animation-name: pop-in, orbit; animation-duration: .55s, 4s; animation-timing-function: ease, linear; }
.fx-fall { animation-name: fall, none; animation-duration: 1.4s, 1s; animation-iteration-count: infinite, 1; animation-timing-function: ease-in; }
.fx-rise { animation-name: rise, none; animation-duration: 2.2s, 1s; animation-iteration-count: infinite, 1; animation-timing-function: ease-out; }
.fx-drop { animation-name: drop, none; animation-duration: 1.2s, 1s; animation-timing-function: cubic-bezier(.5,0,.6,1.4); }
.fx-slideL { animation-name: slide-l, none; animation-duration: .9s, 1s; animation-timing-function: cubic-bezier(.3,1.4,.5,1); }
.fx-slideR { animation-name: slide-r, none; animation-duration: .9s, 1s; animation-timing-function: cubic-bezier(.3,1.4,.5,1); }
.fx-flutter { animation-name: pop-in, flutter; animation-duration: .55s, 2.4s; }
.fx-flap { animation-name: pop-in, flap; animation-duration: .55s, .8s; }
.fx-waddle { animation-name: pop-in, waddle; animation-duration: .55s, .7s; transform-origin: 50% 92%; }
.fx-dive { animation-name: pop-in, dive; animation-duration: .55s, 2s; }
.fx-stomp { animation-name: pop-in, stomp; animation-duration: .55s, 1.1s; transform-origin: 50% 92%; }
.fx-breathe { animation-name: pop-in, breathe; animation-duration: .55s, 4s; }
.fx-pull { animation-name: pull, none; animation-duration: 1.2s, 1s; animation-timing-function: cubic-bezier(.7,0,.9,.6); }
.slide.paused .actor, .slide:not(.active) .actor { animation-play-state: paused; }

/* "Your turn": the scene holds and its actors become things to touch. A soft ring says "touch
   me"; the right one grows and glows, the others step back; a wrong one wobbles (player.js). */
/* Targets settle when the turn opens (a small child cannot catch a bouncing thing): the idle
   motion stops and the entrance pop plays once more as a "here I am". */
.actor.tappable { cursor: pointer; pointer-events: auto; outline: none; animation-name: pop-in, none; }
/* Press feedback: the thing under a small finger gives a little, so the touch is felt as heard. */
/* Only for things that are tapped: a dragged thing follows the finger with no delay. */
.actor.tappable:not(.movable) { transition: transform 140ms ease-out; }
.actor.tappable:not(.movable):active { transform: scale(.93); }
.actor.tappable::after {
  content: ''; position: absolute; inset: -14%; border-radius: 50%;
  border: .05em dashed rgba(255,255,255,.9); box-shadow: 0 0 0 .04em rgba(0,0,0,.12);
  animation: turn-ring 1.6s ease-in-out infinite; pointer-events: none;
}
.actor.tappable:focus-visible::after { border-style: solid; border-color: var(--mango); }
.actor.hint::after { border: .08em solid #FFD84D; animation-duration: .8s; }
/* The actors' own animations hold scale and opacity, so these replace the animation (yes) or work
   through filter (dim), which no keyframe touches. */
.actor.yes { animation: turn-yes .5s cubic-bezier(.3,1.6,.5,1) both; filter: drop-shadow(0 0 .3em #FFD84D) drop-shadow(0 8px 10px rgba(0,0,0,.18)); }
.actor.yes::after { content: '✨'; inset: auto; top: -.35em; right: -.45em; border: 0; box-shadow: none; font-size: .5em; animation: turn-spark .9s ease-out both; }
.actor.dim { filter: grayscale(1) opacity(.45); transition: filter .3s; }
.actor.dim::after { display: none; }
.slide.your-turn .caption .w { color: #FFF3B0; }
/* A place turn's spot: a soft dashed pool the things go into, sized from the stage like actors. */
.zone {
  position: absolute; translate: -50% -50%; aspect-ratio: 1; border-radius: 50%;
  width: calc(var(--r) * 2cqw); pointer-events: none;
  background: rgba(255,255,255,.14); border: .25rem dashed rgba(255,255,255,.55);
}
.zone.open { border-color: rgba(255,255,255,.9); animation: turn-ring 1.6s ease-in-out infinite; }
.zone.hint { border: .3rem solid #FFD84D; background: rgba(255,216,77,.18); }
/* "Order": numbered slots in a row, each a soft rounded square the size of a big emoji. */
.slot {
  position: absolute; translate: -50% -50%; width: 17cqw; aspect-ratio: 1; border-radius: 22%;
  border: .22rem dashed rgba(255,255,255,.55); background: rgba(255,255,255,.1);
  display: grid; place-items: end center; padding-bottom: .15em;
  font-weight: 800; font-size: min(1.1rem, 4.2cqw); color: rgba(255,255,255,.75); pointer-events: none;
}
.slot.open { border-color: rgba(255,255,255,.9); }
.slot.full { border-style: solid; background: rgba(255,255,255,.18); }
.slot.hint { border: .3rem solid #FFD84D; background: rgba(255,216,77,.18); }
/* "Sort": each group is a ring with its picture above; a thing picked up lifts and glows. */
.bin { pointer-events: none; }
.bin.open { pointer-events: auto; cursor: pointer; }
.bin.ready { background: rgba(255,255,255,.2); }
.bin-label { position: absolute; left: 50%; top: 0; translate: -50% -85%; font-size: min(2.6rem, 9cqw); line-height: 1; }
.actor.picked { filter: drop-shadow(0 0 .25em #FFD84D) drop-shadow(0 8px 10px rgba(0,0,0,.25)); scale: 1.15; }
.actor.movable { touch-action: none; }
.actor.movable::after { inset: -10%; }
.actor.placed::after { display: none; }
.actor.dragging { z-index: 5; filter: drop-shadow(0 14px 14px rgba(0,0,0,.28)); }
/* A dial turn's slider: along the top of the picture, under the header and clear of the right-hand
   buttons, because a long reply fills the caption at the bottom. Actors in a dial scene keep below
   y 32 (the validator says so). The target band shows on the track only as a hint. */
.dial {
  position: absolute; left: 6%; right: 18%; top: 14%; display: grid;
  grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 4px 8px; align-items: center;
  padding: 8px 10px; border-radius: 18px; background: rgba(0,0,0,.28); color: var(--cloud);
  opacity: .5; transition: opacity .3s; touch-action: none; pointer-events: auto;
}
.dial.open { opacity: 1; }
.dial-label { grid-column: 1 / -1; font-weight: 800; font-size: .95rem; text-align: center; }
.dial button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; font: 800 1.6rem/1 var(--font, inherit);
  background: var(--cloud); color: var(--ink); cursor: pointer;
}
.dial input[type=range] {
  width: 100%; height: 44px; margin: 0; accent-color: var(--mango); cursor: pointer;
  background: transparent;
}
.dial.hint input[type=range] {
  background: linear-gradient(90deg, transparent var(--lo), rgba(255,216,77,.55) var(--lo), rgba(255,216,77,.55) var(--hi), transparent var(--hi));
  border-radius: 22px;
}
.dial.won { box-shadow: 0 0 0 3px #FFD84D; }
@keyframes turn-yes { from { scale: 1; } to { scale: 1.3; } }
@keyframes turn-ring { 0%, 100% { scale: 1; opacity: .9; } 50% { scale: 1.12; opacity: .45; } }
@keyframes turn-spark { from { scale: .2; opacity: 0; } 60% { scale: 1.3; opacity: 1; } to { scale: 1; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .actor.tappable::after, .actor.yes::after { animation: none; } }

.shade { position: absolute; inset: 45% 0 0 0; background: linear-gradient(transparent, rgba(0,0,0,.55)); pointer-events: none; }
.caption, .meta, .sticker { text-align: start; }
.caption {
  position: absolute; left: 16px; right: 76px; bottom: 150px;
  font-size: 1.55rem; font-weight: 800; line-height: 1.15;
  pointer-events: none;
}
.caption .w { color: rgba(255,255,255,.4); transition: color .12s; }
.caption .w.on { color: var(--cloud); text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.play-icon {
  position: absolute; left: 50%; top: 42%; translate: -50% -50%;
  font-size: 4rem; opacity: 0; transition: opacity .2s, scale .2s; scale: 1.4;
  pointer-events: none; text-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.slide.paused .play-icon { opacity: .9; scale: 1; }

.rail {
  position: absolute; right: 8px; bottom: 96px; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.rail .avatar {
  width: 50px; height: 50px; border-radius: 50%; border: 2px solid var(--cloud);
  background: var(--c); font-size: 1.6rem; display: grid; place-items: center; margin-bottom: 4px; pointer-events: none;
}
.act { border: 0; background: none; display: grid; justify-items: center; gap: 0; padding: 0; min-width: 48px; }
.act .ico { font-size: 2rem; line-height: 1.15; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)) grayscale(.9) brightness(1.6); transition: filter .15s, scale .15s; }
.act .n { font-size: .78rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.act[aria-pressed="true"] .ico { filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); animation: tap-pop .35s; }
.act.quiz-btn .ico, .act.sound .ico { filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
/* Questions turned off: the brain stays put so the button keeps its meaning, struck through. */
.act.quiz-btn.off .ico { opacity: .5; position: relative; display: inline-block; }
.act.quiz-btn.off .ico::after {
  content: ''; position: absolute; left: -12%; right: -12%; top: 46%; height: 3px;
  background: currentColor; border-radius: 2px; transform: rotate(-20deg);
}
.act.quiz-btn.off .n { opacity: .7; }
.act:active .ico { scale: .85; }

.meta { position: absolute; left: 14px; right: 80px; bottom: 16px; z-index: 2; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.meta p, .meta h2 { margin: 0; }
.handle { font-weight: 800; font-size: 1.05rem; }
.title { font-size: 1rem; font-weight: 600; }
.tags { font-size: .9rem; opacity: .9; font-weight: 700; }
.why { display: inline-block; margin-top: 4px !important; font-size: .8rem; font-weight: 700; background: rgba(0,0,0,.3); padding: 1px 10px; border-radius: 999px; text-shadow: none; }
.music { display: flex; align-items: center; gap: 6px; font-size: .85rem; margin-top: 6px !important; overflow: hidden; white-space: nowrap; }
.music .disc { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.4); animation: spin 3s linear infinite; }
.music .mq { flex: 1; overflow: hidden; }
.music .marquee { display: inline-block; padding-left: 100%; animation: marquee 9s linear infinite; }
.slide.paused .music .disc, .slide.paused .marquee { animation-play-state: paused; }

.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.25); z-index: 4; }
.progress i { display: block; height: 100%; background: var(--cloud); transform-origin: left; transform: scaleX(0); }

/* Quiz sticker (poll style) */
.sticker {
  position: absolute; z-index: 6; left: 50%; top: 40%; translate: -50% -50%;
  width: min(86%, 340px); background: var(--cloud); color: var(--ink);
  border-radius: 24px; padding: 16px; rotate: -2deg;
  box-shadow: 0 10px 0 rgba(0,0,0,.2);
  animation: sticker-in .45s cubic-bezier(.3,1.6,.5,1) both;
}
.sticker .q { padding-inline-end: 34px; margin: 0 0 10px; font-size: 1.25rem; font-weight: 800; line-height: 1.15; text-align: center; }
.sticker .opts { display: grid; gap: 8px; }
.sticker .opts button {
  border: 0; border-radius: 16px; padding: 10px 12px; min-height: 54px;
  background: #EFEAFF; color: var(--ink); font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; gap: 10px; text-align: left;
}
.sticker .opts button { transition: transform .2s, box-shadow .2s, background .2s; }
.sticker .opts button .e { font-size: 2.2rem; display: inline-block; }
.sticker .opts button .label { flex: 1; }
/* Read-aloud: the option being spoken grows, glows and gets a pointer */
.sticker.reading .opts button:not(.speaking) { opacity: .55; }
.sticker .opts button.speaking { transform: scale(1.06); background: #FFF1C9; box-shadow: 0 0 0 4px var(--mango); opacity: 1; }
.sticker .opts button.speaking .e { animation: bounce-inline .5s ease-in-out infinite; }
.sticker .opts button.speaking::after { content: '👈'; font-size: 1.8rem; animation: poke .5s ease-in-out infinite; }
[dir="rtl"] .sticker .opts button.speaking::after { content: '👉'; animation-name: poke-rtl; }
/* The scrolling sound line always moves the same way; its text still shapes right-to-left. */
.music { direction: ltr; }
.sticker .q.speaking { animation: pulse 1s ease-in-out infinite; }
/* After reading: pictures keep taking turns to wiggle so they stay inviting */
.sticker:not(.reading) .opts button:not(:disabled) .e { animation: wiggle-turn 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * 1.2s); }
.sticker .hear {
  position: absolute; top: -18px; right: -10px; width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid var(--cloud); background: var(--mango); font-size: 1.4rem; box-shadow: 0 4px 0 #C77F00;
}
.sticker.reading .hear { animation: pulse 1s ease-in-out infinite; }
.sticker .opts button.right { background: var(--leaf); color: var(--cloud); }
.sticker .opts button.wrong { animation: shake .4s; background: #FFE1EA; }
.sticker .result { margin: 10px 0 0; text-align: center; font-weight: 800; font-size: 1.2rem; }

.up-next {
  position: absolute; z-index: 6; left: 50%; bottom: 34%; translate: -50% 0;
  border: 0; border-radius: 999px; padding: 8px 18px; background: rgba(0,0,0,.6); font-weight: 800;
  display: inline-flex; gap: 6px; align-items: center;
}

/* Wiggle break card */
.slide.wiggle { display: grid; place-items: center; text-align: center; padding: 24px; background: linear-gradient(165deg, #19B37A, #0E6BA8); }
.wiggle .big { font-size: 7rem; animation: bob 1s ease-in-out infinite; }
.wiggle h2 { font-size: 1.9rem; line-height: 1.1; margin: 10px 0; font-weight: 800; }
.wiggle .count { font-size: 3rem; font-weight: 800; }

.heart-burst { position: absolute; z-index: 8; font-size: 5.5rem; translate: -50% -50%; pointer-events: none; animation: heart 0.9s ease-out forwards; }
.confetti { position: absolute; z-index: 8; width: 10px; height: 14px; border-radius: 3px; pointer-events: none; animation: confetti 1.2s ease-out forwards; }

/* ───── Explore / saved ───── */
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.topic-grid button {
  border: 0; border-radius: 20px; aspect-ratio: 1; background: var(--c);
  display: grid; align-content: center; justify-items: center; gap: 2px; font-weight: 800; font-size: .95rem; line-height: 1.1;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.18);
}
.topic-grid button span { font-size: 2.2rem; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.card {
  border: 0; aspect-ratio: 9 / 14; border-radius: 12px; padding: 8px; position: relative; overflow: hidden;
  background: linear-gradient(165deg, var(--bg1), var(--bg2));
  display: flex; flex-direction: column; justify-content: flex-end; text-align: left;
}
.card .e { position: absolute; top: 34%; left: 50%; translate: -50% -50%; font-size: 2.6rem; }
.card b { font-size: .8rem; line-height: 1.1; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.card small { font-size: .7rem; opacity: .9; }
.card .seen { position: absolute; top: 6px; right: 6px; font-size: .65rem; background: rgba(0,0,0,.4); border-radius: 999px; padding: 0 6px; }
.empty { opacity: .75; text-align: center; margin-top: 40px; }
.empty-star { display: block; font-size: 3rem; margin-bottom: 8px; }

/* Shelves: a sideways row per topic, bleeding to the screen edge, one card snapping in at a time. */
.shelves { display: grid; gap: 18px; margin-top: 22px; }
.shelf h2, .shelf-head { margin: 0 0 8px; }
.shelf-head {
  display: inline-flex; align-items: center; gap: .4em; border: 0; background: none; padding: 4px 0;
  font-size: 1.15rem; font-weight: 800; min-height: 44px;
}
.shelf-head span:first-child { font-size: 1.4rem; }
.shelf-head .go { font-size: .75rem; width: 1.9em; height: 1.9em; display: inline-grid; place-items: center; border-radius: 50%; background: var(--c); color: var(--ink); }
.shelf-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 12px) / 3.25); gap: 6px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px;
}
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-row .card { scroll-snap-align: start; }
#saved-lately { margin-top: 28px; }
/* Category chips: one sideways row per group, the group's emoji leading; any number can be picked. */
.pick-title { margin: 22px 0 10px; }
.cat-groups { display: grid; gap: 8px; }
.cat-row {
  display: flex; gap: 6px; align-items: center; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  margin-inline: -16px; padding: 2px 16px; scroll-padding-inline: 16px;
}
.cat-row::-webkit-scrollbar { display: none; }
.cat-group {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: var(--c); font-size: 1.25rem; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.cat {
  flex: none; display: inline-flex; align-items: center; gap: .35em; min-height: 40px; padding: 0 12px;
  border: 2px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.06);
  font-weight: 700; font-size: .95rem; white-space: nowrap;
  transition: background-color .15s ease-out, border-color .15s ease-out, scale .12s ease-out;
}
.cat small { font-size: .72rem; opacity: .6; font-weight: 700; }
.cat[aria-pressed="true"] { background: var(--c); border-color: var(--cloud); color: var(--cloud); }
.cat[aria-pressed="true"] small { opacity: .9; }
.cat:active { scale: .96; }
.pick-bar {
  position: sticky; bottom: 8px; z-index: 3; margin-top: 16px; display: flex; gap: 8px; align-items: center;
  padding: 8px; border-radius: 999px; background: rgba(27, 20, 64, .92); box-shadow: 0 6px 24px rgba(0,0,0,.45);
  animation: bar-in .2s ease-out;
}
.pick-bar .play-all { flex: 1; }
.pick-clear { border: 0; border-radius: 999px; min-height: 44px; padding: 0 16px; background: rgba(255,255,255,.12); font-weight: 800; }
@keyframes bar-in { from { translate: 0 12px; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pick-bar { animation: none; } .cat { transition: none; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.play-all { border: 0; border-radius: 999px; padding: 10px 18px; min-height: 44px; background: var(--mango); color: var(--ink); font-weight: 800; font-size: 1rem; }

/* ───── Grown-ups ───── */
/* ───── Grown-ups: a calm, adult page. A week of learning in words, a little shape where it helps
   (the seven days, where the time went), and every setting folded into five groups. ───── */
.grownups { padding-bottom: 40px; }
.gu-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.gu-head h1 { margin: 0; }
.gu-date { margin: 0; color: var(--soft); font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gu-block { margin-top: 28px; }
.view-page .gu-block h2 { margin: 0 0 8px; font-size: 1.05rem; }
.gu-block .note { margin: -2px 0 10px; }
.gu-line { margin: 0; font-size: 1rem; line-height: 1.45; }
.gu-meter { height: 6px; margin-top: 10px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.gu-meter i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--leaf); transform-origin: left; scale: 0 1; transition: scale .25s cubic-bezier(.25, 1, .5, 1); }
[dir="rtl"] .gu-meter i { transform-origin: right; }
.gu-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 120px; margin-bottom: 12px; }
.gu-day { display: grid; grid-template-rows: 1fr auto auto; justify-items: center; gap: 3px; min-height: 0; }
.gu-col { width: 100%; max-width: 30px; display: flex; align-items: flex-end; min-height: 0; }
.gu-col i { display: block; width: 100%; border-radius: 6px 6px 3px 3px; background: rgba(255,255,255,.26); }
.gu-day.today .gu-col i { background: var(--sky); }
.gu-day b { font-size: .72rem; color: var(--soft); font-variant-numeric: tabular-nums; min-height: 1.2em; line-height: 1.2; }
.gu-day small { font-size: .78rem; color: var(--soft); line-height: 1; }
.gu-day.today small { color: var(--cloud); font-weight: 800; }
.gu-chapters, .gu-dinner, .gu-groups { display: grid; gap: 8px; }
.gu-ch, .gu-q, .gu-group { background: var(--ink-2); border-radius: 14px; }
.grownups summary { list-style: none; cursor: pointer; min-height: 44px; padding: 12px 40px 12px 14px; position: relative; border-radius: 14px; }
.grownups summary::-webkit-details-marker { display: none; }
.grownups summary::after {
  content: ''; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border: solid var(--soft); border-width: 0 2px 2px 0; rotate: 45deg; transition: rotate .2s ease-out, translate .2s ease-out;
}
.grownups details[open] > summary::after { rotate: 225deg; translate: 0 4px; }
.grownups summary:focus-visible { outline: 3px solid var(--mango); outline-offset: 2px; }
.gu-ch summary { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.gu-cls { font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: rgba(46,107,255,.24); color: #C7D5FF; white-space: nowrap; }
.gu-ch-t { display: grid; min-width: 0; }
.gu-ch-t b { font-size: .95rem; line-height: 1.25; }
.gu-ch-t small { font-size: .78rem; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gu-ch summary em { font-style: normal; color: var(--soft); font-size: .85rem; font-variant-numeric: tabular-nums; }
.gu-ch ul { list-style: none; margin: 0; padding: 0 14px 12px; display: grid; gap: 8px; }
.gu-ch li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .9rem; }
.ghost.small { flex: none; padding: 6px 12px; border-radius: 12px; font-size: .85rem; }
.gu-again { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gu-again li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 14px; background: var(--ink-2); border-radius: 14px; }
.gu-again li.none { background: none; padding: 0; color: var(--soft); font-size: .9rem; }
.gu-again-t { display: grid; min-width: 0; }
.gu-again-t b { font-size: .95rem; line-height: 1.25; }
.gu-again-t small { color: var(--soft); font-size: .8rem; }
.gu-again .big-cta.small { flex: none; font-size: .9rem; padding: 8px 14px; box-shadow: 0 3px 0 #C77F00; }
.gu-q summary { font-weight: 700; line-height: 1.35; }
.gu-q p { margin: 0; padding: 0 14px 12px; line-height: 1.4; }
.gu-q p small { color: var(--leaf); font-weight: 800; font-size: .75rem; }
.gu-group summary { display: grid; gap: 2px; }
.gu-group summary b { font-size: 1rem; }
.gu-group summary small { color: var(--soft); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gu-group .settings { padding: 4px 14px 16px; }
.gu-group .bars { margin-top: 4px; }
.gu-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grownups .did { margin: 0; }
.grownups .bar { grid-template-columns: 9.5rem 1fr 2rem; }
.gu-more { display: grid; gap: 8px; }
.gu-more > summary { min-height: 40px; padding: 8px 40px 8px 14px; color: var(--soft); font-weight: 700; background: rgba(255,255,255,.05); }
.gu-more[open] > summary { order: 99; }
ul > .gu-more { list-style: none; }
.note { opacity: .75; font-size: .9rem; margin: -4px 0 10px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 7.5rem 1fr 2.4rem; gap: 8px; align-items: center; font-size: .9rem; }
.bar .track { height: 12px; background: var(--ink-2); border-radius: 999px; overflow: hidden; }
.bar .track i { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.bar em { font-style: normal; opacity: .8; text-align: right; font-size: .8rem; }
.settings { display: grid; gap: 14px; }
.setting { display: grid; gap: 6px; }
.setting > span { font-weight: 700; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 2px solid rgba(255,255,255,.2); background: none; border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--cloud); color: var(--ink); border-color: var(--cloud); }
.safety { padding-left: 1.1rem; margin: 0; display: grid; gap: 4px; opacity: .9; }
.danger { color: #FF9EBB; border-color: rgba(255,79,139,.5); }

/* ───── Break + gate ───── */
.break-screen {
  position: absolute; inset: 0; z-index: 40; padding: 40px 24px;
  background: linear-gradient(170deg, #FFB020, #FF6B3D 60%, #FF4F8B);
  display: flex; flex-direction: column; justify-content: center; gap: 10px; text-align: center;
}
.break-sun { font-size: 6rem; animation: bob 3s ease-in-out infinite; }
.break-screen h1 { font-size: 2.2rem; line-height: 1.05; margin: 0; }
.break-screen p { font-size: 1.15rem; margin: 0; }
.break-ideas { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; text-align: left; }
.break-ideas li { background: rgba(255,255,255,.2); border-radius: 16px; padding: 10px 14px; font-weight: 700; font-size: 1.1rem; }

.gate { border: 0; border-radius: 24px; padding: 20px; width: min(90vw, 360px); background: var(--cloud); color: var(--ink); }
.gate::backdrop { background: rgba(10, 6, 30, .7); }
.gate h2 { margin: 0 0 6px; }
.gate input { width: 100%; font-size: 1.6rem; font-weight: 800; padding: 8px 12px; border-radius: 14px; border: 2px solid #CFC7F0; color: var(--ink); background: #F7F5FF; }
.gate-err { color: #C81D4E; font-weight: 700; }
.gate-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.gate .ghost { border-color: #CFC7F0; }

.toast {
  position: absolute; z-index: 50; left: 50%; top: calc(64px + var(--safe-t)); translate: -50% -20px;
  background: var(--cloud); color: var(--ink); padding: 8px 16px; border-radius: 999px; font-weight: 800;
  opacity: 0; transition: opacity .2s, translate .2s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; translate: -50% 0; }

/* ───── Motion ───── */
@keyframes pop-in { 0% { scale: 0; opacity: 0; } 100% { scale: 1; opacity: 1; } }
@keyframes grow-in {
  0% { scale: .08 .12; opacity: 0; animation-timing-function: cubic-bezier(.2,.7,.4,1); }
  55% { scale: .72 1.04; opacity: 1; animation-timing-function: ease-out; }
  100% { scale: 1 1; opacity: 1; }
}
@keyframes drift-in { 0% { translate: -120% -50%; opacity: 0; } 100% { translate: -50% -50%; opacity: 1; } }
@keyframes bounce {
  0% { translate: -50% -50%; scale: 1.08 .92; animation-timing-function: cubic-bezier(.2,.7,.4,1); }
  22% { translate: -50% -62%; scale: .95 1.05; }
  50% { translate: -50% -70%; scale: 1 1; animation-timing-function: cubic-bezier(.6,0,.85,.4); }
  78% { translate: -50% -62%; scale: .95 1.05; }
  100% { translate: -50% -50%; scale: 1.08 .92; }
}
@keyframes float {
  0% { translate: -50% -50%; }
  33% { translate: -47% -57%; }
  66% { translate: -53% -56%; }
  100% { translate: -50% -50%; }
}
@keyframes spin { 100% { rotate: 360deg; } }
@keyframes pulse {
  0% { scale: 1; }
  15% { scale: 1.14; }
  100% { scale: 1; }
}
@keyframes breathe {
  0% { scale: .85; }
  50% { scale: 1.25; }
  100% { scale: .85; }
}
@keyframes wiggle {
  0% { rotate: -8deg; }
  50% { rotate: 8deg; }
  100% { rotate: -8deg; }
}
@keyframes shake {
  0% { rotate: 0deg; }
  12% { rotate: -9deg; }
  28% { rotate: 7deg; }
  44% { rotate: -5deg; }
  60% { rotate: 3deg; }
  78% { rotate: -1.5deg; }
  100% { rotate: 0deg; }
}
@keyframes sway {
  0% { rotate: -4deg; }
  50% { rotate: 4deg; }
  100% { rotate: -4deg; }
}
@keyframes flap {
  0% { scale: 1 1; }
  50% { scale: 1.06 .96; }
  100% { scale: 1 1; }
}
@keyframes waddle {
  0% { translate: -54% -50%; rotate: -7deg; }
  50% { translate: -46% -50%; rotate: 7deg; }
  100% { translate: -54% -50%; rotate: -7deg; }
}
@keyframes stomp {
  0% { translate: -50% -50%; scale: 1 1; rotate: 0deg; animation-timing-function: ease-out; }
  30% { translate: -50% -59%; scale: .96 1.04; rotate: -4deg; animation-timing-function: cubic-bezier(.6,0,.9,.4); }
  46% { translate: -50% -47%; scale: 1.14 .86; rotate: 0deg; animation-timing-function: ease-out; }
  62% { translate: -50% -51%; scale: 1 1; rotate: 2deg; }
  100% { translate: -50% -50%; scale: 1 1; rotate: 0deg; }
}
@keyframes flutter {
  0% { translate: -50% -50%; rotate: -6deg; animation-timing-function: ease-in; }
  25% { translate: -30% -70%; rotate: 8deg; animation-timing-function: ease-out; }
  47% { translate: -62% -82%; rotate: -5deg; animation-timing-function: ease-in-out; }
  72% { translate: -76% -58%; rotate: 6deg; animation-timing-function: ease-in; }
  100% { translate: -50% -50%; rotate: -6deg; }
}
@keyframes dive {
  0% { translate: -50% -50%; rotate: 0deg; }
  50% { translate: -50% 10%; rotate: 70deg; }
  100% { translate: -50% -50%; rotate: 0deg; }
}
@keyframes orbit { 0% { rotate: 0deg; transform-origin: 50% 180%; } 100% { rotate: 360deg; transform-origin: 50% 180%; } }
@keyframes fall {
  0% { translate: -58% -250%; opacity: 0; }
  20% { opacity: 1; }
  100% { translate: -43% 250%; opacity: 0; }
}
@keyframes rise {
  0% { translate: -50% 40%; opacity: 0; }
  30% { opacity: 1; }
  100% { translate: -50% -300%; opacity: 0; }
}
@keyframes drop {
  0% { translate: -50% -400%; scale: .94 1.08; opacity: 0; animation-timing-function: cubic-bezier(.6,0,.9,.5); }
  4% { opacity: 1; }
  55% { translate: -50% -50%; scale: 1.16 .84; animation-timing-function: ease-out; }
  72% { translate: -50% -60%; scale: .96 1.05; animation-timing-function: ease-in; }
  86% { translate: -50% -50%; scale: 1.06 .94; animation-timing-function: ease-out; }
  100% { translate: -50% -50%; scale: 1 1; }
}
@keyframes slide-l {
  0% { translate: 60% -50%; opacity: 0; }
  12% { opacity: 1; }
  100% { translate: -50% -50%; }
}
@keyframes slide-r {
  0% { translate: -160% -50%; opacity: 0; }
  12% { opacity: 1; }
  100% { translate: -50% -50%; }
}
@keyframes pull {
  0% { translate: -50% -50%; opacity: 0; }
  1% { opacity: 1; }
  30% { translate: -50% -50%; }
  100% { translate: -150% -50%; }
}
@keyframes layer-in { from { opacity: 0; scale: 1.04; } }
@keyframes layer-out { to { opacity: 0; scale: .96; } }
@keyframes bob { 50% { translate: 0 -14px; } }
@keyframes bounce-inline { 50% { translate: 0 -8px; } }
@keyframes poke { 50% { translate: -8px 0; } }
@keyframes poke-rtl { 50% { translate: 8px 0; } }
@keyframes wiggle-turn { 0%, 30%, 100% { rotate: 0deg; scale: 1; } 8% { rotate: -14deg; scale: 1.2; } 16% { rotate: 12deg; scale: 1.2; } 24% { rotate: -6deg; } }
@keyframes tab-pop { 40% { scale: 1.3; } }
@keyframes tile-pop { 40% { scale: .92; } }
@keyframes twinkle { 50% { scale: 1.2; rotate: 20deg; } }
@keyframes hint { 0%, 100% { translate: -50% 0; } 50% { translate: -50% -16px; } }
@keyframes tap-pop { 50% { scale: 1.35; } }
@keyframes sticker-in { from { scale: .3; opacity: 0; rotate: -12deg; } }
@keyframes heart { 0% { scale: .2; opacity: 0; } 25% { scale: 1.2; opacity: 1; } 60% { scale: 1; } 100% { scale: 1.4; opacity: 0; translate: -50% -140%; } }
@keyframes confetti { to { translate: var(--dx) var(--dy); rotate: var(--r); opacity: 0; } }
@keyframes marquee { to { translate: -100% 0; } }

@media (prefers-reduced-motion: reduce) {
  /* Less motion, not no information: an actor still arrives on its word, by a short fade instead of
     a pop, so a reveal ("Crack!" and then the chick) keeps its order. */
  .actor { animation-name: rm-fade, none !important; animation-duration: .2s, 0s !important; animation-timing-function: ease-out !important; }
  .layer, .set, .set > i, .set::after, .sticker *, .music .disc, .marquee, .wiggle .big, .break-sun, .swipe-hint, .spark-logo span { animation: none !important; }
  .feed { scroll-behavior: auto; }
}

/* Picture-only quiz for ages 2–4: big tiles, the spoken word is the label */
.sticker.pics .opts { grid-template-columns: 1fr 1fr; gap: 12px; }
.sticker.pics .opts button { flex-direction: column; justify-content: center; min-height: 132px; padding: 10px; }
.sticker.pics .opts button .e { font-size: 4.4rem; line-height: 1; }
.sticker.pics .opts button .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sticker.pics .opts button.speaking { transform: scale(1.08); }
.sticker.pics .opts button.speaking::after { content: none; }
.sticker.pics .opts button.speaking .e { animation: bounce-inline .45s ease-in-out infinite; }

/* Tap feedback on the tab bar and topic tiles (they speak their name for ages 2–4) */
.tabbar button.tapped span { animation: tab-pop .35s ease-out; }
.topic-grid button:active { animation: tile-pop .2s ease-out; }

/* ── cinema: generated by scripts/cinema-build.py ── */
@keyframes cam-push { 0%{scale: 1}100%{scale: 1.07} }
@keyframes cam-push-bg { 0%{scale: 1.0}100%{scale: 1.028} }
@keyframes cam-pull { 0%{scale: 1.07}100%{scale: 1} }
@keyframes cam-pull-bg { 0%{scale: 1.028}100%{scale: 1.0} }
@keyframes cam-panL { 0%{translate: 1.8% 0%;scale: 1.03}100%{translate: -1.8% 0%;scale: 1.03} }
@keyframes cam-panL-bg { 0%{translate: 0.72% 0%;scale: 1.012}100%{translate: -0.72% 0%;scale: 1.012} }
@keyframes cam-panR { 0%{translate: -1.8% 0%;scale: 1.03}100%{translate: 1.8% 0%;scale: 1.03} }
@keyframes cam-panR-bg { 0%{translate: -0.72% 0%;scale: 1.012}100%{translate: 0.72% 0%;scale: 1.012} }
@keyframes cam-rise { 0%{translate: 0% 1.6%;scale: 1.03}100%{translate: 0% -1.6%;scale: 1.03} }
@keyframes cam-rise-bg { 0%{translate: 0% 0.64%;scale: 1.012}100%{translate: 0% -0.64%;scale: 1.012} }
@keyframes cam-sink { 0%{translate: 0% -1.6%;scale: 1.03}100%{translate: 0% 1.6%;scale: 1.03} }
@keyframes cam-sink-bg { 0%{translate: 0% -0.64%;scale: 1.012}100%{translate: 0% 0.64%;scale: 1.012} }
@keyframes in-fade { 0%{scale: 1.04;opacity: 0}100%{scale: 1;opacity: 1} }
@keyframes in-zoom { 0%{scale: 0.82;opacity: 0}100%{scale: 1;opacity: 1} }
@keyframes in-rise { 0%{translate: 0% 7%;opacity: 0}100%{translate: 0% 0%;opacity: 1} }
@keyframes in-drop { 0%{translate: 0% -7%;opacity: 0}100%{translate: 0% 0%;opacity: 1} }
@keyframes in-slide { 0%{translate: 9% 0%;opacity: 0}100%{translate: 0% 0%;opacity: 1} }
@keyframes in-iris { 0%{clip-path: circle(0% at 50% 45%)}100%{clip-path: circle(80% at 50% 45%)} }
/* ── end cinema ── */

/* "Play along" leads Explore as a wide banner: the lessons where the child acts inside the reel. */
.topic-grid .play-tile { grid-column: 1 / -1; aspect-ratio: auto; grid-auto-flow: column; justify-content: center; gap: .45em; padding-block: 1.05em; font-size: 1.15rem; }
.topic-grid .play-tile span { animation: play-nudge 1.6s ease-in-out infinite; }
@keyframes play-nudge { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12%; } }
@media (prefers-reduced-motion: reduce) { .topic-grid .play-tile span { animation: none; } }
@keyframes rm-fade { from { opacity: 0; } to { opacity: 1; } }

/* A 3D solid: sized like an actor (--s units), turned by a finger. The ring says "touch me" once
   its turn opens; the count badge shows how many faces are painted. */
.solid3d { position: absolute; translate: -50% -50%; width: calc(var(--s) * 3.3rem); width: calc(var(--s) * min(3.3rem, 11.48cqw)); aspect-ratio: 1; pointer-events: auto; touch-action: none; }
.solid3d canvas { width: 100%; height: 100%; display: block; }
.solid3d.open::after { content: ''; position: absolute; inset: -4%; border-radius: 50%; border: .22rem dashed rgba(255,255,255,.75); pointer-events: none; animation: turn-ring 1.6s ease-in-out infinite; }
.solid3d.hint::after { border-color: #FFD84D; border-style: solid; }
.solid3d.won::after { display: none; }
.solid-count { position: absolute; right: -2%; top: -2%; min-width: 1.6em; padding: .1em .35em; border-radius: 1em; background: #FFD84D; color: #2b2340; font-weight: 800; font-size: min(1.6rem, 6cqw); text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
@media (prefers-reduced-motion: reduce) { .solid3d.open::after { animation: none; } }

/* "Trace": a square box of dotted strokes; the ink fills as the finger follows. */
.trace { position: absolute; translate: -50% -50%; width: calc(var(--s) * 3.3rem); width: calc(var(--s) * min(3.3rem, 11.48cqw)); aspect-ratio: 1; overflow: visible; pointer-events: none; touch-action: none; }
.trace.open { pointer-events: auto; }
.trace .guide { fill: none; stroke: rgba(255,255,255,.7); stroke-width: 7; stroke-dasharray: .5 8; stroke-linecap: round; stroke-linejoin: round; }
.trace .stroke:not(.now):not(.filled) .guide { opacity: .35; }
.trace .ink { fill: none; stroke: #FFD84D; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 0 rgba(0,0,0,.2)); }
.trace .start { fill: #19B37A; stroke: #fff; stroke-width: 2; animation: turn-ring 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.trace.hint .now .guide { stroke: #FFD84D; opacity: 1; }
.trace.won .ink { stroke: #19B37A; transition: stroke .3s; }
/* "Scratch": a cover over an actor, rubbed away by a finger. Before the turn it is a plain shape. */
.scratch-cover { position: absolute; translate: -50% -50%; width: calc(var(--s) * 4.4rem); width: calc(var(--s) * min(4.4rem, 15.3cqw)); aspect-ratio: 1; background: var(--c); touch-action: none; pointer-events: none; }
/* Rounded before the turn; while open the canvas draws its own rounded cover and the whole square
   takes a touch, since a CSS radius would also cut the corners out of the touch area. */
.scratch-cover:not(.open) { border-radius: 22%; }
.scratch-cover.open { pointer-events: auto; cursor: grab; outline: .22rem dashed rgba(255,255,255,.75); outline-offset: .2rem; }
.scratch-cover.hint { outline: .3rem solid #FFD84D; }
@media (prefers-reduced-motion: reduce) { .trace .start { animation: none; } }

/* "Clap": the word breaks into parts that light one per clap. */
.actor .w-part { opacity: .45; transition: opacity .15s, color .15s; }
.actor .w-part + .w-part::before { content: '·'; opacity: .5; margin: 0 .08em; }
.actor .w-part.lit { opacity: 1; color: #FFD84D; }
.actor.is-text.clapped .w-part { color: #7CF0B4; }
.clap-count { position: absolute; right: -18%; top: -14%; font-size: .32em; }
/* "Mark": a number line; the whole band around it takes the tap, and ticks sit below it. */
.markline { position: absolute; height: .45rem; translate: 0 -50%; border-radius: .3rem; background: rgba(255,255,255,.9); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.markline::before { content: ''; position: absolute; inset: -2.2rem -.8rem; }
.markline.open { cursor: pointer; }
.markline.hint { background: #FFD84D; }
.markline .tick { position: absolute; top: 100%; translate: -50% .35rem; font-weight: 800; font-size: min(1.1rem, 4.4cqw); color: var(--cloud); -webkit-text-stroke: .05em var(--ink); paint-order: stroke fill; }
.markline .tick::before { content: ''; position: absolute; left: 50%; top: -.8rem; width: .2rem; height: .7rem; translate: -50% 0; background: rgba(255,255,255,.9); border-radius: .1rem; }
.markline .mark-flag, .markline .mark-true { position: absolute; bottom: 100%; translate: -30% 0; font-size: min(2.4rem, 9cqw); line-height: 1; pointer-events: none; }
.markline .mark-true { translate: -50% -.2rem; }
/* "Fingers": a little picture appears under each finger on the glass; the count sits top centre. */
.layer.fingers-open { cursor: pointer; }
.finger-mark { position: absolute; translate: -50% -50%; font-size: min(3.2rem, 13cqw); pointer-events: auto; user-select: none; filter: drop-shadow(0 4px 0 rgba(0,0,0,.18)); }
.finger-mark.won { animation: finger-won .5s cubic-bezier(0.23, 1, 0.32, 1); }
@keyframes finger-won { 40% { transform: translateY(-18%) scale(1.15); } }
.finger-count { position: absolute; left: 50%; right: auto; top: 14%; translate: -50% 0; font-size: min(2.2rem, 9cqw); }
.layer.fingers-hint::after { content: '✋'; position: absolute; left: 50%; top: 58%; translate: -50% -50%; font-size: min(4rem, 16cqw); opacity: .5; animation: pulse 1.2s ease-in-out infinite; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .finger-mark.won, .layer.fingers-hint::after { animation: none; } }
/* A slider the phone's tilt moves: a small rocking phone says "lean me". */
.dial.tilt .dial-label::before { content: '📱'; display: inline-block; margin-inline-end: .35em; animation: tilt-hint 1.6s ease-in-out infinite; }
@keyframes tilt-hint { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .dial.tilt .dial-label::before { animation: none; } }
/* "Shake": each shake drops one thing into a row below the thing shaken. */
.shake-drop { position: absolute; translate: -50% -50%; font-size: min(2.4rem, 10cqw); pointer-events: none; filter: drop-shadow(0 3px 0 rgba(0,0,0,.18)); }
.shake-drop.won { animation: finger-won .5s cubic-bezier(0.23, 1, 0.32, 1); }
@media (prefers-reduced-motion: reduce) { .shake-drop.won { animation: none; } }
/* "Blow": a ring fills with breath around the thing; an ear shows while the microphone listens. */
.actor.blowable::before { content: ''; position: absolute; inset: -12%; border-radius: 50%; pointer-events: none;
  background: conic-gradient(rgba(255,255,255,.85) calc(var(--breath, 0) * 360deg), rgba(255,255,255,.15) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 86%, #000 88%); mask: radial-gradient(closest-side, transparent 86%, #000 88%); }
.listening { position: absolute; left: 8%; top: 14%; font-size: min(1.8rem, 7cqw); padding: .1em .25em; border-radius: 1em; background: rgba(0,0,0,.28); pointer-events: none; }
.blow-fly { position: absolute; translate: -50% -50%; font-size: min(1.6rem, 7cqw); pointer-events: none; }
.age-hint { margin: -4px 0 10px; font-size: .9rem; opacity: .8; }
/* "Look": the same filling ring as blow; a small eye, or for a colour hunt a round live preview. */
.actor.lookable::before { content: ''; position: absolute; inset: -12%; border-radius: 50%; pointer-events: none;
  background: conic-gradient(rgba(255,255,255,.85) calc(var(--breath, 0) * 360deg), rgba(255,255,255,.15) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 86%, #000 88%); mask: radial-gradient(closest-side, transparent 86%, #000 88%); }
.actor.lookable.won { filter: drop-shadow(0 0 .5em var(--found, #fff)); }
.looking { position: absolute; left: 8%; top: 14%; font-size: min(1.8rem, 7cqw); padding: .1em .25em; border-radius: 1em; background: rgba(0,0,0,.28); pointer-events: none; }
.looking.peek { padding: 0; width: 28%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 4px solid #fff; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.looking.peek video { width: 100%; height: 100%; object-fit: cover; }
.layer { transition: filter .2s ease-out; }
/* The learning receipt: one line per thing the child did, newest first. */
.did { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.did li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.08); }
.did li b { font-size: .95rem; }
.did li span { font-size: .9rem; opacity: .9; }
.did li em { font-style: normal; font-size: .8rem; opacity: .7; }
.did li.none { font-size: .9rem; opacity: .8; }
.dial-value { margin-inline-start: .35em; padding: 0 .4em; border-radius: .6em; background: rgba(255,255,255,.2); font-variant-numeric: tabular-nums; }
