/* Inkanyezi · design tokens and components
   Night = the sky map. Day = playing a star. One product, two lights. */

@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --night-0: #060A1C;
  --night-1: #0B1233;
  --night-2: #18225C;
  --star: #EEF0FF;
  --star-muted: #A3ABDA;
  --glass: rgba(16, 24, 68, .78);
  --glass-line: rgba(160, 172, 255, .18);

  --paper: #F5EFE3;
  --paper-2: #EFE6D3;
  --card: #FFFDF8;
  --ink: #1E1B16;
  --ink-2: #5E574B;
  --line: #E2D8C4;
  --red: #E0442F;
  --red-ink: #B92F1C;
  --ochre: #F2B33D;
  --teal: #2FA89A;
  --gold: #FFD36B;

  --maths: #F5B841;
  --language: #FF7A66;
  --science: #3DD6C0;
  --social: #74A9FF;
  --life: #C79BFF;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Atkinson", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --shadow: 0 1px 0 rgba(30, 27, 22, .06), 0 8px 24px rgba(30, 27, 22, .08);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
svg { display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---------- NIGHT · the sky ---------- */
body.night {
  background: radial-gradient(120% 90% at 60% 30%, var(--night-2) 0%, var(--night-1) 45%, var(--night-0) 100%) fixed;
  color: var(--star);
  overflow: hidden;
  overscroll-behavior: none;
}
body.night.page { overflow: auto; }
#sky { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#sky.dragging { cursor: grabbing; }

.sky-head { position: fixed; top: 0; left: 0; padding: 22px 24px 0; pointer-events: none; max-width: 640px; }
.sky-head > * { pointer-events: auto; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 600; font-size: 15px; letter-spacing: .02em; text-decoration: none; color: var(--gold); }
.wordmark-star { width: 16px; height: 16px; fill: var(--gold); }
.sky-title { font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 4.2vw, 44px); line-height: 1.08; margin: 14px 0 6px; letter-spacing: -.01em; text-shadow: 0 2px 18px rgba(6, 10, 28, .8); }
.sky-meta { margin: 0; font-size: 13px; color: var(--star-muted); }

.sky-tools { position: fixed; top: 18px; right: 18px; display: flex; gap: 8px; align-items: flex-start; z-index: 5; }
.search { position: relative; display: flex; align-items: center; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px; padding: 0 12px; height: 40px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--star-muted); stroke-width: 2; stroke-linecap: round; }
.search input { background: none; border: 0; color: var(--star); font: inherit; font-size: 14px; width: 170px; padding: 0 6px; height: 100%; outline: none; }
.search input::placeholder { color: var(--star-muted); }
.results { position: absolute; top: 46px; right: 0; width: 290px; margin: 0; padding: 6px; list-style: none; background: var(--night-1); border: 1px solid var(--glass-line); border-radius: var(--r); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.results li { padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; display: flex; gap: 10px; align-items: baseline; }
.results li small { color: var(--star-muted); margin-left: auto; white-space: nowrap; font-size: 12px; }
.results li:hover, .results li[aria-selected="true"] { background: rgba(160, 172, 255, .12); }
.results .empty { color: var(--star-muted); cursor: default; }

.pill { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); font-size: 14px; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); white-space: nowrap; }
.pill svg { width: 15px; height: 15px; fill: currentColor; }
.pill-play { background: var(--gold); color: #261B00; border-color: transparent; font-weight: 700; }
.pill-count { background: rgba(38, 27, 0, .14); border-radius: 999px; padding: 1px 7px; font-size: 12px; }
#lit-btn svg { fill: var(--gold); }

.games { position: fixed; top: 66px; right: 18px; width: 330px; background: var(--night-1); border: 1px solid var(--glass-line); border-radius: var(--r-lg); padding: 10px; z-index: 6; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); }
.games-head { margin: 4px 8px 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--star-muted); }
.game { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: var(--r); text-decoration: none; }
.game:hover { background: rgba(160, 172, 255, .1); }
.game strong { display: block; font-weight: 700; font-size: 15px; }
.game small { color: var(--star-muted); font-size: 12.5px; }
.game-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px rgba(255, 255, 255, .06); }

.legend { position: fixed; left: 20px; bottom: calc(46px + var(--safe-b)); display: flex; flex-wrap: wrap; gap: 6px; max-width: 860px; z-index: 3; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; font-size: 12.5px; background: var(--glass); border: 1px solid var(--glass-line); cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.chip-dot { width: 9px; height: 9px; border-radius: 50%; }
.chip[aria-pressed="true"] { border-color: rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .12); }

[data-subject="maths"] .chip-dot, [data-subject="maths"] .game-dot, [data-subject="maths"].game-dot { background: var(--maths); }
[data-subject="language"] .chip-dot, [data-subject="language"] .game-dot { background: var(--language); }
[data-subject="science"] .chip-dot, [data-subject="science"] .game-dot { background: var(--science); }
[data-subject="social"] .chip-dot, [data-subject="social"] .game-dot { background: var(--social); }
[data-subject="life"] .chip-dot, [data-subject="life"] .game-dot { background: var(--life); }

.card { position: fixed; left: 20px; bottom: calc(96px + var(--safe-b)); width: 380px; max-height: calc(100vh - 220px); overflow: auto; background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r-lg); padding: 18px 20px 18px; z-index: 4; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.card-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.card-close svg, .back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.card-close:hover { background: rgba(255, 255, 255, .08); }
.eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--language); }
.card h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.15; margin: 0 30px 8px 0; }
.card-q { margin: 0 0 14px; color: #D3D8F5; font-size: 15px; line-height: 1.45; }
.card-links { display: grid; gap: 10px; margin-bottom: 16px; }
.lk { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.lk-in { color: #FF9E8F; }
.lk-out { color: var(--gold); }
.lk-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lk-list button { border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .04); color: var(--star); border-radius: 999px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; }
.lk-list button:hover { background: rgba(255, 255, 255, .1); }
.lk-list .none { font-size: 13px; color: var(--star-muted); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; border: 0; }
.btn svg { width: 16px; height: 16px; }
.btn-play { background: var(--gold); color: #261B00; }
.btn-play svg { fill: currentColor; }
.btn-ghost { background: transparent; border: 1px solid var(--glass-line); color: var(--star); }
.btn-ghost svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.btn-ghost[aria-pressed="true"] { background: rgba(255, 211, 107, .16); border-color: var(--gold); color: var(--gold); }
.btn-dark { background: var(--ink); color: var(--paper); }

.hint { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); margin: 0; padding: 9px 16px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px; font-size: 13px; color: var(--star-muted); pointer-events: none; animation: rise .4s ease-out; white-space: nowrap; }

.sky-foot { position: fixed; left: 20px; right: 20px; bottom: calc(14px + var(--safe-b)); display: flex; gap: 16px; font-size: 12px; color: var(--star-muted); z-index: 2; }
.sky-foot a { color: var(--star-muted); text-decoration: none; }
.sky-foot a:hover { color: var(--star); }
.sky-foot .by { margin-left: auto; letter-spacing: .04em; }

.lost { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 24px; gap: 8px; }
.lost h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; margin: 0 0 18px; }
.lost .btn { justify-self: center; }

/* ---------- DAY · playing a star ---------- */
body.day { background: var(--paper); color: var(--ink); }
.play { position: relative; height: 100vh; height: 100dvh; min-height: 560px; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; overflow-x: hidden; }
.back { position: absolute; z-index: 5; top: 16px; left: 16px; width: 40px; height: 40px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ink); }
.play-head { padding: 16px 16px 0 68px; display: grid; gap: 10px; justify-items: start; max-width: 560px; z-index: 2; }
.q-card { background: var(--card); border-radius: var(--r); padding: 12px 16px 14px; box-shadow: var(--shadow); }
.eyebrow-day { color: var(--red); }
.q-card h1 { margin: 0; font-family: var(--sans); font-weight: 700; font-size: clamp(19px, 2.6vw, 26px); line-height: 1.2; }
.q-card h1 em { font-style: normal; color: var(--red); }
.narrator { margin: 0; background: var(--card); border-radius: var(--r); padding: 11px 14px; font-size: 15px; line-height: 1.45; box-shadow: var(--shadow); max-width: 380px; min-height: 44px; transition: opacity .2s; }
.narrator.swap { opacity: .25; }

.readout { position: absolute; top: 16px; right: 16px; z-index: 3; background: var(--card); border: 3px solid var(--ink); border-radius: var(--r); padding: 8px 14px 10px; box-shadow: 4px 4px 0 var(--ink); min-width: 128px; text-align: left; }
.readout .tag { display: inline-block; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.readout .big { font-family: var(--sans); font-weight: 700; font-size: 34px; line-height: 1.05; margin-top: 4px; font-variant-numeric: tabular-nums; }
.readout .big small { font-size: 18px; margin-left: 2px; }
.readout .sub { display: inline-block; margin-top: 4px; font-size: 11px; border: 1px solid var(--ink); border-radius: 999px; padding: 1px 8px; }

.stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 8px 8px 0; }
.stage > svg { position: absolute; top: 8px; bottom: 0; left: 0; right: 0; margin: 0 auto; width: 100%; height: calc(100% - 8px); max-width: 1040px; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; padding: 10px 16px calc(18px + var(--safe-b)); }
.toggle { display: inline-flex; align-items: center; gap: 12px; height: 52px; padding: 0 20px 0 10px; background: var(--card); border: 3px solid var(--line); border-radius: 999px; font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: var(--shadow); }
.toggle .knob { width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.toggle .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.toggle[aria-pressed="true"] { border-color: var(--red); }
.toggle[aria-pressed="true"] .knob { background: var(--red); }
.toggle[aria-pressed="true"] .knob::after { transform: translateX(20px); }
.chipbtn { height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; cursor: pointer; }
.chipbtn[aria-pressed="true"] { background: var(--ochre); border-color: var(--ochre); color: #2A1E00; }
.seg { display: inline-flex; background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 8px 12px; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.slider { display: flex; align-items: center; gap: 12px; background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 6px 18px; box-shadow: var(--shadow); width: min(560px, 100%); }
.slider label { font-weight: 700; font-size: 14px; white-space: nowrap; }
.slider output { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.slider input[type=range] { flex: 1; accent-color: var(--red); height: 32px; min-width: 0; }
.ctl-label { width: 100%; text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 2px 0 -4px; }

.badge-pop { font-family: var(--sans); font-weight: 700; }

.ctl-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }
.ctl-row[hidden] { display: none; }
.stepper { display: inline-flex; align-items: center; gap: 10px; background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 16px; box-shadow: var(--shadow); }
.stepper-label { font-weight: 700; font-size: 14px; }
.stepper output { font-weight: 700; font-size: 20px; min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.step { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); font-size: 22px; font-weight: 700; cursor: pointer; line-height: 1; }

.till { width: min(820px, 100%); display: grid; gap: 10px; }
.tray { background: var(--card); border: 3px dashed var(--line); border-radius: var(--r); padding: 10px 12px; min-height: 84px; }
.tray-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.tray-head strong { font-size: 18px; color: var(--ink); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.tray-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; min-height: 40px; }
.tray-empty { color: var(--ink-2); font-size: 14px; }
.coins { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; background: #2B2B35; border-radius: var(--r); padding: 10px; }
.coin { border: 0; background: transparent; padding: 3px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; min-width: 44px; min-height: 44px; }
.coin:hover { background: rgba(255, 255, 255, .1); }
.coin:active { transform: scale(.94); }
.in-tray { min-width: 0; min-height: 0; }
.in-tray:hover { background: var(--paper-2); }
.till-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btn:disabled { opacity: .45; cursor: default; }

.quiz { position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--card); border-top: 3px solid var(--ink); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px 18px calc(20px + var(--safe-b)); box-shadow: 0 -12px 40px rgba(30, 27, 22, .18); animation: rise .25s ease-out; max-width: 640px; margin: 0 auto; }
.quiz .eyebrow { color: var(--teal); }
.quiz h2 { margin: 0 0 12px; font-size: 19px; line-height: 1.3; }
.quiz .opts { display: grid; gap: 8px; }
.quiz .opts button { text-align: left; padding: 13px 16px; border-radius: var(--r); border: 2px solid var(--line); background: var(--paper); font-size: 15.5px; cursor: pointer; line-height: 1.35; }
.quiz .opts button:hover { border-color: var(--ink-2); }
.quiz .opts button.right { border-color: var(--teal); background: #E3F5F1; }
.quiz .opts button.wrong { border-color: var(--red); background: #FBE6E2; }
.quiz .why { margin: 12px 0 0; font-size: 15px; line-height: 1.45; }
.quiz .row { display: flex; justify-content: flex-end; margin-top: 12px; gap: 8px; }

.done { position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 14px; background: var(--night-1); color: var(--star); padding: 12px 12px 12px 16px; border-radius: 999px; box-shadow: 0 16px 40px rgba(6, 10, 28, .35); animation: rise .3s ease-out; width: max-content; max-width: calc(100vw - 24px); }
.done svg { width: 30px; height: 30px; fill: var(--gold); flex: none; filter: drop-shadow(0 0 8px rgba(255, 211, 107, .6)); }
.done div { display: grid; font-size: 13px; color: var(--star-muted); }
.done strong { color: var(--star); font-size: 15px; }
.done .btn-dark { background: var(--gold); color: #261B00; height: 40px; }

/* ---------- Docs (list, about) ---------- */
body.day.page { min-height: 100%; }
.doc { max-width: 760px; margin: 0 auto; padding: 28px 18px 80px; }
.doc-back { display: inline-block; margin-bottom: 26px; font-size: 14px; text-decoration: none; color: var(--ink-2); }
.doc h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 5vw, 44px); line-height: 1.08; margin: 0 0 12px; }
.doc h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 34px 0 10px; }
.doc h2 small { font-family: var(--sans); font-size: 14px; color: var(--ink-2); font-weight: 400; margin-left: 6px; }
.doc p { font-size: 16.5px; line-height: 1.6; }
.lede { font-size: 18px !important; color: var(--ink-2); }
.bullets { padding-left: 20px; line-height: 1.6; font-size: 16.5px; }
.bullets li { margin-bottom: 8px; }
.small { font-size: 13px !important; color: var(--ink-2); margin-top: 40px; }
.grade-block { border-top: 1px solid var(--line); margin-top: 26px; }
.subj { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
.subj::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.subj-maths { color: #A8740B; } .subj-language { color: #C2412D; } .subj-science { color: #1D8F80; } .subj-social { color: #2F64C2; } .subj-life { color: #7C4FC4; }
.concepts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.concepts li { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; display: grid; gap: 3px; position: relative; }
.concepts li span { color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.mini-play { justify-self: start; margin-top: 6px; font-size: 13px; font-weight: 700; background: var(--ochre); color: #2A1E00; padding: 4px 12px; border-radius: 999px; text-decoration: none; }

/* ---------- Phone ---------- */
@media (max-width: 720px) {
  .sky-head { padding: 14px 16px 0; right: 0; max-width: none; }
  .sky-title { font-size: 25px; margin-top: 10px; max-width: 15ch; }
  .sky-meta { font-size: 12px; }
  .sky-tools { top: 12px; right: 12px; }
  .search { width: 40px; padding: 0; justify-content: center; }
  .search input { position: absolute; opacity: 0; width: 40px; height: 40px; padding: 0; cursor: pointer; }
  .search.open { position: fixed; left: 12px; right: 12px; top: 12px; width: auto; padding: 0 12px; justify-content: flex-start; z-index: 8; background: var(--night-1); }
  .search.open input { position: static; opacity: 1; width: 100%; padding: 0 6px; cursor: text; }
  .search.open .results { left: 0; right: 0; width: auto; }
  #lit-btn { display: none; }
  .pill-play { padding: 0 12px; }
  .games { left: 12px; right: 12px; width: auto; top: 60px; }
  .legend { left: 0; right: 0; bottom: calc(40px + var(--safe-b)); flex-wrap: nowrap; overflow-x: auto; padding: 0 12px; max-width: none; scrollbar-width: none; }
  .legend::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .card { left: 8px; right: 8px; width: auto; bottom: calc(8px + var(--safe-b)); max-height: 58vh; border-radius: var(--r-lg); padding: 16px 16px 16px; background: rgba(13, 20, 58, .96); }
  .card h2 { font-size: 22px; }
  .hint { bottom: calc(84px + var(--safe-b)); font-size: 12px; }
  .sky-foot { left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); }

  .play-head { padding: 12px 12px 0 60px; }
  .back { top: 12px; left: 12px; }
  .q-card { padding: 10px 12px 12px; }
  .narrator { font-size: 14px; padding: 9px 12px; max-width: none; }
  .readout { position: static; align-self: flex-end; display: flex; align-items: center; gap: 8px; margin: 8px 12px 0 0; padding: 6px 12px; min-width: 0; box-shadow: 3px 3px 0 var(--ink); border-width: 2px; }
  .readout:not([hidden]) { display: flex; }
  .readout br { display: none; }
  .readout .big { font-size: 22px; margin: 0; }
  .readout .sub { margin: 0; }
  .stage { padding: 0 4px; }
  .stage > svg { position: static; height: auto; max-height: 52vh; }
  .controls { gap: 8px; padding: 8px 10px calc(14px + var(--safe-b)); }
  .toggle { height: 48px; font-size: 15px; }
  .done { border-radius: var(--r-lg); }
}
@media (max-width: 720px) {
  .play { display: flex; flex-direction: column; height: auto; min-height: 100dvh; }
  .stage { flex: 0 0 auto; padding: 14px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Scene previews and the circle reveal ---------- */
/* demo: the scene plays by itself inside a star's card, like a silent video loop */
body.demo { overflow: hidden; background: var(--paper); }
body.demo .play { display: block; height: 100vh; min-height: 0; }
body.demo .back, body.demo .play-head, body.demo .controls, body.demo .quiz, body.demo .done { display: none !important; }
body.demo .stage { position: absolute; inset: 0; padding: 0; }
body.demo .stage > svg { position: absolute; inset: 4px 4px 0; width: calc(100% - 8px); height: calc(100% - 4px); max-height: none; margin: 0; }
body.demo .readout:not([hidden]) { position: absolute; top: auto; bottom: 8px; right: 8px; margin: 0; display: block; transform: scale(.62); transform-origin: bottom right; z-index: 4; }

.card-media { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; margin: 2px 0 14px; border-radius: var(--r); overflow: hidden; background: var(--paper); border: 0; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.card-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.card-media .media-play { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px 0 10px; border-radius: 999px; background: rgba(14, 22, 64, .86); color: #fff; font-size: 13px; font-weight: 700; }
.card-media .media-play svg { width: 14px; height: 14px; fill: var(--gold); }
.card-media .media-tag { position: absolute; top: 10px; left: 10px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; }
.card-media:hover .media-play { background: var(--night-1); }
.card.has-media { width: 400px; }

.scene { position: fixed; inset: 0; z-index: 50; background: var(--paper); clip-path: circle(0 at var(--sx, 50%) var(--sy, 50%)); transition: clip-path .62s cubic-bezier(.65, 0, .35, 1); }
.scene.open { clip-path: circle(150vmax at var(--sx, 50%) var(--sy, 50%)); }
.scene iframe { width: 100%; height: 100%; border: 0; display: block; }
.scene-ring { position: fixed; z-index: 51; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 3px solid var(--red); pointer-events: none; animation: ping .62s ease-out forwards; }
@keyframes ping { from { transform: scale(.4); opacity: 1; } to { transform: scale(3); opacity: 0; } }

@media (max-width: 720px) {
  .card.has-media { width: auto; max-height: 72vh; }
  .card-media { margin-bottom: 12px; }
}
.card.has-media .card-close { z-index: 2; top: 24px; right: 26px; background: rgba(14, 22, 64, .86); color: #fff; }
.card.has-media .card-close:hover { background: var(--night-1); }
.card.has-media h2 { margin-right: 0; }

/* =========================================================
   Accounts, dashboards and admin (day theme, data-first)
   ========================================================= */
:root { --data: #2F64C2; --data-soft: rgba(47, 100, 194, .12); --ok: #1D7A4E; --warn: #A8740B; --bad: #B92F1C; }
.sr, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; flex: none; }
.dot-maths { background: #C98A12; } .dot-language { background: #D9533F; } .dot-science { background: #1D8F80; } .dot-social { background: #2F64C2; } .dot-life { background: #7C4FC4; }

.btn-quiet { background: transparent; border: 2px solid var(--line); color: var(--ink); height: 40px; padding: 0 14px; font-size: 14px; }
.btn-quiet:hover { border-color: var(--ink-2); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-block { width: 100%; height: 50px; font-size: 16px; }
.btn-play-day { background: var(--gold); color: #261B00; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* sky: account pill */
.pill-me { text-decoration: none; color: var(--star); }
.pill-me svg { fill: none; stroke: currentColor; stroke-width: 2; }
.me-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #261B00; display: grid; place-items: center; font-weight: 700; font-size: 12px; margin-left: -6px; }

/* ---------- sign in / sign up ---------- */
body.auth-page { min-height: 100vh; }
.auth { display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; min-height: 100vh; min-height: 100dvh; }
.auth-aside { background: radial-gradient(120% 90% at 30% 20%, var(--night-2) 0%, var(--night-1) 50%, var(--night-0) 100%); color: var(--star); padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; position: relative; overflow: hidden; }
.auth-aside::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(1.5px 1.5px at 20% 30%, #fff8, transparent), radial-gradient(1.5px 1.5px at 70% 15%, #FFD36B, transparent), radial-gradient(2px 2px at 85% 60%, #3DD6C0aa, transparent), radial-gradient(1.5px 1.5px at 35% 75%, #FF7A66aa, transparent), radial-gradient(1.5px 1.5px at 55% 45%, #fff6, transparent), radial-gradient(2px 2px at 12% 88%, #C79BFFaa, transparent), radial-gradient(1.5px 1.5px at 90% 90%, #74A9FFaa, transparent); pointer-events: none; }
.auth-pitch { margin-top: auto; margin-bottom: auto; position: relative; }
.auth-pitch h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 3vw, 40px); line-height: 1.1; margin: 0 0 18px; }
.auth-pitch ul { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 10px; color: #D3D8F5; font-size: 16px; }
.auth-pitch li::before { content: "★"; color: var(--gold); margin-right: 10px; }
.auth-note { color: var(--star-muted); font-size: 14px; margin: 0; }
.auth-by { margin: 0; font-size: 12px; letter-spacing: .1em; color: var(--star-muted); position: relative; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(440px, 100%); display: grid; gap: 14px; }
.auth-card h1 { font-family: var(--serif); font-weight: 600; font-size: 36px; margin: 0 0 4px; }
.auth-switch { margin: 0; text-align: center; font-size: 14px; color: var(--ink-2); }
.auth-switch a { color: var(--ink); font-weight: 700; }
.form-error { margin: 0; background: #FBE6E2; border: 1px solid #F0B9AE; color: var(--bad); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14.5px; }

.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-weight: 700; font-size: 14px; padding: 0; }
.field small { font-weight: 400; color: var(--ink-2); margin-left: 6px; }
.field input, .field select { height: 48px; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--card); padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); width: 100%; }
.field input:focus, .field select:focus { outline: none; border-color: var(--data); box-shadow: 0 0 0 3px var(--data-soft); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: grid; place-items: center; height: 46px; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--card); font-weight: 700; font-size: 14.5px; cursor: pointer; text-align: center; padding: 0 8px; }
.choice input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.choice input:focus-visible + span { outline: 3px solid var(--gold); }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.consent input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--ink); }
.consent a { color: var(--ink); }

/* press and hold */
.hold-btn { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 10px 14px 10px 10px; border-radius: var(--r); border: 2px dashed var(--line); background: var(--card); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
.hold-ring { width: 60px; height: 60px; flex: none; transform: rotate(-90deg); }
.hold-track { fill: none; stroke: var(--paper-2); stroke-width: 6; }
.hold-fill { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.hold-star { fill: var(--gold); transform: rotate(90deg); transform-origin: 32px 32px; transition: transform .2s; }
.hold-tick { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: rotate(90deg); transform-origin: 32px 32px; }
.hold-text { display: grid; gap: 2px; }
.hold-label { font-size: 16px; }
.hold-help { font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.hold.is-holding .hold-btn { border-style: solid; border-color: var(--gold); }
.hold.is-holding .hold-star { transform: rotate(90deg) scale(.86); }
.hold.is-done .hold-btn { border-style: solid; border-color: var(--ok); background: #E8F4EC; cursor: default; }
.hold.is-done .hold-fill { stroke: var(--ok); stroke-dashoffset: 0 !important; }
.hold.is-done .hold-star { opacity: 0; }
.hold.is-done .hold-tick { opacity: 1; }
.hold.is-done .hold-track { stroke: var(--ok); }
.hold.is-error .hold-btn { border-color: var(--bad); }
.hold.is-error .hold-help { color: var(--bad); }

/* ---------- top bar ---------- */
body.dash-page { background: var(--paper); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 10px 24px; background: rgba(245, 239, 227, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.wordmark-day { color: var(--ink); }
.wordmark-day .wordmark-star { fill: var(--ochre); }
.area { margin-left: 8px; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: var(--ink); color: var(--paper); padding: 3px 8px; border-radius: 999px; }
.topnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.topnav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.topnav a:hover { color: var(--ink); background: var(--paper-2); }
.topnav a[aria-current] { background: var(--ink); color: var(--paper); }
.topbar-out { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { font-size: 14px; color: var(--ink-2); }

/* ---------- dashboard layout ---------- */
.dash { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; display: grid; gap: 20px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.dash-head h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; margin: 0 0 8px; }
.dash-head .lede { margin: 0; font-size: 16px !important; color: var(--ink-2); max-width: 60ch; }
.filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filters-form { justify-content: flex-start; }
.field-inline input, .field-inline select { height: 42px; }
.seg-link { text-decoration: none; height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); font-weight: 700; font-size: 14px; color: var(--ink-2); background: var(--card); }
.seg-link[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.kpi-label { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.kpi-value { margin: 6px 0 4px; font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi-delta { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.kpi-delta .up { color: var(--ok); font-weight: 700; } .kpi-delta .down { color: var(--bad); font-weight: 700; } .kpi-delta .flat { font-weight: 700; }
.kpi-help { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); }
.stat-row { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat-row div { background: var(--card); padding: 12px 16px; }
.stat-row dt { font-size: 12.5px; color: var(--ink-2); }
.stat-row dd { margin: 2px 0 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.panel h2 { font-family: var(--sans); font-size: 17px; font-weight: 700; margin: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head .muted { margin: 0; font-size: 13px; }
.panel > p { font-size: 14.5px; }
.panel-danger { border-color: #F0B9AE; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.empty { color: var(--ink-2); font-size: 14.5px; padding: 18px 0; margin: 0; }
.insight { margin: 12px 0 0; font-size: 13.5px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 10px; }

.hbar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.hbar-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.hbar-label .dot { margin-right: 6px; }
.hbar-track { height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; width: 0; background: var(--data); border-radius: 999px; }
.hbar-val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hbar-val small { font-weight: 400; color: var(--ink-2); margin-left: 4px; }

.chart { width: 100%; min-height: 200px; }
.line-chart { display: block; overflow: visible; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .axis { stroke: #CFC3AA; stroke-width: 1; }
.line-chart .tick { font: 11.5px var(--sans); fill: var(--ink-2); }
.line-chart .line { fill: none; stroke: var(--data); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .area { fill: var(--data-soft); }
.line-chart .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.line-chart .dot-hover, .line-chart .dot-end { fill: var(--data); stroke: var(--card); stroke-width: 2; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--paper); font-size: 13px; padding: 6px 10px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.2); max-width: 280px; }
.as-table { margin-top: 10px; font-size: 14px; }
.as-table summary { cursor: pointer; color: var(--ink-2); }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl a { color: var(--ink); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-on { background: #E3F2E9; color: var(--ok); } .badge-off { background: #FBE6E2; color: var(--bad); } .badge-warn { background: #FBF0D6; color: var(--warn); }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.row-actions details summary { list-style: none; }
.row-actions details[open] form { margin-top: 10px; background: var(--paper); border-radius: var(--r-sm); padding: 12px; max-width: 420px; }

/* family / teacher dashboard */
.learners { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.lcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 16px; align-content: start; }
.lcard.is-active { border: 2px solid var(--ochre); box-shadow: 0 0 0 4px rgba(242, 179, 61, .15); }
.lcard-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.lcard-head h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0; }
.lcard-head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.lcard-head .btn { height: 40px; font-size: 14px; padding: 0 14px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--night-1); color: var(--gold); display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 20px; }
.mini-kpis { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-kpis div { background: var(--paper); border-radius: var(--r-sm); padding: 10px 12px; }
.mini-kpis dt { font-size: 12px; color: var(--ink-2); }
.mini-kpis dd { margin: 2px 0 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.subj-bars { display: grid; gap: 2px; }
.sbar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 13.5px; padding: 3px 0; }
.sbar-name { display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sbar-track { height: 8px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.sbar-fill { display: block; height: 100%; width: 0; background: var(--data); border-radius: 999px; }
.sbar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.lcard-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.star-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.star-list a { color: var(--ink); text-decoration: none; display: flex; align-items: baseline; }
.star-list a .dot { flex: none; }
.star-list a:hover { text-decoration: underline; }
.star-list small { color: var(--ink-2); margin-left: 17px; display: block; font-size: 12px; }
.tag-play { font-size: 11px; font-weight: 700; background: var(--gold); color: #261B00; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.lcard-remove { font-size: 13.5px; color: var(--ink-2); }
.lcard-remove summary { cursor: pointer; }
.lcard-remove form { margin-top: 8px; }
.add-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.add-form .field { flex: 1 1 200px; }
.add-form .btn { height: 48px; }
.inline-form { margin-top: 12px; }
.panel details summary { cursor: pointer; font-weight: 700; font-size: 14.5px; }

@media (max-width: 960px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { padding: 18px 20px; gap: 10px; }
  .auth-pitch { margin: 6px 0 0; }
  .auth-pitch h2 { font-size: 22px; margin-bottom: 8px; }
  .auth-pitch ul, .auth-by { display: none; }
  .auth-main { padding: 20px 16px 40px; align-items: start; }
  .auth-card h1 { font-size: 30px; }
  .grid-2, .grid-3, .kpis { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .pill-me .me-text { display: none; }
  .pill-me { padding: 0 9px; }
  .pill-me .me-dot { margin-left: 0; }
  .topbar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .topnav { order: 3; width: 100%; }
  .who { display: none; }
  .dash { padding: 18px 12px 60px; gap: 14px; }
  .kpi-value { font-size: 36px; }
  .learners { grid-template-columns: 1fr; }
  .lcard-head { grid-template-columns: auto 1fr; }
  .lcard-head form { grid-column: 1 / -1; }
  .lcard-head form .btn { width: 100%; }
  .lcard-lists { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: minmax(0, 1fr) 80px auto; }
}
