/* Science lessons, laid out for an iPad Air (834 x 1112 points) held either way:
   a 16:10 stage for the animated scenes, 56px+ touch targets, no hover states.
   Same colours and book print as the reader and maths, kept in its own file.
   Things on the stage are sized in cqw: one percent of the stage's width. */

@font-face { font-family: 'Andika'; src: url('../fonts/andika.woff2') format('woff2'); font-display: block; }

:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --ink: #1d2433;
  --muted: #5b6577;
  --line: #e4dfd4;
  --accent: #2f5fb3;
  --accent-soft: #e9effa;
  --right: #1f9d55;
  --right-soft: #e6f6ec;
  --wrong: #d64545;
  --gold: #f2b01e;
  --now: #c8dafb;
  --shadow: 0 1px 2px rgb(29 36 51 / 0.08), 0 8px 24px rgb(29 36 51 / 0.1);
  --ui: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --book: 'Andika', var(--ui);
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body.science {
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.4 var(--ui);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.message { grid-row: 1 / -1; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; font-size: 22px; }

/* ---- Bars and buttons ---- */

.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.bar-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: 400 32px/1.2 var(--book);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.round {
  flex: none;
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 26px;
  line-height: 1;
  text-decoration: none;
  color: inherit;
}
.round.spacer { visibility: hidden; }

.big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 0 26px;
  border: 2px solid var(--line);
  border-radius: 32px;
  background: #fff;
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
}
.big.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.big.saying { border-color: var(--accent); background: var(--now); color: var(--ink); }
/* The way on, once the step is done: it breathes so the child sees it, and a hand
   bounces over it (feedback.js pointAt) so a child who can't read knows to tap it. */
.big.primary.ready { animation: ready 1.4s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 26%, transparent); } }
.big.primary.point { position: relative; overflow: visible; }
.big .hand {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  font: 40px/1 var(--emoji);
  translate: -50% 0;
  pointer-events: none;
  filter: drop-shadow(0 3px 3px rgb(29 36 51 / 0.25));
  animation: hand-bob 0.8s ease-in-out infinite;
}
@keyframes hand-bob { 50% { transform: translateY(-12px); } }

/* Words that light up as the voice reads them (questions, steps, answers), and whole
   lines said by the voice. .cw.now is the same as under the stage. */
.read-along .cw { border-radius: 0.2em; padding: 0 0.04em; transition: background-color 0.12s; }
.speaking { border-radius: 0.3em; background: var(--now); box-shadow: 0 0 0 0.2em var(--now); }

/* The tap effects (feedback.js): drawn over everything, never in the way of a finger. */
.tap-fx { position: fixed; inset: 0; z-index: 1000; pointer-events: none; overflow: hidden; }
.tap-fx > span { position: absolute; }
.fx-ring { border: 5px solid #fff; border-radius: 50%; box-shadow: 0 0 12px rgb(255 255 255 / 0.6); }
.fx-dot { width: 12px; height: 12px; border-radius: 50%; }
.fx-star { width: 20px; height: 20px; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.fx-confetti { width: 10px; height: 16px; border-radius: 2px; }
.fx-hand { z-index: 2; left: 0; top: 0; font: 54px/1 var(--emoji); filter: drop-shadow(0 4px 4px rgb(29 36 51 / 0.3)); }
.fx-ghost { left: 0; top: 0; font: 56px/1 var(--emoji); filter: drop-shadow(0 6px 8px rgb(29 36 51 / 0.25)); }

.round:active:not(:disabled), .big:active, .lesson-card:active, .answer:active:not(:disabled), .year-tab:active, .card.tap:active {
  transform: scale(0.94);
  filter: brightness(0.92);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 96px;
  padding: 12px 20px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.controls.empty { min-height: 0; padding: 0; border: 0; }

/* The lesson's steps: 🎬 watch, 👆 try, 🎮 game, 🏅 badge. */
.steps { display: flex; flex: 1; justify-content: center; gap: 4px; min-width: 0; font: 22px/1 var(--emoji); }
.step { opacity: 0.25; filter: grayscale(1); }
.step.past { opacity: 0.7; filter: none; }
.step.now { opacity: 1; filter: none; transform: scale(1.35); margin: 0 6px; }

.stars { display: inline-flex; gap: 2px; font-family: var(--ui); }
.star { color: #d8d2c4; }
.star.on { color: var(--gold); }

/* ---- Home: years and lessons ---- */

.home { overflow-y: auto; padding: 18px 24px 32px; }
.years {
  display: flex;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 20px;
  padding: 6px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
}
.year-tab {
  min-width: 120px;
  min-height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: 700 22px/1 var(--ui);
  white-space: nowrap;
}
.year-tab[aria-selected="true"] { background: var(--accent); color: #fff; }

.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.lesson-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'icon title' 'icon note' 'icon stars';
  align-items: center;
  column-gap: 16px;
  min-height: 132px;
  padding: 14px 18px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: left;
}
.lesson-icon { grid-area: icon; font: 64px/1 var(--emoji); }
.lesson-title { grid-area: title; font: 400 28px/1.15 var(--book); }
.lesson-note { grid-area: note; color: var(--muted); font-size: 16px; line-height: 1.25; }
.lesson-card .stars { grid-area: stars; margin-top: 4px; font-size: 24px; }
.lesson-badge { position: absolute; top: 10px; right: 12px; font: 30px/1 var(--emoji); }

/* ---- Watch: the stage and the words being said ---- */

.watch { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
.scene-holder {
  container-type: size;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* long words under the stage wrap instead of widening it */
  grid-template-rows: auto auto;
  align-content: center;
  justify-items: center;
  gap: 12px;
  min-height: 0;
  padding: 14px 20px;
}
.stage {
  position: relative;
  width: min(100cqw, (100cqh - 110px - var(--caption-extra, 0px)) * 1.6);
  aspect-ratio: 16 / 10;
  container-type: inline-size;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: var(--shadow);
  background: #fffaf0;
}
.caption {
  max-width: 34em;
  margin: 0;
  font: 400 clamp(22px, 3.1cqw, 34px)/1.35 var(--book);
  text-align: center;
  word-spacing: 0.15em;
}
.cw { border-radius: 0.2em; padding: 0 0.04em; }
.cw.now { background: var(--now); box-shadow: inset 0 -0.08em var(--accent); }

.title-card { display: grid; justify-items: center; gap: 12px; animation: pop 0.6s ease-out; }
.title-icon { font: 140px/1 var(--emoji); }
.title-card h2 { margin: 0; font: 400 56px/1.1 var(--book); }

/* The places a scene stands on (js/science/backdrops.js draws them as SVG) and
   the cameras that film them: the far one (sky, back wall) moves at half the
   speed of the near one (ground and the things on it). */
.cam, .drift, .things, .fx, .bg-layer, .ambient { position: absolute; inset: 0; }
.cam { transform-origin: 50% 50%; }
.drift { transform-origin: 50% 60%; }
.bg-layer > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 58%, rgb(20 24 48 / 0.16) 100%);
  box-shadow: inset 0 0 0 1px rgb(29 36 51 / 0.06);
}

/* Slow life in the places: clouds and ripples drift, stars twinkle. */
.bg-layer .sway { animation: bd-drift var(--d, 60s) ease-in-out infinite alternate; }
.bg-layer .twinkle { animation: bd-twinkle 3.2s ease-in-out infinite; }
.bg-layer .twinkle.t1 { animation-delay: -1.1s; animation-duration: 2.6s; }
.bg-layer .twinkle.t2 { animation-delay: -2.2s; animation-duration: 3.8s; }
.bg-layer .ripple { transform-box: fill-box; transform-origin: center; animation: bd-ripple 3.6s ease-out infinite; }
.bg-layer .ripple.r1 { animation-delay: -1.2s; }
.bg-layer .ripple.r2 { animation-delay: -2.4s; }
@keyframes bd-drift { to { transform: translateX(var(--dx, 60px)); } }
@keyframes bd-twinkle { 50% { opacity: 0.35; } }
@keyframes bd-ripple { 0% { transform: scale(0.3); opacity: 0.8; } 100% { transform: scale(1.4); opacity: 0; } }

/* Little lights in the air. */
.ambient { pointer-events: none; overflow: hidden; }
.mote { position: absolute; left: var(--x); top: var(--y); width: calc(var(--s) * 0.7cqw); height: calc(var(--s) * 0.7cqw); border-radius: 50%; }
.pollen .mote { background: radial-gradient(circle, #fffbe0 0 35%, rgb(255 236 150 / 0) 70%); width: calc(var(--s) * 1.3cqw); height: calc(var(--s) * 1.3cqw); animation: mote-float var(--d) ease-in-out var(--delay) infinite; }
.dust .mote { background: rgb(255 255 255 / 0.9); box-shadow: 0 0 0.6cqw rgb(255 255 255 / 0.9); width: calc(var(--s) * 0.45cqw); height: calc(var(--s) * 0.45cqw); animation: mote-float calc(var(--d) * 1.5) ease-in-out var(--delay) infinite; }
.sparkle .mote { width: calc(var(--s) * 1.4cqw); height: calc(var(--s) * 1.4cqw); border-radius: 0; background: var(--bd-accent, #e5a50a); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); opacity: 0; animation: mote-glint calc(var(--d) * 0.6) ease-in-out var(--delay) infinite; }
.bg-beach.sparkle .mote { background: #fff; top: calc(48% + var(--y) * 0.12); }
.snow .mote { background: #fff; box-shadow: 0 0 0.4cqw rgb(160 190 230 / 0.8); animation: mote-fall var(--d) linear var(--delay) infinite; }
.bubbles .mote { border: 0.18cqw solid rgb(255 255 255 / 0.85); width: calc(var(--s) * 1.1cqw); height: calc(var(--s) * 1.1cqw); animation: mote-rise var(--d) ease-in var(--delay) infinite; }
.fireflies .mote { background: #f4ff8a; box-shadow: 0 0 1.2cqw 0.3cqw rgb(230 255 120 / 0.7); width: calc(var(--s) * 0.6cqw); height: calc(var(--s) * 0.6cqw); animation: mote-float var(--d) ease-in-out var(--delay) infinite, mote-blink 2.4s ease-in-out var(--delay) infinite; }
.comet .mote { width: 9cqw; height: 0.35cqw; border-radius: 1cqw; background: linear-gradient(90deg, transparent, #fff); opacity: 0; animation: mote-comet 9s ease-in 2s infinite; }
@keyframes mote-float { 0%, 100% { transform: translate(0, 0); opacity: 0.2; } 50% { transform: translate(var(--dx), -6cqw); opacity: 0.95; } }
@keyframes mote-glint { 0%, 100% { transform: scale(0.2) rotate(0deg); opacity: 0; } 50% { transform: scale(1) rotate(45deg); opacity: 0.55; } }
@keyframes mote-fall { from { transform: translate(0, 0); } to { transform: translate(var(--dx), 68cqw); } }
@keyframes mote-rise { 0% { transform: translate(0, 0); opacity: 0; } 20% { opacity: 0.9; } 100% { transform: translate(calc(var(--dx) * 0.3), -24cqw); opacity: 0; } }
@keyframes mote-blink { 50% { opacity: 0.25; } }
@keyframes mote-comet { 0% { transform: translate(0, 0) rotate(18deg); opacity: 0; } 4% { opacity: 1; } 14% { transform: translate(60cqw, 20cqw) rotate(18deg); opacity: 0; } 100% { opacity: 0; } }

/* Things on the stage. GSAP places and moves them; sizes follow the stage.
   .act carries the flourishes and .life the breathing, so they never fight the cues. */
.item { position: absolute; line-height: 1; white-space: nowrap; }
.item .act, .item .life { position: relative; display: block; transform-origin: 50% 60%; }
.item .inner { display: block; }
.item.emoji { font-size: calc(var(--size) * 1cqw); font-family: var(--emoji); }
.item .face { display: block; filter: drop-shadow(0 0.08em 0.06em rgb(29 36 51 / 0.22)); }
.item .face.flip { transform: scaleX(-1); }
.item .shadow {
  position: absolute;
  left: 50%;
  bottom: 0.02em;
  width: 0.78em;
  height: 0.14em;
  border-radius: 50%;
  translate: -50% 50%;
  background: radial-gradient(closest-side, rgb(30 30 40 / 0.34), rgb(30 30 40 / 0));
}
.item.label { font: 600 calc(var(--size) * 1cqw)/1.1 var(--book); }
.item.label .inner {
  padding: 0.14em 0.45em 0.18em;
  border-radius: 0.5em;
  background: #fff;
  border: 0.08em solid rgb(29 36 51 / 0.08);
  box-shadow: 0 0.1em 0 rgb(29 36 51 / 0.12), 0 0.25em 0.6em rgb(29 36 51 / 0.14);
}
.item.label.bare .inner { padding: 0; background: none; border: 0; box-shadow: none; }
.item.pic img { display: block; width: calc(var(--w) * 1cqw); border: 0.6cqw solid #fff; border-radius: 1.6cqw; box-shadow: 0 0.6cqw 2cqw rgb(29 36 51 / 0.25); }
.item.arrow .act { transform-origin: 0% 50%; }
.item.arrow .inner { width: calc(var(--len) * 1cqw); height: 1.3cqw; border-radius: 1cqw; background: currentColor; box-shadow: 0 0.3cqw 0.6cqw rgb(29 36 51 / 0.2); }
.item.arrow .inner::after {
  content: '';
  position: absolute;
  right: -2.6cqw;
  top: 50%;
  transform: translateY(-50%);
  border-left: 3.2cqw solid currentColor;
  border-top: 2cqw solid transparent;
  border-bottom: 2cqw solid transparent;
}
.shape .inner { width: calc(var(--w) * 1cqw); height: calc(var(--h) * 1cqw); background: var(--c, #cfd6e0); }
.shape-circle .inner { border-radius: 50%; box-shadow: inset -0.6cqw -0.8cqw 0 rgb(0 0 0 / 0.08); }
.shape-rect .inner { border-radius: 1cqw; box-shadow: 0 0.4cqw 1cqw rgb(29 36 51 / 0.15); }
.shape-globe .inner, .globe-big {
  position: relative;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 34%, #6fd18a 0 17%, transparent 18%),
    radial-gradient(circle at 66% 58%, #6fd18a 0 15%, transparent 16%),
    radial-gradient(circle at 42% 74%, #5cc47a 0 10%, transparent 11%),
    radial-gradient(circle at 70% 28%, #5cc47a 0 8%, transparent 9%),
    #3a86d8;
  box-shadow: inset -0.5cqw -0.5cqw 0 rgb(0 0 0 / 0.12);
}
.shape-globe .inner { box-shadow: inset -0.5cqw -0.5cqw 0 rgb(0 0 0 / 0.12), 0 0 2cqw rgb(120 180 255 / 0.35); }
.pin { position: absolute; left: 50%; top: 3%; width: 15%; height: 15%; transform: translateX(-50%); border: 0.35cqw solid #fff; border-radius: 50%; background: #e0453a; }
.shape-bar .inner { display: flex; overflow: hidden; border-radius: 1cqw; background: none; box-shadow: 0 0.4cqw 1.2cqw rgb(29 36 51 / 0.2); }
.shape-bar .inner.turned { flex-direction: row-reverse; }
.shape-bar .pole { font-size: calc(var(--h) * 0.6cqw); }
.shape-shade .inner, .globe-shade { border-radius: 50%; background: linear-gradient(to right, transparent 50%, rgb(8 16 48 / 0.62) 50%); }
.shape-waves .inner { position: relative; background: none; }
.wave { position: absolute; top: 50%; left: 0; border: 0.7cqw solid transparent; border-right-color: var(--c, var(--accent)); border-radius: 50%; transform: translateY(-50%); }
.wave:nth-child(1) { width: 40%; height: 40%; }
.wave:nth-child(2) { width: 70%; height: 70%; left: -15%; }
.wave:nth-child(3) { width: 100%; height: 100%; left: -30%; }

/* The glow cue: warm light with slowly turning rays behind the thing. */
.item .halo {
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 236 140 / 0.95) 0 16%, rgb(255 205 70 / 0.5) 36%, rgb(255 205 70 / 0) 66%);
  pointer-events: none;
}
.item .halo::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(rgb(255 240 170 / 0.7) 0 7deg, transparent 7deg 24deg);
  -webkit-mask: radial-gradient(circle, transparent 18%, #000 30%, transparent 70%);
  mask: radial-gradient(circle, transparent 18%, #000 30%, transparent 70%);
}

/* Sparks, rings and puffs where something happens. */
.fx { pointer-events: none; }
.burst { position: absolute; width: 0; height: 0; }
.burst .ray { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.burst .spark { position: absolute; left: calc(var(--r) * 0.5cqw); top: calc(var(--r) * -0.09cqw); width: calc(var(--r) * 0.18cqw); height: calc(var(--r) * 0.18cqw); border-radius: 50%; }
.burst .spark.star { border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); width: calc(var(--r) * 0.3cqw); height: calc(var(--r) * 0.3cqw); }
.burst .ring { position: absolute; left: calc(var(--r) * -1.2cqw); top: calc(var(--r) * -1.2cqw); width: calc(var(--r) * 2.4cqw); height: calc(var(--r) * 2.4cqw); border-radius: 50%; border: calc(var(--r) * 0.06cqw + 0.2cqw) solid rgb(255 255 255 / 0.9); box-shadow: 0 0 1cqw rgb(255 255 255 / 0.6); }
.burst .flash { position: absolute; left: calc(var(--r) * -1.3cqw); top: calc(var(--r) * -1.3cqw); width: calc(var(--r) * 2.6cqw); height: calc(var(--r) * 2.6cqw); border-radius: 50%; background: radial-gradient(circle, #fff 0 30%, rgb(255 255 255 / 0) 70%); }
.puff .cloudlet { position: absolute; left: 0; top: 0; width: calc(var(--r) * 0.9cqw); height: calc(var(--r) * 0.9cqw); border-radius: 50%; }
.puff.dust .cloudlet { background: radial-gradient(circle, rgb(236 222 196 / 0.95) 0 40%, rgb(236 222 196 / 0) 72%); }
.puff.smoke .cloudlet { background: radial-gradient(circle, rgb(255 255 255 / 0.95) 0 40%, rgb(230 236 245 / 0) 72%); }

/* The KidStudy logo, small in the corner of every scene. */
.wm {
  position: absolute;
  right: 1.6cqw;
  bottom: 1.6cqw;
  z-index: 5;
  padding: 0.55cqw 1cqw;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.72);
  box-shadow: 0 0.2cqw 0.8cqw rgb(29 36 51 / 0.12);
  opacity: 0.88;
  pointer-events: none;
}
.wm.bl { right: auto; left: 1.6cqw; }
.wm.tr { bottom: auto; top: 1.6cqw; }
.wm.tl { bottom: auto; top: 1.6cqw; right: auto; left: 1.6cqw; }
.wm img { display: block; width: 11cqw; height: auto; }

/* A scene opens like an eye (an iris), and in the whole video zooms away before the next. */
.stage.enter { animation: stage-iris 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.stage.leave { animation: stage-leave 0.38s cubic-bezier(0.5, 0, 0.75, 0) both; }
@keyframes stage-iris { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(75% at 50% 50%); } }
@keyframes stage-leave { to { transform: scale(0.94); opacity: 0; filter: blur(4px); } }

/* The opening and closing cards of the whole video. */
.title-stage { display: grid; place-items: center; background: radial-gradient(circle at 50% 42%, #fffdf6 0 30%, color-mix(in srgb, var(--bd-accent, #2f5fb3) 22%, #fff7e6) 100%); }
.title-stage .ts-rays {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 150cqw;
  height: 150cqw;
  margin: -75cqw 0 0 -75cqw;
  border-radius: 50%;
  background: repeating-conic-gradient(color-mix(in srgb, var(--bd-accent, #2f5fb3) 16%, transparent) 0 9deg, transparent 9deg 22deg);
  -webkit-mask: radial-gradient(circle, transparent 6%, #000 14%, transparent 52%);
  mask: radial-gradient(circle, transparent 6%, #000 14%, transparent 52%);
}
.title-stage .ts-ground { position: absolute; left: -10%; right: -10%; bottom: -30%; height: 52%; border-radius: 50%; background: color-mix(in srgb, var(--bd-accent, #2f5fb3) 30%, #fff); }
.title-stage .ts-kobi { position: absolute; left: 7%; bottom: 4%; width: 27cqw; height: auto; filter: drop-shadow(0 1cqw 1.2cqw rgb(29 36 51 / 0.25)); }
.title-stage .ts-icon { position: absolute; right: 9%; top: 14%; font: 14cqw/1 var(--emoji); filter: drop-shadow(0 0.8cqw 0.8cqw rgb(29 36 51 / 0.2)); }
.title-stage .ts-kicker {
  position: absolute;
  left: 50%;
  top: 22%;
  translate: -50% 0;
  margin: 0;
  padding: 0.35em 1em;
  border-radius: 999px;
  background: var(--bd-accent, #2f5fb3);
  color: #fff;
  font: 600 2.6cqw/1 var(--ks-brand-font, var(--ui));
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.title-stage .ts-title { position: relative; max-width: 62cqw; margin: 0 0 4cqw 12cqw; color: var(--ink); font: 600 7.4cqw/1.08 var(--ks-brand-font, var(--book)); text-align: center; text-shadow: 0 0.12em 0 #fff, 0 0.2em 0.5em rgb(29 36 51 / 0.12); }
.title-stage .ts-word { display: inline-block; white-space: nowrap; }
.title-stage .ts-ch { display: inline-block; }
.end-stage .ts-title { margin: 0 0 9cqw 14cqw; }
.end-stage .ts-icon { right: auto; left: 50%; top: 10%; translate: -10% 0; }
.end-stage .ts-logo { position: absolute; left: 50%; bottom: 9%; width: 30cqw; translate: -36% 0; }
.end-stage .fx { position: absolute; inset: 0; }

@media (prefers-reduced-motion: reduce) {
  .stage.enter, .stage.leave { animation: none; }
  .bg-layer .sway, .bg-layer .twinkle, .bg-layer .ripple, .ambient .mote { animation: none; }
}

/* ---- Try: the prompt, the activity and a well done ---- */

.try { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; min-height: 0; padding: 14px 24px; }
.prompt { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0; font: 400 30px/1.25 var(--book); text-align: center; }
.say {
  flex: none;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 26px;
}
.say.saying { background: var(--now); }
.try-done { margin: 0; padding: 10px 18px; border-radius: 18px; background: var(--right-soft); color: #13643a; font: 400 26px/1.3 var(--book); text-align: center; animation: pop 0.5s ease-out; }

.activity { min-height: 0; }
.card {
  display: inline-grid;
  justify-items: center;
  gap: 2px;
  min-width: 112px;
  padding: 10px 12px 8px;
  border: 3px solid transparent;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
  touch-action: none;
}
.card-emoji { font: 56px/1.05 var(--emoji); }
.card-label { font: 400 20px/1.15 var(--book); text-align: center; }
.card.picked { border-color: var(--accent); }
.card.right { border-color: var(--right); background: var(--right-soft); }
.card.wrong { border-color: var(--wrong); }

/* Sort and match: things in a tray, boxes underneath. */
.sort { display: grid; grid-template-rows: auto auto; align-content: center; gap: 28px; }
.tray { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 12px; min-height: 130px; }
.bins { display: grid; grid-template-columns: repeat(var(--bins, 2), minmax(0, 1fr)); gap: 14px; }
.bins-3 .bins { --bins: 3; }
.bins-4 .bins { --bins: 4; }
.bins-5 .bins { --bins: 5; }
.bin { display: grid; grid-template-rows: auto 1fr; min-height: 190px; padding: 10px; border: 3px dashed #b9c6dc; border-radius: 24px; background: rgb(255 255 255 / 0.55); }
.bin-head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.bin-emoji { font: 44px/1 var(--emoji); }
.bin-label { font: 400 26px/1.1 var(--book); }
.bins-5 .bins { gap: 8px; }
.bins-5 .bin { padding: 8px 4px; }
.bins-5 .bin-head { flex-direction: column; gap: 2px; }
.bins-5 .bin-emoji { font-size: 38px; }
.bins-5 .bin-label { font-size: 20px; }
.bin-list { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 8px; padding-top: 8px; }
.bin-list .card { min-width: 0; padding: 4px 8px; box-shadow: none; }
.bin-list .card-emoji { font-size: 36px; }
.bin-list .card-label { font-size: 15px; }

/* Order: numbered places along the top, the pile underneath. */
.order { display: grid; grid-template-rows: auto auto; align-content: center; gap: 28px; }
.slots { display: flex; justify-content: center; align-items: center; gap: 6px; }
.slot { position: relative; display: grid; place-items: center; width: 150px; min-height: 150px; border: 3px dashed #b9c6dc; border-radius: 22px; }
.n5 .slot { width: 130px; }
.slot-n { position: absolute; top: 6px; left: 10px; color: var(--muted); font-weight: 800; }
.slot .card { box-shadow: none; }
.then { color: var(--muted); font-size: 34px; font-weight: 800; }
.pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; min-height: 140px; }

/* Choose: big cards to tap. */
.choose { display: grid; place-items: center; }
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; max-width: 900px; }
.choices .card { min-width: 150px; }
.choices .card-emoji { font-size: 72px; }

/* ---- The hands-on experiments ---- */

.sim { position: relative; display: grid; align-content: center; justify-items: center; gap: 14px; }
.sim-note { margin: 0; min-height: 1.3em; font: 400 26px/1.3 var(--book); text-align: center; }
.big-note { font-size: 34px; }
.sim-buttons { display: flex; gap: 14px; }

.magnet-sim { display: block; min-height: 360px; }
.magnet-sim .magnet-big { position: absolute; left: 24%; top: 50%; transform: translate(-50%, -50%); font: min(190px, 30vh)/1 var(--emoji); }
.magnet-sim .card { position: absolute; }
.magnet-sim .sim-note { position: absolute; left: 0; right: 0; bottom: 0; }

.pole-track { display: flex; justify-content: center; align-items: center; gap: 12%; width: 100%; }
.bar-magnet { display: flex; width: 32%; height: 96px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.bar-magnet.turned { flex-direction: row-reverse; }
.pole { flex: 1; display: grid; place-items: center; color: #fff; font: 800 44px/1 var(--ui); }
.pole.n { background: #e0453a; }
.pole.s { background: #2f6fd6; }

.spin-sim { grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; align-items: center; width: 100%; }
.sun-big { grid-row: 1; font: min(140px, 18vh)/1 var(--emoji); filter: drop-shadow(0 0 30px rgb(255 200 0 / 0.8)); }
.beams { display: none; }
.globe-wrap { grid-row: 1; position: relative; justify-self: center; width: min(46vh, 60vw); aspect-ratio: 1; }
.globe-big { position: absolute; inset: 0; container-type: inline-size; touch-action: none; cursor: grab; }
.globe-big .pin { border-width: 4px; }
.globe-shade { position: absolute; inset: 0; pointer-events: none; }
.spin-sim .sim-note { grid-column: 1 / -1; }
.sim-note.night { color: #26386e; }

.heat-sim { gap: 24px; }
.melt-row { display: flex; justify-content: center; gap: 40px; }
.melt-thing { display: grid; justify-items: center; gap: 6px; }
.melt-art { position: relative; display: grid; place-items: end center; width: 150px; height: 140px; }
.melt-art .solid { font: 96px/1 var(--emoji); }
.melt-art .puddle { position: absolute; bottom: 0; left: 10px; right: 10px; height: 30px; border-radius: 50%; background: var(--c); }
.state { padding: 2px 12px; border-radius: 999px; background: var(--accent-soft); font-weight: 800; }
.state.liquid { background: #ffe7c7; }
.heat-row { display: flex; align-items: center; gap: 14px; width: min(680px, 90%); font: 44px/1 var(--emoji); }
/* Cold blue to hot red, with a thumb big enough for a small finger. */
.heat-slider {
  flex: 1;
  height: 20px;
  margin: 18px 0;
  border-radius: 10px;
  background: linear-gradient(to right, #7cc4ff, #f6d36b, #f08a24, #e0453a);
  -webkit-appearance: none;
  appearance: none;
  touch-action: none;
}
.heat-slider::-webkit-slider-thumb { width: 56px; height: 56px; border: 5px solid #f08a24; border-radius: 50%; background: #fff; box-shadow: var(--shadow); -webkit-appearance: none; appearance: none; }
.heat-slider::-moz-range-thumb { width: 46px; height: 46px; border: 5px solid #f08a24; border-radius: 50%; background: #fff; box-shadow: var(--shadow); }

.pitch-sim .tin { display: grid; gap: 26px; width: min(620px, 90%); padding: 34px 24px; border-radius: 28px; background: linear-gradient(#d9dee6, #b9c1cd); box-shadow: var(--shadow); }
.band { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; min-height: 84px; padding: 0 14px; border: 0; border-radius: 18px; background: rgb(255 255 255 / 0.5); }
.band-line { display: block; height: 6px; border-radius: 6px; background: #7a3b18; }
.band-line.loose { height: 34px; background: none; border-bottom: 6px solid #7a3b18; border-radius: 0 0 50% 50%; }
.band-label { font: 400 26px/1 var(--book); }
.float-note { position: absolute; right: 30%; top: 0; font: 400 26px/1 var(--book); pointer-events: none; }

.shadow-sim { display: block; min-height: 380px; overflow: hidden; container-type: inline-size; border-radius: 24px; background: linear-gradient(#a9dcff, #e4f4ff 78%); }
.shadow-sim .ground { position: absolute; left: 0; right: 0; bottom: 0; height: 22%; background: #8ccf6b; }
/* Short enough on a narrow screen that the Sun stays in the sky when it is low. */
.sun-arm { position: absolute; left: 50%; bottom: 22%; width: 0; height: min(66%, calc(50cqw - 44px)); transform-origin: 50% 100%; }
.sun-handle { position: absolute; top: -40px; left: -40px; width: 80px; height: 80px; display: grid; place-items: center; font: 64px/1 var(--emoji); touch-action: none; cursor: grab; filter: drop-shadow(0 0 18px rgb(255 200 0 / 0.9)); }
.shadow-thing { position: absolute; left: 50%; bottom: 21%; transform: translateX(-50%); font: min(120px, 17vh)/1 var(--emoji); }
.shadow-dark { position: absolute; bottom: calc(22% - 12px); width: 46%; height: 24px; border-radius: 50%; background: rgb(20 30 20 / 0.4); }
.shadow-sim .sim-note { position: absolute; left: 0; right: 0; top: 10px; }

.push-sim { width: 100%; }
.lane { position: relative; width: 100%; height: 200px; border-radius: 24px; background: linear-gradient(#e4f4ff 0 55%, #8ccf6b 55%); }
.push-ball { position: absolute; left: 8px; bottom: 24px; width: 92px; height: 92px; display: grid; place-items: center; font: 84px/1 var(--emoji); touch-action: none; cursor: grab; }
.flag { position: absolute; bottom: 70px; font: 44px/1 var(--emoji); }
.flag.f1 { left: 34%; }
.flag.f2 { left: 66%; }
.flag.f3 { right: 10px; }

/* ---- Game ---- */

/* Centred while it fits; from the top once it scrolls (plain centring pushed the top out
   of reach on a phone). Browsers without `safe` keep `start`. */
.game { display: grid; align-content: start; align-content: safe center; justify-items: center; gap: 20px; padding: 20px 24px; }
.quiz-count { margin: 0; color: var(--muted); font-weight: 700; }
.question { display: flex; align-items: center; gap: 14px; margin: 0; font: 400 36px/1.25 var(--book); text-align: center; }
.options { display: grid; gap: 14px; width: min(640px, 100%); }
.option { display: flex; align-items: center; gap: 12px; }
.answer {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 8px 22px;
  border: 3px solid var(--line);
  border-radius: 22px;
  background: #fff;
  font: 400 30px/1.2 var(--book);
  text-align: left;
}
.answer-emoji { font: 44px/1 var(--emoji); }
.answer.right { border-color: var(--right); background: var(--right-soft); }
.answer.wrong { border-color: var(--wrong); opacity: 0.55; animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---- Done: the badge ---- */

.done { display: grid; align-content: start; align-content: safe center; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.badge-big { font: 150px/1 var(--emoji); animation: pop 0.7s ease-out; filter: drop-shadow(0 0 24px rgb(242 176 30 / 0.7)); }
.badge-big.locked { filter: grayscale(1); opacity: 0.35; animation: none; }
.done h2 { margin: 0; font: 400 48px/1.1 var(--book); }
.big-stars { font-size: 56px; }
.done-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 8px; }
@keyframes pop { 0% { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

/* ---- The whole video ---- */

.scene-holder.video { padding-bottom: 6px; }
.video-bar { display: flex; gap: 6px; padding: 0 20px 12px; }
.video-seg { flex: 1; height: 8px; border-radius: 8px; background: var(--line); }
.video-seg.on { background: var(--accent); }
.video-seg .fill { display: none; }

@media (max-width: 700px) {
  .year-tab { min-width: 0; padding: 0 12px; font-size: 18px; }
  .steps { font-size: 16px; }
}

/* ---- Phones: held upright (narrow) or on their side (short) ---- */

@media (max-width: 600px), (max-height: 500px) {
  .bar { gap: 8px; padding: 8px 10px; }
  .bar .round.spacer { display: none; }
  .bar-title { font-size: 24px; }
  .round { width: 46px; height: 46px; font-size: 22px; }
  .big { min-height: 52px; padding: 0 16px; font-size: 18px; }

  /* The step icons get their own row above the buttons. */
  .controls { flex-wrap: wrap; justify-content: center; gap: 8px 10px; min-height: 0; padding: 8px 12px; }
  .controls .steps { order: -1; flex: 1 1 100%; gap: 2px; font-size: 15px; }
  .controls .big { flex: 1 1 0; }
  .step.now { margin: 0 4px; }

  .home { padding: 14px 14px 24px; }
  .year-tab { min-width: 0; min-height: 46px; padding: 0 12px; font-size: 17px; }
  .lessons { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; }
  .lesson-card { column-gap: 12px; min-height: 100px; padding: 10px 14px; border-radius: 18px; }
  .lesson-icon { font-size: 46px; }
  .lesson-title { font-size: 22px; padding-right: 26px; }
  .lesson-note { font-size: 14px; }
  .lesson-card .stars { font-size: 20px; }
  .lesson-badge { font-size: 24px; }

  .scene-holder { gap: 8px; padding: 10px 12px; }
  .stage { width: min(100cqw, (100cqh - 90px - var(--caption-extra, 0px)) * 1.6); border-radius: 16px; }
  .caption { font-size: clamp(18px, 4.6cqw, 24px); }
  .title-icon { font-size: 90px; }
  .title-card h2 { font-size: 36px; }

  /* Never smaller than what it holds: on a short screen the step scrolls instead of
     squeezing the activity under the words (activities sized by their box still fill it). */
  .try { gap: 8px; padding: 10px 12px; overflow-y: auto; grid-template-rows: auto minmax(max-content, 1fr) auto; }
  .prompt { gap: 10px; font-size: 21px; }
  .say { width: 44px; height: 44px; font-size: 20px; }
  .try-done { padding: 6px 12px; font-size: 19px; }

  .card { min-width: 84px; padding: 6px 8px 5px; border-radius: 16px; }
  .card-emoji { font-size: 38px; }
  .card-label { font-size: 15px; }

  .sort, .order { gap: 14px; }
  .tray { gap: 8px; min-height: 90px; }
  .bins { gap: 8px; }
  .bin { min-height: 110px; padding: 6px 4px; border-radius: 18px; }
  .bin-head { flex-direction: column; gap: 0; }
  .bin-emoji, .bins-5 .bin-emoji { font-size: 30px; }
  .bin-label, .bins-5 .bin-label { font-size: 15px; text-align: center; }
  .bin-list { gap: 4px; padding-top: 4px; }
  .bin-list .card-emoji { font-size: 26px; }
  .bin-list .card-label { font-size: 12px; }

  .slots { gap: 2px; }
  .slot, .n5 .slot { flex: 1 1 0; width: auto; min-width: 0; max-width: 150px; min-height: 96px; border-radius: 16px; }
  .slot-n { top: 2px; left: 6px; font-size: 13px; }
  .slot .card { min-width: 0; padding: 4px; }
  .slot .card-emoji { font-size: 30px; }
  .slot .card-label { font-size: 12px; }
  .then { font-size: 18px; }
  .pile { gap: 8px; min-height: 90px; }

  .choices { gap: 10px; }
  .choices .card { min-width: 100px; }
  .choices .card-emoji { font-size: 50px; }

  .sim { gap: 10px; }
  .sim-note { font-size: 19px; }
  .big-note { font-size: 24px; }
  .sim-buttons { flex-wrap: wrap; justify-content: center; gap: 10px; }
  .magnet-sim { min-height: 280px; }
  .magnet-sim .magnet-big { font-size: min(120px, 30vw, 26vh); }
  .bar-magnet { height: 64px; }
  .pole { font-size: 30px; }
  .sun-big { font-size: min(90px, 18vh); }
  .melt-row { gap: 16px; }
  .melt-art { width: 110px; height: 100px; }
  .melt-art .solid { font-size: 68px; }
  .heat-row { width: 100%; font-size: 32px; }
  .pitch-sim .tin { gap: 14px; width: 100%; padding: 18px 14px; }
  .band { min-height: 64px; }
  .band-label, .float-note { font-size: 20px; }
  .shadow-sim { min-height: 280px; }
  .sun-handle { font-size: 50px; }
  .lane { height: 160px; }
  .push-ball { width: 72px; height: 72px; font-size: 64px; }
  .flag { bottom: 60px; font-size: 34px; }

  .game { gap: 14px; padding: 14px 12px; overflow-y: auto; }
  .question { gap: 10px; font-size: 25px; }
  .options { gap: 10px; }
  .answer { min-height: 60px; gap: 10px; padding: 6px 14px; border-radius: 18px; font-size: 22px; }
  .answer-emoji { font-size: 32px; }

  .done { gap: 10px; padding: 16px 14px; overflow-y: auto; }
  .badge-big { font-size: 100px; }
  .done h2 { font-size: 34px; }
  .big-stars { font-size: 42px; }
  .done-links .big { white-space: normal; }

  .video-bar { padding: 0 12px 8px; }
}

/* Phone on its side: thin bars, and a smaller stage leaves room for the words. */
@media (max-height: 500px) {
  .bar { padding: 4px 10px; }
  .controls { flex-wrap: nowrap; padding: 4px 12px; }
  .controls .steps { order: 0; flex: 1 1 auto; }
  .controls .big { flex: none; }
  .scene-holder { padding: 6px 12px; gap: 4px; }
  .stage { width: min(100cqw, (100cqh - 70px - var(--caption-extra, 0px)) * 1.6); }
  .caption { font-size: clamp(16px, 2.6cqw, 22px); }
  .badge-big { font-size: 70px; }
  .title-icon { font-size: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .big.primary.ready, .badge-big, .title-card, .try-done, .answer.wrong, .big .hand, .guess.picked { animation: none; }
}

/* ---- KidStudy: Kobi is the way home, waits while things load and cheers at the end ---- */

.bar a.round[href="./"] { font-size: 0; border-color: var(--ks-blue); background: var(--ks-blue) url('../icons/icon-192.png') center / cover; }
.message::before { content: ''; width: 150px; aspect-ratio: 582 / 640; background: url('../brand/kobi-main.webp') center / contain no-repeat; }

/* ---- 🤔 Predict: a guess before the scene, and "Were you right?" after it ---- */

/* Centred when there is room; when there is not (a phone on its side) it scrolls from the top. */
.predict { display: flex; flex-direction: column; align-items: center; gap: 18px; min-height: 0; padding: 14px 24px; overflow-y: auto; }
.predict > :first-child { margin-top: auto; }
.predict > :last-child { margin-bottom: auto; }
/* The "on" things wear the app's subject colour (kidstudy-ui.css), or blue without it. */
.kicker { margin: 0; color: var(--subject-dark, var(--accent)); font: 700 20px/1.2 var(--ui); text-align: center; }
.guesses { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.guess.card { position: relative; align-content: center; min-width: 190px; max-width: 250px; min-height: 180px; padding: 18px 16px 14px; touch-action: manipulation; }
.guess .card-emoji { font-size: 84px; }
.guess .card-label { font-size: 24px; }
.guess.chosen { border-color: var(--subject-dark, var(--accent)); background: var(--subject-soft, var(--accent-soft)); }
.guess-tag {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--subject-dark, var(--accent));
  color: #fff;
  font: 700 15px/1.4 var(--ui);
  white-space: nowrap;
  visibility: hidden;
}
.guess.chosen .guess-tag { visibility: visible; }
/* A guess bounces when it is tapped. */
.guess.picked { animation: picked 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes picked { 0% { transform: scale(0.88); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.predict-note { margin: 0; color: var(--muted); font: 400 20px/1.3 var(--book); text-align: center; }
/* Under the cards: "Let's watch", big, once there is a guess (room kept so nothing jumps). */
.predict-go { display: grid; place-items: center; min-height: 128px; padding-top: 48px; }
.big.go { min-height: 72px; padding: 0 40px; font-size: 28px; }

/* After the scene the stage makes room for the answer under it. */
.stage { transition: width 0.4s ease; }
.scene-holder.revealed .stage { width: min(100cqw, (100cqh - 270px) * 1.6); }
.reveal { display: grid; justify-items: center; gap: 10px; max-width: min(46em, 100%); text-align: center; animation: pop 0.5s ease-out; }
.reveal h2 { margin: 0; font: 400 32px/1.2 var(--book); }
.reveal-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border: 3px solid var(--line); border-radius: 999px; background: #fff; font: 400 22px/1.2 var(--book); opacity: 0.6; }
.chip.right, .chip.mine { opacity: 1; }
.chip.right { border-color: var(--right); background: var(--right-soft); }
.chip.mine:not(.right) { border-color: var(--subject-dark, var(--accent)); }
.chip-emoji { font: 30px/1 var(--emoji); }
.chip-mark { color: var(--right); font: 800 24px/1 var(--ui); }
.chip-tag { padding: 1px 8px; border-radius: 999px; background: var(--subject-dark, var(--accent)); color: #fff; font: 700 13px/1.4 var(--ui); white-space: nowrap; }
.reveal-result { margin: 0; font: 400 26px/1.3 var(--book); }
.reveal-note { margin: 0; padding: 6px 16px; border-radius: 16px; background: var(--right-soft); color: #13643a; font: 400 22px/1.3 var(--book); }
.reveal-note.other { background: #fff4d6; color: #6b4a00; }

/* ---- 🏡 Try it at home: the card, the record table and the notes for grown-ups ---- */

.done .curriculum { max-width: 44em; margin: 4px 0 0; color: var(--muted); font: 13px/1.4 var(--ui); }

.athome { overflow-y: auto; padding: 18px 24px 32px; }
.home-card {
  max-width: 820px;
  margin: 0 auto;
  overflow: hidden;
  border-top: 10px solid var(--ks-science);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
  -webkit-user-select: text;
  user-select: text;
}
.hc-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 22px 6px; }
.hc-icon { font: 54px/1 var(--emoji); }
.hc-kicker { margin: 0; color: #0b7f7f; font: 700 14px/1.3 var(--ui); letter-spacing: 0.03em; text-transform: uppercase; }
.hc-head h2 { margin: 2px 0 0; font: 400 34px/1.15 var(--book); }
.hc-time { padding: 6px 12px; border-radius: 999px; background: #e1f5f5; color: #0b7f7f; font: 700 16px/1 var(--ui); white-space: nowrap; }
.hc-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 0 26px; padding: 0 22px; }
.home-card h3 { margin: 12px 0 6px; font: 700 18px/1.25 var(--ui); }
.hc-need ul, .hc-steps ol { margin: 0; padding-left: 1.3em; font: 400 19px/1.4 var(--book); }
.hc-need li + li, .hc-steps li + li { margin-top: 4px; }
.hc-safety { margin: 12px 22px 0; padding: 8px 14px; border-left: 6px solid var(--ks-sun); border-radius: 12px; background: #fff4d6; font: 16px/1.4 var(--ui); }
.hc-record { padding: 0 22px; overflow-x: auto; }
.record { width: 100%; border-collapse: collapse; font: 400 17px/1.25 var(--book); }
.record th, .record td { padding: 5px 6px; border: 1.5px solid #bcd6d6; text-align: center; vertical-align: middle; }
.record tbody th { font-weight: 400; text-align: left; }
.record .group { background: #e1f5f5; font: 700 15px/1.2 var(--ui); }
.record .choice { font-size: 15px; font-weight: 400; }
.record .choice span { display: block; }
.rec-emoji { font-family: var(--emoji); }
.record td.first { border-left-width: 3px; }
.tick { width: 40px; height: 40px; padding: 0; border: 2.5px solid #6fa3a3; border-radius: 9px; background: #fff; font: 800 26px/1 var(--ui); vertical-align: middle; }
.tick[aria-pressed="true"]::after { content: '✓'; }
.record.tally td { height: 46px; }
.record .tally-cell { width: 42%; }
.hc-notice { margin: 12px 22px 0; font: 400 18px/1.4 var(--book); }
.grownups { margin-top: 14px; padding: 14px 22px 10px; border-top: 1px dashed #c9d2df; background: #f3f6fb; color: #2c3446; font: 15px/1.45 var(--ui); }
.grownups h3 { margin: 0 0 6px; color: var(--ks-blue); font-size: 17px; }
.grownups p { margin: 0 0 6px; }
.grownups .talk { margin: 0 0 8px; padding-left: 1.3em; }
.codes { margin-top: 8px; padding-top: 8px; border-top: 1px solid #dde3ec; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.codes ul { margin: 2px 0 4px; padding-left: 1.2em; }
.codes p { margin: 0 0 3px; }
.codes .source { font-style: italic; }
.hc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 22px 12px; background: #f3f6fb; color: var(--muted); font: 13px/1.2 var(--ui); }
.hc-foot .brand { font-size: 18px; }

@media (max-width: 600px), (max-height: 500px) {
  .predict { gap: 12px; padding: 10px 12px; }
  .kicker { font-size: 16px; }
  .guesses { gap: 14px; }
  .guess.card { min-width: 130px; max-width: 160px; min-height: 120px; padding: 12px 8px 8px; }
  .guess .card-emoji { font-size: 54px; }
  .guess .card-label { font-size: 17px; }
  .guess-tag { top: -12px; font-size: 12px; }
  .predict-note { font-size: 16px; }
  .predict-go { min-height: 100px; padding-top: 40px; }
  .big.go { min-height: 56px; padding: 0 26px; font-size: 21px; }
  .big .hand { font-size: 32px; }

  .scene-holder.revealed .stage { width: min(100cqw, (100cqh - 230px) * 1.6); }
  .reveal { gap: 6px; }
  .reveal h2 { font-size: 22px; }
  .reveal-options { gap: 6px; }
  .chip { gap: 4px; padding: 3px 10px; border-width: 2px; font-size: 16px; }
  .chip-emoji { font-size: 22px; }
  .chip-mark { font-size: 18px; }
  .chip-tag { font-size: 11px; }
  .reveal-result { font-size: 18px; }
  .reveal-note { padding: 4px 10px; font-size: 16px; }

  .athome { padding: 10px 10px 20px; }
  .home-card { border-radius: 18px; }
  .hc-head { gap: 10px; padding: 12px 14px 4px; }
  .hc-icon { font-size: 38px; }
  .hc-kicker { font-size: 11px; }
  .hc-head h2 { font-size: 24px; }
  .hc-time { padding: 4px 8px; font-size: 13px; }
  .hc-body { grid-template-columns: minmax(0, 1fr); padding: 0 14px; }
  .hc-need ul, .hc-steps ol { font-size: 17px; }
  .hc-safety { margin: 10px 14px 0; font-size: 14px; }
  .hc-record { padding: 0 14px; }
  .record { font-size: 14px; }
  .record th, .record td { padding: 3px; }
  .record .group, .record .choice { font-size: 12px; }
  .tick { width: 32px; height: 32px; font-size: 20px; }
  .hc-notice { margin: 10px 14px 0; font-size: 16px; }
  .grownups { padding: 12px 14px 8px; font-size: 14px; }
  .hc-foot { padding: 8px 14px 10px; }
}

/* A phone on its side: the answer goes beside the stage, not under it. */
@media (max-height: 500px) {
  .predict { gap: 8px; padding: 6px 12px; }
  .guesses { gap: 12px; }
  .guess.card { min-height: 0; padding: 8px 8px 6px; }
  .guess .card-emoji { font-size: 42px; }
  .guess .card-label { font-size: 16px; }
  .predict-go { min-height: 88px; padding-top: 36px; }
  .scene-holder.revealed { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); align-items: center; gap: 12px; }
  .scene-holder.revealed .stage { width: min(56cqw, (100cqh - 4px) * 1.6); }
}

/* The card prints alone on one A4 page: no bars or buttons, print-sized type. */
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { height: auto; }
  body.science { background: #fff; }
  .app { display: block; height: auto; padding: 0; }
  .bar, .controls { display: none !important; }
  .athome { overflow: visible; padding: 0; }
  .home-card {
    max-width: none;
    margin: 0;
    border: 1.5pt solid #9fcfcf;
    border-top: 7pt solid var(--ks-science);
    border-radius: 10pt;
    box-shadow: none;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .hc-head { padding: 10pt 14pt 2pt; }
  .hc-icon { font-size: 30pt; }
  .hc-kicker { font-size: 8.5pt; }
  .hc-head h2 { font-size: 21pt; }
  .hc-time { font-size: 10pt; }
  .hc-body { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 0 16pt; padding: 0 14pt; }
  .home-card h3 { margin: 7pt 0 3pt; font-size: 11pt; }
  .hc-need ul, .hc-steps ol { font-size: 11pt; line-height: 1.3; }
  .hc-need li + li, .hc-steps li + li { margin-top: 1pt; }
  .hc-safety { margin: 8pt 14pt 0; padding: 5pt 9pt; font-size: 9.5pt; }
  .hc-record { padding: 0 14pt; overflow: visible; }
  .record { font-size: 11pt; }
  .record th, .record td { padding: 2pt 4pt; border-width: 0.75pt; }
  .record .group, .record .choice { font-size: 9pt; }
  .tick { width: 14pt; height: 14pt; border-width: 1pt; border-radius: 3pt; font-size: 11pt; }
  .record.tally td { height: 24pt; }
  .hc-notice { margin: 8pt 14pt 0; font-size: 11pt; }
  .grownups { margin-top: 8pt; padding: 7pt 14pt 5pt; font-size: 8.5pt; line-height: 1.35; }
  .grownups h3 { font-size: 10.5pt; }
  .grownups p { margin-bottom: 3pt; }
  .grownups .talk { margin-bottom: 4pt; }
  .codes { margin-top: 5pt; padding-top: 5pt; font-size: 7.5pt; }
  .hc-foot { padding: 5pt 14pt 7pt; font-size: 8pt; }
  .hc-foot .brand { font-size: 11pt; }
}
