/* Sciencenauts lessons: tokens, page, mission shell, tank.
   Palette and layout rules: docs/design-research-2026-11-13.md
   One rule to keep: inside a mission, colour goes only on the primary
   button, the feedback and the thing being taught. */

/* The fonts are served from this site and never fetched from Google: a site
   for children makes no third-party requests. Both are variable fonts
   (weights 400 to 700) under the SIL Open Font License (fonts/OFL-*.txt).
   The "latin" files cover Spanish; a browser fetches "latin-ext" only when a
   page uses a character from it. Each page preloads the two latin files. */
@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/lexend-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/lexend-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/unbounded-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/unbounded-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ink: #12172b;
  --ink-2: #4a5068;
  --line: #d5d9e6;
  --line-2: #767e95; /* the design system's "outline": control borders at 3:1 or more */
  --page: #ffffff;
  --quiet: #eef2fb;
  --lead: #2450e6;
  --lead-edge: #1636a8;
  --yellow: #ffcb1f;
  --yellow-soft: #fff1b8;
  --clay: #ff6b2c;
  --water: #a9cdff;
  --off: #e4e7f0;
  --off-edge: #c9cede;
  --off-ink: #5a6078;
  --warn: #a23c06;
  /* Lexend for everything a person reads, Unbounded for short strings and
     numbers. Both are declared at the top of this file. */
  --font: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --tap: 56px;
  /* Motion: smooth and subtle. One easing, three speeds. */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 140ms; /* colour and press feedback */
  --t-mid: 240ms;  /* things appearing: a step, a message, the mission itself */
  --t-slow: 480ms; /* what the child changes on the stage */
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* The hidden attribute always wins, whatever display a class sets. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--lead); }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--lead); outline-offset: 3px; }

button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Page (what a parent finds from search) ---------- */

.page { max-width: 680px; margin: 0 auto; padding: 12px 20px 48px; }

.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 12px; }
.brand { margin: 0; font-weight: 700; font-size: 17px; letter-spacing: 0.08em; }
.top a { display: flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; }
/* The app bar (navigation): the site's name leads home; on the right, at most two quiet links in
   the design system's rest state (surface, 2px outline border, ink text), never a second filled
   button: the page keeps its one primary. The language link names the other language ("EN", "ES"). */
.top .brand a { display: inline-flex; min-height: 44px; color: var(--ink); font: inherit; letter-spacing: inherit; text-decoration: none; }
.top-nav { display: flex; align-items: center; gap: 8px; }
.top .top-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 14px; border: 2px solid var(--line-2); border-radius: 999px; background: #ffffff; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1; text-decoration: none; }
.top .top-link:hover { border-color: var(--ink); }
.top .top-link:active { transform: translateY(1px); }

.crumbs { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }
.page h1 { margin: 0 0 10px; font-size: 30px; line-height: 1.15; font-weight: 700; text-wrap: balance; }
.meta { margin: 0 0 16px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.lead { margin: 0 0 24px; font-size: 18px; line-height: 1.55; }
.page h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.25; font-weight: 700; }
/* :where() keeps this at zero specificity, so .brand, .crumbs, .meta and
   .lead keep their own margins. */
:where(.page) p { margin: 0 0 14px; }
.page section { margin-bottom: 32px; }
:where(.page) ul, :where(.page) ol { margin: 0 0 16px; padding-left: 22px; }
:where(.page) ol li { margin-bottom: 8px; }

.invite { padding: 18px; border-radius: 24px; background: var(--quiet); }
.invite h2 { margin: 0 0 6px; }
.invite p { font-size: 15px; line-height: 1.5; }
/* The invitation with its guide: she stands beside the words, on the button. */
.invite.has-char { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; align-items: end; }
.invite.has-char > * { grid-column: 1 / -1; }
.invite.has-char > h2, .invite.has-char > p { grid-column: 1; }
.invite.has-char > .invite-char { grid-column: 2; grid-row: 1 / span 2; height: 150px; margin-right: -6px; pointer-events: none; }
.invite-char > img { display: block; width: auto; height: 100%; } /* a still, when the character has no move here */
.invite.has-char > .btn { margin-top: 4px; }

.label { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lead); }

/* Experiment pages: a list of experiments, each with the same parts. */
.toc { list-style: none; margin: 0 0 32px; padding: 0; border-top: 2px solid var(--line); }
.toc li { margin: 0; border-bottom: 2px solid var(--line); }
.toc a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 0; color: var(--ink); font-weight: 600; text-decoration: none; line-height: 1.3; }
.toc a:hover { color: var(--lead); }
.toc .age { flex-shrink: 0; font-size: 14px; font-weight: 500; color: var(--ink-2); }

.exp { margin: 0 0 40px; padding-top: 8px; scroll-margin-top: 16px; }
.exp h2 { text-wrap: balance; }
.exp h3 { margin: 20px 0 8px; font-size: 18px; line-height: 1.3; font-weight: 700; }
.facts { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.care { padding: 12px 14px; border-radius: 14px; background: var(--yellow-soft); font-size: 16px; line-height: 1.5; }
.src { font-size: 14px; color: var(--ink-2); }
.exp .invite { margin: 20px 0 16px; }
.invite-title { margin: 0 0 6px; font-size: 20px; line-height: 1.25; font-weight: 700; }

.photo-todo { display: flex; align-items: center; justify-content: center; height: 180px; margin-bottom: 16px; padding: 16px; border: 2px dashed var(--ink-2); border-radius: 16px; background: #f1f3f8; text-align: center; font-size: 14px; font-weight: 600; color: var(--ink-2); }

.next-q { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border: 2px solid var(--ink); border-radius: 16px; color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.3; }

.foot { padding-top: 16px; border-top: 2px solid var(--line); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.foot p { margin: 0 0 8px; }
.foot .links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot .links a, .linklike { display: flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--lead); font-size: 14px; font-weight: 600; text-decoration: underline; }

/* ---------- Buttons ---------- */

.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: var(--tap); padding: 0 20px;
  border: 0; border-radius: 16px;
  font-size: 17px; font-weight: 700; text-decoration: none;
  touch-action: manipulation;
}
.btn-primary { background: var(--lead); color: #ffffff; box-shadow: 0 4px 0 var(--lead-edge); }
.btn-primary:hover { color: #ffffff; }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--lead-edge); }
.btn-primary[aria-disabled="true"] { background: var(--off); color: var(--off-ink); box-shadow: 0 4px 0 var(--off-edge); }

.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: var(--tap); padding: 16px 20px;
  border: 2px solid var(--line-2); border-radius: 16px; background: #ffffff;
  font-size: 20px; line-height: 1.3; text-align: left;
  touch-action: manipulation;
}
.opt[aria-pressed="true"] { padding: 15px 19px; border: 3px solid var(--ink); background: var(--yellow-soft); font-weight: 700; }
.opt .tick { display: none; flex-shrink: 0; }
.opt[aria-pressed="true"] .tick { display: block; }

.stack { display: grid; gap: 24px; } /* 24 px between things a child taps (BBC GEL: 22-24 px) */

.round {
  display: flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); padding: 0;
  border: 2px solid var(--ink); border-radius: 14px; background: #ffffff;
  box-shadow: 0 3px 0 var(--ink);
  touch-action: manipulation;
}
.round:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* ---------- Mission shell ---------- */

/* Child-sized controls inside a mission (docs/boat-mission-audit-2026-11-21.md, batch A):
   at least 13 mm, about 80 CSS px, on phones and tablets; parents' pages keep --tap from :root. */
.m { display: none; position: fixed; inset: 0; z-index: 10; background: var(--page); --tap: 80px; }
.m.is-open { display: flex; flex-direction: column; }
body.m-lock { overflow: hidden; }

/* The bar says where you are (the site's name), how to get out and how far along you are.
   Phones: exit, name and count on one row, the progress under them. Wider: one row. */
.m-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "exit brand count" "segs segs segs"; align-items: center; column-gap: 12px; row-gap: 8px; padding: 8px 20px 12px 12px; flex-shrink: 0; border-bottom: 1px solid var(--line); }
.m-exit { position: relative; grid-area: exit; display: inline-flex; align-items: center; gap: 6px; min-height: 60px; padding: 0 20px 0 14px; border: 2px solid var(--line-2); border-radius: 999px; background: #ffffff; color: var(--ink); font: inherit; font-size: 18px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.m-exit:hover { border-color: var(--ink); }
/* Its touch area runs into the screen's corner: a gap between a target and the edge nearly
   doubled children's misses (Anthony et al. 2013). The bar's padding is at most 12 px on top
   and 20 px on the left, and nothing else in the bar can be touched. */
.m-exit::before { content: ""; position: absolute; top: -14px; left: -22px; right: -8px; bottom: -8px; }
.m-brand { grid-area: brand; text-align: center; font-size: 14px; }
.m-segs { grid-area: segs; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 5px; }
.m-segs i { height: 10px; border-radius: 5px; background: var(--line); }
.m-segs i.on { background: var(--ink); }
.m-count { grid-area: count; margin: 0; min-width: 52px; text-align: right; font-size: 16px; font-weight: 500; color: var(--ink-2); }
@media (min-width: 768px) {
  .m-bar { grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "exit brand segs count"; column-gap: 20px; padding: 10px 24px 10px 16px; }
  .m-brand { text-align: left; }
  .m-segs { justify-self: center; width: 100%; max-width: 560px; }
}

.m-body { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 4px 20px 24px; }
.m-step {
  display: grid; min-height: 100%;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto 1fr auto;
  grid-template-areas: "head" "stage" "controls" "msg" "foot";
  gap: 14px;
}
/* A step with no stage gives back the stage's row, and the gap that came with it. */
.m-step.no-stage { grid-template-rows: auto auto 1fr auto; grid-template-areas: "head" "controls" "msg" "foot"; }
.m-step.is-guard { pointer-events: none; }
/* A new step appears in its final state; only the child's own changes animate. */
.m-step.is-still, .m-step.is-still * { transition: none !important; }

.m-head { grid-area: head; }
.m .label { font-size: 18px; letter-spacing: 0.08em; } /* nothing a child reads under 18 px */
.m .btn { font-size: 20px; }
.m-title { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 700; text-wrap: balance; }
.m-sub { margin: 6px 0 0; font-size: 18px; line-height: 1.4; color: var(--ink-2); }

.m-stage { grid-area: stage; align-self: start; padding: 16px 16px 14px; border-radius: 20px; background: var(--quiet); }
.m-controls { grid-area: controls; }
/* The main button stays pinned to the bottom of the screen, so the next thing to do is always
   in sight even when a step is taller than the phone (the kit: the action row 16 px above the
   bottom safe area). Only the button: the message stays in the flow, so it never covers what
   the child touches. A short fade says there is more above. */
.m-foot {
  grid-area: foot; align-self: end;
  position: sticky; bottom: 0; z-index: 1;
  margin: 0 -4px; padding: 10px 4px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--page);
}
.m-foot::before { content: ""; position: absolute; left: 0; right: 0; top: -20px; height: 20px; background: linear-gradient(to top, var(--page), rgba(255, 255, 255, 0)); pointer-events: none; }
.m-body { padding-bottom: 0; }
/* The main button keeps its place but only shows once there is something to do,
   instead of sitting there greyed out. */
.m .m-next { transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease), box-shadow var(--t-fast) var(--ease); }
.m .m-next[aria-disabled="true"] { visibility: hidden; opacity: 0; transform: translateY(8px); }

.m-msg { grid-area: msg; align-self: end; margin: 0; font-size: 20px; line-height: 1.4; color: var(--ink-2); }
.m-msg:empty { display: none; }
/* A hint comes with the guide's face: a round crop of her worried move. */
.hint-face { float: left; width: 60px; height: 60px; margin: 0 12px 2px 0; overflow: hidden; border-radius: 50%; background: var(--quiet); }
.hint-face .sprite { width: 97px; height: auto; margin: -20px 0 0 -18px; } /* zoomed and centred on her face: eyes, mouth and hands on her cheeks */
.hint-face .sprite img { width: 100%; height: auto; }
.m-msg.is-good {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border: 2px solid var(--ink); border-radius: 16px; background: var(--yellow); color: var(--ink);
}
.m-msg.is-good::before {
  content: ""; flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2312172b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12.5 3 3 5-6'/%3E%3C/svg%3E");
}

/* ---------- Tank ---------- */

.tank-wrap { position: relative; width: 100%; aspect-ratio: 302 / 176; }
.tank {
  position: absolute; left: 0; top: 0; width: 302px; height: 176px;
  transform-origin: 0 0; transform: scale(var(--k, 1));
  border: 3px solid var(--ink); border-top: 0; border-radius: 0 0 14px 14px;
  background: #ffffff; overflow: hidden;
  /* The clay morphs between ball, bowl and boat by animating its own width and height (the
     thing being taught). Containment keeps that relayout inside this fixed-size box. */
  contain: layout paint;
}
/* The water fills the tank and slides down to its level: a transform, so the
   level change never triggers layout. */
.tank .agua {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  border-top: 3px solid var(--lead); background: var(--water);
  transform: translateY(calc(100% - var(--water-h, 96px)));
  transition: transform 0.5s ease;
}
.tank .hull {
  position: absolute; left: 50%; bottom: var(--b, 5px);
  width: var(--w, 56px); height: var(--h, 56px); margin-left: calc(var(--w, 56px) / -2);
  display: flex; justify-content: center; align-items: flex-start;
  border: 3px solid var(--ink); border-top-width: var(--bt, 3px); border-radius: var(--r-out, 28px);
  background: var(--clay); transform: rotate(var(--rot, 0deg));
  transition: all 0.5s ease;
}
.tank .hollow {
  width: var(--iw, 0px); height: var(--ih, 0px);
  display: flex; align-items: flex-end; justify-content: center;
  border: 3px solid var(--ink); border-top: 0; border-radius: var(--r-in, 0px);
  background: var(--fill, #ffffff); opacity: var(--io, 0); overflow: hidden;
  transition: all 0.5s ease;
}
/* In a mission the result plays slowly enough to watch: the hull settles or sinks and the
   water moves over 1.2 s; a change of shape still morphs at the old speed. The front door's
   tank keeps 0.5 s. */
.m .tank .agua { transition: transform 1.2s ease; }
.m .tank .hull {
  transition: bottom 1.2s ease, transform 1.2s ease, width 0.5s ease, height 0.5s ease,
    margin-left 0.5s ease, border-radius 0.5s ease, border-width 0.5s ease;
}
.m .tank .hollow {
  transition: background-color 1.2s ease, width 0.5s ease, height 0.5s ease, border-radius 0.5s ease, opacity 0.5s ease;
}
.tank .pesas { padding: 0 0 4px; font-size: 0; line-height: 0; text-align: center; }
.tank .pesa { display: inline-block; width: 15px; height: 14px; margin: 3px 1.5px 0; border-radius: 3px; background: var(--ink); }
.tank .ghost {
  position: absolute; right: 32px; bottom: 60px; width: 128px; height: 50px;
  border: 3px dashed var(--ink); border-top: 0; border-radius: 6px 6px 50px 50px;
}
.tank .ask { position: absolute; right: 32px; bottom: 113px; width: 128px; margin: 0; text-align: center; font-size: 22px; font-weight: 700; line-height: 1; }

.bars { display: grid; gap: 8px; margin-top: 16px; }
.bar { display: flex; align-items: center; gap: 10px; }
.bar .name { margin: 0; width: 118px; flex-shrink: 0; font-size: 13px; line-height: 1.2; }
.bar .track { flex: 1 1 0; height: 14px; border-radius: 7px; background: #ffffff; overflow: hidden; }
/* Full-width fill slid left inside the clipped track: same look as a growing
   width, without layout. */
.bar .fill { width: 100%; height: 100%; border-radius: 7px; background: var(--ink); transform: translateX(calc(var(--v, 0%) - 100%)); transition: transform 0.4s ease; }
.bar .fill.is-water { background: var(--lead); }
.bar .num { margin: 0; width: 52px; flex-shrink: 0; text-align: right; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m .bar .name { width: 128px; font-size: 18px; line-height: 1.15; }
.m .bar .num { width: 64px; font-size: 18px; }
/* Phones: a step must fit above the pinned button without scrolling (the kit: one step per
   screen), so the tank gives up a little width; on short phones (an iPhone SE is 667 px) more. */
@media (max-width: 999px) {
  .m-step { gap: 12px; }
  .m .tank-wrap { width: 86%; margin-inline: auto; }
  .m .bars { margin-top: 12px; }
}
@media (max-width: 999px) and (max-height: 700px) {
  .m .tank-wrap { width: 58%; }
  .m-head .label { display: none; } /* the title says what to do; the bar says how far along */
  .m-title { font-size: 22px; }
  .m-msg, .m .bubble { font-size: 18px; }
  .m-msg.is-good { padding: 10px 12px; }
  .m .rule .big { font-size: 20px; }
  .m .say-char { height: 104px; }
  .m .bubble { margin-bottom: 8px; }
  .m .shape { height: 84px; }
}
/* Phones: at 18 px the name doesn't fit beside the track ("El agua aguanta" least of all),
   so the name and number sit on a line above a full-width track. */
@media (max-width: 999px) {
  .m .bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name num" "track track"; row-gap: 6px; column-gap: 10px; }
  .m .bar .name { grid-area: name; width: auto; }
  .m .bar .num { grid-area: num; width: auto; }
  .m .bar .track { grid-area: track; flex: none; }
}

.shapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.shape {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px;
  height: 92px; padding: 10px 4px;
  border: 2px solid var(--line-2); border-radius: 16px; background: #ffffff; font-size: 18px;
  touch-action: manipulation;
}
.shape[aria-pressed="true"] { border: 3px solid var(--ink); background: var(--yellow-soft); font-weight: 700; }
.shape .ico { background: var(--clay); }
.shape .ico.bola { width: 20px; height: 20px; border-radius: 50%; }
.shape .ico.cuenco, .shape .ico.barco { height: 18px; background: none; border: 5px solid var(--clay); border-top: 0; }
.shape .ico.cuenco { width: 34px; border-radius: 2px 2px 17px 17px; }
.shape .ico.barco { width: 52px; border-radius: 2px 2px 10px 10px; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 24px; }
.stepper .val { margin: 0; min-width: 116px; text-align: center; font-size: 22px; font-weight: 700; }

/* Step 4, one case at a time (batch B): which case, its name and two bars on the stage, then
   Floats or Sinks, each with a small picture of the outcome. */
.case-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.case-of { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink-2); }
.case-name { margin: 2px 0 0; font-size: 22px; line-height: 1.25; font-weight: 700; }
/* Marks after a check: ink words with an icon, never red and never colour alone.
   "Right" gets a yellow tick; "Look again" an eye, in the same ink as everything else. */
.mark { display: inline-flex; align-items: center; gap: 6px; margin: 0; flex-shrink: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.mark:empty { display: none; }
.mark::before { content: ""; flex-shrink: 0; width: 24px; height: 24px; background: no-repeat center / contain; }
.mark.ok::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%23ffcb1f' stroke='%2312172b' stroke-width='2'/%3E%3Cpath d='m7.5 12.5 3 3 6-6.5' fill='none' stroke='%2312172b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.mark.bad::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2312172b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.pick { display: flex; align-items: center; justify-content: center; gap: 10px; height: var(--tap); padding: 0 10px; border: 2px solid var(--line-2); border-radius: 16px; background: #ffffff; font-size: 20px; touch-action: manipulation; }
.pick .pic { width: 48px; height: auto; flex-shrink: 0; }
.pick span { white-space: nowrap; } /* "Se hunde" stays on one line */
@media (max-width: 999px) { .pick { gap: 6px; padding: 0 8px; } .pick .pic { width: 38px; } }
.pick[aria-pressed="true"] { border: 3px solid var(--ink); background: var(--yellow-soft); font-weight: 700; }

/* Step 1: three pictured predictions in a row. */
.preds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pred {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
  min-height: var(--tap); padding: 10px 6px 12px;
  border: 2px solid var(--line-2); border-radius: 16px; background: #ffffff;
  font-size: 18px; line-height: 1.2; text-align: center; text-wrap: balance;
  touch-action: manipulation;
}
.pred .pic { width: 100%; max-width: 92px; height: auto; }
.pred[aria-pressed="true"] { padding: 9px 5px 11px; border: 3px solid var(--ink); background: var(--yellow-soft); font-weight: 700; }

.card { padding: 14px 16px; border: 2px solid var(--line); border-radius: 16px; }
.card p { margin: 0 0 4px; }
.card .big { font-size: 17px; font-weight: 700; }
.card .small { font-size: 15px; line-height: 1.4; color: var(--ink-2); }
.m .card .big { font-size: 20px; }
.m .card .small { font-size: 18px; }

/* ---------- Tablet and wider: the thing you touch on the left ---------- */

@media (min-width: 1000px) and (min-height: 600px) {
  :root { --tap: 64px; }
  .m-bar { padding: 12px 32px 12px 20px; }
  .m-body { padding: 8px 32px 28px; }
  .m-step {
    grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr);
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas: "stage head" "stage controls" "stage msg" "stage foot";
    column-gap: 32px; row-gap: 20px;
    max-width: 1320px; margin-inline: auto; /* a 2000 px screen gets a centred mission, not a stretched one */
  }
  .m-stage { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 40px 48px; border-radius: 28px; }
  .m-step.no-stage { grid-template-columns: minmax(0, 640px); grid-template-rows: auto auto 1fr auto; justify-content: center; grid-template-areas: "head" "controls" "msg" "foot"; }
  .m-title { font-size: 30px; line-height: 1.2; }
  .m-sub { font-size: 20px; }
  .m-msg { font-size: 22px; }
  .bars { gap: 14px; margin-top: 32px; }
  .bar .name { width: 170px; font-size: 17px; }
  .bar .track { height: 22px; border-radius: 11px; }
  .bar .fill { border-radius: 11px; }
  .bar .num { width: 76px; font-size: 20px; }
  .m .bar .name { width: 170px; }
  .m .bar .num { width: 76px; font-size: 20px; }
  .shape { height: 104px; gap: 10px; font-size: 20px; border-radius: 18px; }
  .opt { font-size: 22px; }
  .btn { font-size: 20px; border-radius: 20px; }
}

/* Parents print experiment pages: drop the links and buttons, keep the steps. */
@media print {
  .top a, .foot .links, .invite .btn, .next-q svg { display: none; }
  .care { border: 1px solid var(--ink); background: none; }
  .exp { break-inside: avoid-page; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Type roles from the design system ---------- */

.brand { font-family: var(--font-display); font-size: 16px; letter-spacing: 0.04em; }
/* Unbounded is wide. On a phone the brand and the header link share one line
   only if both step down a size; on anything narrower still, the link wraps
   under the brand instead of running into it. */
.top { flex-wrap: wrap; gap: 0 16px; }
@media (max-width: 419px) {
  .brand, .top a { font-size: 14px; }
  .top .top-link { padding: 0 12px; font-size: 14px; }
}
.label { font-family: var(--font-display); letter-spacing: 0.1em; line-height: 1.3; text-wrap: balance; } /* a long label breaks into even lines, never one stray word */
.bar .num { font-family: var(--font-display); font-weight: 600; }

/* ---------- Home ---------- */

.sci-engineering { --sci: #ff6b2c; --sci-edge: #c75322; }
.sci-chemistry { --sci: #ff5c8a; --sci-edge: #c7486c; }
.sci-physics { --sci: #8f6bff; --sci-edge: #7053c7; }
.sci-biology { --sci: #22b565; --sci-edge: #1b8d4f; }
.sci-earth { --sci: #ffcb1f; --sci-edge: #c79e18; }
.sci-space { --sci: #0e1330; --sci-edge: #0b0f25; }

.home-lead { margin: 0 0 20px; font-size: 16px; color: var(--ink-2); }

.hero { position: relative; overflow: hidden; margin: 0 0 28px; padding: 20px; border-radius: 24px; background: var(--lead); color: #ffffff; }
/* The guide stands on the card's bottom edge, clear of the words. */
.hero h2, .hero .meta2 { position: relative; max-width: 60%; }
.hero .segs, .hero .btn { position: relative; }
/* The character is as tall as the card, but never wider than 79% of it: when
   the title wraps (a narrow phone, large text) the card grows taller, and a
   figure sized by height alone would grow over the title. */
.hero-char { position: absolute; right: 6px; bottom: 0; height: 100%; max-width: 79%; pointer-events: none; }
/* A character's move: a still frame shows first; once the sprite sheet has
   loaded, the element shows the sheet behind it and the still steps aside.
   The element takes its size from the still, so the sheet's frames fit it. */
.sprite { display: block; width: fit-content; background-repeat: no-repeat; } /* as wide as its still, so the sheet's frames are never stretched */
.sprite img { display: block; width: auto; height: 100%; max-width: 100%; object-fit: contain; object-position: 50% 100%; }
.sprite.is-playing img { visibility: hidden; }
/* No room for the title and the character side by side: the title wins. */
@media (max-width: 349px) {
  .hero-char { display: none; }
  .hero h2, .hero .meta2 { max-width: none; }
}
.hero h2 { margin: 0 0 8px; font-size: 26px; line-height: 1.2; text-wrap: balance; }
.hero .meta2 { margin: 0 0 14px; font-size: 15px; font-weight: 500; }
.hero .segs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; width: 150px; margin: 0 0 20px; }
.hero .segs i { height: 8px; border-radius: 4px; background: var(--lead-edge); transition: background-color var(--t-mid) var(--ease); }
.hero .segs i.on { background: var(--yellow); }
.btn-sun { display: inline-flex; width: auto; min-width: 168px; background: var(--yellow); color: var(--ink); box-shadow: 0 4px 0 #c79e18; }
.btn-sun:hover { color: var(--ink); }
.btn-sun:active { transform: translateY(2px); box-shadow: 0 2px 0 #c79e18; }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.sec-head h2 { margin: 0; font-size: 20px; }
.sec-head p { margin: 0; font-size: 14px; font-weight: 500; color: var(--ink-2); }

/* Earned things are raised on an edge in a darker shade of their own colour: never a ring. */
.badges { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 28px; padding: 0; list-style: none; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 64px; margin: 0; font-size: 13px; line-height: 1.2; text-align: center; }
.disc { display: flex; align-items: center; justify-content: center; width: 50px; height: 50px; flex-shrink: 0; border-radius: 50%; background: var(--sci, var(--clay)); box-shadow: 0 4px 0 var(--sci-edge, #c75322); color: var(--ink); }
.badge.is-empty { color: var(--ink-2); }
.badge.is-empty .disc { border: 2px dashed var(--line-2); background: none; box-shadow: none; color: var(--ink-2); font-weight: 700; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(158px, 100%), 1fr)); gap: 12px; margin: 0 0 28px; }
.tile { display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: 20px; overflow: hidden; background: #ffffff; color: var(--ink); text-decoration: none; box-shadow: 0 4px 0 var(--line); }
.tile:hover { color: var(--ink); transform: translateY(-2px); box-shadow: 0 6px 0 var(--line); }
.tile:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }
.tile.is-current { border-color: var(--lead); box-shadow: 0 5px 0 var(--lead-edge); }
.tile.is-current:hover { box-shadow: 0 7px 0 var(--lead-edge); }
.tile.is-current:active { box-shadow: 0 2px 0 var(--lead-edge); }
.tile .cover { display: flex; align-items: center; justify-content: center; height: 84px; background: var(--sci, var(--clay)); color: var(--ink); }
.tile .body { display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 14px; }
.tile .q { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.tile .meta2 { margin: 0; font-size: 13px; color: var(--ink-2); }
.tile .state { margin: 0; font-size: 13px; font-weight: 700; color: var(--lead); }
.tile .state:empty { display: none; }

/* The end of a mission */
.rule { padding: 14px 16px; border-radius: 16px; background: var(--quiet); }
.rule p { margin: 0; }
.rule .label { margin: 0 0 4px; color: var(--ink-2); }
.rule .big { font-size: 22px; line-height: 1.3; font-weight: 700; }
.earned { display: flex; align-items: center; gap: 14px; }
.earned p { margin: 0; }
.earned .big { font-size: 20px; font-weight: 700; line-height: 1.3; }
.earned .small { font-size: 18px; color: var(--ink-2); }
/* The idea's reveal at the end of a mission (the kit: a short pause, the badge grows past its
   size and settles, a small burst; under 2 s, never random). After the step's own 350 ms touch
   guard: 400 ms, then 600 ms of growing, then the burst and the words. */
.m .earned .disc { position: relative; width: 60px; height: 60px; animation: sn-badge 600ms var(--ease) 400ms both; }
.m .earned .disc::after {
  content: ""; position: absolute; inset: -4px; border: 3px solid var(--yellow); border-radius: 50%;
  opacity: 0; animation: sn-burst 600ms ease-out 900ms both; pointer-events: none;
}
.m .earned > div { animation: sn-fade var(--t-mid) var(--ease) 900ms both; }
@keyframes sn-badge { 0% { transform: scale(0); } 65% { transform: scale(1.18); } 85% { transform: scale(0.95); } 100% { transform: scale(1); } }
@keyframes sn-burst { from { opacity: 1; transform: scale(0.8); } to { opacity: 0; transform: scale(1.7); } }
/* The end screen has nothing to tap but its button, so its blocks sit closer together. */
.m-step.no-stage .stack { gap: 16px; }
/* The guide speaks: a still figure and what she says. */
.say { display: flex; align-items: flex-end; gap: 2px; }
.say-char { height: 140px; flex-shrink: 0; margin: 0 4px 0 0; }
.bubble { margin: 0 0 20px; padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--quiet); font-size: 20px; line-height: 1.35; }

@media (min-width: 1000px) {
  .page.is-home { max-width: 1120px; padding: 16px 32px 48px; }
  .home-grid { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 32px; align-items: start; }
  .hero { padding: 28px; border-radius: 28px; }
  .hero h2 { font-size: 30px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
  .tile .cover { height: 120px; }
  .tile .q { font-size: 17px; }
}

/* ---------- Motion: smooth and subtle ----------
   Colour and press feedback are fast, things that appear rise a few pixels
   while they fade in, and only what the child changes moves on the stage. */

html { scroll-behavior: smooth; }

a, .btn, .opt, .shape, .round, .pick, .pred, .tile, .next-q, .toc a, .linklike {
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.opt:active, .shape:active, .pick:active, .pred:active { transform: scale(0.98); }
.next-q:hover { transform: translateX(2px); }
.m-segs i { transition: background-color var(--t-mid) var(--ease); }

@keyframes sn-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sn-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes sn-fade { from { opacity: 0; } to { opacity: 1; } }

/* The mission fades and rises in, and fades out, instead of snapping. */
.m {
  display: flex; flex-direction: column;
  visibility: hidden; opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease), visibility 0s linear var(--t-mid);
}
.m.is-open {
  visibility: visible; opacity: 1; transform: none; pointer-events: auto;
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
.m-step { animation: sn-rise var(--t-mid) var(--ease) both; }      /* each new step */
.m-msg > span { display: block; animation: sn-fade var(--t-mid) var(--ease) both; }
.m-msg.is-good { animation: sn-pop var(--t-mid) var(--ease) both; } /* the discovery */
.mark { animation: sn-fade var(--t-mid) var(--ease) both; }
/* The page itself never fades in: what a parent or a search engine came to read is there at once. */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
