/* site.css — Ready Set Know
   Dark-first and cinematic: deep space background, glass panels, the three start lights (ready, set,
   know) as the brand mark. Light theme and reading settings are driven by data-attributes on <html>,
   set by site.js and stored in localStorage (never cookies). No external requests: system fonts only.
   The simulation engine (core.js Lab.theme) reads --stage-bg, --ink*, --line, --accent*, --warn, --ok. */

/* ---------- Tokens ---------- */
:root {
  --bg: #05070D;
  --bg-2: #0A0E19;
  --panel: #0C111F;
  --panel-2: #111829;
  --glass: rgba(255, 255, 255, .035);
  --glass-2: rgba(255, 255, 255, .065);
  --glass-3: rgba(255, 255, 255, .1);
  --border: rgba(255, 255, 255, .08);
  --border-2: rgba(255, 255, 255, .15);
  --ink: #EEF2FF;
  --ink-2: #B9C2DA;
  --ink-3: #8690AD;
  --line: #1C2338;
  --line-strong: #2A3350;
  --link: #8CC8FF;

  --red: #FF5A5F;
  --amber: #FFC247;
  --go: #34F5A4;
  --go-ink: #04140D;
  --go-text: #34F5A4;
  --amber-text: #FFC247;
  --violet: #9B87FF;
  --grad: linear-gradient(100deg, #FF5A5F 0%, #FFC247 45%, #34F5A4 100%);
  --grad-cool: linear-gradient(120deg, #34F5A4, #4DA3FF 55%, #9B87FF);

  /* simulation engine colours (core.js) */
  --stage-bg: #070B16;
  --accent: #6CB4FF;
  --accent-ink: #04101F;
  --accent-soft: #12233D;
  --warn: #FF8A65;
  --warn-soft: rgba(255, 138, 101, .1);
  --ok: #34F5A4;
  --ok-soft: rgba(52, 245, 164, .09);
  --ks3: #3BC9DB;
  --ks4: #B197FC;

  /* topic hues */
  --t41: #FF9F45; --t42: #FFD23F; --t43: #2EE6C5; --t44: #B18CFF; --t45: #5BF08A; --t46: #4DA3FF; --t47: #FF5C8A; --t48: #8FB3FF;
  --band-foundation: #5BF08A; --band-crossover: #6CB4FF; --band-higher: #B18CFF; --band-stretch: #FFC247;
  --m-none: #1C2338; --m-read: #2F5A94; --m-practised: #6CB4FF; --m-secure: #34F5A4;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "SF Pro Display", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --font-size: 17px;
  --leading: 1.65;

  --r-xl: 28px;
  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --pill: 999px;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
  --header-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 50px -24px rgba(0, 0, 0, .8);
  --glow-go: 0 0 0 1px rgba(52, 245, 164, .35), 0 10px 40px -10px rgba(52, 245, 164, .45);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F3F5FA;
  --bg-2: #FFFFFF;
  --panel: #FFFFFF;
  --panel-2: #F6F8FC;
  --glass: rgba(12, 20, 40, .025);
  --glass-2: rgba(12, 20, 40, .05);
  --glass-3: rgba(12, 20, 40, .08);
  --border: rgba(12, 20, 40, .09);
  --border-2: rgba(12, 20, 40, .17);
  --ink: #0A1020;
  --ink-2: #3A4560;
  --ink-3: #5A6480;
  --line: #DCE2EE;
  --line-strong: #C3CCDD;
  --link: #1F5FD6;
  --go: #0B8550;
  --go-ink: #FFFFFF;
  --amber: #C98A00;
  /* darker text versions: small text needs 4.5:1 on every light tint */
  --go-text: #087345;
  --amber-text: #8A5A00;
  --red: #D63A40;
  --grad: linear-gradient(100deg, #E5484D 0%, #E0A100 45%, #0E9F63 100%);
  --stage-bg: #FFFFFF;
  --accent: #1F5FD6;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3ECFD;
  --warn: #A8431A;
  --warn-soft: #FDEEE4;
  --ok: #0B7A4B;
  --ok-soft: #E3F7EC;
  --ks3: #0B7285;
  --ks4: #5F3DC4;
  /* topic colours are used for small text (kickers, codes): each is at least 4.6:1 on every light tint (29 Nov 2026) */
  --t41: #A84F12; --t42: #866500; --t43: #0F776A; --t44: #6B42B8; --t45: #207844; --t46: #1D69C5; --t47: #C0325A; --t48: #3E5F8F;
  --band-foundation: #207844; --band-crossover: #1F5FD6; --band-higher: #6B42B8; --band-stretch: #8F5A00;
  --m-none: #DCE2EE; --m-read: #9CC3F0; --m-practised: #3B7BD0; --m-secure: #0E9F63;
  --shadow: 0 1px 2px rgba(12, 20, 40, .05), 0 18px 40px -22px rgba(12, 20, 40, .3);
  --glow-go: 0 10px 30px -12px rgba(14, 159, 99, .55);
  color-scheme: light;
}

/* Reading settings */
:root[data-font="dyslexia"] { --font: "OpenDyslexic", "Comic Sans MS", Verdana, Arial, sans-serif; --display: var(--font); letter-spacing: .02em; word-spacing: .1em; }
:root[data-font="plain"] { --font: Verdana, Arial, sans-serif; --display: var(--font); }
:root[data-size="s"] { --font-size: 15px; }
:root[data-size="l"] { --font-size: 19px; }
:root[data-size="xl"] { --font-size: 22px; }
:root[data-spacing="wide"] { --leading: 1.95; }
:root[data-tint="cream"] { --bg: #14110A; --panel: #1A160D; --stage-bg: #16130B; }
:root[data-tint="blue"] { --bg: #06101E; --panel: #0B1830; --stage-bg: #0A1528; }
:root[data-tint="lilac"] { --bg: #0E0A18; --panel: #160F26; --stage-bg: #130D22; }
:root[data-tint="grey"] { --bg: #0E1012; --panel: #16191C; --stage-bg: #131619; }
:root[data-theme="light"][data-tint="cream"] { --bg: #FBF5E6; --panel: #FFFBF0; --panel-2: #F5EDD8; --stage-bg: #FFFBF0; }
:root[data-theme="light"][data-tint="blue"] { --bg: #EAF2FA; --panel: #F5F9FD; --panel-2: #E1ECF6; --stage-bg: #F5F9FD; }
:root[data-theme="light"][data-tint="lilac"] { --bg: #F1ECF8; --panel: #FAF8FD; --panel-2: #E9E2F3; --stage-bg: #FAF8FD; }
:root[data-theme="light"][data-tint="grey"] { --bg: #ECEEED; --panel: #F6F7F6; --panel-2: #E3E6E4; --stage-bg: #F6F7F6; }

@supports (interpolate-size: allow-keywords) { :root { interpolate-size: allow-keywords; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--font-size); scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--font); line-height: var(--leading);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 85% -10%, rgba(77, 163, 255, .09), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(155, 135, 255, .07), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(52, 245, 164, .05), transparent 60%);
  background-attachment: fixed;
}
:root[data-theme="light"] body { background-image: radial-gradient(1100px 600px at 85% -10%, rgba(31, 95, 214, .07), transparent 60%), radial-gradient(900px 500px at -10% 10%, rgba(107, 66, 184, .05), transparent 60%); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.08; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.03em; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 1.2rem + 3.6vw, 4rem); }
h2 { font-size: clamp(1.6rem, 1.15rem + 1.6vw, 2.4rem); }
h3 { font-size: 1.22rem; letter-spacing: -.015em; }
h4 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--go); outline-offset: 3px; border-radius: 6px; }
img, svg, video, canvas { max-width: 100%; display: block; }
ul, ol { padding-left: 1.3em; }
li + li { margin-top: .3em; }
small, .small { font-size: .875rem; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
code { font-family: var(--mono); font-size: .92em; background: var(--glass-2); padding: .08em .4em; border-radius: 6px; }
sub, sup { line-height: 0; }
table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: .95rem; }
th, td { text-align: left; padding: .6em .75em; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 700; color: var(--ink-2); font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; }
dl { margin: 0 0 1em; } dt { font-weight: 700; } dd { margin: 0 0 .6em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--go); color: var(--go-ink); padding: 10px 16px; border-radius: var(--pill); z-index: 300; font-weight: 700; }
.skip-link:focus { top: 8px; }
::selection { background: rgba(52, 245, 164, .3); color: var(--ink); }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.wrap.wide { width: min(100% - 2 * var(--gutter), 1380px); }
.wrap.narrow { width: min(100% - 2 * var(--gutter), 760px); }
.wrap.read { width: min(100% - 2 * var(--gutter), 800px); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 18px; }
.eyebrow { font-family: var(--mono); font-size: .74rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--go-text); margin-bottom: .8em; }
.lead { font-size: clamp(1.05rem, .95rem + .45vw, 1.28rem); color: var(--ink-2); max-width: 60ch; line-height: 1.6; }

/* ---------- Brand: the three start lights ---------- */
.lights { display: inline-flex; gap: 4px; align-items: center; flex: none; }
.lights i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); }
.lights i:nth-child(2) { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.lights i:nth-child(3) { background: var(--go); box-shadow: 0 0 10px var(--go); }
.js .site-header .lights i { animation: light-on .5s var(--ease) both; }
.js .site-header .lights i:nth-child(2) { animation-delay: .25s; }
.js .site-header .lights i:nth-child(3) { animation-delay: .5s; }
@keyframes light-on { from { opacity: .15; box-shadow: none; transform: scale(.7); } to { opacity: 1; transform: none; } }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: none; }
.wordmark { font-family: var(--display); font-size: 1.22rem; font-weight: 800; letter-spacing: -.035em; line-height: 1; white-space: nowrap; }
.wordmark .w2 { color: var(--ink-2); }
.wordmark .w3 { background: var(--grad-cool); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .wordmark .w3 { background: none; color: var(--go-text); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-bottom: 1px solid var(--border); }
@supports not (background: color-mix(in srgb, red 50%, blue)) { .site-header { background: var(--bg); } }
.header-row { display: flex; align-items: center; gap: 14px; min-height: var(--header-h); }
.nav { display: flex; gap: 2px; margin-left: 10px; }
.nav a { padding: 7px 14px; border-radius: var(--pill); font-weight: 600; font-size: .93rem; text-decoration: none; color: var(--ink-2); white-space: nowrap; transition: color .2s, background .2s; }
.nav a:hover { color: var(--ink); background: var(--glass-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--border); }
.header-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--border); background: var(--glass); color: var(--ink-2); text-decoration: none; transition: color .2s, background .2s, border-color .2s; }
.icon-btn:hover { color: var(--ink); background: var(--glass-2); border-color: var(--border-2); }
.icon-btn strong { font-size: .95rem; }
@media (max-width: 560px) {
  .wordmark { font-size: 1.05rem; }
  .brand { gap: 9px; }
  .nav { margin-left: 0; }
  .nav a { padding: 6px 10px; font-size: .88rem; }
  .header-row { gap: 6px; }
  .icon-btn { width: 36px; height: 36px; }
}
/* Phones: the three nav links drop to a second row so the header never runs wider than the screen
   (it was 430 px wide on a 390 px phone, pushing the Aa settings button off-screen, and still overflowed up to about 620 px). The row height grows,
   so --header-h follows it for the scroll offsets; the landscape rule further down still sets it to 0. */
@media (max-width: 640px) {
  :root { --header-h: 88px; }
  .header-row { flex-wrap: wrap; row-gap: 2px; min-height: 0; padding-block: 8px 4px; }
  .nav { order: 3; flex: 1 0 100%; margin-left: -10px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 420px) { .header-actions [data-act="theme"] { display: none; } }
@media (max-width: 360px) { .brand .wordmark .w2, .brand .wordmark .w1 { display: none; } }

/* reading progress rail (lesson pages): pure CSS where scroll timelines exist, site.js otherwise */
.rail { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; pointer-events: none; }
.rail i { display: block; height: 100%; width: 100%; background: var(--grad); transform-origin: 0 50%; transform: scaleX(var(--progress, 0)); box-shadow: 0 0 12px rgba(52, 245, 164, .6); }
@supports (animation-timeline: scroll()) {
  .rail i { animation: rail linear both; animation-timeline: scroll(root); }
  @keyframes rail { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 80px; background: linear-gradient(180deg, transparent, var(--bg-2)); }
.foot { display: grid; gap: 22px 40px; grid-template-columns: 1fr auto; padding: 44px 0 34px; align-items: start; }
.foot-brand p { margin: 12px 0 0; color: var(--ink-3); font-size: .92rem; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: flex-end; }
.foot-nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .93rem; }
.foot-nav a:hover { color: var(--ink); }
.foot-small { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .84rem; color: var(--ink-3); }
.foot-small a { color: var(--ink-2); }
@media (max-width: 700px) { .foot { grid-template-columns: 1fr; } .foot-nav { justify-content: flex-start; } }

/* ---------- Buttons and tags ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px; border-radius: var(--pill); border: 1px solid var(--border-2); font-weight: 700; font-size: .98rem; text-decoration: none; cursor: pointer; background: var(--glass-2); color: var(--ink); transition: transform .18s var(--ease), background .2s, box-shadow .25s, border-color .2s, opacity .2s; white-space: nowrap; letter-spacing: -.005em; }
.btn:hover { background: var(--glass-3); border-color: var(--border-2); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-go, .btn-primary { background: var(--grad); color: #05070D; border-color: transparent; box-shadow: var(--glow-go); }
.btn-go:hover, .btn-primary:hover { background: var(--grad); filter: brightness(1.08); transform: translateY(-1px); }
:root[data-theme="light"] .btn-go, :root[data-theme="light"] .btn-primary { background: var(--go); color: #fff; }
.btn-glass { background: var(--glass); border-color: var(--border-2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn-ghost { background: transparent; border-color: var(--border-2); }
.btn-ghost:hover { background: var(--glass-2); }
.btn-accent { background: var(--amber); color: #1A1200; border-color: transparent; }
.btn-light { background: var(--glass-2); }
.btn-sm { min-height: 38px; padding: 6px 16px; font-size: .9rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.link-btn { border: 0; background: none; color: var(--link); text-decoration: underline; text-underline-offset: 3px; padding: 0; font: inherit; font-size: .88rem; cursor: pointer; min-height: 24px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag, .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: var(--pill); font-size: .76rem; font-weight: 700; letter-spacing: .02em; background: var(--glass-2); color: var(--ink-2); border: 1px solid var(--border); line-height: 1.6; white-space: nowrap; }
.tag-ht { color: #CDBBFF; border-color: rgba(177, 140, 255, .35); background: rgba(177, 140, 255, .1); }
.tag-sep { color: #A8D4FF; border-color: rgba(77, 163, 255, .35); background: rgba(77, 163, 255, .1); }
.tag-rp { color: #FFD98A; border-color: rgba(255, 194, 71, .35); background: rgba(255, 194, 71, .08); }
.tag-learn { color: var(--go-text); border-color: rgba(52, 245, 164, .35); background: rgba(52, 245, 164, .08); }
.tag-beyond { color: var(--ink-2); border-style: dashed; border-color: var(--border-2); background: transparent; }
:root[data-theme="light"] .tag-ht { color: #5B33A8; } :root[data-theme="light"] .tag-sep { color: #1B5BB0; } :root[data-theme="light"] .tag-rp { color: #8A5A00; } :root[data-theme="light"] .tag-learn { color: var(--go-text); }
.band { display: inline-block; padding: 2px 9px; border-radius: var(--pill); font-family: var(--mono); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bg); }
.band-foundation { background: var(--band-foundation); } .band-crossover { background: var(--band-crossover); } .band-higher { background: var(--band-higher); } .band-stretch { background: var(--band-stretch); }
:root[data-theme="light"] .band { color: #fff; }
.t41 { --tc: var(--t41); } .t42 { --tc: var(--t42); } .t43 { --tc: var(--t43); } .t44 { --tc: var(--t44); } .t45 { --tc: var(--t45); } .t46 { --tc: var(--t46); } .t47 { --tc: var(--t47); } .t48 { --tc: var(--t48); }

.kicker { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: var(--mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 18px; }
.kdot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc, var(--go)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc, var(--go)) 22%, transparent), 0 0 16px var(--tc, var(--go)); }
.kcode { padding: 2px 9px; border-radius: var(--pill); border: 1px solid var(--border-2); color: var(--ink); letter-spacing: .06em; }
.cue-arrow { display: inline-block; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-left: 8px; translate: 0 -3px; }
.js .cue-arrow { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { translate: 0 -4px; } 50% { translate: 0 2px; } }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Home hero ---------- */
.home-hero { position: relative; min-height: calc(100svh - var(--header-h)); display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 6vw, 80px) 0 30px; overflow: hidden; isolation: isolate; }
.aurora { position: absolute; inset: -20% -10% 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 50% at 18% 30%, rgba(255, 90, 95, .16), transparent 70%),
    radial-gradient(35% 45% at 45% 15%, rgba(255, 194, 71, .12), transparent 70%),
    radial-gradient(45% 55% at 80% 40%, rgba(52, 245, 164, .14), transparent 70%),
    radial-gradient(50% 60% at 70% 90%, rgba(77, 163, 255, .14), transparent 70%);
  filter: blur(10px); mask-image: linear-gradient(#000 60%, transparent); -webkit-mask-image: linear-gradient(#000 60%, transparent); }
.js .aurora { animation: drift 22s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate3d(-2%, 0, 0) scale(1); } to { transform: translate3d(2%, -3%, 0) scale(1.08); } }
.home-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(70% 60% at 50% 40%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 20%, transparent 75%); opacity: .55; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(28px, 4vw, 64px); align-items: center; }
@media (max-width: 1000px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.h-mega { font-size: clamp(3.2rem, 1.4rem + 7vw, 7.2rem); line-height: .92; letter-spacing: -.055em; margin: 0 0 28px; display: flex; flex-wrap: wrap; gap: 0 .22em; }
.h-mega span { display: inline-block; }
.h-mega span:nth-child(1) { color: var(--ink); }
.h-mega span:nth-child(2) { color: var(--ink-2); }
.h-mega span:nth-child(3) { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .06em; }
:root[data-theme="light"] .h-mega span:nth-child(3) { background: linear-gradient(100deg, #0E9F63, #1F5FD6); -webkit-background-clip: text; background-clip: text; }
.js .h-mega span { animation: rise .9s var(--ease) both; }
.js .h-mega span:nth-child(2) { animation-delay: .18s; }
.js .h-mega span:nth-child(3) { animation-delay: .36s; }
.h-mega .h-beta { flex-basis: 100%; margin-top: 14px; font-size: clamp(1rem, .8rem + 1vw, 1.4rem); letter-spacing: .02em; line-height: 1.2; color: var(--ink-2); font-family: var(--mono); text-transform: uppercase; }
.js .h-mega .h-beta { animation-delay: .54s; }
.beta-note { margin: 0 0 22px; padding: 14px 18px; border-radius: var(--r); border: 1px solid var(--accent); background: var(--glass); color: var(--ink); font-size: 1rem; }
.beta-note strong { color: var(--accent); }
.js .home-hero .lead, .js .hero-cta, .js .hero-stats { animation: rise .9s var(--ease) both .55s; }
.js .hero-visual { animation: rise 1.1s var(--ease) both .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-stats { list-style: none; padding: 0; margin: 38px 0 0; display: flex; flex-wrap: wrap; gap: 14px 34px; }
.hero-stats li { margin: 0; display: flex; flex-direction: column; font-size: .84rem; color: var(--ink-3); font-weight: 600; }
.hero-stats b { font-family: var(--display); font-size: 2rem; letter-spacing: -.04em; color: var(--ink); line-height: 1.05; font-variant-numeric: tabular-nums; }
.console { position: relative; border-radius: var(--r-xl); padding: 1px; background: linear-gradient(140deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .04) 40%, rgba(52, 245, 164, .3)); box-shadow: 0 40px 120px -40px rgba(52, 245, 164, .35), 0 30px 80px -30px rgba(0, 0, 0, .9); }
.console > * { border-radius: 0; }
.console-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border-radius: calc(var(--r-xl) - 1px) calc(var(--r-xl) - 1px) 0 0; font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--border); }
.console-top .rec { margin-left: auto; color: var(--go-text); }
.js .console-top .rec { animation: blink 2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.console .lab, .console .lab.no-side { border: 0; border-radius: 0 0 calc(var(--r-xl) - 1px) calc(var(--r-xl) - 1px); box-shadow: none; margin: 0; }
.hero-visual .caption { font-size: .88rem; color: var(--ink-3); margin: 14px 6px 0; }
.hero-tease { align-self: center; margin-top: 46px; display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); text-decoration: none; }
.hero-tease:hover { color: var(--ink); }
.resume { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; padding: 10px 10px 10px 18px; border: 1px solid var(--border-2); border-radius: var(--pill); background: var(--glass); font-size: .93rem; }

/* ---------- Page hero (map, topic, utility pages) ---------- */
.page-hero { position: relative; padding: clamp(44px, 7vw, 96px) 0 clamp(28px, 4vw, 48px); isolation: isolate; overflow-x: clip; }
.page-hero::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 70vw; height: 70vw; max-width: 900px; max-height: 900px; z-index: -1; background: radial-gradient(closest-side, color-mix(in srgb, var(--tc, var(--violet)) 20%, transparent), transparent); pointer-events: none; }
.page-hero h1 { max-width: 18ch; }
.page-hero .lead { margin-top: 6px; }
.breadcrumb { font-size: .85rem; color: var(--ink-3); margin-bottom: 22px; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li { margin: 0; }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--ink-3); }
.stats { display: flex; flex-wrap: wrap; gap: 14px 34px; margin-top: 30px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--display); font-size: 2rem; letter-spacing: -.04em; line-height: 1; }
.stat span { font-size: .82rem; color: var(--ink-3); font-weight: 600; margin-top: 6px; }
.exam-note { margin-top: 30px; max-width: 760px; padding: 16px 20px; border-radius: var(--r); border: 1px solid var(--border); background: var(--glass); color: var(--ink-2); font-size: .97rem; }
.exam-note span { display: block; font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--tc, var(--go)); margin-bottom: 4px; }

/* ---------- The map ---------- */
.map-section { padding: clamp(40px, 6vw, 90px) 0 20px; scroll-margin-top: var(--header-h); }
.map-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.map-head h2 { margin-bottom: .2em; }
.map-head .lead { margin: 0; }
.switches { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: center; margin: 6px 0 10px; }
.sw { display: flex; align-items: center; gap: 10px; }
.sw-k { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.seg { display: inline-flex; background: var(--glass); border-radius: var(--pill); padding: 4px; border: 1px solid var(--border); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 15px; border-radius: var(--pill); font-weight: 700; font-size: .87rem; color: var(--ink-3); min-height: 34px; transition: color .2s, background .25s, box-shadow .25s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); box-shadow: 0 4px 16px -6px rgba(0, 0, 0, .6); }
.sw-note { font-size: .86rem; color: var(--ink-3); margin: 0 0 26px; }
.map-note { font-size: .86rem; color: var(--ink-3); margin: 26px 0 0; max-width: 70ch; }
:root[data-stage="ks1"] .ks4-only, :root[data-stage="ks2"] .ks4-only, :root[data-stage="ks3"] .ks4-only { display: none !important; }
:root:not([data-stage="ks3"]) .ks3-only, :root:not([data-stage="ks2"]) .ks2-only, :root:not([data-stage="ks1"]) .ks1-only { display: none !important; }
:root:not([data-stage="ks1"]):not([data-stage="ks2"]) .primary-only { display: none !important; }
:root[data-tier="foundation"] .ht-only { display: none !important; }
:root[data-course="trilogy"] .sep-only { display: none !important; }
/* the course switch: one science on the map */
:root[data-course="biology"] .map .subj-chemistry, :root[data-course="biology"] .map .subj-physics, :root[data-course="biology"] .map.subj-chemistry, :root[data-course="biology"] .map.subj-physics,
:root[data-course="chemistry"] .map .subj-biology, :root[data-course="chemistry"] .map .subj-physics, :root[data-course="chemistry"] .map.subj-biology, :root[data-course="chemistry"] .map.subj-physics,
:root[data-course="physics"] .map .subj-biology, :root[data-course="physics"] .map .subj-chemistry, :root[data-course="physics"] .map.subj-biology, :root[data-course="physics"] .map.subj-chemistry { display: none !important; }
/* Maths sits beside the sciences: a science course hides it, Maths hides every science (KS1 and KS2 science is subj-science) */
:root[data-course="trilogy"] .map .subj-maths, :root[data-course="biology"] .map .subj-maths, :root[data-course="chemistry"] .map .subj-maths, :root[data-course="physics"] .map .subj-maths, :root[data-course="science"] .map .subj-maths,
:root[data-course="trilogy"] .map.subj-maths, :root[data-course="biology"] .map.subj-maths, :root[data-course="chemistry"] .map.subj-maths, :root[data-course="physics"] .map.subj-maths, :root[data-course="science"] .map.subj-maths,
:root[data-course="maths"] .map .subj-biology, :root[data-course="maths"] .map .subj-chemistry, :root[data-course="maths"] .map .subj-physics, :root[data-course="maths"] .map .subj-science,
:root[data-course="maths"] .map.subj-biology, :root[data-course="maths"] .map.subj-chemistry, :root[data-course="maths"] .map.subj-physics { display: none !important; }
.seg-wrap { flex-wrap: wrap; }
/* Small phones: the map switches (stage, tier, course) were up to about 20 px wider than a 320 px screen.
   Tighter buttons first; if a row still cannot fit, the label and the buttons wrap instead of overflowing. */
@media (max-width: 420px) {
  .sw { flex-wrap: wrap; gap: 6px 10px; max-width: 100%; }
  .seg { flex-wrap: wrap; max-width: 100%; }
  .seg button { padding: 6px 10px; }
}
/* Exam-board filter (site.js, "Exam-board filter"): the chooser, the note under the switches and each lesson's references */
.board-select { background: var(--glass); color: var(--ink); border: 1px solid var(--border); border-radius: var(--pill); padding: 6px 14px; min-height: 42px; font-weight: 700; font-size: .87rem; max-width: 100%; }
.sw-board { max-width: 100%; min-width: 0; }   /* long board names ("... (separate sciences)") must not widen the page on phones */
.sw-board .board-select { min-width: 0; flex: 0 1 auto; text-overflow: ellipsis; }
.board-select:focus-visible { outline: 2px solid var(--go); outline-offset: 2px; }
.board-select option { color: #111; background: #fff; }
.board-out { display: none !important; }
.board-note b { color: var(--ink); }
.linkish { border: 0; background: none; padding: 0; color: var(--go-text); font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 24px; }
.pt-board { font-size: .86rem; color: var(--ink-2); margin: 0 0 10px; max-width: 70ch; }
.board-ref b { color: var(--ink); font-weight: 700; }
.board-ref i { font-style: normal; color: #FFD98A; }
.board-ref.none { color: var(--ink-3); }
.board-ai { display: inline-block; font-size: .74rem; font-weight: 700; color: var(--ink-2); border: 1px solid var(--border); border-radius: var(--pill); padding: 1px 8px; margin-left: 4px; white-space: nowrap; }
.board-check > .pt-d > summary .title::after { content: " · to check"; font-size: .74rem; font-weight: 700; color: #FFD98A; }
.tags .sw-board { margin-left: 6px; }
.tags .board-select { min-height: 36px; padding: 4px 12px; }
.tags .board-refs { flex: 1 1 300px; font-size: .9rem; color: var(--ink-2); align-self: center; }
.tags .board-refs:empty { display: none; }
.board-caveat { display: block; font-size: .8rem; color: var(--ink-3); margin-top: 2px; }
:root[data-theme="light"] .board-ref i, :root[data-theme="light"] .board-check > .pt-d > summary .title::after { color: #8A5A00; }

/* drop-downs: smooth height where the browser can animate details */
details::details-content { block-size: 0; overflow: clip; transition: block-size .5s var(--ease), content-visibility .5s allow-discrete; }
details[open]::details-content { block-size: auto; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.chev { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; transition: transform .4s var(--ease), background .2s, border-color .2s; margin-left: 4px; }
.chev::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: translateY(-2px) rotate(45deg); }
details[open] > summary .chev { transform: rotate(180deg); background: var(--glass-2); }
summary:hover .chev { border-color: var(--border-2); }

.map { display: grid; gap: 14px; }
.map-subject { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 -4px 4px; }
.map-subject:first-child { margin-top: 0; }
.topic-d { position: relative; border-radius: var(--r-lg); border: 1px solid var(--border); background: linear-gradient(180deg, var(--glass), transparent 120%), var(--panel); overflow: hidden; transition: border-color .3s, box-shadow .4s; }
.topic-d::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tc, var(--go)); box-shadow: 0 0 20px var(--tc, var(--go)); opacity: .9; }
.topic-d::after { content: ""; position: absolute; inset: -60% -10% auto auto; width: 50%; height: 200%; background: radial-gradient(closest-side, color-mix(in srgb, var(--tc, var(--go)) 14%, transparent), transparent); pointer-events: none; opacity: 0; transition: opacity .6s; }
.topic-d:hover::after, .topic-d[open]::after { opacity: 1; }
.topic-d:hover, .topic-d[open] { border-color: color-mix(in srgb, var(--tc, var(--go)) 35%, var(--border)); }
.topic-d[open] { box-shadow: 0 30px 80px -40px color-mix(in srgb, var(--tc, var(--go)) 40%, transparent); }
.topic-d > summary { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; padding: 22px 22px 22px 28px; }
.t-num { font-family: var(--mono); font-size: .82rem; font-weight: 600; letter-spacing: .06em; color: var(--tc, var(--go)); min-width: 3.2em; }
.t-name { flex: 1; min-width: 0; font-family: var(--display); font-weight: 800; font-size: clamp(1.2rem, 1rem + .9vw, 1.65rem); letter-spacing: -.03em; line-height: 1.1; }
.t-name small { display: block; font-family: var(--font); font-weight: 500; font-size: .84rem; letter-spacing: 0; color: var(--ink-3); margin-top: 6px; }
.t-prog { position: relative; width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.t-prog svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.t-prog circle { fill: none; stroke: var(--border-2); stroke-width: 3; }
.t-prog circle.arc { stroke: var(--tc, var(--go)); stroke-linecap: round; stroke-dasharray: 97.4; stroke-dashoffset: calc(97.4 - 97.4 * var(--pct, 0)); transition: stroke-dashoffset 1.2s var(--ease); filter: drop-shadow(0 0 4px var(--tc, var(--go))); }
.t-prog b { font-family: var(--mono); font-size: .7rem; font-weight: 600; color: var(--ink-2); }
.topic-body { position: relative; z-index: 1; padding: 0 22px 22px 28px; }
.t-blurb { color: var(--ink-2); max-width: 72ch; margin: 0 0 16px; }
.t-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.t-stage:empty, .pt-stage:empty { display: none; }
.t-stage { margin: 0 0 18px; }

.sec-d { border-top: 1px solid var(--border); }
.sec-d > summary { display: flex; align-items: center; gap: 14px; padding: 16px 4px; }
.sec-d > summary .code { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); min-width: 4.4em; }
.sec-d > summary .title { flex: 1; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.sec-d > summary .count { font-size: .8rem; color: var(--ink-3); white-space: nowrap; }
.sec-d > summary:hover .title { color: var(--tc, var(--go)); }
.map-sections { gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); padding: 4px 22px; }
.map-sections > .sec-d:first-child, .map-sections > .pt-list:first-child { border-top: 0; }
.map-sections > .pt-list.solo { border-top: 1px solid var(--border); }
.topic-body > .pt-list.solo { border-top: 1px solid var(--border); }

.pt-list { list-style: none; margin: 0 0 10px; padding: 0; counter-reset: pt; }
.pt-list > li { margin: 0; }
.pt-list.solo { margin: 0; }
.pt-d { border-radius: var(--r); transition: background .25s; }
.pt-d[open] { background: var(--glass); box-shadow: inset 0 0 0 1px var(--border); margin: 6px 0; }
.pt-d > summary, .pt-soon { display: grid; grid-template-columns: minmax(4.6em, max-content) 1fr auto auto; gap: 14px; align-items: center; padding: 11px 12px; border-radius: var(--r); min-height: 52px; }
.pt-d > summary:hover { background: var(--glass); }
.pt-d > summary .code, .pt-soon .code { font-family: var(--mono); font-size: .78rem; color: var(--ink-3); white-space: nowrap; }
.pt-d > summary .title, .pt-soon .title { font-weight: 600; }
.pt-d > summary .meta, .pt-soon .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pt-d .chev { width: 26px; height: 26px; }
.pt-soon { grid-template-columns: minmax(4.6em, max-content) 1fr auto; color: var(--ink-3); }
.pt-body { padding: 2px 16px 18px calc(4.6em + 26px); }
.pt-sum { color: var(--ink-2); margin: 0 0 10px; max-width: 70ch; }
.pt-tease { font-size: .9rem; color: var(--ink-2); margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pt-tease span { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--tc, var(--go)); }
/* while the point's simulation runs, its "Opens on" line steps aside so the title, description and lab fit one screen */
.pt-body:has(> .pt-stage > .lab) > .pt-tease { display: none; }
@media (min-width: 900px) and (max-height: 760px) {
  /* a short laptop screen: the title row and description tighten up while the lab runs, so the lab keeps more height */
  .pt-d:has(> .pt-body > .pt-stage > .lab) > summary { min-height: 0; padding-top: 5px; padding-bottom: 3px; }
  .pt-body:has(> .pt-stage > .lab) > .pt-sum { margin-bottom: 6px; line-height: 1.35; }
}
.pt-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pt-stage { margin-top: 18px; }
.pt-stage .lab { margin: 0; }
.btn-share { gap: 7px; }
.btn-share svg { flex: none; }
.btn-share.copied { border-color: color-mix(in srgb, var(--go) 60%, transparent); color: var(--go-text, var(--go)); }
/* a lesson page: the share button sits under the simulation at the top, on the right */
.lab-band .share-row { display: flex; justify-content: flex-end; margin: -10px 0 0; }
.lab.in-fs { --above: 0px !important; }
@media (max-width: 700px) {
  .topic-d > summary { padding: 18px 14px 18px 20px; gap: 12px; }
  .t-num { display: none; }
  .topic-body { padding: 0 12px 16px 18px; }
  .map-sections { padding: 2px 10px; }
  .pt-d > summary, .pt-soon { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 6px; }
  .pt-d > summary .code, .pt-soon .code { grid-column: 1; }
  .pt-d > summary .title, .pt-soon .title { grid-column: 1; }
  .pt-d > summary .meta { grid-column: 2; grid-row: 1 / span 2; }
  .pt-d > summary .chev { display: none; }
  .pt-body { padding: 2px 8px 16px; }
  .t-prog { width: 38px; height: 38px; }
}
.mastery-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--m-none); display: inline-block; flex: none; box-shadow: inset 0 0 0 1px var(--border-2); }
.mastery-dot[data-m="read"] { background: var(--m-read); } .mastery-dot[data-m="practised"] { background: var(--m-practised); box-shadow: 0 0 8px var(--m-practised); } .mastery-dot[data-m="secure"] { background: var(--m-secure); box-shadow: 0 0 10px var(--m-secure); }
.due { font-style: normal; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--amber-text); border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); padding: 1px 7px; border-radius: var(--pill); }

/* ---------- Practice (in the map) ---------- */
.prac { border-radius: var(--r-lg); border: 1px solid var(--border-2); background: var(--panel-2); padding: 20px 22px; box-shadow: var(--shadow); }
.js .prac { animation: rise .5s var(--ease) both; }
.prac-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.prac-k { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.prac-title { font-weight: 800; font-family: var(--display); letter-spacing: -.02em; font-size: 1.1rem; }
.prac-pips { display: flex; gap: 4px; }
.prac-pips i { width: 16px; height: 4px; border-radius: 2px; background: var(--border-2); }
.prac-pips i.ok { background: var(--go); box-shadow: 0 0 8px var(--go); }
.prac-pips i.no { background: var(--warn); }
.prac-pips i.on { background: var(--ink); }
.prac-q .q-text { font-size: 1.08rem; }
.prac-from { font-size: .82rem; color: var(--ink-3); margin: -6px 0 10px; }
.prac-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.prac-score { text-align: center; padding: 10px 0 4px; }
.prac-score .big { font-family: var(--display); font-weight: 800; font-size: 3rem; letter-spacing: -.05em; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.prac-score p { color: var(--ink-2); margin: 10px auto 16px; max-width: 52ch; }

/* ---------- Lesson: the mission hero ---------- */
.mission-hero { position: relative; padding: clamp(22px, 3vw, 40px) 0 20px; isolation: isolate; overflow-x: clip; }
.mission-hero .kicker { margin-bottom: 12px; }
.mission-hero::before { content: ""; position: absolute; inset: -30% -20% auto -20%; height: 90%; z-index: -1; pointer-events: none; background: radial-gradient(45% 60% at 20% 30%, color-mix(in srgb, var(--tc, var(--go)) 18%, transparent), transparent 70%), radial-gradient(40% 50% at 85% 20%, rgba(77, 163, 255, .1), transparent 70%); }
.mission-hero h1 { font-size: clamp(2.1rem, 1.1rem + 3.2vw, 3.8rem); letter-spacing: -.05em; line-height: .98; max-width: 22ch; margin-bottom: 14px; }
.js .mission-hero .hero-copy > * { animation: rise .8s var(--ease) both; }
.js .mission-hero .hero-copy > :nth-child(2) { animation-delay: .08s; }
.js .mission-hero .hero-copy > :nth-child(3) { animation-delay: .16s; }
.js .mission-hero .hero-copy > :nth-child(4) { animation-delay: .24s; }
.js .mission-hero .lab-band { animation: rise 1s var(--ease) both .3s; }
.promise { font-size: clamp(1.02rem, .96rem + .35vw, 1.2rem); color: var(--ink-2); max-width: 70ch; margin-bottom: 14px; }
.lab-band { margin-top: clamp(18px, 2.4vw, 30px); }
.scroll-cue { margin-top: 26px; margin-bottom: 0; text-align: center; font-size: .95rem; color: var(--ink-3); }
.scroll-cue strong { color: var(--ink); }

/* ---------- Lesson: the journey ---------- */
.journey { padding-bottom: 20px; }
.chapter { padding: clamp(56px, 8vw, 110px) 0 10px; scroll-margin-top: var(--header-h); }
.ch-head { margin-bottom: 30px; }
.ch-num { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(3.6rem, 2rem + 6vw, 6rem); line-height: .8; letter-spacing: -.06em; color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--tc, var(--go)) 70%, transparent); margin-bottom: 14px; }
.ch-kicker { display: inline-block; font-family: var(--mono); font-size: .76rem; letter-spacing: .18em; text-transform: uppercase; color: var(--tc, var(--go)); margin-bottom: 10px; }
.ch-head h2 { margin: 0; }
.ch-next { margin: 54px 0 0; padding: 20px 22px; border-radius: var(--r-lg); border: 1px dashed var(--border-2); background: linear-gradient(110deg, var(--glass), transparent); display: grid; gap: 4px; color: var(--ink-2); position: relative; overflow: hidden; }
.ch-next::after { content: ""; position: absolute; right: 22px; top: 50%; width: 12px; height: 12px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-70%) rotate(45deg); }
.ch-next-k { font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.ch-next strong { font-family: var(--display); font-size: 1.3rem; letter-spacing: -.02em; color: var(--ink); }
.chapter p, .chapter li { font-size: 1.06rem; }
.chapter > p, .seg-block p, .seg-block li { max-width: 68ch; }
.intro p { font-size: 1.2rem; color: var(--ink-2); line-height: 1.6; }
.intro p:first-child::first-letter { font-family: var(--display); font-weight: 800; color: var(--tc, var(--go)); }
.keycard { margin: 30px 0 36px; padding: 22px 24px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--border); position: relative; overflow: hidden; }
.keycard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--grad); }
.keycard-k { font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.keypoints { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.keypoints li { position: relative; padding-left: 32px; margin: 0; }
.keypoints li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 12px; height: 12px; border-radius: 50%; background: var(--tc, var(--go)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc, var(--go)) 18%, transparent); }
.seg-block { padding: 10px 0 18px; scroll-margin-top: calc(var(--header-h) + 10px); }
.seg-block h3 { font-size: 1.45rem; margin: 18px 0 .6em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg-block img, .seg-block svg { border-radius: var(--r); }
.chapter table { display: block; max-width: 100%; overflow-x: auto; }
.callout { border-radius: var(--r); padding: 16px 18px; margin: 0 0 1.4em; border: 1px solid var(--border); background: var(--glass); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-family: var(--mono); font-weight: 600; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .6em; color: var(--ink-3); }
.callout.key, .callout.tip { border-left: 3px solid var(--accent); }
.callout.mis { border-left: 3px solid var(--warn); background: var(--warn-soft); }
.callout.practical { border-left: 3px solid var(--amber); }
.callout.ht { border-left: 3px solid var(--violet); }
.quiz-inline { margin: 8px 0 30px; }

.eqs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin-bottom: 18px; }
.eq { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 22px; background: var(--panel); position: relative; overflow: hidden; }
.eq::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 70%; height: 120%; background: radial-gradient(closest-side, color-mix(in srgb, var(--tc, var(--go)) 12%, transparent), transparent); pointer-events: none; }
.eq .sym { font-family: var(--mono); font-size: 1.45rem; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.eq .words { color: var(--ink-2); font-size: .95rem; margin-top: 6px; }
.eq .units { color: var(--ink-3); font-size: .84rem; margin-top: 4px; }
.eq .tags { margin-top: 12px; }

.worked { counter-reset: step; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); padding: 22px 24px; margin-bottom: 18px; }
.worked-k { font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--tc, var(--go)); margin-bottom: 8px; }
.worked .wq { font-weight: 700; font-size: 1.08rem; margin-bottom: 14px; }
.worked ol { list-style: none; padding: 0; margin: 0 0 14px; }
.worked ol li { counter-increment: step; position: relative; padding-left: 40px; margin: 0 0 10px; }
.worked ol li::before { content: counter(step); position: absolute; left: 0; top: .05em; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-2); font-family: var(--mono); font-size: .76rem; display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.worked li.faded::before { border-style: dashed; }
.worked .ans { font-weight: 800; color: var(--go-text); }
.worked .btn { white-space: normal; text-align: left; height: auto; }
.worked .reveal-text { display: inline; }

.mis-list { display: grid; gap: 14px; }
.mis-item { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--panel); }
@media (max-width: 640px) { .mis-item { grid-template-columns: 1fr; } }
.mis-item > div { padding: 16px 18px; }
.mis-item .wrong { background: var(--warn-soft); }
.mis-item .right { background: var(--ok-soft); }
.mis-item b { display: block; font-family: var(--mono); font-size: .7rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 6px; }
.mis-item .wrong b { color: var(--warn); } .mis-item .right b { color: var(--ok); }

.prove-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; }
.prove-bar p { margin: 0; font-size: .92rem; color: var(--ink-3); max-width: 58ch; }

.review-box { border-radius: var(--r-lg); padding: 22px 24px; background: var(--panel); border: 1px solid var(--border); margin: 0 0 22px; }
.review-box h3 { margin-top: 0; }
.review-box p:last-child { margin-bottom: 0; }
.recap { border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--panel); overflow: hidden; margin: 0 0 28px; }
.recap-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.recap-head p { margin: 4px 0 0; color: var(--ink-3); font-size: .92rem; }
.recap-k { font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.script button.line { width: 100%; text-align: left; display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 13px 22px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--ink-2); font-size: .98rem; transition: background .2s, color .2s; }
.script button.line:first-child { border-top: 0; }
.script button.line:hover { background: var(--glass); color: var(--ink); }
.script button.line[aria-current="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--go); }
.script .t { font-family: var(--mono); font-size: .78rem; color: var(--ink-3); padding-top: 3px; }
.next-mission { position: relative; display: grid; gap: 6px; text-decoration: none; color: var(--ink); padding: 30px 30px 28px; border-radius: var(--r-xl); border: 1px solid color-mix(in srgb, var(--tc, var(--go)) 40%, var(--border)); background: radial-gradient(80% 140% at 100% 0%, color-mix(in srgb, var(--tc, var(--go)) 20%, transparent), transparent 60%), var(--panel); overflow: hidden; transition: transform .35s var(--ease), box-shadow .35s; }
.next-mission:hover { transform: translateY(-3px); box-shadow: 0 30px 80px -30px color-mix(in srgb, var(--tc, var(--go)) 55%, transparent); }
.nm-k { font-family: var(--mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--tc, var(--go)); }
.nm-t { font-family: var(--display); font-weight: 800; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); letter-spacing: -.04em; line-height: 1.05; }
.nm-s { color: var(--ink-2); max-width: 62ch; }
.nm-sim { font-size: .88rem; color: var(--ink-3); }
.nm-go { margin-top: 12px; justify-self: start; display: inline-flex; gap: 8px; align-items: center; padding: 10px 20px; border-radius: var(--pill); background: var(--grad); color: #05070D; font-weight: 800; box-shadow: var(--glow-go); }
:root[data-theme="light"] .nm-go { background: var(--go); color: #fff; }
.also { margin-top: 14px; font-size: .92rem; color: var(--ink-3); }
.back-map { margin-top: 26px; font-size: .92rem; color: var(--ink-3); }
.lesson-foot { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 40px; }

/* ---------- Questions ---------- */
.quiz { display: grid; gap: 16px; }
.q { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px 24px; }
.quiz-inline .q { background: var(--glass); border-style: dashed; }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .78rem; color: var(--ink-3); font-weight: 600; margin-bottom: 12px; font-family: var(--mono); letter-spacing: .04em; }
.q-from { color: var(--ink-2); }
.q-text { font-size: 1.1rem; font-weight: 600; margin: 0 0 16px; }
.options { display: grid; gap: 8px; }
.option { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; text-align: left; border: 1px solid var(--border-2); background: var(--glass); border-radius: var(--r); padding: 10px 12px; min-height: 52px; font-size: 1rem; color: var(--ink); transition: border-color .15s, background .15s, transform .15s; }
.option:hover:not([disabled]) { border-color: var(--accent); background: var(--accent-soft); transform: translateX(2px); }
.option .letter { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-2); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 600; font-size: .82rem; color: var(--ink-2); }
.option[data-state="correct"] { border-color: var(--ok); background: var(--ok-soft); }
.option[data-state="correct"] .letter { background: var(--ok); color: var(--bg); border-color: var(--ok); }
.option[data-state="wrong"] { border-color: var(--warn); background: var(--warn-soft); }
.option[data-state="wrong"] .letter { background: var(--warn); color: var(--bg); border-color: var(--warn); }
.option[disabled] { cursor: default; }
.explain { margin-top: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--glass-2); font-size: .96rem; color: var(--ink-2); }
.explain strong { display: block; margin-bottom: 4px; color: var(--ink); }
.explain .ms { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-2); }
.conf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; font-size: .85rem; color: var(--ink-3); }
.conf button { border: 1px solid var(--border-2); background: transparent; border-radius: var(--pill); padding: 4px 12px; min-height: 32px; font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.conf button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.quiz-summary { margin-top: 18px; border-radius: var(--r-lg); padding: 24px 26px; border: 1px solid color-mix(in srgb, var(--go) 35%, var(--border)); background: radial-gradient(80% 140% at 100% 0%, rgba(52, 245, 164, .12), transparent 60%), var(--panel); }
.quiz-summary .score { font-family: var(--display); font-size: 3rem; font-weight: 800; letter-spacing: -.05em; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-tier="foundation"] .q[data-band="higher"], :root[data-tier="foundation"] .q[data-band="stretch"] { display: none; }
:root[data-tier="higher"] .q[data-band="foundation"] { display: none; }
:root[data-tier="foundation"] .ht { display: none; }

/* ---------- Lab (the simulation console) ----------
   One block that fits one screen with nothing scrolling inside it: the scene's options, the mission, then the simulation
   with its own strip along the bottom (play, step, reset; speed on the right) and full screen in its top-right corner.
   There are no sliders or readout boxes: numbers are set by dragging handles in the canvas and read from the canvas.
   The ranges stay as visually hidden inputs in the stage for the keyboard and screen readers. */
.lab { container: lab / inline-size; --chrome: 60px; --k-adj: var(--go-text); --k-mon: var(--accent); position: relative; background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: 0 40px 100px -50px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .02) inset; overflow: clip; margin: 0 0 1.4em; }
.lab.has-missions { --chrome: 160px; }
:root[data-theme="light"] .lab { --k-adj: #087345; --k-mon: #1F5FAD; }
.mission-hero .lab { box-shadow: 0 50px 140px -60px color-mix(in srgb, var(--tc, var(--go)) 55%, transparent), 0 30px 80px -40px rgba(0, 0, 0, .9); }
[data-lab]:not(.lab) { min-height: min(560px, 70svh); border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--panel); margin: 0 0 1.4em; }
[data-lab]:not(.lab) .lab-steps-src { margin: 0; padding: 22px 24px 22px 44px; color: var(--ink-2); }
.lab-noscript { padding: 18px 20px; color: var(--ink-2); }
.lab-main { display: flex; flex-direction: column; align-items: center; background: var(--stage-bg); }
/* the simulation takes what the screen has left: between 16:10 and 2:1, never taller than the space under the chrome;
   its strip is part of it, the same width and colour */
/* the lab shrinks to the space left under the header, its controls and its mission brief; 160px is the smallest it goes
   (a quiz brief with a two-line question needs it on a 1280x609 laptop screen) */
.lab-main { --avail: calc(100svh - var(--header-h) - var(--chrome) - 16px - var(--above, 0px)); --hh: max(160px, min(calc(100cqw / 1.6), var(--avail))); }
.lab-sim { width: min(100%, calc(var(--hh) * 2)); display: flex; flex-direction: column; }
/* Crack it's working: beside the simulation when the lab is wide enough (the simulation keeps its height and gives up
   a little width), under it when not; never above it, where it used to squeeze the simulation to a thumbnail */
.lab-work { width: 100%; padding: 8px 14px 10px; border-top: 1px solid var(--border); background: var(--panel-2); }
.lab-work[hidden] { display: none; }
.lw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lab-work .m-eq { margin-top: 4px; }
/* Beside the working the simulation keeps its height and may go as narrow as 5:4 (the shape it has on a phone) before
   it shrinks; at 16:10 it lost about a quarter of its height on a large screen as soon as the working showed (hand-test
   4 Nov, energy resources 4.1.3) */
@container lab (min-width: 760px) {
  .lab.has-work .lab-main { flex-direction: row; align-items: flex-start; justify-content: center; --hh: max(160px, min(calc((100cqw - 316px) / 1.25), calc(100cqw / 1.6), var(--avail))); }
  .lab.has-work .lab-sim { width: min(calc(100% - 300px), calc(var(--hh) * 2)); }
  .lab.has-work .lab-sim { flex: none; }
  .lab-work { width: auto; flex: 1 1 300px; min-width: 280px; max-width: 440px; align-self: stretch; max-height: calc(var(--hh) + 47px); overflow-y: auto; border-top: 0; border-left: 1px solid var(--border); scrollbar-width: thin; }
}
.lab-stage { position: relative; height: var(--hh); width: 100%; min-height: 0; touch-action: manipulation; }
.lab-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 80px rgba(0, 0, 0, .35); }
:root[data-theme="light"] .lab-stage::after { box-shadow: none; }
.lab-stage.drag { touch-action: none; }
.lab-stage canvas { width: 100%; height: 100%; display: block; }
.lab-stage canvas:focus-visible { outline: 2px solid var(--go); outline-offset: -2px; }
.lab-fs { position: absolute; top: 8px; right: 8px; z-index: 3; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--border-2); border-radius: 10px; background: color-mix(in srgb, var(--panel) 72%, transparent); color: var(--ink-2); cursor: pointer; backdrop-filter: blur(6px); }
.lab-fs:hover { color: var(--ink); border-color: var(--ink-3); }
.lab-fs:focus-visible { outline: 2px solid var(--go); outline-offset: 2px; }
.lab-bar { display: flex; align-items: center; gap: 6px 8px; padding: 6px 8px; background: var(--stage-bg); border-top: 1px solid var(--border); }
.lab-bar .spacer { flex: 1; }
.lab-bar .btn { min-height: 34px; padding: 4px 12px; font-size: .84rem; }
.lab-bar .btn-play { min-width: 92px; background: var(--ink); color: var(--bg); border-color: transparent; }
.lab-speed { flex: none; font-size: .8rem; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.lab-speed select { border: 1px solid var(--border-2); border-radius: var(--pill); padding: 3px 8px; background: var(--panel-2); min-height: 32px; font-size: .8rem; }
/* the scene's options: modes, switches and buttons, as compact chips above the mission */
.lab-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; padding: 7px 14px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--glass-2), transparent); }
.lab-opts:empty { display: none; }
.lab-opts .ctl { margin: 0; padding: 0; display: flex; align-items: center; gap: 6px; }
.lab-opts .ctl-label, .lab-opts .ctl-select > label { margin: 0; font-size: .76rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.lab-opts .seg { width: auto; flex-wrap: nowrap; }
.lab-opts .seg button { flex: none; min-height: 32px; padding: 3px 10px; font-size: .8rem; white-space: nowrap; }
.lab-opts select { width: auto; max-width: 220px; min-height: 34px; padding: 4px 8px; font-size: .84rem; border-radius: var(--pill); }
.lab-opts .toggle { min-height: 34px; padding: 0 12px 0 10px; gap: 7px; border: 1px solid var(--border-2); border-radius: var(--pill); font-size: .8rem; white-space: nowrap; }
.lab-opts .toggle:has(input:checked) { border-color: color-mix(in srgb, var(--go) 55%, transparent); background: color-mix(in srgb, var(--go) 8%, transparent); }
.lab-opts .toggle input { width: 15px; height: 15px; }
.lab-opts .btn { min-height: 34px; padding: 3px 12px; font-size: .82rem; }
/* the ranges: hidden inputs for the keyboard and screen readers; one the scene does not draw shows itself when focused */
.lab-sr { position: absolute; left: 10px; bottom: 10px; z-index: 2; width: min(320px, calc(100% - 20px)); }
.lab-sr > .ctl:not(.orphan), .lab-sr > .ctl-group { position: absolute !important; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.lab-sr > .ctl.orphan { margin: 0; padding: 10px 12px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6); }
@container lab (max-width: 560px) {
  .lab-main { --hh: max(250px, min(calc(100cqw * .8), var(--avail))); }
  .lab-sim { width: 100%; }
  .lab-reset .t, .lab-speed .t { display: none; }
  .lab-bar .btn { padding: 4px 10px; }
  .lab-bar [data-act="step"] { display: none; }
  .lab-opts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 6px 10px; }
  .lab-opts::-webkit-scrollbar { display: none; }
  .lab-opts .ctl { flex: none; }
  .lab-fs { top: 6px; right: 6px; width: 32px; height: 32px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  :root { --header-h: 0px; }
  .site-header { position: static; }
}
.lab.no-side { border-radius: inherit; }
/* full screen: the browser's own, or the dialog fallback */
.lab.in-fs { --header-h: 0px; margin: 0; border: 0; border-radius: 0; overflow: auto; background: var(--bg); }
.lab.in-fs .lab-main { min-height: 100%; }

.lab-dialog { width: 100vw; max-width: 100vw; height: 100svh; max-height: 100svh; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--bg); overflow: auto; }
.lab-dialog::backdrop { background: rgba(2, 4, 8, .85); }
.lab-dialog .lab { --header-h: 0px; margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 100%; }

/* HUD parts */
.lab-sec.locked .lab-ctls { opacity: .45; filter: saturate(.4); }
.lock-note { font-size: .85rem; background: var(--glass-2); border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; color: var(--ink-2); }
.lab-explain summary { cursor: pointer; font-weight: 700; font-size: .92rem; min-height: 32px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.lab-explain summary::before { content: "+"; font-family: var(--mono); width: 18px; height: 18px; border: 1px solid var(--border-2); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; }
.lab-explain[open] summary::before { content: "–"; }
.lab-explain p { font-size: .9rem; color: var(--ink-2); }
.lab-explain .mis { background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 6px; }
.lab-below { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); border-top: 1px solid var(--border); }
.lab-panel { padding: 14px 16px 16px; min-width: 0; }
.lab-panel + .lab-panel { border-left: 1px solid var(--border); }
.explain-box { width: 100%; border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 10px; font-size: .95rem; background: var(--stage-bg); color: var(--ink); margin: 0 0 8px; resize: vertical; }
.fb { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.fb.ok { background: var(--ok-soft); } .fb.no { background: var(--warn-soft); }
.lab-q .q-text { font-weight: 600; margin: 0 0 10px; font-size: .95rem; }
.lab-q .stepper { font-family: var(--mono); font-size: .68rem; color: var(--ink-3); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }
.lab-q .opts { display: grid; gap: 6px; margin-bottom: 10px; }
.lab-q .opts button { text-align: left; border: 1px solid var(--border-2); background: var(--glass); border-radius: 10px; padding: 8px 12px; min-height: 40px; font-size: .9rem; color: var(--ink); }
.lab-q .opts button[data-state="picked"] { border-color: var(--accent); background: var(--accent-soft); }
.lab-q .opts button[data-state="right"] { border-color: var(--ok); background: var(--ok-soft); }
.lab-q .opts button[data-state="wrong"] { border-color: var(--warn); background: var(--warn-soft); }
.lab-q .btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.lab-equations { list-style: none; padding: 0; margin: 0; }
.lab-equations li { font-family: var(--mono); font-size: .95rem; padding: 6px 0; border-top: 1px solid var(--border); }

/* controls built by core.js: option chips in the bar, and a hidden range shown when it has no handle in the scene */
.ctl { position: relative; margin: 0 0 14px; padding: 2px 0; border-radius: 10px; transition: background .3s, box-shadow .3s; }
.ctl label { display: flex; justify-content: space-between; gap: 8px; font-size: .86rem; font-weight: 600; margin-bottom: 4px; color: var(--ink-2); }
.ctl label .val { font-family: var(--mono); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ctl label.toggle { justify-content: flex-start; }
.ctl input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; --p: 50%; }
.ctl input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) 0 var(--p), var(--line-strong) var(--p) 100%); }
.ctl input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--line-strong); }
.ctl input[type="range"]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.ctl input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; margin-top: -7px; background: var(--ink); border: 3px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent), 0 2px 8px rgba(0, 0, 0, .5); transition: transform .15s; }
.ctl input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.ctl input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
@media (pointer: coarse) { .ctl input[type="range"] { height: 44px; } }
.ctl select { width: 100%; border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 10px; background: var(--panel-2); min-height: 40px; }
.ctl .ctl-label { font-size: .86rem; font-weight: 600; margin-bottom: 4px; color: var(--ink-2); }
.ctl .seg { display: flex; flex-wrap: wrap; width: 100%; }
.ctl .seg button { flex: 1; min-height: 34px; padding: 4px 10px; font-size: .83rem; }
.ctl .toggle { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-weight: 600; font-size: .88rem; }
.ctl .toggle input { width: 18px; height: 18px; accent-color: var(--go); margin: 0; }
.ctl .help { font-size: .76rem; color: var(--ink-3); margin-top: 3px; }
.ctl-group { font-family: var(--mono); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin: 16px 0 8px; }
.ctl:has(> .btn:only-child) { display: inline-block; margin: 0 6px 10px 0; vertical-align: top; }

/* missions: one at a time, above the simulation. The words use the scene's colours: green for what to adjust,
   blue for what to monitor or record. A reading to record is typed into a gap in the sentence; a calculation shows
   its working with the scene's own numbers (symbols above, numbers below). */
.lab-brief { padding: 9px 16px; min-height: 50px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, color-mix(in srgb, var(--go) 6%, var(--panel-2)), var(--panel-2) 60%); outline: none; transition: background .3s; }
.lab-brief.ok { background: linear-gradient(90deg, color-mix(in srgb, var(--go) 22%, var(--panel-2)), var(--panel-2) 80%); }
.js .lab-brief > * { animation: rise .35s var(--ease) both; }
.b-txt { margin: 0; font-size: .97rem; color: var(--ink-2); line-height: 1.6; }
.b-txt strong { color: var(--ink); }
.b-txt .btn { vertical-align: middle; margin: 0 4px; }
.k-adj, .b-txt .k-adj strong { color: var(--k-adj); font-weight: 700; }
.k-mon, .b-txt .k-mon strong { color: var(--k-mon); font-weight: 700; }
.b-k { display: inline-block; margin-right: 10px; font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.b-skip { margin-left: 6px; font-size: .82rem; color: var(--ink-3); }
.b-opts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin: 10px 0 0; }
/* the hint and "What to notice" drop down under the brief, in full (nothing scrolls inside them); "What to notice" ends
   with its own Hide button */
.lab-drops > div { padding: 8px 16px 10px; border-bottom: 1px solid var(--border); background: var(--panel-2); font-size: .9rem; color: var(--ink-2); }
.lab-drops > div[hidden] { display: none; }
.lab-hint p { margin: 0; max-width: 90ch; line-height: 1.55; }
.lab-hint .h-eq { font-family: var(--mono); font-size: .92em; color: var(--ink); }
.lab-drop .drop-end { margin: 10px 0 0; }
.b-tools { display: inline-flex; flex-wrap: wrap; gap: 0 4px; vertical-align: baseline; }
.lab-notes { font-size: .9rem; color: var(--ink-2); }
.lab-notes p { margin: 8px 0 0; max-width: 90ch; }
.lab-notes .mis { background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 6px; }
.m-input { display: inline-flex; gap: 6px; align-items: center; vertical-align: middle; }
.m-input input { width: calc(var(--w, 6ch) + 18px); min-width: 0; border: 0; border-bottom: 2px solid var(--k-mon); border-radius: 6px 6px 0 0; padding: 3px 8px; min-height: 32px; background: color-mix(in srgb, var(--k-mon) 10%, var(--stage-bg)); color: var(--ink); font-family: var(--mono); font-size: 1rem; text-align: center; }
.m-input input::placeholder { color: color-mix(in srgb, var(--k-mon) 70%, transparent); letter-spacing: .08em; }
.m-input input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--k-mon) 30%, transparent); }
.m-input .unit { font-family: var(--mono); color: var(--k-mon); font-size: .92rem; }
.m-input .btn { margin: 0 0 0 4px; }
.m-eq { display: grid; gap: 6px; margin-top: 8px; }
.eq-l { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 8px; font-family: var(--mono); }
.eq-q { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; padding: 2px 8px; border-radius: 8px; background: var(--glass); border: 1px solid var(--border); }
.eq-q i { font-style: italic; font-size: .82rem; color: var(--ink-3); }
.eq-q b { font-weight: 700; font-size: .95rem; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.eq-q.adj { border-color: color-mix(in srgb, var(--k-adj) 60%, transparent); background: color-mix(in srgb, var(--k-adj) 10%, transparent); }
.eq-q.adj i, .eq-q.adj b { color: var(--k-adj); }
.eq-q.out { border-color: color-mix(in srgb, var(--k-mon) 60%, transparent); background: color-mix(in srgb, var(--k-mon) 10%, transparent); }
.eq-q.out i, .eq-q.out b { color: var(--k-mon); }
.eq-o { padding-bottom: 4px; color: var(--ink-2); font-size: .95rem; white-space: nowrap; }
.m-msg { font-size: .88rem; margin: 8px 0 0; padding: 7px 12px; border-radius: 10px; }
.m-msg.no { background: var(--warn-soft); color: var(--ink); }
.m-msg.ok { background: var(--ok-soft); color: var(--ink); }
.m-stars { display: flex; gap: 5px; }
.m-stars.inline { display: inline-flex; vertical-align: -2px; margin-right: 10px; }
.m-stars i { width: 16px; height: 16px; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: var(--border-2); }
.m-stars i.on { background: var(--amber); filter: drop-shadow(0 0 6px var(--amber)); }
@container lab (max-width: 560px) {
  .lab-brief { padding: 7px 12px; min-height: 0; }
  .b-txt { font-size: .9rem; line-height: 1.5; }
  .m-eq { margin-top: 6px; gap: 4px; }
  .eq-l { gap: 3px 5px; }
  .eq-q { padding: 1px 5px; }
  .eq-q i { font-size: .72rem; }
  .eq-q b { font-size: .8rem; }
  .eq-o { font-size: .85rem; padding-bottom: 2px; }
}

/* ---------- Dialogs ---------- */
dialog { border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: 0; background: var(--panel); color: var(--ink); max-width: min(92vw, 560px); width: 100%; box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .9); }
dialog::backdrop { background: rgba(2, 4, 8, .6); backdrop-filter: blur(6px); }
.dialog-body { padding: 24px 26px; display: grid; gap: 18px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { margin: 0; font-size: 1.35rem; }
.control .label { display: block; font-weight: 700; font-size: .86rem; margin-bottom: 8px; color: var(--ink-2); }
.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice button { border: 1px solid var(--border-2); background: var(--glass); border-radius: var(--pill); padding: 7px 14px; min-height: 38px; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.choice button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Search and simple pages ---------- */
.search-form { display: flex; align-items: center; border: 1px solid var(--border-2); border-radius: var(--pill); background: var(--glass); padding: 0 20px; height: 58px; margin: 22px 0 12px; max-width: 620px; }
.search-form:focus-within { border-color: var(--go); box-shadow: 0 0 0 4px rgba(52, 245, 164, .15); }
.search-form input { border: 0; background: transparent; width: 100%; height: 100%; outline: none; font-size: 1.1rem; }
.result { display: block; text-decoration: none; color: inherit; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); margin-bottom: 10px; transition: border-color .2s, transform .2s; }
.result:hover { border-color: var(--border-2); transform: translateX(3px); }
.result .code { font-family: var(--mono); font-size: .76rem; color: var(--ink-3); }
.result h3 { font-size: 1.05rem; margin: 3px 0 4px; }
.result p { margin: 0; font-size: .92rem; color: var(--ink-2); }
.empty { text-align: center; padding: 36px 20px; border: 1px dashed var(--border-2); border-radius: var(--r-lg); color: var(--ink-2); }
section.tight { padding: 24px 0; }
main > section.tight:first-child { padding-top: clamp(44px, 7vw, 96px); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px 26px; }
.card h2 { font-size: 1.4rem; }
.card h3 { margin-top: 0; }
.prose { padding-bottom: 20px; }
.facts { list-style: none; padding: 0; margin: 26px 0; display: grid; gap: 12px; }
.facts li { margin: 0; padding: 14px 18px; border-radius: var(--r); border: 1px solid var(--border); background: var(--glass); color: var(--ink-2); }
.facts li strong { color: var(--ink); }
.creator { margin-top: 30px; font-size: 1.05rem; }
.creator a { font-weight: 700; }

/* ---------- Listen player ---------- */
.player { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 150; width: min(100% - 24px, 720px); background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); color: var(--ink); border: 1px solid var(--border-2); border-radius: 22px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9); padding: 10px 12px; }
.player-main { display: flex; align-items: center; gap: 8px; }
.player .pbtn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--glass-2); color: var(--ink); font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; }
.player .pbtn:hover { background: var(--glass-3); }
.player .pbtn.play { width: 52px; height: 52px; background: var(--grad); color: #05070D; font-weight: 800; }
.player .pbtn.close { background: transparent; color: var(--ink-3); }
.player-info { flex: 1; min-width: 0; padding: 0 6px; }
.player-part { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.player-caption { font-size: .92rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 6px; }
.player-track { height: 3px; border-radius: 3px; background: var(--border-2); overflow: hidden; }
.player-track i { display: block; height: 100%; background: var(--grad); transition: width .3s ease; }
.player-rate select { background: var(--glass-2); color: var(--ink); border: 1px solid var(--border-2); border-radius: 999px; padding: 6px 8px; min-height: 36px; }
.player-rate option { color: #111827; }
body.has-player { padding-bottom: 96px; }
@media (max-width: 560px) {
  .player { bottom: 8px; padding: 8px; border-radius: 18px; }
  .player .pbtn { width: 40px; height: 40px; }
  .player .pbtn.play { width: 46px; height: 46px; }
  .player-rate { display: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .lab-stage { aspect-ratio: 4 / 3; }
  .chapter p, .chapter li { font-size: 1rem; }
  .intro p { font-size: 1.08rem; }
  .q { padding: 18px 16px; }
  .next-mission { padding: 24px 20px; }
  .hero-stats b, .stat b { font-size: 1.6rem; }
  .lab { border-radius: var(--r-lg); }
}
.pill { max-width: 100%; }

/* ---------- Motion and print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
@media print {
  .site-header, .site-footer, .lab, .rail, .scroll-cue, .ch-next, .recap-head .btn, .no-print, .skip-link, .player, .next-mission .nm-go { display: none !important; }
  :root { --bg: #fff; --ink: #000; --ink-2: #222; --ink-3: #444; --panel: #fff; --border: #ccc; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .js .reveal { opacity: 1; transform: none; }
  .ch-num { -webkit-text-stroke: 1px #999; }
  .q .explain { display: block !important; }
  a { color: inherit; text-decoration: none; }
}
/* tables on the plain pages (privacy, levels) scroll inside their card on narrow phones instead of widening the page */
.page-hero table, .card table, .prose table { display: block; max-width: 100%; overflow-x: auto; }

/* First-save notice: shown once, the first time progress is saved */
.save-note { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 250; max-width: 420px; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow); }
.save-note p { margin: 0 0 10px; font-size: .92rem; }
@media print { .save-note { display: none; } }

/* the test copy in /beta (build.ps1 -Beta) says so on every page */
.beta-strip { padding: 7px 16px; text-align: center; font-size: .85rem; color: var(--go-ink); background: var(--amber); }
.beta-strip a { color: inherit; font-weight: 700; text-decoration: underline; }
/* light theme: dark ink on the bright amber, as in the dark theme (white on the light theme's darker amber was 2.9:1) */
:root[data-theme="light"] .beta-strip { color: #0A1020; background: #FFC247; }

/* home page film (rsk-lab5-zoom, landscape): muted loop that plays while on screen (home-video.js), controls for sound */
.film-section { padding: clamp(40px, 6vw, 90px) 0 0; }
.film-head { max-width: 760px; margin-bottom: 22px; }
.film-head h2 { margin-bottom: .2em; }
.film-head .lead { margin: 0; }
.console.film { max-width: 1040px; }
.console.film .console-top > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console.film .console-top .rec { white-space: nowrap; }
.film-video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #05070D; border-radius: 0 0 calc(var(--r-xl) - 1px) calc(var(--r-xl) - 1px); }
.film-section .caption { max-width: 1040px; font-size: .88rem; color: var(--ink-3); margin: 14px 6px 0; }
@media print { .film-section { display: none; } }
