/* ============================================================ tokens */
:root {
  --bg: #fff8ef;
  --surface: #ffffff;
  --surface-2: #fdf2e4;
  --text: #22254a;
  --muted: #5d6286;
  --border: #eadfce;
  --primary: #5b4cf0;
  --primary-hover: #4a3bd8;
  --primary-soft: #ecebff;
  --on-primary: #ffffff;
  --coral: #ff6b4a;
  --sun: #ffc23d;
  --mint: #1fae6b;
  --sky: #2d9cdb;
  --right: #138a52;
  --right-soft: #e3f7ec;
  --wrong: #d23c3c;
  --wrong-soft: #fdeaea;
  --on-wrong: #ffffff;
  --donate: #c93f22; /* white text 5:1 (the brand coral #ff6b4a is too light behind white text) */
  --on-donate: #ffffff;
  --on-bubble: #ffffff;
  --lvl-kindergarten: #e2508b;
  --lvl-primary: #f07a2a;
  --lvl-middle: #1a9e60;
  --lvl-high: #2d8fdb;
  --lvl-college: #8a4cf0;
  --diagram-fill: #ecebff;
  --shadow: 0 1px 2px rgba(34, 37, 74, .06), 0 8px 24px rgba(34, 37, 74, .08);
  --radius: 18px;
  --font: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

/* The dark palette, every token spelled out (none falls back to a light value), checked for WCAG AA contrast:
   text at least 4.5:1 on --bg, --surface, --surface-2 and its own soft tint (3:1 for large text), measured page by page
   (README: "Dark mode"). --primary on --primary-soft 4.8:1; the level colours 5.3–6.5:1 on --surface-2; --muted 6.6:1.
   Used when the device asks for dark (unless a page sets data-theme="light"), or always with data-theme="dark". */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141631;
    --surface: #1d2044;
    --surface-2: #252957;
    --text: #f1f1fb;
    --muted: #a9acd0;
    --border: #30356a;
    --primary: #9a8fff;
    --primary-hover: #aaa1ff;
    --primary-soft: #2b2a63;
    --on-primary: #12132b;
    --coral: #ff6b4a;
    --sun: #ffc23d;
    --mint: #3cc985;
    --sky: #5fb1f0;
    --right: #4fd394;
    --right-soft: #183c33;
    --wrong: #ff7b7b;
    --wrong-soft: #45202b;
    --on-wrong: #12132b;
    --donate: #c93f22;
    --on-donate: #ffffff;
    --lvl-kindergarten: #f47aa9;
    --lvl-primary: #ff9a52;
    --lvl-middle: #3cc985;
    --lvl-high: #5fb1f0;
    --lvl-college: #b18cff;
    --on-bubble: #12132b;
    --diagram-fill: #2b2a63;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141631;
  --surface: #1d2044;
  --surface-2: #252957;
  --text: #f1f1fb;
  --muted: #a9acd0;
  --border: #30356a;
  --primary: #9a8fff;
  --primary-hover: #aaa1ff;
  --primary-soft: #2b2a63;
  --on-primary: #12132b;
  --coral: #ff6b4a;
  --sun: #ffc23d;
  --mint: #3cc985;
  --sky: #5fb1f0;
  --right: #4fd394;
  --right-soft: #183c33;
  --wrong: #ff7b7b;
  --wrong-soft: #45202b;
  --on-wrong: #12132b;
  --donate: #c93f22;
  --on-donate: #ffffff;
  --lvl-kindergarten: #f47aa9;
  --lvl-primary: #ff9a52;
  --lvl-middle: #3cc985;
  --lvl-high: #5fb1f0;
  --lvl-college: #b18cff;
  --on-bubble: #12132b;
  --diagram-fill: #2b2a63;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ============================================================== base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 900; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; font-weight: 800; }
p { margin: 0 0 1em; }
a { color: var(--primary); font-weight: 700; }
a:hover { color: var(--primary-hover); }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; font-size: .95em; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding-top: 28px; padding-bottom: 64px; }
#app:focus, #app:focus-visible { outline: none; }
.muted { color: var(--muted); }
.tiny { font-size: .85rem; margin: .4em 0 0; }
.center { text-align: center; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 800; color: var(--coral); margin-bottom: .4em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 10px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ===================================================== maths input */
/* The WYSIWYG maths field (js/mathinput.js), its keypad (js/mathinput-keypad.js) and its lab page (js/mathinput-lab.js,
   #/lab/math-input). Rows are inline; a fraction is a two-row grid whose bar sits on the maths axis; roots and brackets
   draw an SVG that stretches to their contents. The frame (.mi) does not clip, so the touch caret handle can hang below
   it; .mi-scroll scrolls sideways, with a fade on a side that has more. */
.mi { position: relative; display: block; min-width: 0; max-width: 100%; min-height: 3.2rem; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); cursor: text; font-size: 1.4rem; line-height: 1.35; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.mi:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.mi.mi-focus, .mi.mi-kp { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.mi-scroll { display: block; overflow-x: auto; overflow-y: hidden; padding: 10px 14px; border-radius: 10px; scrollbar-width: thin; }
.mi::before, .mi::after { content: ''; position: absolute; top: 0; bottom: 0; width: 22px; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .15s; }
.mi::before { left: 0; border-radius: 10px 0 0 10px; background: linear-gradient(to right, var(--surface) 25%, transparent); }
.mi::after { right: 0; border-radius: 0 10px 10px 0; background: linear-gradient(to left, var(--surface) 25%, transparent); }
.mi.mi-more-l::before, .mi.mi-more-r::after { opacity: 1; }
.mi-box { display: inline-block; white-space: nowrap; padding: .15em 0; }
.mi-ta { position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; resize: none; overflow: hidden; pointer-events: none; font-size: 16px; }
.mi-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mi-row { display: inline-block; }
.mi-n, .mi-op, .mi-rel, .mi-comma, .mi-sym, .mi-fn { font-family: KaTeX_Main, 'Times New Roman', serif; }
.mi-v { font-family: KaTeX_Math, 'Times New Roman', serif; font-style: italic; padding-right: .04em; }
.mi-fn { margin-right: .12em; }
.mi-op { margin: 0 .22em; }
.mi-op.mi-sign { margin: 0 .06em 0 0; }
.mi-rel { margin: 0 .3em; }
.mi-comma { margin-right: .3em; }
/* an empty block: a dashed box to type into */
.mi-empty { min-width: .7em; border: 1px dashed color-mix(in srgb, var(--muted) 70%, transparent); border-radius: 3px; background: color-mix(in srgb, var(--primary) 6%, transparent); }
.mi-empty::after { content: '\200b'; }
.mi-top.mi-empty { border: 0; background: none; min-width: 0; }
.mi-top.mi-empty::after { content: attr(data-ph); color: var(--muted); font-family: var(--font); font-size: .75em; }
/* fractions: two equal rows, so the bar (the top of row 2) is the middle of the box, which vertical-align puts on the
   maths axis whatever the heights of the numerator and denominator */
.mi-frac { display: inline-grid; grid-template-rows: 1fr 1fr; vertical-align: middle; margin: 0 .1em; }
.mi-frac::before { content: ''; grid-area: 2 / 1; align-self: start; border-top: 2px solid currentColor; }
.mi-frac > .mi-row { grid-column: 1; text-align: center; padding: 0 .12em; }
.mi-frac > .mi-num { grid-row: 1; align-self: end; padding-bottom: .06em; }
.mi-frac > .mi-den { grid-row: 2; align-self: start; padding-top: calc(2px + .06em); }
.mi-frac > .mi-empty { justify-self: center; min-width: .9em; }
.mi-frac > .mi-den.mi-empty { margin-top: calc(2px + .06em); padding-top: 0; }
.mi-frac .mi-frac { font-size: .88em; }
/* powers and subscripts (a power on a tall base is raised further by the script) */
.mi-pow, .mi-subs { display: inline-block; font-size: .7em; }
.mi-pow { vertical-align: .62em; }
.mi-subs { vertical-align: -.4em; }
.mi-pow .mi-pow, .mi-pow .mi-subs, .mi-subs .mi-subs, .mi-subs .mi-pow { font-size: .85em; }
/* roots */
.mi-sqrt { position: relative; display: inline-block; padding-left: .62em; margin-right: .06em; }
.mi-surd { position: absolute; left: 0; top: 0; bottom: 0; width: .66em; }
.mi-surd svg, .mi-br svg { display: block; width: 100%; height: 100%; overflow: visible; }
.mi-surd path, .mi-br path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mi-rad { border-top: 2px solid currentColor; padding: .08em .1em 0 .06em; }
.mi-nroot { display: inline-block; }
.mi-idx { position: relative; z-index: 1; min-width: .9em; margin-right: -.62em; font-size: .55em; vertical-align: 1.05em; text-align: right; }
.mi-idx.mi-empty { min-width: .7em; }
/* brackets */
.mi-paren { position: relative; display: inline-block; padding: 0 .36em; }
.mi-br { position: absolute; top: .02em; bottom: .02em; width: .3em; }
.mi-brl { left: .02em; }
.mi-brr { right: .02em; }
.mi-abs { padding: 0 .26em; }
.mi-abs .mi-br { width: .2em; }
/* caret, selection and the touch caret handle (a drop below the caret; 44px to grab) */
.mi-caret { display: inline-block; width: 0; height: 1.15em; margin-right: -2px; vertical-align: -.22em; border-left: 2px solid var(--primary); visibility: hidden; }
.mi-focus .mi-caret, .mi-kp .mi-caret { visibility: visible; animation: mi-blink 1.06s steps(1) infinite; }
.mi-grab .mi-caret { animation: none; }
@keyframes mi-blink { 50% { opacity: 0; } }
.mi-sel { background: color-mix(in srgb, var(--primary) 26%, transparent); border-radius: 3px; }
.mi-handle { position: absolute; z-index: 3; display: none; width: 44px; height: 44px; margin-left: -22px; touch-action: none; cursor: grab; }
.mi-handle-on .mi-handle { display: block; }
.mi-handle::before { content: ''; position: absolute; left: 11px; top: 9px; width: 22px; height: 22px; border-radius: 0 50% 50% 50%; transform: rotate(45deg); background: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
@media (prefers-reduced-motion: reduce) { .mi-focus .mi-caret, .mi-kp .mi-caret { animation: none; } .mik-track { transition: none !important; } }
/* the keypad: tabs and tools on top; pages of keys (swipe) beside a column of ⌫ ← → ↵ */
.mik { max-width: 36rem; margin-top: 8px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
.mik-bar { display: flex; align-items: center; gap: 4px; }
.mik-tabs { display: flex; flex: 1; gap: 4px; min-width: 0; }
.mik-tab, .mik-tool { min-width: 44px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: 800 .95rem var(--font); cursor: pointer; }
.mik-tool { font-size: 1.15rem; }
.mik-fold { font-size: .9rem; white-space: nowrap; }
.mik-tab:hover, .mik-tool:hover { color: var(--text); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.mik-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: inset 0 -3px 0 var(--primary); }
.mik-body { display: grid; gap: 6px; margin-top: 6px; }
.mik-body[hidden] { display: none; }
.mik-pages { min-width: 0; overflow: hidden; touch-action: pan-y; }
.mik-track { display: flex; transition: transform .25s ease; }
.mik-page { display: grid; flex: 0 0 100%; grid-auto-rows: 50px; gap: 6px; }
.mik-nav { display: grid; grid-auto-rows: 50px; gap: 6px; }
.mik-key { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0; border: 0; border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 1px 0 var(--border), 0 1px 2px rgba(34, 37, 74, .08); font: 400 1.4rem/1 KaTeX_Main, 'Times New Roman', serif; cursor: pointer; touch-action: manipulation; }
.mik-key i { font-family: KaTeX_Math, 'Times New Roman', serif; }
.mik-key sup, .mik-key sub { font-size: .62em; line-height: 0; }
.mik-key sup { vertical-align: .75em; }
.mik-key sup .mik-bx, .mik-key sub .mik-bx { vertical-align: baseline; }
.mik-op { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); }
.mik-nav .mik-key { background: color-mix(in srgb, var(--muted) 13%, var(--surface)); font-family: var(--font); }
.mik-nav .mik-enter { background: var(--primary); color: var(--on-primary); font-weight: 800; }
.mik-key:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }
.mik-key.mik-down { background: color-mix(in srgb, var(--primary) 26%, var(--surface)); transform: translateY(1px); }
.mik-nav .mik-enter.mik-down { background: var(--primary-hover); }
.mik-key:focus-visible, .mik-tab:focus-visible, .mik-tool:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; position: relative; z-index: 1; }
.mik-bx { display: inline-block; width: .56em; height: .66em; border: 1.5px solid currentColor; border-radius: 2px; opacity: .7; vertical-align: middle; }
.mik-fr { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; vertical-align: middle; }
.mik-fr .mik-bx { width: .5em; height: .5em; }
.mik-ln { display: block; width: .9em; border-top: 2px solid currentColor; }
.mik-blank { visibility: hidden; }
/* Windows high contrast and other forced colours: borders and system colours where the look relied on fills */
@media (forced-colors: active) {
  .mi.mi-focus, .mi.mi-kp { outline: 2px solid Highlight; outline-offset: 2px; }
  .mi-caret { border-color: CanvasText; }
  .mi-sel { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .mi-empty { border-color: CanvasText; }
  .mi-handle::before { forced-color-adjust: none; background: Highlight; }
  .mik { border-color: CanvasText; }
  .mik-key, .mik-tab, .mik-tool { border: 1px solid ButtonText; }
  .mik-tab[aria-selected="true"] { border: 3px solid Highlight; }
  .mik-key.mik-down { border-color: Highlight; }
}
/* the lab page */
.mil-card { display: grid; gap: 12px; }
.mil-label { margin: 0; font-weight: 800; }
.mil-layouts { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0; padding: 0; border: 0; }
.mil-layouts legend { float: left; margin-right: 6px; font-weight: 800; color: var(--muted); }
.mil-layouts label { display: inline-flex; gap: 6px; align-items: center; min-height: 32px; cursor: pointer; }
.mil-vars { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.mil-vars label { font-weight: 800; color: var(--muted); }
.mil-vars input { width: 8em; padding: 6px 10px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: 1rem ui-monospace, monospace; }
.mil-out { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.mil-out dt { font-weight: 800; color: var(--muted); }
.mil-out dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mil-tree pre { max-height: 320px; overflow: auto; font-size: .8rem; background: var(--surface-2); padding: 10px; border-radius: 10px; }
.mil-form { display: flex; gap: 8px; flex-wrap: wrap; }
.mil-src { flex: 1 1 200px; min-width: 0; padding: 8px 12px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: 1rem ui-monospace, monospace; }
.mil-examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 0; }
.mil-ex { font-family: ui-monospace, monospace; font-weight: 600; }
@media (max-width: 520px) { .mil-out { grid-template-columns: 1fr; gap: 2px; } .mil-out dd { margin-bottom: 8px; } .mik-fold-t { display: none; } }
/* typed answers in questions (phase 3): practice, My Way, check sets and placement (.expr-answer), long answers (.sa-mi),
   worksheets (.ws-expr). An answered field is read-only: no caret, the answer's colour on the frame. */
.expr-answer { display: block; max-width: 560px; margin: 4px 0 2px; }
.expr-answer .mik { margin-top: 10px; }
.mi.is-right { border-color: var(--right); background: var(--right-soft); }
.mi.is-wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.mi.mi-ro { cursor: default; }
.mi.mi-ro .mi-caret, .mi.mi-ro .mi-handle { display: none; }
.sa-mi { display: block; width: min(100%, 420px); margin-top: 6px; }
.sa-exprline .sa-work { display: block; }
.sa-exprline .mik { margin-top: 8px; }
.ws-expr { display: inline-block; vertical-align: middle; width: min(100%, 320px); }
.ws-expr .mi { font-size: 1.2rem; min-height: 2.8rem; }
.ws-expr .mik { margin-top: 8px; }
@media print { .ws-expr, .expr-answer .mik { display: none; } }
/* ================================================= end maths input */

/* =========================================================== header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-mark {
  display: grid; place-items: center; width: 48px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--coral), var(--sun)); color: #fff; font-weight: 900; font-size: .9rem; letter-spacing: -.02em;
  transform: rotate(-6deg); box-shadow: 0 3px 0 rgba(0, 0, 0, .12);
}
.logo-text { font-weight: 900; font-size: 1.3rem; }
.logo-text span { color: var(--primary); }
.site-nav { display: flex; gap: 4px; }
.site-nav a { text-decoration: none; color: var(--muted); padding: 8px 14px; border-radius: 999px; font-weight: 800; }
.site-nav a:hover { background: var(--surface-2); color: var(--text); }
.site-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
/* the syllabus switch in the header */
.syl-switch { position: relative; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.seg.lang-switch { flex-wrap: nowrap; box-shadow: none; padding: 3px; gap: 2px; border-radius: 12px; }
.seg.lang-switch .seg-btn { padding: 6px 12px; font-weight: 900; border-radius: 9px; }
.syl-pop .lang-switch { display: inline-flex; margin: 6px 0 4px; }
.syl-pop-head-2 { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.site-nav a { white-space: nowrap; }
@media (min-width: 901px) and (max-width: 1100px) { .site-nav { gap: 0; } .site-nav a { padding: 8px 9px; } .header-inner { gap: 10px; } }
@media (min-width: 901px) and (max-width: 980px) { .site-nav a { padding: 8px 6px; font-size: .95rem; } }
.syl-chip { display: grid; justify-items: start; gap: 0; padding: 4px 12px 5px; border: 2px solid var(--primary); border-radius: 12px; background: var(--primary-soft); color: var(--text); font: inherit; cursor: pointer; line-height: 1.2; }
.syl-chip:hover { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }
.syl-chip:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.syl-chip-label { font-size: .64rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); }
.syl-chip-name { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: .95rem; white-space: nowrap; }
.syl-caret { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: -3px 0 0 2px; }
.syl-chip[aria-expanded="true"] .syl-caret { transform: rotate(-135deg); margin-top: 3px; }
.syl-pop { position: absolute; top: calc(100% + 8px); left: 0; width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 100px); overflow: auto; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; z-index: 30; }
.syl-pop-head { font-weight: 900; font-size: 1.05rem; margin: 0 0 2px; }
.syl-options { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.syl-option { width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 10px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.syl-option:hover { border-color: var(--primary); }
.syl-option[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.syl-option-badge { width: 2.4em; flex-shrink: 0; text-align: center; font-size: 1.1rem; }
.syl-option-text { flex: 1; display: grid; gap: 2px; }
.syl-option-text strong { font-size: .95rem; }
.syl-option-text span { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.syl-check { font-weight: 900; color: var(--primary); width: 1em; }
@media (max-width: 900px) {
  .syl-pop { position: fixed; top: 74px; left: 16px; right: 16px; width: auto; }
}
/* Small phones: tighten the header so logo, syllabus, language and menu fit on one row. */
@media (max-width: 420px) {
  .header-inner { gap: 6px; }
  .syl-switch { gap: 4px; }
  .logo-mark { width: 42px; font-size: .8rem; }
  .syl-chip { padding: 3px 8px 4px; }
  .syl-chip-name { font-size: .88rem; gap: 4px; }
  .seg.lang-switch .seg-btn { padding: 5px 6px; font-size: .85rem; }
  .nav-toggle { width: 40px; flex-shrink: 0; }
}
/* 360px phones with the syllabus chip and the EN/ID switch: the chip's badge goes (the name says it), and a long
   syllabus name shortens with "…" rather than push the menu button off the screen. */
@media (max-width: 380px) {
  .syl-switch, .syl-chip, .syl-chip-name { min-width: 0; }
  .syl-chip { grid-template-columns: minmax(0, 1fr); }
  .syl-chip-name > span:not([class]) { overflow: hidden; text-overflow: ellipsis; }
  .syl-chip .syl-badge { display: none; }
}
/* The full name needs room: drop it where the header gets tight and keep the MBG mark. */
@media (max-width: 520px), (min-width: 901px) and (max-width: 1099px) {
  .logo-text { display: none; }
}
.nav-toggle { display: none; background: none; border: 2px solid var(--border); color: var(--text); border-radius: 10px; font-size: 1.2rem; width: 44px; height: 40px; cursor: pointer; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px 16px; box-shadow: var(--shadow); }
  .nav-open .site-nav { display: flex; }
}
/* "A new version is ready. Reload" (js/pwa.js): one quiet line under the header; it never reloads by itself. */
.update-line { background: var(--primary-soft); color: var(--text); font-size: .95rem; border-bottom: 1px solid var(--border); }
.update-line .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding-top: 6px; padding-bottom: 6px; }
.update-reload { font: inherit; font-weight: 800; color: var(--primary); background: none; border: 0; padding: 4px 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.update-reload:hover { color: var(--primary-hover); }
@media print { .update-line { display: none; } }

/* =========================================================== footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0; font-size: .95rem; }
.site-footer p { margin: .2em 0; }

/* ========================================================== buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; border-radius: 14px; padding: 10px 18px; line-height: 1.2;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 0 color-mix(in srgb, var(--primary) 60%, #000); }
.btn.primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn.primary:active { box-shadow: 0 2px 0 color-mix(in srgb, var(--primary) 60%, #000); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.danger { background: var(--wrong); color: var(--on-wrong); }
.btn.lg { padding: 14px 24px; font-size: 1.05rem; }
.btn.sm { padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.cta-row.center { justify-content: center; }

/* ============================================================= hero */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; padding: 24px 0 40px; }
.hero h1 { font-size: clamp(2.1rem, 5.4vw, 3.5rem); }
.hl { padding: 0 .15em; border-radius: 10px; white-space: nowrap; }
.hl-1 { background: color-mix(in srgb, var(--sun) 55%, transparent); }
.hl-2 { background: color-mix(in srgb, var(--coral) 35%, transparent); }
.hero-art { position: relative; height: 340px; }
.bubble {
  position: absolute; display: grid; place-items: center; border-radius: 50%;
  font-weight: 900; color: var(--on-bubble); box-shadow: 0 6px 0 rgba(0, 0, 0, .12);
  animation: bob 6s ease-in-out infinite;
}
.b1 { width: 120px; height: 120px; left: 4%; top: 6%; background: var(--lvl-primary); font-size: 1.5rem; }
.b2 { width: 88px; height: 88px; left: 44%; top: 0; background: var(--mint); font-size: 2.4rem; animation-delay: -1s; }
.b3 { width: 104px; height: 104px; right: 2%; top: 14%; background: var(--sky); font-size: 2.2rem; animation-delay: -2s; }
.b4 { width: 80px; height: 80px; left: 30%; top: 40%; background: var(--coral); font-size: 2.3rem; animation-delay: -3s; }
.b5 { width: 70px; height: 70px; right: 30%; top: 50%; background: var(--sun); color: var(--text); font-size: 2rem; animation-delay: -1.5s; }
.b6 { width: 128px; height: 128px; right: 4%; bottom: 0; background: var(--lvl-college); font-size: 3.4rem; animation-delay: -2.5s; }
.b7 { width: 92px; height: 92px; left: 6%; bottom: 6%; background: var(--primary); font-size: 2.4rem; animation-delay: -4s; }
.b8 { width: 62px; height: 62px; left: 46%; bottom: 2%; background: var(--lvl-high); font-size: 1.6rem; animation-delay: -.5s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { height: 200px; order: -1; }
  .hero-art .bubble { transform: scale(.7); animation: none; }
}

/* ============================================================ stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 0 0 40px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-num { display: block; font-size: 1.6rem; font-weight: 900; }
.stat-label { color: var(--muted); font-weight: 700; font-size: .9rem; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================== how */
.how, .journey { margin: 8px 0 48px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.how-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.how-card p { color: var(--muted); margin: 0; }
.how-num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-weight: 900; margin-bottom: 12px; }
.how-card:nth-child(2) .how-num { background: color-mix(in srgb, var(--coral) 18%, transparent); color: var(--coral); }
.how-card:nth-child(3) .how-num { background: color-mix(in srgb, var(--mint) 18%, transparent); color: var(--mint); }
@media (max-width: 800px) { .how-grid { grid-template-columns: 1fr; } }

/* ========================================================== journey */
.journey-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.journey-card {
  --stage: var(--primary);
  display: flex; flex-direction: column; text-decoration: none; color: var(--text); font-weight: 400;
  background: var(--surface); border: 1px solid var(--border); border-top: 6px solid var(--stage);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: transform .15s ease;
}
.journey-card:hover { transform: translateY(-3px); color: var(--text); }
.journey-card p { color: var(--muted); font-size: .95rem; }
.journey-step { font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--stage); }
.journey-icons { font-size: 1.3rem; display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.journey-count { font-weight: 800; color: var(--stage); font-size: .9rem; }
.lvl-kindergarten { --stage: var(--lvl-kindergarten); }
.lvl-primary { --stage: var(--lvl-primary); }
.lvl-middle { --stage: var(--lvl-middle); }
.lvl-high { --stage: var(--lvl-high); }
.lvl-college { --stage: var(--lvl-college); }
@media (max-width: 1000px) { .journey-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .journey-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .journey-grid { grid-template-columns: 1fr; } }

/* ========================================================== catalog */
.page-head { margin-bottom: 28px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.stage { margin-bottom: 44px; scroll-margin-top: 84px; }
.stage-head { border-left: 6px solid var(--stage); padding-left: 14px; margin-bottom: 18px; }
.stage-head h2 { margin-bottom: .15em; }
.stage-head p { margin: 0; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.course-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--text); font-weight: 400;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.course-card:hover { transform: translateY(-3px); border-color: var(--stage); color: var(--text); }
.course-card h3 { margin: 10px 0 4px; }
.course-card > p { color: var(--muted); font-size: .95rem; margin-bottom: .6em; }
.course-card.status-locked, .course-card.status-soon { background: var(--surface-2); }
.course-card.status-locked .course-icon, .course-card.status-soon .course-icon { filter: grayscale(.9); opacity: .7; }
.course-card.status-mastered { border-color: color-mix(in srgb, var(--mint) 60%, var(--border)); }
.course-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.course-icon {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; font-size: 1.7rem; font-weight: 900;
  background: color-mix(in srgb, var(--stage) 16%, var(--surface)); color: var(--stage); flex-shrink: 0;
}
.course-icon.xl { width: 84px; height: 84px; font-size: 2.8rem; border-radius: 22px; }

/* folding sections: a level, a syllabus stage or a strand */
.fold { margin-bottom: 14px; scroll-margin-top: 84px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--surface-2); }
.fold > summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.fold > summary .stage-head { flex: 1; margin: 0; display: grid; gap: 2px; min-width: 0; }
.fold-title { font-size: 1.3rem; font-weight: 900; color: var(--text); }
.strand > summary .fold-title { font-size: 1.1rem; flex: 1; }
.fold-progress { display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 800; color: var(--muted); margin-top: 4px; }
.fold-progress .pbar { width: 120px; min-width: 0; height: 8px; }
.fold-chev { width: 12px; height: 12px; border-right: 3px solid var(--muted); border-bottom: 3px solid var(--muted); transform: rotate(45deg); transition: transform .15s ease; flex-shrink: 0; margin: 0 6px 6px 0; }
.fold[open] > summary .fold-chev { transform: rotate(-135deg); margin: 6px 6px 0 0; }
.fold-body { padding: 4px 16px 16px; }
.fold.stage { border-left: 6px solid var(--stage); }
.fold.stage > summary .stage-head { border-left: 0; padding-left: 0; }
.later { margin-top: 12px; }
.later > summary { cursor: pointer; font-weight: 800; color: var(--muted); padding: 10px 12px; border: 2px dashed var(--border); border-radius: 14px; }
.later > summary:hover { color: var(--text); border-color: var(--muted); }
.later[open] > summary { margin-bottom: 10px; }
.fold.strand { margin-bottom: 12px; }
.fold.strand > summary .fold-title { font-size: 1.15rem; }
.year-grid:has(.year-done) { align-items: start; }
.legend-box { margin-top: 10px; }
.lang-note { font-size: .88rem; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border); border-radius: 12px; padding: 8px 12px; margin: 8px 0 14px; }
.legend-box > summary { cursor: pointer; font-weight: 800; color: var(--primary); margin-bottom: 8px; width: fit-content; }

/* compact course tiles */
.course-grid:has(.course-tile) { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.course-tile { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 400; min-height: 64px; transition: border-color .15s ease, transform .15s ease; }
.course-tile:hover { border-color: var(--stage); color: var(--text); transform: translateY(-1px); }
.course-icon.sm { width: 40px; height: 40px; font-size: 1.3rem; border-radius: 11px; }
.tile-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.tile-title { font-weight: 800; line-height: 1.25; }
.tile-sub { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.tile-body .pbar { height: 6px; min-width: 0; max-width: 140px; }
.tile-status { font-size: 1.05rem; flex-shrink: 0; }
.course-tile.status-locked, .course-tile.status-soon { background: var(--surface-2); color: var(--muted); }
.course-tile.status-locked .course-icon, .course-tile.status-soon .course-icon { filter: grayscale(.9); opacity: .6; }
.course-tile.status-locked .tile-title { color: var(--muted); }
.course-tile.status-mastered { border-color: color-mix(in srgb, var(--mint) 45%, var(--border)); }
.course-tile.status-gap { border-color: color-mix(in srgb, var(--coral) 60%, var(--border)); }
.course-tile.status-assumed, .course-tile.status-review { border-style: dashed; }
.course-tile.is-current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.course-tile.is-current .tile-sub { color: var(--primary); font-weight: 800; }

/* home: you are here */
.now { background: var(--surface); border: 2px solid var(--border); border-top: 6px solid var(--stage); border-radius: var(--radius); padding: 22px; margin: 8px 0 28px; box-shadow: var(--shadow); }
.now .eyebrow { color: var(--stage); }
.now-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.now-head h1 { font-size: clamp(1.5rem, 5vw, 2.1rem); margin: 0; }
.now-head h1 a { color: inherit; text-decoration: none; }
.now-head p { margin: 2px 0 0; }
.path-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 2px; }
.path-steps li { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--muted); position: relative; }
.path-steps li:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 34px; bottom: -8px; width: 2px; background: var(--border); }
.path-steps .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; border: 2px solid var(--border); background: var(--surface); font-size: .8rem; font-weight: 900; z-index: 1; }
.path-steps .done { color: var(--text); }
.path-steps .done .dot { background: var(--right-soft); border-color: var(--right); color: var(--right); }
.path-steps .next { color: var(--text); font-weight: 800; }
.path-steps .next .dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.now-opens { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 6px; }

/* course page: the topic to do next */
.topic.is-next { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.next-label { margin: 0 0 2px; font-size: .78rem; font-weight: 900; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; }
.needs { font-size: .85rem; color: var(--muted); margin-top: auto; }
.needs span { font-weight: 800; color: var(--text); }
.needs span.met { color: var(--right); }
.needs span.met::before { content: '✓ '; }

/* ============================================================= pills */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.pill-open { background: var(--primary-soft); color: var(--primary); }
.pill-progress { background: color-mix(in srgb, var(--sun) 28%, var(--surface)); color: var(--text); }
.pill-mastered { background: var(--right-soft); color: var(--right); }
.pill-locked { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.pill-prereq { background: var(--surface-2); color: var(--text); border-color: var(--border); white-space: nowrap; }
a.pill-prereq { text-decoration: none; }
a.pill-prereq:hover { border-color: var(--primary); }
/* A course whose prerequisites aren't met: open, so not greyed out, only set back a little. */
.course-tile.status-unmet, .course-tile.status-unknown { background: var(--surface-2); }
.prereq-notice { border-style: dashed; }
.prereq-notice .prereq-list li { flex-wrap: nowrap; align-items: baseline; }
.prereq-notice h2 { margin-top: 0; }
.prereq-note { margin: 10px 0; padding: 10px 14px; font-size: .95rem; }
.skip-quiz { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-weight: 700; cursor: pointer; }
.skip-quiz input { width: 20px; height: 20px; flex: none; }
.mw-offer h1 { margin-top: 4px; }
.pill-soon { background: transparent; color: var(--muted); border: 1px dashed var(--border); }

/* ============================================================== bar */
.pbar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; min-width: 80px; border: 1px solid var(--border); }
.pbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--sky)); border-radius: 999px; transition: width .3s ease; }

/* ====================================================== course page */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .9rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { text-decoration: none; }
.course-head { display: flex; gap: 22px; align-items: flex-start; margin-bottom: 26px; }
.course-head .lead { margin-bottom: .6em; }
.course-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.course-meta .pbar { width: 200px; }
@media (max-width: 600px) { .course-head { flex-direction: column; gap: 12px; } }

.notice { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 26px; }
.notice h2 { font-size: 1.25rem; }
.notice p:last-child { margin-bottom: 0; }
.notice.success { border-color: color-mix(in srgb, var(--mint) 55%, var(--border)); background: var(--right-soft); }
.locked-notice { border-style: dashed; }
.prereq-list { list-style: none; padding: 0; margin: 0 0 1em; display: grid; gap: 8px; }
.prereq-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.topic-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.topic { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.topic.soon { background: transparent; box-shadow: none; border-style: dashed; }
.topic.soon h3 { color: var(--muted); }
.topic h3 { margin: 0 0 2px; }
.topic p { margin: 0; font-size: .95rem; }
.topic-num { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 900; flex-shrink: 0; }
.topic.done .topic-num { background: var(--right); color: #fff; }
.topic.soon .topic-num { background: var(--surface-2); color: var(--muted); }
.topic-body { flex: 1; min-width: 0; }
.topic-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  .topic { flex-wrap: wrap; }
  .topic-body { flex-basis: calc(100% - 60px); }
  .topic-actions { width: 100%; justify-content: flex-start; padding-left: 54px; }
}

/* ============================================================ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: clamp(20px, 4vw, 40px); box-shadow: var(--shadow); margin-bottom: 24px; }

/* =========================================================== lesson */
.lesson { max-width: 820px; margin: 0 auto; }
.lesson-body { font-size: 1.05rem; }
.lesson-body h3 { margin-top: 1.6em; color: var(--primary); }
.lesson-body ul, .lesson-body ol { padding-left: 1.4em; }
.lesson-body li { margin-bottom: .35em; }
.example { background: var(--surface-2); border-left: 5px solid var(--sky); border-radius: 0 14px 14px 0; padding: 16px 20px; margin: 1.2em 0; }
.example p:last-child, .example ol:last-child { margin-bottom: 0; }
.ex-title { font-weight: 900; color: var(--sky); margin-bottom: .5em; }
.callout { background: color-mix(in srgb, var(--sun) 20%, var(--surface)); border-radius: 14px; padding: 14px 18px; margin: 1.2em 0; }
.formula { text-align: center; font-size: 1.25rem; padding: 14px; background: var(--primary-soft); border-radius: 14px; overflow-x: auto; }
.formulas { border-collapse: collapse; width: 100%; margin: 1em 0; }
.formulas th, .formulas td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.formulas th { white-space: nowrap; width: 1%; color: var(--primary); }
.type-tip { font-size: .95rem; color: var(--muted); }
.lesson-foot { margin-top: 2em; padding-top: 1.4em; border-top: 2px dashed var(--border); }
.steps { padding-left: 1.4em; margin: 0 0 1em; }
.steps li { margin-bottom: .35em; }
.steps.sol li { margin-bottom: .55em; }
.sol-switch { display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0 10px; background: var(--surface-2); border-radius: 999px; }
.sol-btn { font: inherit; font-size: .88rem; font-weight: 800; border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.sol-btn[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.sol-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.sol-view[hidden] { display: none; }
.sol-brief { margin: 0 0 1em; padding-left: .8em; border-left: 3px solid var(--primary-soft); }
.sol-brief p { margin: .3em 0; font-weight: 600; }
.sol-work { display: block; margin-top: .2em; padding-left: .8em; border-left: 3px solid var(--primary-soft); font-weight: 600; }
pre.column { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 1.1rem; line-height: 1.35; background: var(--surface); border-radius: 10px; padding: 10px 16px; display: inline-block; margin: 0 0 .8em; }

/* ======================================================== math bits */
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .12em; line-height: 1.15; font-size: .92em; }
.frac > span { padding: 0 .2em; }
.frac > span:first-child { border-bottom: 2px solid currentColor; }
.lim { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; margin-right: .2em; }
.lim sub { font-size: .55em; margin-top: .2em; }
.int { font-size: 1.5em; display: inline-flex; align-items: center; vertical-align: middle; line-height: 1; }
.int .bounds { display: inline-flex; flex-direction: column; font-size: .45em; margin-left: -.05em; gap: .9em; }
.int sup, .int sub { line-height: 1; vertical-align: baseline; }
.matrix { display: inline-grid; vertical-align: middle; border-left: 2px solid currentColor; border-right: 2px solid currentColor; border-radius: 6px; padding: 0 4px; }
.matrix .mrow { display: contents; }
.matrix .mrow > span { padding: 2px 10px; text-align: center; }
.blank { display: inline-block; min-width: 1.4em; padding: 0 .2em; border-radius: 6px; background: color-mix(in srgb, var(--sun) 35%, transparent); color: var(--text); text-align: center; }
sup.blank { min-width: 1em; }

/* ========================================================= diagrams */
.diagram { display: block; width: 100%; max-width: 340px; height: auto; margin: 10px 0 16px; color: var(--text); }
.diagram .shape { fill: var(--diagram-fill); stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; }
.diagram .lbl { font: 800 17px var(--font); fill: currentColor; }
.diagram .lbl.small { font-size: 15px; }
/* Figure toolkit (FIG in js/curriculum.js; style guide in docs/figures.md). Line weights: outline 2.5, axis 2,
   marks 1.75, auxiliary 1.5 dashed, grid 1. Labels get a halo in the colour behind the figure (--fig-bg), so a
   label never sits on a line or on the grid. */
.diagram { --fig-bg: var(--surface); }
.example .diagram { --fig-bg: var(--surface-2); }
.callout .diagram { --fig-bg: color-mix(in srgb, var(--sun) 20%, var(--surface)); }
.diagram .lbl, .diagram .tick, .diagram .fig-num { paint-order: stroke; stroke: var(--fig-bg); stroke-width: 4px; stroke-linejoin: round; }
.diagram .fig-num { font: 700 12.5px var(--font); letter-spacing: -.3px; fill: var(--text); }
.diagram .var { font-family: KaTeX_Math, 'Cambria Math', 'Times New Roman', serif; font-style: italic; font-weight: 600; }
.diagram .fig-outline { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.diagram .fig-mark { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linejoin: round; }
.diagram .fig-mark.hot { stroke: var(--coral); stroke-width: 2.5; }
.diagram .fig-aux { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 6 5; }
.diagram .fig-mark.thin { stroke-width: 1; opacity: .6; }
.diagram .fig-aux.thin { stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.diagram .gridline.minor { stroke-width: .5; }
.diagram .fig-head { fill: currentColor; stroke: none; }
.diagram .fig-shaft { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: butt; }
.diagram .fig-arrow.velocity .fig-shaft, .diagram .fig-arrow.accel .fig-shaft { stroke-dasharray: 8 5; }
.diagram .fig-arrow.component { opacity: .75; }
.diagram .fig-arrow.component .fig-shaft { stroke-width: 1.75; stroke-dasharray: 4 4; }
.diagram .fig-arrow.axis .fig-shaft { stroke-width: 2; }
.diagram .fig-arrow.dim .fig-shaft { stroke-width: 1.5; }
.diagram .fig-arrow.ask { color: var(--coral); }
.diagram .fig-set { color: var(--primary); }
.diagram .fig-set-bar { stroke: currentColor; stroke-width: 5; stroke-linecap: butt; }
.diagram .fig-dot { fill: currentColor; stroke: currentColor; stroke-width: 2.5; }
.diagram .fig-dot.open { fill: var(--fig-bg); }
/* 3D solids (SVG.solid): visible faces in the shape fill, the top a shade lighter and the side a shade darker so the
   solid reads as solid in both themes; a triangle picked out inside a solid in the accent, see-through. */
.diagram .solid-face { fill: var(--diagram-fill); stroke: none; }
.diagram .solid-face.top { fill: color-mix(in srgb, var(--diagram-fill) 72%, #fff); }
.diagram .solid-face.side { fill: color-mix(in srgb, var(--diagram-fill) 85%, #000); }
.fig-row { display: flex; align-items: flex-end; justify-content: center; gap: 14px; max-width: 360px; margin: 10px 0 16px; }
.fig-row .diagram { margin: 0; min-width: 0; }
.diagram .fig-lens { fill: var(--fig-bg); stroke: currentColor; stroke-width: 2; }
.diagram .fig-water { fill: var(--sky); fill-opacity: .28; stroke: none; }
.diagram .fig-sky { color: var(--sky); }
.diagram .fig-shade { fill: color-mix(in srgb, var(--primary) 24%, transparent); stroke: none; }
.emoji-grid { display: grid; grid-template-columns: repeat(5, 2.4rem); gap: 6px; font-size: 1.9rem; line-height: 1; margin: 8px 0 18px; }
.emoji-grid span { display: grid; place-items: center; height: 2.4rem; }
.emoji-grid.demo { font-size: 1.5rem; grid-template-columns: repeat(5, 2rem); }

/* ========================================================= practice */
.practice, .placement { max-width: 760px; margin: 0 auto 24px; }
.practice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.practice-head h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.dots { display: flex; gap: 6px; margin: 4px 0 6px; flex-wrap: wrap; }
.dot { width: 22px; height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); transition: background .2s; }
.dot.current { background: var(--primary-soft); border-color: var(--primary); }
.dot.good { background: var(--right); border-color: var(--right); }
.dot.bad { background: var(--wrong); border-color: var(--wrong); }
.dot.good.helped { background: linear-gradient(90deg, var(--right) 50%, var(--surface-2) 50%); } /* right after a hint: counts for less */
.qnum { color: var(--muted); font-weight: 800; font-size: .9rem; }
.placement .pbar { margin: 8px 0 20px; }
.prompt { font-size: 1.15rem; margin: 10px 0 6px; overflow-x: auto; }
.prompt .big, .big { font-size: clamp(1.6rem, 4.5vw, 2.3rem); font-weight: 900; margin: .2em 0 .6em; }
.answer-input {
  font: inherit; font-size: 1.4rem; font-weight: 800; width: 100%; max-width: 360px;
  padding: 12px 16px; border-radius: 14px; border: 3px solid var(--border); background: var(--surface); color: var(--text);
}
.answer-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }
.answer-input.is-right { border-color: var(--right); background: var(--right-soft); }
.answer-input.is-wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; max-width: 560px; }
.choice {
  font: inherit; font-size: 1.4rem; font-weight: 900; padding: 14px; border-radius: 14px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 3px solid var(--border); box-shadow: 0 3px 0 var(--border);
}
.choice:hover:not(:disabled) { border-color: var(--primary); }
.choice.selected { border-color: var(--primary); background: var(--primary-soft); }
.choice.is-right { border-color: var(--right); background: var(--right-soft); }
.choice.is-wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.choice:disabled { cursor: default; }
.form-msg { color: var(--wrong); font-weight: 700; min-height: 1.4em; margin: .4em 0; font-size: .95rem; }
/* The right value in the wrong form (2.5 for "2 decimal places"): not wrong, so amber, not red. */
.form-msg.is-form:not(:empty), .ws-fb.is-form { color: var(--now); background: var(--now-soft); padding: .45em .7em; border-radius: 10px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { margin-top: 16px; background: color-mix(in srgb, var(--sun) 20%, var(--surface)); border-radius: 14px; padding: 12px 16px; }
.hint-list { margin: 4px 0 0; padding: 0; list-style: none; }
.hint-list.many { padding-left: 1.4em; list-style: decimal; }
.hint-list li + li { margin-top: 6px; }
.hint strong + .hint-list:not(.many) { display: inline; }
.hint strong + .hint-list:not(.many) li { display: inline; }
.feedback:empty { display: none; }
.fb { margin-top: 18px; border-radius: 16px; padding: 16px 20px; animation: pop .25s ease; }
.fb-right { background: var(--right-soft); border: 2px solid color-mix(in srgb, var(--right) 40%, transparent); }
.fb-wrong { background: var(--wrong-soft); border: 2px solid color-mix(in srgb, var(--wrong) 40%, transparent); }
.fb-title { font-weight: 900; font-size: 1.1rem; }
.fb p:last-child, .fb ol:last-child { margin-bottom: 0; }
.fb details summary { cursor: pointer; font-weight: 800; color: var(--right); margin-bottom: .4em; }
.xp { display: inline-block; margin-left: 6px; background: var(--sun); color: #3b2a00; border-radius: 999px; padding: 1px 10px; font-size: .85rem; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.summary { text-align: center; }
.summary .lead { margin-left: auto; margin-right: auto; }
.summary-badge { width: 96px; height: 96px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 3rem; }
.summary-badge.pass { background: color-mix(in srgb, var(--sun) 40%, var(--surface)); }
.summary-badge.retry { background: var(--primary-soft); }
.summary .hint-credit { max-width: 560px; margin: 0 auto 10px; }
/* The kindergarten placement: a grown-up's choice (js/app.js kidStart), then a short tap-only check */
.kid-choices { display: grid; gap: 10px; margin: 16px 0; }
.kid-choice { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; min-height: 64px; padding: 12px 16px; border-radius: 16px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.kid-choice:hover, .kid-choice:focus-visible { border-color: var(--primary); }
.kid-choice.suggested { border-color: var(--primary); background: var(--primary-soft); }
.kid-choice-icon { font-size: 2rem; flex: none; }
.kid-choice strong { display: block; font-size: 1.05rem; }
.kid-choice span span { display: block; color: var(--muted); font-size: .92rem; }
.kid-asked { text-align: left; }
.summary .notice { text-align: left; margin: 20px auto; max-width: 560px; }
.placed { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 1.2em; }
.placed .pill { font-size: .95rem; padding: 6px 14px; white-space: normal; text-align: center; max-width: 100%; }
.ticks { list-style: none; padding: 0; margin: 0 0 1.4em; }
.ticks li::before { content: '✓'; color: var(--mint); font-weight: 900; margin-right: 10px; }
.ticks li { margin-bottom: .3em; }

/* ========================================================= progress */
.progress-table { width: 100%; border-collapse: collapse; }
.progress-table th, .progress-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.progress-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.progress-table td:last-child { width: 30%; }
.progress-table a { text-decoration: none; }
/* A status can be long ("Ditempatkan, layak diulang · 3 untuk diulang"): let it wrap, so the table fits a phone. */
.progress-table .pill { white-space: normal; border-radius: 12px; }
.progress-table td:first-child { overflow-wrap: anywhere; }
.danger-zone h2 { color: var(--wrong); }
/* Your progress file (js/backup.js): save, load, a transfer code; the reminder line near the top */
.backup { padding: 18px 20px; }
.backup h2 { margin-top: 0; }
.bk-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.bk-status p { margin: 10px 0 0; }
.bk-bad { color: var(--wrong); font-weight: 700; }
.bk-preview { margin-top: 14px; padding: 14px 16px; border: 2px solid var(--primary); border-radius: 16px; background: var(--primary-soft); }
.bk-preview h3 { margin: 0 0 6px; font-size: 1.05rem; }
.bk-facts { margin: 0 0 8px; padding-left: 1.2em; }
.bk-pick { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.bk-pick .btn { width: 100%; justify-content: space-between; gap: 12px; }
.bk-pick small { font-weight: 600; color: var(--muted); }
.bk-code { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.bk-code summary { cursor: pointer; font-weight: 800; min-height: 32px; }
.bk-out { margin: 10px 0 4px; }
.bk-label { display: block; font-weight: 800; margin: 14px 0 4px; }
.bk-text { display: block; width: 100%; box-sizing: border-box; font: .82rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all;
  padding: 8px 10px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); resize: vertical; }
.bk-text:focus { outline: none; border-color: var(--primary); }
.backup-nag { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 18px; padding: 8px 6px 8px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--sun) 18%, var(--surface)); font-size: .92rem; }
.backup-nag > span { flex: 1; align-self: center; }
.backup-nag .link-btn { font: inherit; font-weight: 800; color: var(--primary); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.backup-nag .nag-close { flex: none; font: inherit; color: var(--muted); background: none; border: 0; cursor: pointer; min-width: 32px; min-height: 32px; border-radius: 8px; }
.backup-nag .nag-close:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
@media print { .backup, .backup-nag { display: none; } }
@media (max-width: 560px) {
  .progress-table th:nth-child(3), .progress-table td:nth-child(3) { display: none; }
}

/* ======================================== Who's learning? (js/profiles.js) */
/* The picker hides what belongs to a learner (the menu, the syllabus): nobody is learning yet. */
body.picking .site-nav, body.picking .nav-toggle, body.picking .syl-switch > * { display: none !important; }
/* An avatar: the animal on its colour (av-c0 … av-c5), in three sizes. */
.who-av { --c: var(--primary); display: inline-grid; place-items: center; flex: none; width: 76px; height: 76px; border-radius: 50%;
  font-size: 2.6rem; line-height: 1; background: color-mix(in srgb, var(--c) 26%, var(--surface)); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--c) 55%, var(--surface)); }
.who-av-sm { width: 40px; height: 40px; font-size: 1.35rem; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 55%, var(--surface)); }
.who-av-lg { width: 96px; height: 96px; font-size: 3.3rem; }
.av-c0 { --c: var(--coral); } .av-c1 { --c: var(--sun); } .av-c2 { --c: var(--mint); }
.av-c3 { --c: var(--sky); } .av-c4 { --c: var(--primary); } .av-c5 { --c: var(--lvl-kindergarten); }
.who { max-width: 760px; margin: 0 auto; }
.who [hidden] { display: none !important; }
.who > h1 { text-align: center; }
.who-lead { text-align: center; color: var(--muted); }
.who-grid { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.who-tile { width: 100%; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 8px;
  background: var(--surface); color: var(--text); border: 2px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); font: inherit; cursor: pointer; text-decoration: none; }
.who-tile:hover { border-color: var(--primary); color: var(--text); }
.who-tile:active { transform: translateY(2px); }
.who-name { font-weight: 900; font-size: 1.15rem; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.who-level { font-size: .78rem; font-weight: 700; color: var(--muted); text-align: center; }
.who-add { border-style: dashed; box-shadow: none; background: transparent; }
.who-plus { --c: var(--muted); font-weight: 900; color: var(--muted); }
.who-foot { text-align: center; margin-top: 26px; font-size: .95rem; }
.who-foot a { color: var(--muted); }
.who-nag { margin-top: 12px; }
.who-opening { text-align: center; padding-top: 40px; }
.who-opening h1 { margin-top: 14px; }
/* A picture code: three slots that fill as the pictures are tapped, and the nine pictures. */
.who-ask { text-align: center; max-width: 440px; margin: 18px auto 0; }
.who-ask h2 { margin: 12px 0 10px; font-size: 1.3rem; }
.code-show { display: flex; justify-content: center; margin: 6px 0; }
.code-slots { display: inline-flex; gap: 10px; }
.code-slot { width: 52px; height: 52px; border-radius: 14px; border: 2px dashed var(--border); display: grid; place-items: center; font-size: 1.8rem; }
.code-slot.full { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.code-show.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.code-msg { min-height: 1.6em; margin: 4px 0; font-weight: 800; color: var(--wrong); }
.code-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; margin: 8px auto 14px; }
.code-pic { width: 72px; height: 72px; border-radius: 18px; border: 2px solid var(--border); background: var(--surface); font-size: 2.2rem; cursor: pointer; }
.code-pic:hover { border-color: var(--primary); }
.code-pic:active { transform: translateY(2px); }
/* A new learner. */
.who-new h1 { text-align: left; }
.who-label { display: block; font-weight: 900; margin: 0 0 6px; }
.who-input { width: 100%; max-width: 360px; font: inherit; font-size: 1.15rem; font-weight: 700; padding: 10px 14px; border: 2px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); }
.who-input:focus { outline: none; border-color: var(--primary); }
.who-form .tiny { margin-top: 6px; }
.who-set { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; max-width: 520px; }
.av-pick { --c: var(--primary); aspect-ratio: 1; min-height: 52px; border-radius: 50%; border: 3px solid transparent; font-size: 1.7rem; cursor: pointer;
  background: color-mix(in srgb, var(--c) 20%, var(--surface)); }
.av-pick[aria-pressed="true"] { border-color: var(--text); background: color-mix(in srgb, var(--c) 45%, var(--surface)); transform: scale(1.06); }
.who-codeset { margin: 18px 0 0; border-top: 1px solid var(--border); padding-top: 10px; }
.who-codeset summary { cursor: pointer; font-weight: 800; min-height: 32px; }
.who-codeset .code-show { justify-content: flex-start; }
.who-codeset .code-pad { justify-content: start; margin-left: 0; }
.who-msg { min-height: 1.4em; margin: 12px 0 0; font-weight: 800; color: var(--wrong); }
/* Manage learners. */
.mg-sec { padding: 18px 20px; }
.mg-sec h2 { margin-top: 0; }
.mg-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.mg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.mg-name { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.mg-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.mg-remove { color: var(--wrong); }
.mg-ren { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; }
.mg-ren .who-input { flex: 1 1 160px; font-size: 1rem; padding: 6px 10px; }
.mg-switch { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.switch { flex: none; width: 56px; height: 32px; border-radius: 999px; border: 2px solid var(--border); background: var(--surface-2); position: relative; cursor: pointer; padding: 0; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(24px); background: var(--on-primary); }
.mg-turn { margin: 4px 0 10px; }
.mg-turn .tiny { margin: 6px 0 0; }
.class-plan { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.class-plan li { display: flex; align-items: center; gap: 10px; }
.class-plan li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
/* The learner in use, under the header. */
.who-bar { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.who-bar-in { display: flex; align-items: center; gap: 10px; padding-top: 5px; padding-bottom: 5px; }
.who-bar .who-av-sm { width: 32px; height: 32px; font-size: 1.1rem; }
.who-bar-name { font-weight: 900; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-switch { margin-left: auto; flex: none; font-size: .92rem; padding: 6px 4px; }
@media print { .who-bar { display: none; } }
/* "Great turn!" and "Still you?" */
.turn-end { text-align: center; }
.turn-end h2 { margin-bottom: 4px; }
.turn-end .mw-sum { text-align: left; display: inline-block; }
.summary .turn-end { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.still-you { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 82%, transparent); }
.still-card { text-align: center; max-width: 420px; width: 100%; margin: 0; }
.still-card h2 { margin: 12px 0 16px; }

/* ============================================= grids & charts */
:root { --chart-bar: #2d8fdb; --gridline: rgba(34, 37, 74, .14);
  /* categorical fills for figures (pie slices, Venn sets), in this order */
  --fig-c1: #4e79a7; --fig-c2: #f28e2b; --fig-c3: #59a14f; --fig-c4: #e15759; --fig-c5: #b07aa1; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --chart-bar: #5fb1f0; --gridline: rgba(241, 241, 251, .14);
    --fig-c1: #6b9bd1; --fig-c2: #f5a052; --fig-c3: #74bb6a; --fig-c4: #ee7678; --fig-c5: #c896bb; }
}
:root[data-theme="dark"] { --chart-bar: #5fb1f0; --gridline: rgba(241, 241, 251, .14);
  --fig-c1: #6b9bd1; --fig-c2: #f5a052; --fig-c3: #74bb6a; --fig-c4: #ee7678; --fig-c5: #c896bb; }
.fig-c0 { fill: var(--fig-c1); } .fig-c1 { fill: var(--fig-c2); } .fig-c2 { fill: var(--fig-c3); } .fig-c3 { fill: var(--fig-c4); } .fig-c4 { fill: var(--fig-c5); }
.diagram.grid { max-width: 320px; }
.diagram .gridline { stroke: var(--gridline); stroke-width: 1; }
.diagram .gridline.faint { stroke-dasharray: 2 3; }
.diagram .axis { stroke: currentColor; stroke-width: 1.5; }
.diagram .tick { font: 700 11px var(--font); fill: var(--muted); }
.diagram .tick.cat { font-size: 12px; fill: var(--text); }
.diagram .quad { font: 900 22px var(--font); fill: var(--primary); opacity: .55; }
.diagram .curve { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.diagram .pt { fill: var(--coral); stroke: var(--surface); stroke-width: 2; }
.diagram .bar-mark { fill: var(--chart-bar); }
.chart { margin: 8px 0 14px; }
.chart figcaption { font-weight: 800; margin-bottom: 2px; }
.diagram.bars { max-width: 480px; margin-top: 0; }
.formulas.freq { width: auto; }
.formulas.freq td { text-align: center; min-width: 2.6em; font-weight: 800; }

/* ======================================== levels & syllabi */
.journey-card .aligned { list-style: none; padding: 0; margin: 0 0 12px; font-size: .88rem; color: var(--muted); display: grid; gap: 2px; }
.journey-card .aligned-none { font-size: .88rem; }
.stage-head .ages { font-size: .9rem; font-weight: 800; color: var(--stage); margin-left: 6px; letter-spacing: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.seg-btn { font: inherit; font-weight: 800; border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 12px; cursor: pointer; }
.seg-btn:hover { color: var(--text); background: var(--surface-2); }
.seg-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.syl-blurb { color: var(--muted); margin: 10px 0 14px; }
.level-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { --stage: var(--primary); text-decoration: none; font-size: .88rem; font-weight: 800; padding: 5px 12px; border-radius: 999px; border: 2px solid color-mix(in srgb, var(--stage) 45%, transparent); color: var(--text); background: var(--surface); }
.chip:hover { background: color-mix(in srgb, var(--stage) 14%, var(--surface)); color: var(--text); }
.notice-inline { color: var(--muted); margin-bottom: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.tag { font-size: .75rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.stage-card .tags { margin-top: -2px; }
.filter { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.filter-label { font-weight: 900; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip-btn { font: inherit; font-weight: 800; padding: 8px 16px; border-radius: 999px; cursor: pointer; border: 2px solid var(--border); background: var(--surface); color: var(--text); }
.chip-btn:hover { border-color: var(--primary); }
.chip-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-btn[aria-pressed="true"]::before { content: '✓ '; }
.stage-summary { color: var(--muted); margin-bottom: 22px; }
.strand { margin-bottom: 32px; }
.strand h2 { font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.strand .count { font-size: .8rem; font-weight: 900; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 2px 10px; border: 1px solid var(--border); }
.topic .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px !important; }
.topic .meta .tags { margin: 0; }
.from { font-size: .82rem; font-weight: 700; text-decoration: none; color: var(--muted); }
.from:hover { color: var(--primary); }
a.pill-locked { text-decoration: none; }
.in-syllabi { font-size: .9rem; color: var(--muted); background: var(--surface-2); border-radius: 12px; padding: 8px 12px; }
.syl-badge { display: inline-grid; place-items: center; min-width: 2.1em; padding: 1px 5px; border-radius: 6px; font-size: .72em; font-weight: 900; letter-spacing: .04em; color: #fff; vertical-align: middle; line-height: 1.5; }
.syl-sg-express, .syl-sg-na, .syl-sg-nt, .syl-sg-sec-g3, .syl-sg-sec-g2, .syl-sg-sec-g1 { background: #d22f3b; }
.syl-us { background: #3c3b6e; }
.syl-indonesia { background: #0f7b62; }
.syl-ib { background: #1d6fb8; }
.syl-uni { background: #7a3fd6; }
.course-icon .syl-badge { font-size: .5em; }
.course-icon.xl .syl-badge { font-size: .42em; }
.seg-btn[aria-pressed="true"] .syl-badge { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }

/* ======================================== show all / available */
.show-toggle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.filter-label-inline { font-weight: 900; }
.seg-sm .seg-btn { padding: 6px 12px; font-size: .92rem; }
.empty-note { background: var(--surface); border: 2px dashed var(--border); border-radius: var(--radius); padding: 14px 18px; color: var(--muted); }
.hidden-note { margin-top: 10px; }
.avail { color: var(--right); font-weight: 800; }
.linklike { font: inherit; font-weight: 800; color: var(--primary); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

/* ======================================== kindergarten */
.kid-group { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 13em; justify-content: center; font-size: 1.5rem; line-height: 1.15; }
.kid-group i { font-style: normal; }
.kid-group i.gone { position: relative; }
.kid-group i.gone span { opacity: .3; }
.kid-group i.gone::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--wrong); font-weight: 900; opacity: 1; }
.kid-row, .kid-center { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 10px 0 16px; }
.kid-num { font-size: clamp(2.6rem, 8vw, 3.6rem) !important; margin: 0 !important; color: var(--primary); }
.kid-emoji { font-size: 4rem !important; }
.kid-numbers { font-size: 1.6rem; font-weight: 900; letter-spacing: .08em; color: var(--primary); }
.kid-numbers.days { font-size: 1.1rem; letter-spacing: 0; }
.op { font-weight: 900; font-size: 1.6rem; margin: 0 8px; color: var(--coral); }
.tenframe { display: inline-grid; grid-template-columns: repeat(5, 30px); gap: 3px; padding: 4px; border: 3px solid var(--text); border-radius: 6px; background: var(--surface); vertical-align: middle; }
.tenframe i { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 4px; display: grid; place-items: center; }
.tenframe i.on::after { content: ''; width: 22px; height: 22px; border-radius: 50%; background: var(--coral); }
.die { width: 96px; height: 96px; }
.dots { width: 120px; height: 120px; }
.dots.wide { width: 204px; }
.flash { position: relative; }
.flash.covered svg { visibility: hidden; }
.flash.covered::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; font-weight: 700; color: var(--muted, currentColor); }
.look-btn { display: block; margin: .25rem auto 0; }
.die-face { fill: var(--surface); stroke: var(--text); stroke-width: 4; }
.pip { fill: var(--text); }
.kshape { stroke: var(--text); stroke-width: 3; stroke-linejoin: round; }
.kfill-0 { fill: #ff8a65; } .kfill-1 { fill: #64b5f6; } .kfill-2 { fill: #81c784; } .kfill-3 { fill: #ffd54f; }
.cut-shape { fill: #ffd54f; stroke: var(--text); stroke-width: 3; }
.cut-line { stroke: var(--text); stroke-width: 3; stroke-dasharray: 6 4; }
.shape-row figure { margin: 0; text-align: center; font-weight: 800; }
.clock { width: 170px; height: 170px; }
.clock-face { fill: var(--surface); stroke: var(--text); stroke-width: 4; }
.clock-num { font: 800 12px var(--font); fill: var(--text); }
.hand-min { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.hand-hour { stroke: var(--coral); stroke-width: 5; stroke-linecap: round; }
.ribbons { display: grid; gap: 14px; margin: 12px 0 18px; max-width: 420px; }
.ribbon { display: block; height: 22px; border-radius: 4px; }
.ribbon.red, .tower.red i { background: #e53935; }
.ribbon.blue, .tower.blue i { background: #1e88e5; }
.towers { display: flex; gap: 40px; align-items: flex-end; margin: 12px 0 18px; padding-left: 20px; border-bottom: 3px solid var(--text); width: fit-content; padding-right: 20px; }
.tower { display: flex; flex-direction: column-reverse; gap: 2px; }
.tower i { width: 34px; height: 16px; border-radius: 3px; }
.queue { font-size: 2rem; letter-spacing: .1em; }
.queue .front { font-size: .9rem; font-weight: 800; color: var(--muted); letter-spacing: 0; margin-right: 6px; }
.shelf { display: inline-flex; flex-direction: column; gap: 0; border-left: 4px solid #8d6e63; border-right: 4px solid #8d6e63; margin: 8px 0 16px; }
.shelf span { font-size: 2.2rem; padding: 4px 24px; border-bottom: 4px solid #8d6e63; text-align: center; }
.pattern { font-size: 1.8rem; letter-spacing: .08em; }
.picto { display: grid; gap: 6px; margin: 10px 0 16px; }
.picto p { margin: 0; display: flex; align-items: center; gap: 4px; font-size: 1.4rem; }
.picto b { width: 2.2em; border-right: 2px solid var(--text); margin-right: 6px; }
.picto i { font-style: normal; }
.grownup { background: var(--primary-soft); }
.practice.kid .choice { font-size: 1.9rem; min-height: 76px; }
.practice.kid .choices { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.practice.kid .prompt { font-size: 1.35rem; }
.say-btn { border-color: var(--primary); }

.practice.kid .choices.wordy .choice { font-size: 1.15rem; }
.practice.kid .choices.wordy { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.choice .kid-group { display: inline-grid; grid-template-columns: repeat(5, auto); font-size: 1.15rem; max-width: none; }

/* ======================================== placement evidence */
.pill-assumed { background: var(--surface-2); color: var(--text); border: 1px dashed var(--muted); }
.pill-review { background: color-mix(in srgb, var(--sun) 30%, var(--surface)); color: var(--text); }
.pill-gap { background: color-mix(in srgb, var(--coral) 22%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--coral) 60%, transparent); }
a.pill { text-decoration: none; }
.course-card.status-gap { border-color: color-mix(in srgb, var(--coral) 60%, var(--border)); }
.course-card.status-assumed, .course-card.status-review { border-style: dashed; border-color: color-mix(in srgb, var(--mint) 45%, var(--border)); }
.gap-notice { border-color: color-mix(in srgb, var(--coral) 55%, var(--border)); }
.check-notice { border-style: dashed; }
.quick-box:empty { display: none; }
.quick-box { margin-top: 12px; }
.summary .sum-h { font-size: 1.1rem; margin: 22px 0 4px; }
.summary details summary { cursor: pointer; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.level-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.level-pick .btn { flex-direction: column; padding: 14px; }
.level-pick small { font-weight: 700; color: var(--muted); font-size: .8rem; }
.level-pick .btn.primary small { color: inherit; opacity: .85; }

/* ======================================== primary pictures */
.array { display: inline-grid; grid-template-columns: repeat(var(--cols), 1.7rem); gap: 4px; margin: 8px 0 14px; font-size: 1.25rem; line-height: 1; }
.array span { display: grid; place-items: center; height: 1.7rem; }
.diagram.numline { max-width: 560px; }
.diagram.ineq { max-width: 400px; }
.numline .tick { font-size: 13px; }
.numline .arrow { fill: var(--coral); }
.fracpic .fon { fill: #ffb74d; stroke: var(--text); stroke-width: 1.5; }
.fracpic .foff { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.choice .fracpic { width: 70px; height: auto; }
.coin { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; font-weight: 900; font-size: .85rem; margin: 2px;
  background: radial-gradient(circle at 35% 30%, #fff6, transparent 60%), #c0c4cc; color: #2a2d3a; border: 2px solid #8b909c; vertical-align: middle; }
.coin.c50, .coin.c100 { width: 52px; height: 52px; }
.coin.c100, .coin.c200 { background: radial-gradient(circle at 35% 30%, #fff8, transparent 60%), #e6c35c; border-color: #b8952f; }
.coin.c200 { width: 56px; height: 56px; }
.blocks { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 8px 0 14px; }
.b100 { display: grid; grid-template-columns: repeat(10, 7px); gap: 1px; padding: 1px; background: #1565c0; }
.b10 { display: grid; grid-template-rows: repeat(10, 12px); gap: 1px; padding: 1px; background: #1565c0; }
.b100 i, .b10 i { background: #64b5f6; display: block; }
.b10 i { width: 12px; }
.b100 i { width: 7px; height: 7px; }
.b1s { display: flex; flex-wrap: wrap; gap: 3px; max-width: 70px; }
.b1s i { width: 12px; height: 12px; background: #ffb74d; border: 1px solid #e65100; display: block; }
.sym-letter { font-family: Arial, Helvetica, sans-serif; font-size: 5rem !important; }
.sym-box { position: relative; display: inline-grid; place-items: center; width: 7rem; height: 7rem; margin: .5rem auto; }
.sym-box .sym-letter { line-height: 1; }
.sym-fold { position: absolute; border-color: var(--primary); border-style: dashed; border-width: 0; }
.sym-fold.v { left: 50%; top: 0; bottom: 0; border-left-width: 2px; }
.sym-fold.h { top: 50%; left: 0; right: 0; border-top-width: 2px; }

/* ======================================== upper-primary pictures */
.thermo { max-width: 130px; }
.th-tube { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.th-bulb, .th-liquid { fill: #e53935; }
.pie { max-width: 240px; }
.pie.wide { max-width: 340px; }
.pie .pie-lbl.out { fill: var(--text); stroke: var(--fig-bg); stroke-width: 4px; }
.pie .slice { stroke: var(--surface); stroke-width: 2; }
.pie-lbl { font: 800 12px var(--font); fill: #fff; paint-order: stroke; stroke: rgba(20, 22, 49, .5); stroke-width: 3px; stroke-linejoin: round; }
.dotplot { display: flex; gap: 6px; align-items: flex-end; border-bottom: 2px solid var(--text); width: fit-content; padding: 0 6px; margin: 6px 0 22px; }
.dotplot > div { display: flex; flex-direction: column; align-items: center; width: 38px; position: relative; }
.dotplot .dots { display: flex; flex-direction: column-reverse; align-items: center; min-height: 10px; }
.dotplot i { font-style: normal; font-weight: 900; color: var(--primary); line-height: 1.15; }
.dotplot b { position: absolute; bottom: -22px; font-size: .9rem; }
.mapgrid { display: inline-grid; grid-template-columns: repeat(3, 56px); grid-auto-rows: 56px; border: 2px solid var(--border); margin: 8px 0 14px; }
.mapgrid span { display: grid; place-items: center; font-size: 1.8rem; border: 1px dashed var(--border); }
.diagram .lbl.ask { fill: var(--coral); font-size: 20px; }
.choices.wordy .choice { font-size: 1.1rem; }
.choices.wordy { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.level-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.level-tabs a { text-decoration: none; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--border); color: var(--text); font-size: .92rem; }
.level-tabs a[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ctx-note { font-size: .9rem; color: var(--muted); }
.syl-next { background: var(--primary-soft); border-radius: 12px; padding: 10px 14px; }
/* Science placement: the maths a science course waits for, the invitation after the maths quiz, the science page card. */
.sci-needs { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; gap: 6px; text-align: left; }
.sci-needs li { border: 2px solid var(--border); border-radius: 12px; padding: 8px 12px; background: var(--surface); line-height: 1.5; }
.sci-next-quiz { margin: 14px 0; text-align: left; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.sci-next-quiz .cta-row { margin-top: 8px; }
.sci-place-card { margin: 12px 0 16px; padding: 14px 16px; }
.sci-place-card .suggest { margin-bottom: 6px; }
.sci-place-card .cta-row { margin-top: 8px; }
/* The detailed placement quiz: the offer (results page, Progress) and the Progress page's placement summary. */
/* Quiet ways in (learning-flow phases 3 and 4): "Print my next steps" and "Check my level in depth", as plain links. */
.quiet-links { margin: 10px 0 0; }
.quiet-links p, .thorough-line, .ws-line { margin: 4px 0; }
.ws-link, .thorough-link { font-weight: 700; }
.mw-quiet { margin-top: 2px; }
.mw-quiet a { white-space: nowrap; }
.mw-level-hint .mw-hint-x { margin-left: 6px; font-weight: 600; color: var(--muted); }
.ws-topic-link { margin: 12px 0 0; }
/* The worksheet's topic picker (chosen topics, for a teacher) */
.ws-choose { margin: 8px 0; }
.ws-choose summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.ws-pick-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.ws-pick { display: flex; flex-direction: column; gap: 2px; font-size: .85rem; min-width: 0; flex: 1 1 200px; }
.ws-pick select { max-width: 100%; font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.ws-queued { margin: 4px 0; }
.placement-summary { margin-bottom: 26px; }
.place-sum { margin-bottom: 12px; padding: 16px 18px; }
.place-sum h3 { margin: 0 0 6px; font-size: 1.1rem; }
.place-sum .syl-next { margin-bottom: 6px; }
.myway > .mw-note { margin-bottom: 10px; }
.stage-cov { max-width: 520px; margin: 0 auto 8px; text-align: left; }
.stage-cov td:nth-child(2) { width: 50%; }
.year-tabs a { font-size: .85rem; padding: 4px 12px; }
.level-pick .btn small { display: block; }

/* Venn diagrams */
.venn-a { fill: color-mix(in srgb, var(--fig-c1) 18%, transparent); stroke: var(--fig-c1); stroke-width: 2.5; }
.venn-b { fill: color-mix(in srgb, var(--fig-c2) 18%, transparent); stroke: var(--fig-c2); stroke-width: 2.5; }

/* Science figures (SF in js/science.js). A line spectrum is drawn on a black strip in both themes, like the real
   thing; each line also has its wavelength on the scale below, so colour never carries the meaning alone. */
.diagram .sp-strip { fill: #0b0b14; stroke: currentColor; stroke-width: 1.5; }
.diagram .sp-line { stroke-width: 3; }
.diagram .sp-line.uv { stroke: #c9c9d6; stroke-width: 2; }
.diagram .sp-abs { stroke: #0b0b14; stroke-width: 3; }
.diagram .sp-v { stroke: #9b6bff; fill: #9b6bff; } .diagram .sp-b { stroke: #3b82f6; fill: #3b82f6; } .diagram .sp-c { stroke: #22d3ee; fill: #22d3ee; }
.diagram .sp-g { stroke: #22c55e; fill: #22c55e; } .diagram .sp-y { stroke: #facc15; fill: #facc15; } .diagram .sp-o { stroke: #f97316; fill: #f97316; }
.diagram .sp-r { stroke: #ef4444; fill: #ef4444; }
.diagram rect.sp-band { stroke: none; }

/* Pascal's triangle */
.pascal { display: grid; gap: 6px; justify-items: center; margin: 12px 0 16px; max-width: 420px; font-weight: 800; }
.pascal div { display: flex; gap: 6px; }
.pascal span { min-width: 34px; padding: 4px 6px; text-align: center; border-radius: 8px; background: var(--primary-soft); }

/* Syllabus catalog: a card per school year */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.year-card { gap: 6px; }
.year-card .year-name { font-size: 1.5rem; font-weight: 900; line-height: 1.1; color: var(--stage, var(--text)); }
.year-topics { list-style: none; margin: 4px 0 6px; padding: 0; font-size: .9rem; line-height: 1.35; }
.year-topics li { padding-left: 1em; position: relative; }
.year-topics li::before { content: '•'; position: absolute; left: 0; color: var(--muted); }
.year-topics li.done::before { content: '✓'; color: var(--right); }
.year-topics li.more { color: var(--muted); font-weight: 700; }
.year-topics li.more::before { content: ''; }
.stage-head h2 a { color: inherit; text-decoration: none; }
.stage-head h2 a:hover { text-decoration: underline; }
.stage-subjects { margin: -6px 0 14px; }

/* ===================== Walkthroughs ===================== */
:root { --now: #c25e00; --now-soft: #fff1dc; --token-pos: #2d8fdb; --token-neg: #e0464a; }
@media screen and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --now: #ffc23d; --now-soft: #3a2f17; } }
:root[data-theme="dark"] { --now: #ffc23d; --now-soft: #3a2f17; }
.walk-section { margin: 28px 0 8px; padding-top: 18px; border-top: 2px dashed var(--border); }
.walk-section h2 { margin-bottom: .2em; }
.walk { margin-top: 12px; }
.walk-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 8px; }
.walk-ask { font-weight: 800; align-self: center; }
.walk-field { display: flex; flex-direction: column; gap: 2px; font-size: .78rem; font-weight: 800; color: var(--muted); }
.walk-field input, .walk-field select { font: inherit; font-size: 1.05rem; font-weight: 800; color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: 10px; padding: 6px 8px; min-width: 3.2em; }
.walk-field input:focus, .walk-field select:focus { outline: none; border-color: var(--primary); }
.walk-err { color: var(--wrong); font-weight: 700; min-height: 1.2em; margin: 2px 0 6px; }
.walk-err:empty { display: none; }
.walk-methods { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; margin-bottom: 8px; }
.walk-tab { font: inherit; font-size: .9rem; font-weight: 800; border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.walk-tab[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.walk-tab[title]:not([title=""]):not([aria-selected="true"]) { opacity: .6; }
.walk-blurb { color: var(--muted); margin: 4px 0 10px; }
.walk-blurb strong { color: var(--text); }
.walk-stage { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 18px 14px; overflow-x: auto; }
.walk-stage:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.walk-scene { font-size: clamp(1.05rem, 3.6vw, 1.35rem); font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.walk-note { color: var(--muted); font-size: 1rem; text-align: center; max-width: 34em; }
.walk-dock { position: sticky; bottom: 0; z-index: 5; margin-top: 10px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 14px; display: grid; gap: 8px; }
.walk-count { font-size: .78rem; font-weight: 800; color: var(--muted); margin: 0; }
.walk-say { margin: 2px 0 0; font-size: 1.02rem; line-height: 1.45; min-height: 2.9em; }
.walk-work { margin: 0; font-weight: 900; color: var(--now); min-height: 1.3em; }
.walk-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wbtn { font: inherit; font-weight: 900; min-width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.wbtn.play { background: var(--primary); border-color: var(--primary); color: var(--on-primary); min-width: 52px; }
.wbtn:disabled { opacity: .4; cursor: default; }
.wbtn.narrate[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); }
.walk-scrub { flex: 1 1 120px; accent-color: var(--primary); }
.walk-speed { font: inherit; font-weight: 700; border: 2px solid var(--border); border-radius: 10px; padding: 6px; background: var(--surface); color: var(--text); }
.fb .walk-btn { margin-top: 10px; }

/* pieces and marks */
.wk { transition: color .3s, background-color .3s, box-shadow .3s, opacity .3s; position: relative; }
.wk.off { visibility: hidden; }
.wk.now { color: var(--now); }
.wk.strike { text-decoration: line-through 3px; opacity: .45; }
.wk.dim { opacity: .3; }
.wk.ring { box-shadow: 0 0 0 3px var(--primary); border-radius: 999px; }
.wk.under::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: -4px; height: 3px; border-radius: 2px; background: var(--primary); }
.wk.win { color: var(--right); }
.chip.win, .token.win, .wbox.win, .wweight.win, .bar.win { box-shadow: 0 0 0 3px var(--right); }
.note { font-size: .8em; color: var(--muted); font-weight: 700; }
.note.now { color: var(--now); }

/* column layouts */
.wk-grid { display: grid; justify-items: center; align-items: center; row-gap: 4px; font-variant-numeric: tabular-nums; }
.wk-grid .head { font-size: .62em; color: var(--muted); font-weight: 900; }
.wk-grid .carry { font-size: .62em; color: var(--now); align-self: end; }
.wk-grid .digit { font-size: 1.25em; }
.wk-grid .op { color: var(--muted); }
.wk-grid .rule { justify-self: stretch; height: 3px; background: var(--text); border-radius: 2px; }
.wk-check { margin: 0; }
.wk-grid .sdiv-c { font-size: .55em; color: var(--now); vertical-align: top; margin-right: 1px; }
.diagram.protractor { max-width: 380px; }
.protractor .fig-num.pr-outer { font-size: 11.5px; }
.protractor .fig-num.pr-inner { font-size: 10px; fill: var(--muted); }
.protractor .pr-arm { color: var(--coral); }
.protractor .pr-ring { fill: none; stroke: var(--now, var(--primary)); stroke-width: 2.5; }
.protractor .pr-ring.win { stroke: var(--right); }

/* lines of working */
.wk-lines { display: grid; gap: 4px; justify-items: start; }
.wk-lines p { margin: 0; }
.wk-hr { width: 100%; border: 0; border-top: 2px dashed var(--border); margin: 4px 0; }
.wk-stack { display: grid; grid-template-columns: 1.2em auto auto; column-gap: 6px; align-items: baseline; justify-content: center; font-size: 1.25em; font-variant-numeric: tabular-nums; }
.wk-stack .num { justify-self: end; font-weight: 800; }
.wk-stack .op { color: var(--muted); }
.wk-stack .stack-note { font-size: .62em; color: var(--muted); padding-left: .8em; }
.wk-stack .wk-hr { grid-column: 1 / -1; border-top-style: solid; border-color: var(--text); }
.wk-grid .placeholder { color: var(--muted); }
.wk-grid .borrow { font-size: .9em; color: var(--now); }
.wk-mgrid { column-gap: 10px; row-gap: 8px; }
.wk-mgrid .edge { color: var(--primary); font-weight: 800; }
.wk-mgrid .boxcell { padding: 4px 8px; border: 2px solid var(--border); border-radius: 6px; background: var(--surface-2); justify-self: stretch; text-align: center; }
.wk-mgrid .rowsum { font-weight: 800; justify-self: start; white-space: nowrap; }
.wk-mgrid .boxcell, .wk-mgrid .edge { white-space: nowrap; }
.wk-blocks { display: flex; align-items: flex-end; justify-content: center; gap: 6px; flex-wrap: wrap; }
.wk-blocks .rod { display: grid; grid-template-rows: repeat(10, 14px); width: 16px; border: 2px solid var(--primary); border-radius: 3px; background: var(--primary-soft, rgba(91, 79, 233, .15)); }
.wk-blocks .rod i { border-bottom: 1px solid var(--primary); }
.wk-blocks .rod i:last-child { border-bottom: 0; }
.wk-blocks .cubes { display: grid; grid-template-columns: repeat(3, 16px); gap: 3px; margin-left: 10px; }
.wk-blocks .cube { width: 16px; height: 16px; border: 2px solid var(--accent, #e8833a); border-radius: 3px; background: rgba(232, 131, 58, .2); }
.chip { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--primary-soft); }
.chip.total { background: var(--surface-2); }
.chip.now { background: var(--now-soft); }

/* tokens */
.wk-tokens { display: grid; gap: 10px; justify-items: start; }
.tok-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; }
.tok-lab { min-width: 6.5em; font-size: .75em; color: var(--muted); font-weight: 900; }
.token { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 900; font-size: 1.1rem; }
.token.pos { background: var(--token-pos); }
.token.neg { background: var(--token-neg); }
.token.now { box-shadow: 0 0 0 3px var(--now); color: #fff; }
.tok-pair { display: inline-flex; gap: 2px; padding: 3px; border: 2px dashed var(--border); border-radius: 999px; }

/* SVG pictures */
.wk-svg { width: 100%; max-width: 640px; height: auto; overflow: visible; }
.wk-axis { stroke: var(--text); stroke-width: 2.5; }
.wk-tick { fill: var(--muted); font: 800 15px var(--font); text-anchor: middle; }
.wk-tick.big { fill: var(--text); font-size: 17px; }
.wk-tick.zero { fill: var(--text); }
.wk-tick.win, .wk-tick.now { fill: var(--right); }
.wk-tick.now:not(.win) { fill: var(--now); }
.wk-dot { fill: var(--primary); }
.wk-dot.now { fill: var(--now); }
.wk-dot.win { fill: var(--right); }
.wk-jump { fill: none; stroke: var(--now); stroke-width: 3; stroke-dasharray: 7 5; }
.wk-arrowhead { fill: var(--now); }
.wk-jl { fill: var(--now); font: 900 17px var(--font); text-anchor: middle; }

/* balance scale */
.wk-balance { display: grid; justify-items: center; width: 100%; max-width: 560px; }
.wk-balance .pans { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; width: 100%; }
.wk-balance .pan { display: flex; flex-wrap: wrap; align-content: flex-end; justify-content: center; gap: 6px; min-height: 90px; padding: 8px;
  border-bottom: 5px solid var(--text); border-radius: 0 0 40% 40% / 0 0 26px 26px; }
.wk-balance .beam { width: 92%; height: 6px; background: var(--text); border-radius: 3px; margin-top: 10px; }
.wk-balance .stand { width: 0; height: 0; border-left: 22px solid transparent; border-right: 22px solid transparent; border-bottom: 34px solid var(--muted); }
.wbox { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-style: italic; }
.wweight { display: inline-grid; place-items: center; min-width: 40px; height: 38px; padding: 0 8px; border-radius: 12px 12px 6px 6px; background: var(--sun); color: #3b2a00; }
.wbox.now { box-shadow: 0 0 0 3px var(--now); }
.wweight.now { box-shadow: 0 0 0 3px var(--now); }
/* The step being worked on is ringed in --now; its text keeps the box's own colour (--now on a filled box is unreadable). */
.wk.wbox.now { color: var(--on-primary); }
.wk.wweight.now { color: #3b2a00; }

/* bar model */
.wk-bars { display: grid; gap: 8px; width: 100%; max-width: 600px; }
.barrow { display: flex; min-height: 40px; }
.bar-seg { display: flex; }
.bar { display: grid; place-items: center; flex: 1; height: 40px; border: 2px solid var(--text); background: var(--surface-2); border-radius: 6px; margin-right: -2px; }
.bar.whole { background: var(--primary-soft); }
.bar.xseg { background: var(--primary); color: var(--on-primary); font-style: italic; }
.bar.bseg { background: var(--sun); color: #3b2a00; }
.bar.val { background: var(--right-soft); }
.bar.note-bar { background: var(--surface); border-style: dashed; }
.bar.now { box-shadow: inset 0 0 0 3px var(--now); }

/* undo chains */
.wk-chain { display: grid; gap: 6px; justify-items: start; }
.chain-lab { margin: 6px 0 0; font-size: .75em; color: var(--muted); font-weight: 900; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wk-op .arrow { font-size: .8em; color: var(--muted); }
.wk-op .arrow.now { color: var(--now); }
.wk.gone { display: none; }
.token.strike { opacity: .5; text-decoration: none; }
.token.strike::after { content: '✕'; position: absolute; inset: -6px; display: grid; place-items: center; font-size: 1.9rem; color: var(--text); }
.token.dim { opacity: .28; }
.token.win, .token.win.now, .wbox.win, .wbox.win.now, .wweight.win, .wweight.win.now, .chip.win, .chip.win.now, .bar.win, .bar.win.now { box-shadow: 0 0 0 4px var(--right); }
.wbox.win { color: var(--on-primary); }
.wk-venn .wk-vc { fill: var(--primary); fill-opacity: .1; stroke: var(--primary); stroke-width: 2.5; }
.wk-venn .wk-vc.b { fill: var(--coral); stroke: var(--coral); }
.wk-vlab { fill: var(--text); font: 900 18px var(--font); text-anchor: middle; }
.wk-vnum { fill: var(--text); font: 800 22px var(--font); text-anchor: middle; }
.wk-vnum.now { fill: var(--now); }
.wk-vnum.ring { fill: var(--primary); text-decoration: underline; }
.wk-vnum.win, .wk-vnum.ring.win { fill: var(--right); }
.wk-ladder { column-gap: 0; row-gap: 0; }
.wk-ladder .lprime { padding: 4px 12px; border-right: 3px solid var(--text); color: var(--primary); justify-self: end; }
.wk-ladder .lnum { padding: 4px 12px; border-bottom: 3px solid var(--text); justify-self: stretch; text-align: left; }
.wk-ladder .lprime.win { color: var(--right); }
.wk-edge { stroke: var(--muted); stroke-width: 2.5; }
.wk-tnum { fill: var(--text); font: 900 20px var(--font); text-anchor: middle; }
.wk-tnum.now { fill: var(--now); }
.wk-leaf { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 2.5; }
.wk-leaf.now { stroke: var(--now); }
.wk-leaf.win { stroke: var(--right); fill: var(--right-soft); }
.wk-ptable { column-gap: 22px; row-gap: 6px; justify-items: start; }
.wk-ptable .head { font-size: .7em; }
.wk-ptable .num.win { color: var(--right); }
.wk-box { gap: 0; }
.wk-box .boxcell { width: 100%; height: 100%; display: grid; place-items: center; border: 2.5px solid var(--text); margin: -1.25px; background: var(--surface-2); }
.wk-box .boxcell.now { background: var(--now-soft); }
.wk-box .edge { color: var(--primary); }
.wk-box .edge.ring { box-shadow: none; text-decoration: underline 3px; }
.walk-mode { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 10px 8px; background: var(--surface-2); border-radius: 999px; }
.walk-mode[hidden] { display: none; }
.walk-modebtn { font: inherit; font-size: .88rem; font-weight: 800; border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.walk-modebtn[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.walk-try { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.walk-try[hidden] { display: none; }
.walk-try-in { font: inherit; font-size: 1.1rem; font-weight: 800; width: 7em; padding: 6px 10px; border: 2px solid var(--now); border-radius: 10px; background: var(--surface); color: var(--text); }
.walk-try-msg { font-weight: 700; color: var(--wrong); }
.walk-blank { display: inline-block; min-width: 1.6em; padding: 0 .3em; border: 2px dashed var(--now); border-radius: 8px; text-align: center; }
.walk-after { margin-top: 12px; }
.tryone { margin-top: 4px; }
.wk-axis.thin { stroke-width: 1.5; }
.tf-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.tenframe { display: grid; grid-template-columns: repeat(5, 40px); grid-template-rows: repeat(2, 40px); border: 3px solid var(--text); border-radius: 6px; }
.tf-cell { display: grid; place-items: center; border: 1.5px solid var(--border); }
.counter { width: 28px; height: 28px; border-radius: 50%; display: inline-block; }
.counter.a { background: var(--coral); }
.counter.b { background: var(--sky); }
.counter.now { box-shadow: 0 0 0 3px var(--now); }
.counter.win { box-shadow: 0 0 0 3px var(--right); }
.wk-hoops { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hoop { position: relative; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; width: 112px; min-height: 52px; padding: 10px 8px 18px; border: 2.5px dashed var(--muted); border-radius: 18px; }
.wk-hoops.sm .hoop { width: 92px; }
.wk-hoops.sm .counter { width: 18px; height: 18px; }
.hoop-n { position: absolute; right: 8px; bottom: 2px; font-size: .8em; }
.wk-array { display: grid; gap: 4px; justify-content: center; align-items: center; }
.wk-array .counter { width: 22px; height: 22px; vertical-align: middle; }
.wk-array.sm .counter { width: 15px; height: 15px; }
.wk-array .rowlab { font-size: .8em; justify-self: end; padding-right: 6px; }
.wk-array .cutline { width: 3px; align-self: stretch; justify-self: center; background: var(--now); border-radius: 2px; margin: 0 4px; }
.wk-pairs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 8px 0; }
.pair { display: inline-flex; gap: 3px; padding: 4px; border: 2px solid var(--border); border-radius: 999px; }
.pair.single { border-style: dashed; }
.pair.ring { box-shadow: 0 0 0 3px var(--now); }
.hoop.ring { border-radius: 18px; box-shadow: 0 0 0 3px var(--now); }
.wk-fbars { display: grid; gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; }
.fbar-row { display: grid; grid-template-columns: 3.2em 1fr; align-items: center; gap: 10px; }
.flab { justify-self: end; font-weight: 800; font-size: 1.1em; }
.fbar { display: flex; height: 36px; border: 2.5px solid var(--text); border-radius: 4px; overflow: hidden; background: var(--surface); }
.fcell { flex: 1; position: relative; border-right: 2px solid var(--text); }
.fcell:last-child { border-right: 0; }
.fbar.fine .fcell { border-right-width: 1px; }
.ffill { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: .85em; }
.ffill.a { background: var(--coral); }
.ffill.b { background: var(--sky); }
.ffill.e { background: transparent; }
.ffill.strike { opacity: .2; text-decoration: none; }
.amodel { position: relative; width: min(260px, 70vw); aspect-ratio: 1; margin: 0 auto 8px; border: 3px solid var(--text); background: var(--surface); }
.alayer { position: absolute; left: 0; top: 0; }
.alayer.cols { height: 100%; background: color-mix(in srgb, var(--sky) 60%, transparent); }
.alayer.rows { width: 100%; background: color-mix(in srgb, var(--coral) 45%, transparent); }
.alayer.both { background: color-mix(in srgb, var(--primary) 55%, transparent); outline: 3px solid var(--primary); }
.alayer.both.win { outline-color: var(--right); }
.agrid { position: absolute; inset: 0; pointer-events: none; }
.agrid.v { background: linear-gradient(to right, var(--text) 2px, transparent 2px) 0 0 / calc(100% / var(--cols)) 100%; }
.agrid.h { background: linear-gradient(to bottom, var(--text) 2px, transparent 2px) 0 0 / 100% calc(100% / var(--rows)); }
.wk-bars.bm { max-width: 600px; margin: 0 auto; }
.bm-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.bm-row .flab { font-size: .85em; min-width: 2.6em; }
.bm-row .flab:empty { min-width: 0; }
.bar.ghost { visibility: hidden; border: 0; }
.bm-row.nolab { grid-template-columns: 1fr; }
.wk-bars .bar span { display: inline; height: auto; background: none; border-radius: 0; }
.bm .bar-seg { min-width: 0; }
.bm .bar { min-width: 0; overflow: hidden; white-space: nowrap; padding: 0 2px; font-size: clamp(.68em, 2.8vw, .9em); }
.bar .uval { font-weight: 800; }
.hgrid { display: grid; grid-template-columns: repeat(10, 1fr); width: min(240px, 70vw); aspect-ratio: 1; margin: 0 auto 8px; border: 2.5px solid var(--text); }
.hcell { border: .5px solid var(--border); }
.hcell.on { background: var(--coral); }
.hcell.on.off { visibility: visible; background: transparent; }
.tri { position: relative; width: 190px; height: 160px; margin: 0 auto 8px; display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: 1fr 1fr; place-items: center; font-size: 1.6em; font-weight: 900; }
.tri::before { content: ''; position: absolute; inset: 0; background: var(--primary-soft); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.tri > * { position: relative; }
.tri::after { content: ''; position: absolute; left: 25%; right: 25%; top: 50%; border-top: 3px solid var(--text); }
.tri-d { grid-column: 1 / -1; grid-row: 1; align-self: end; }
.tri-s { grid-column: 1; grid-row: 2; justify-self: end; }
.tri-x { grid-column: 2; grid-row: 2; color: var(--muted); font-size: .7em; }
.tri-t { grid-column: 3; grid-row: 2; justify-self: start; }
.tri .wk.dim { opacity: 1; background: var(--text); color: var(--text); border-radius: 6px; padding: 0 .2em; }
.towers { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: clamp(4px, 2vw, 14px); height: 190px; margin: 24px auto 8px; padding: 0 2.4em 0 10px; border-bottom: 3px solid var(--text); width: 100%; max-width: 460px; box-sizing: border-box; }
.tower { position: relative; flex: 1 1 0; min-width: 0; max-width: 44px; height: 100%; display: flex; align-items: flex-end; }
.tw { display: block; width: 100%; background: var(--sky); border-radius: 4px 4px 0 0; position: relative; }
.tw b { position: absolute; top: -1.4em; left: 0; right: 0; text-align: center; font-size: .85em; }
.tw-over { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, var(--coral) 0 6px, transparent 6px 10px); border-radius: 4px 4px 0 0; }
.tw-under { position: absolute; left: 0; right: 0; border: 2.5px dashed var(--coral); border-bottom: 0; }
.tw-line { position: absolute; left: 0; right: 0; border-top: 3px dashed var(--now); height: 0; }
.tw-line b { position: absolute; right: .2em; top: -1.5em; color: var(--now); }
.tw-line.win { border-top-color: var(--right); }

@media (max-width: 520px) {
  .wk-pv { font-size: .78em; }
  .wk-mgrid { font-size: .82em; column-gap: 5px; }
  .wk-mgrid .boxcell { padding: 3px 4px; }
  .wk-mgrid.wide { font-size: .66em; }
}

/* Walkthroughs: algebra lines */
.alg { display: grid; grid-template-columns: auto minmax(0, 15em); column-gap: 1.2em; row-gap: .45em; align-items: baseline; }
.aline { font-size: 1.12em; white-space: nowrap; }
.alg { max-width: 100%; }
@media (max-width: 760px) { .alg .aline { white-space: normal; } }
.awhy { font-size: .72em; color: var(--muted); font-weight: 600; }
.anext { text-decoration: underline 3px var(--now); text-underline-offset: 5px; }
.aline .tx { color: var(--sky); }
.aline .tn { color: var(--coral); }
.aline .xf { display: inline-block; }
.aline .xf.strike { text-decoration: line-through 3px var(--wrong, #d33); opacity: .45; }
.xdot { color: var(--muted); padding: 0 1px; }
.aline .frac > span { padding: 0 .3em; }
.sn-row { display: flex; align-items: flex-end; justify-content: center; font-size: 1.6em; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.sn-row .wk[class*="sn-d"] { color: var(--muted); }
.sn-row .wk[class*="sn-d"].sig { color: var(--text); }
.sn-row .wk.ring { box-shadow: none; text-decoration: underline 3px var(--now); }
.sn-slot { display: inline-block; width: .45em; text-align: center; color: var(--now); font-weight: 900; }
.seqgrid { column-gap: 6px; row-gap: 8px; }
.seqgrid .head { font-size: .7em; justify-self: end; padding-right: 6px; }
.seqgrid .diff { font-size: .75em; color: var(--now); transform: translateX(-50%); }
.wk-ray { stroke: var(--now); stroke-width: 6; }
.wk-ray.win { stroke: var(--right); }
.wk-dot.open { fill: var(--surface); stroke: var(--now); stroke-width: 3; }
@media (max-width: 520px) {
  .alg { grid-template-columns: auto; }
  .awhy { margin: -.3em 0 .2em; }
  .aline { white-space: normal; overflow-wrap: anywhere; }
  .seqgrid { font-size: .8em; column-gap: 3px; }
}

/* Walkthroughs: coordinate grid */
.wk-grid2 { width: 100%; height: auto; }
.cg-line { stroke: var(--border); stroke-width: 1; }
.cg-axis { stroke: var(--text); stroke-width: 2; }
.cg-name { font: italic 800 15px var(--font, sans-serif); fill: var(--text); }
.cg-tick { font: 600 11px var(--font, sans-serif); fill: var(--muted); text-anchor: middle; }
.cg-pt { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.cg-pt.origin { fill: var(--text); }
.cg-pt.mid { fill: var(--now); }
.cg-pt.small { r: 4; fill: var(--muted); }
.cg-pt.win { fill: var(--right); }
.cg-lab { font: 800 13px var(--font, sans-serif); fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.cg-arrow { stroke-width: 3.5; }
.cg-arrow.run, .cg-seg.run { stroke: var(--sky); }
.cg-arrow.rise, .cg-seg.rise { stroke: var(--coral); }
.cg-seg { stroke-width: 3.5; stroke-dasharray: 7 5; }
.cg-seg.hyp { stroke: var(--primary); stroke-dasharray: none; }
.cg-seg.hyp.win, .cg-fline.win { stroke: var(--right); }
.cg-alab { font: 800 13px var(--font, sans-serif); text-anchor: middle; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.cg-alab.run { fill: var(--sky); }
.cg-alab.rise { fill: var(--coral); }
.cg-fline { stroke: var(--primary); stroke-width: 3; }
.cg-fline.faint { stroke-opacity: .45; }
.cg-rect.shade { fill: var(--primary-soft); opacity: .7; }

/* Walkthroughs: shapes */
.wk-shape { width: 100%; height: auto; overflow: visible; }
.sh-poly, .sh-circle { stroke: var(--text); stroke-width: 2.5; stroke-linejoin: round; }
.sh-poly.tri, .sh-poly.outline { fill: var(--surface); }
.sh-poly.outline { fill: none; stroke-width: 3; }
.sh-poly.sq.a { fill: color-mix(in srgb, var(--sky) 45%, transparent); }
.sh-poly.sq.b { fill: color-mix(in srgb, var(--coral) 45%, transparent); }
.sh-poly.sq.c { fill: color-mix(in srgb, var(--primary) 30%, transparent); }
.sh-poly.tri.a { fill: color-mix(in srgb, var(--sky) 40%, transparent); }
.sh-poly.tri.b { fill: color-mix(in srgb, var(--coral) 35%, transparent); }
.sh-poly.wedge.a { fill: color-mix(in srgb, var(--sky) 60%, transparent); stroke-width: 1; }
.sh-poly.wedge.b { fill: color-mix(in srgb, var(--coral) 55%, transparent); stroke-width: 1; }
.sh-poly.win, .sh-circle.win { stroke: var(--right); stroke-width: 4; }
.sh-circle.disc { fill: color-mix(in srgb, var(--sky) 35%, transparent); }
.sh-seg { stroke: var(--text); stroke-width: 2.5; }
.sh-seg.diag { stroke: var(--primary); stroke-dasharray: 6 4; }
.sh-seg.radius { stroke: var(--now); stroke-width: 3; }
.sh-seg.edge { stroke: var(--now); stroke-width: 5; stroke-linecap: round; }
.sh-seg.edge.win, .sh-seg.radius.win { stroke: var(--right); }
.sh-seg.tick { stroke-width: 2; }
.sh-seg.extline { stroke-dasharray: 6 4; }
.sh-right.mark { fill: none; stroke: var(--text); stroke-width: 2; }
.sh-arc { stroke: none; }
.sh-arc.a { fill: color-mix(in srgb, var(--sky) 55%, transparent); }
.sh-arc.b, .sh-arc.a2 { fill: color-mix(in srgb, var(--sky) 55%, transparent); }
.sh-arc.q, .sh-arc.q2, .sh-arc.ext { fill: color-mix(in srgb, var(--coral) 55%, transparent); }
.sh-arc.win { fill: color-mix(in srgb, var(--right) 55%, transparent); }
.sh-text { font: 800 15px var(--font, sans-serif); fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.sh-text.area { font-size: 14px; }
.sh-text.side { fill: var(--primary); }
.sh-text.alab { font-size: 14px; }
.sh-text.win { fill: var(--right); }
.sh-seg.pline { stroke-width: 3; }
.sh-seg.hl { stroke: var(--now); stroke-width: 6; stroke-linecap: round; opacity: .75; }
.sh-seg.edge.ring { stroke: var(--now); stroke-width: 5; }
.sh-seg.edge.win { stroke: var(--right); stroke-width: 5; }
.sh-seg.dash { stroke-dasharray: 6 4; stroke: var(--primary); }
.sh-poly.face.a { fill: color-mix(in srgb, var(--sky) 55%, transparent); }
.sh-poly.face.b { fill: color-mix(in srgb, var(--coral) 45%, transparent); }
.sh-poly.face.c { fill: color-mix(in srgb, var(--primary) 30%, transparent); }
.sh-poly.face.ghost { fill: none; stroke-dasharray: 6 4; stroke-width: 2; }
.sh-poly.ring { stroke: var(--now); stroke-width: 5; }
.wk-units { display: grid; gap: 2px; width: min(100%, calc(var(--cols) * 34px)); }
.wk-units .unit { aspect-ratio: 1; background: color-mix(in srgb, var(--sky) 55%, transparent); border: 1.5px solid var(--text); border-radius: 2px; }
.wk-units .unit.win { background: color-mix(in srgb, var(--right) 45%, transparent); }
.wk-boxes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0; }
.nbox { min-width: 2.2em; padding: 4px 6px; text-align: center; border: 2px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.nbox.strike { opacity: .3; text-decoration: line-through 3px; }
.nbox.win { border-color: var(--right); background: var(--right-soft); color: var(--right); }
.nbox.ring { border-color: var(--now); box-shadow: none; border-radius: 8px; }
.dicegrid { gap: 3px; }
.dicegrid .dcell { width: 100%; text-align: center; padding: 3px 0; border-radius: 5px; background: var(--surface-2); font-size: .85em; }
.dicegrid .dcell.win { background: var(--right-soft); color: var(--right); outline: 2px solid var(--right); }
.ptable2 { column-gap: 10px; row-gap: 10px; }
.ptable2 .digit { padding: 4px 10px; border: 2px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 1.05em; }
.ptable2 .arrowop { font-size: .75em; color: var(--now); font-weight: 800; transform: translateY(-50%); }
.counter.c { background: var(--mint, #3cb371); }
.walk-spot { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.spot-intro { margin: 0 0 8px; }
.spot-list { margin: 0; padding-left: 1.6em; display: grid; gap: 6px; }
.spot-line { font: inherit; font-weight: 700; font-size: 1.05em; text-align: left; padding: 6px 10px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); cursor: pointer; }
.spot-line:hover:not(:disabled) { border-color: var(--primary); }
.spot-line.ok { border-color: var(--right); opacity: .7; }
.spot-line.bad { border-color: var(--wrong, #d33); background: color-mix(in srgb, var(--wrong, #d33) 12%, var(--surface)); }
.spot-fix { display: block; margin: 4px 0 0 4px; font-size: .85em; color: var(--right); font-weight: 800; }
.spot-msg { margin: 10px 0 0; min-height: 1.4em; }
.spot-next { margin: 8px 0 0; }
.walk-stage[hidden], .walk-dock[hidden], .walk-spot[hidden], .walk-modebtn[hidden] { display: none; }

/* Walkthroughs: clock and thermometer */
.wk-clock { width: min(260px, 70vw); height: auto; }
.ck-face { fill: var(--surface); stroke: var(--text); stroke-width: 4; }
.ck-tick { stroke: var(--muted); stroke-width: 1.2; }
.ck-tick.big { stroke: var(--text); stroke-width: 2.5; }
.ck-num { font: 800 17px var(--font, sans-serif); fill: var(--text); text-anchor: middle; }
.ck-num.ring { fill: var(--now); }
.ck-five { font: 800 11px var(--font, sans-serif); fill: var(--now); text-anchor: middle; }
.ck-hand { stroke-linecap: round; }
.ck-hand.hour { stroke: var(--text); stroke-width: 8; }
.ck-hand.min { stroke: var(--primary); stroke-width: 5; }
.ck-hand.win { stroke: var(--right); }
.ck-sweep { fill: color-mix(in srgb, var(--sky) 35%, transparent); }
.ck-pin { fill: var(--text); }
.wk-thermo { width: 150px; height: auto; }
.th-tube { fill: var(--surface); stroke: var(--text); stroke-width: 2.5; }
.th-bulb { fill: var(--coral); stroke: var(--text); stroke-width: 2.5; }
.th-liq { fill: var(--coral); }
.th-tick { stroke: var(--text); stroke-width: 1.5; }
.th-lab { font: 700 13px var(--font, sans-serif); fill: var(--text); }
.th-level { stroke: var(--now); stroke-width: 2.5; stroke-dasharray: 5 4; }
.th-level.win { stroke: var(--right); }

/* Walkthroughs: charts */
.wk-chart { width: 100%; max-width: 460px; height: auto; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-grid.base { stroke: var(--text); stroke-width: 2; }
.ch-y { font: 600 11px var(--font, sans-serif); fill: var(--muted); text-anchor: end; }
.ch-x { font: 700 12px var(--font, sans-serif); fill: var(--text); text-anchor: middle; }
.ch-bar { fill: var(--sky); stroke: var(--text); stroke-width: 1.5; }
.ch-bar.ring, .ch-pt.ring { stroke: var(--now); stroke-width: 4; }
.ch-bar.win { fill: var(--right); }
.ch-bar.dim, .ch-pt.dim { opacity: .35; }
.ch-line { fill: none; stroke: var(--primary); stroke-width: 3; }
.ch-pt { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.ch-pt.win { fill: var(--right); }
.ch-read { stroke: var(--now); stroke-width: 2.5; stroke-dasharray: 6 4; }
.ch-readv { font: 800 12px var(--font, sans-serif); fill: var(--now); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.ftable { gap: 4px; }
.ftable .fcell { padding: 4px 8px; text-align: center; border: 2px solid var(--border); border-radius: 6px; background: var(--surface-2); min-width: 2em; }
.ftable .fcell.ring { border-color: var(--now); box-shadow: none; border-radius: 6px; }
.ftable .fcell.win, .ftable .fcell.prod.win { border-color: var(--right); color: var(--right); }
.ftable .head { justify-self: end; padding-right: 6px; font-size: .75em; }
.dplot { row-gap: 0; }
.dplot .dmark { font-size: 1.3em; color: var(--primary); line-height: 1.1; }
.dplot .dmark.win { color: var(--right); }
.dplot .dval { border-top: 3px solid var(--text); width: 100%; text-align: center; padding-top: 4px; }
.dplot .dval.ring { box-shadow: none; color: var(--now); }
.dplot .dcount { font-size: .75em; color: var(--now); }
.wk-pie { width: min(260px, 70vw); height: auto; }
.pie-s { stroke: var(--surface); stroke-width: 2; }
.pie-s.c0 { fill: var(--sky); } .pie-s.c1 { fill: var(--coral); } .pie-s.c2 { fill: var(--sun); } .pie-s.c3 { fill: var(--mint, #3cb371); } .pie-s.c4 { fill: var(--primary-soft); } .pie-s.c5 { fill: var(--border); }
.pie-s.ring { stroke: var(--now); stroke-width: 5; }
.pie-l { font: 800 12px var(--font, sans-serif); fill: #1d1d2b; text-anchor: middle; }
.sh-seg.trace { stroke: var(--now); stroke-width: 5; stroke-linecap: round; }
.sh-seg.trace.win { stroke: var(--right); }
.sh-seg.grid { stroke: var(--text); stroke-width: 1; opacity: .5; }
.sh-poly.face.layer { fill: color-mix(in srgb, var(--sun) 70%, transparent); }
.sh-seg.refl { stroke: var(--muted); stroke-dasharray: 5 4; stroke-width: 2; }
.sh-seg.symline { stroke: var(--now); stroke-width: 2.5; stroke-dasharray: 8 5; }
.sh-seg.symline.win { stroke: var(--right); }
.wk-rose { width: min(260px, 70vw); height: auto; }
.rose-ray { stroke: var(--border); stroke-width: 1.5; }
.rose-l { font: 800 15px var(--font, sans-serif); fill: var(--text); text-anchor: middle; }
.rose-l.ring { fill: var(--primary); }
.rose-l.win { fill: var(--right); }
.rose-hand { stroke: var(--now); stroke-width: 6; stroke-linecap: round; }
.rose-hand.dim { opacity: .25; }
.nbox.pt { min-width: 0; padding: 4px 2px; border-color: transparent; background: none; }
.wk-venn { width: min(380px, 90vw); height: auto; }
.vn-u { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.vn-c { stroke: var(--text); stroke-width: 2.5; }
.vn-c.a { fill: color-mix(in srgb, var(--sky) 30%, transparent); }
.vn-c.b { fill: color-mix(in srgb, var(--coral) 28%, transparent); }
.vn-l { font: 900 15px var(--font, sans-serif); fill: var(--text); }
.vn-n { font: 800 15px var(--font, sans-serif); fill: var(--text); text-anchor: middle; }
.vn-n.win { fill: var(--right); font-size: 18px; }
.vn-n.dim { opacity: .3; }
.nbox.lo { border-color: color-mix(in srgb, var(--sky) 70%, var(--border)); }
.nbox.hi { border-color: color-mix(in srgb, var(--coral) 70%, var(--border)); }
.recur { text-decoration: overline 2px; }
.pascal { display: grid; gap: 4px; justify-items: center; font-variant-numeric: tabular-nums; }
.prow { display: flex; gap: 4px; }
.pcell { min-width: 2.2em; padding: 3px 4px; text-align: center; border-radius: 6px; background: var(--surface-2); border: 1.5px solid var(--border); font-size: .85em; }
.pcell.ring { border-color: var(--now); box-shadow: none; border-radius: 6px; }
.pcell.win { border-color: var(--right); color: var(--right); }
.cg-curve { fill: none; stroke: var(--primary); stroke-width: 3; }
.cg-curve.win { stroke: var(--right); }
.cg-sol { stroke: var(--right); stroke-width: 7; stroke-linecap: round; opacity: .8; }
.cg-curve.faint, .cg-fline.faint { stroke-opacity: .35; }
.synth { column-gap: 8px; row-gap: 6px; }
.synth .sroot { color: var(--now); border-right: 2.5px solid var(--text); padding-right: 8px; }
.synth .sum, .synth .srem { border-top: 2.5px solid var(--text); width: 100%; text-align: center; }
.synth .srem { color: var(--primary); }
.synth .smul { color: var(--muted); font-size: 1em; }
.sh-circle.rim { fill: none; }
.sh-circle.dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.sh-circle.dot.win { fill: var(--right); }
.sh-path { fill: none; }
.sh-path.arcline { stroke: var(--now); stroke-width: 7; stroke-linecap: round; opacity: .8; }
.cg-area { fill: color-mix(in srgb, var(--sky) 45%, transparent); stroke: none; }
.cg-area.b { fill: color-mix(in srgb, var(--coral) 50%, transparent); }
.cg-area.win { fill: color-mix(in srgb, var(--right) 50%, transparent); }
.wk-vstack { display: grid; gap: 12px; justify-items: center; width: 100%; }
.wk-vstack > .wk-svg { width: 100%; }
.cg-arrow.res { stroke: var(--primary); }
.cg-arrow.res.win { stroke: var(--right); }
.cg-alab.res { fill: var(--primary); }
/* KaTeX maths (see js/typeset.js) */
.tx { max-width: 100%; }
.tx .katex { font-size: 1.12em; }
.tx.b .katex { font-weight: 700; }
.tx .walk-blank, .tx .blank { font-family: var(--font, sans-serif); font-style: normal; }
.tx .katex-base:has(.mfrac) { margin-block: .25em; }
/* a whole-line expression: a block in the line's own alignment that wraps after = + − when too wide (js/typeset.js),
   is shrunk a little if it still doesn't fit, and only then scrolls */
.tx.d { display: block; }
.tx .tx-line { display: block; margin: .3em 0; overflow-x: auto; overflow-y: hidden; padding-block: .1em; text-align: inherit; }
.tx .tx-line > .katex { white-space: normal; }
/* a question's data table on a phone: tighter cells, so it fits the screen more often instead of scrolling sideways */
@media (max-width: 520px) { .prompt .formulas th, .prompt .formulas td { padding: 6px 5px; } .prompt .formulas { font-size: .92em; }
  /* R5: a data table's headings may be phrases ("Bead movement in 10 minutes"): on a phone they wrap rather than push the
     table sideways out of the prompt */
  .prompt .formulas th { white-space: normal; width: auto; } }
.tx .katex-display { margin: .3em 0; overflow-x: auto; overflow-y: hidden; padding-block: .1em; }
.tx .katex-display > .katex { text-align: inherit; }
.cg-pt.hole { fill: var(--surface); stroke: var(--primary); stroke-width: 3; }
.cg-pt.hole.win { stroke: var(--right); }
.sh-circle.rim.node { fill: var(--surface); stroke-width: 2.5; }
/* "Do it with me" walkthroughs for young children */
.walk.kid .walk-say { font-size: 1.35em; font-weight: 800; }
.walk.kid .walk-work { font-size: 1.5em; }
.wk.tapme { cursor: pointer; animation: tap-pulse 1.1s ease-in-out infinite; }
@keyframes tap-pulse { 0%, 100% { transform: scale(1); filter: none; } 50% { transform: scale(1.18); filter: drop-shadow(0 0 6px var(--now)); } }
@media (prefers-reduced-motion: reduce) { .wk.tapme { animation: none; outline: 3px dashed var(--now); outline-offset: 3px; } }
.kd-grid { display: grid; gap: 10px 8px; justify-content: center; margin: 6px auto; }
.kd-cell { display: grid; justify-items: center; gap: 2px; }
.kd-obj { display: inline-block; font-size: 2.3rem; line-height: 1.1; border-radius: 12px; transition: transform .2s, opacity .3s; }
.kd-obj.win { transform: scale(1.1); filter: drop-shadow(0 0 5px var(--right)); }
.kd-obj.ring { outline: 3px solid var(--now); outline-offset: 2px; }
.kd-obj.strike { opacity: 1; position: relative; text-decoration: none; color: transparent; text-shadow: 0 0 0 rgba(128, 128, 128, .35); }
.kd-obj.strike::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--wrong); text-shadow: none; font-weight: 900; font-size: .9em; }
.kd-tag { font: 900 1.15rem var(--font, sans-serif); color: var(--primary); min-height: 1.3em; }
.kd-rows { display: grid; gap: 8px; justify-items: start; }
.kd-rowline { display: flex; align-items: center; gap: 10px; }
.kd-five { letter-spacing: .1em; white-space: nowrap; font-size: clamp(1.3rem, 7vw, 2.3rem); }
.kd-frame { display: inline-grid; gap: 4px; padding: 6px; border: 3px solid var(--text); border-radius: 8px; background: var(--surface); }
.kd-c { width: 2.6rem; height: 2.6rem; border: 2px solid var(--border); border-radius: 6px; display: grid; place-items: center; position: relative; }
.kd-c b { color: var(--coral); font-size: 1.7rem; line-height: 1; }
.kd-c small { position: absolute; font: 900 1rem var(--font, sans-serif); color: var(--primary); opacity: 0; }
.kd-c.win { background: color-mix(in srgb, var(--right) 22%, transparent); border-color: var(--right); }
.kd-c.win small { opacity: 1; }
.kd-c.on.win small { opacity: 0; }
.kd-pair { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.kd-track { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 6px 0; }
.kd-n { min-width: 2.2rem; padding: 4px 6px; text-align: center; font: 900 1.3rem var(--font, sans-serif); border: 2px solid var(--border); border-radius: 8px; background: var(--surface); }
.kd-n.hole { background: color-mix(in srgb, var(--sun) 40%, transparent); }
.kd-n.ring { border-color: var(--now); box-shadow: 0 0 0 2px var(--now); }
.kd-n.win { border-color: var(--right); background: color-mix(in srgb, var(--right) 22%, transparent); }
.kd-groups { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.kd-gcell { display: grid; justify-items: center; padding: 6px 10px; border: 2px dashed var(--border); border-radius: 14px; }
.kd-group { font-size: 1.8rem; max-width: 7em; word-break: break-all; text-align: center; }
.kd-match { display: grid; justify-content: center; justify-items: center; row-gap: 0; }
.kd-link { color: var(--muted); font-size: 1.3rem; line-height: 1; }
.kd-add { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.kd-plus { font: 900 2rem var(--font, sans-serif); color: var(--muted); }
.kd-share { display: grid; gap: 14px; justify-items: center; }
.kd-kids { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.kd-kid { display: grid; justify-items: center; gap: 4px; padding: 6px 10px; border: 2px dashed var(--border); border-radius: 14px; min-width: 5rem; }
.kd-face { font-size: 2rem; }
.kd-plate { display: flex; flex-wrap: wrap; justify-content: center; min-height: 2.6rem; max-width: 8rem; }
.kd-plate .kd-obj { font-size: 1.7rem; }
.kd-picto { display: grid; gap: 6px; justify-items: start; }
.kd-prow { display: flex; align-items: center; gap: 10px; }
.kd-faces { font-size: 1.6rem; letter-spacing: .05em; }
.kd-die { width: 9rem; display: block; margin: 0 auto; }
.kd-die .pip.win { fill: var(--right); }
.sh-poly.kd-shape, .sh-circle.kd-shape { fill: color-mix(in srgb, var(--sky) 30%, transparent); }
.sh-poly.kd-shape.win, .sh-circle.kd-shape.win { fill: color-mix(in srgb, var(--right) 30%, transparent); }
.sh-seg.kd-side { stroke-width: 7; stroke-linecap: round; }
.sh-text.kd-emoji { font-size: 34px; stroke: none; }
.kd-solid { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: center; }
.kd-obj.kd-big { font-size: 4rem; }
.kd-facts { display: grid; gap: 6px; }
.kd-fact { font: 800 1.1rem var(--font, sans-serif); }
.kd-name { font: 900 1.3rem var(--font, sans-serif); color: var(--primary); }
.kd-name.win { color: var(--right); }
.kd-q { color: var(--muted); border: 3px dashed var(--border); padding: 0 .2em; }
.kd-queue { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; justify-content: center; }
.kd-front { font: 900 1rem var(--font, sans-serif); color: var(--muted); align-self: center; }
.kd-lr { display: flex; justify-content: space-between; gap: 2rem; max-width: 22rem; margin: 6px auto 0; }
.kd-shelf { display: grid; justify-items: center; gap: 4px; padding: 6px 30px; border-left: 6px solid var(--border); border-right: 6px solid var(--border); width: max-content; margin: 0 auto; }
.kd-shelf .kd-obj { border-bottom: 5px solid var(--border); padding: 0 18px 2px; }
.kd-bars { display: grid; gap: 10px; justify-content: center; margin: 0 auto; position: relative; }
.kd-bars.up { grid-template-columns: auto auto; align-items: end; border-bottom: 0; }
.kd-bar { display: flex; gap: 2px; }
.kd-bar.up { flex-direction: column-reverse; }
.kd-bar i { width: 1.6rem; height: 1.6rem; border-radius: 3px; }
.kd-bar.red i { background: var(--coral); }
.kd-bar.blue i { background: var(--sky); }
.kd-bar.win { outline: 3px solid var(--right); outline-offset: 3px; border-radius: 4px; }
.kd-base.up { grid-column: 1 / -1; height: 4px; background: var(--text); }
.kd-base.across { position: absolute; left: -6px; top: -6px; bottom: -6px; width: 4px; background: var(--text); }
.kd-pour { display: flex; gap: 30px; justify-content: center; align-items: flex-end; }
.kd-tank { display: block; border: 3px solid var(--text); border-top: 0; border-radius: 0 0 10px 10px; position: relative; margin-top: 4px; }
.kd-tank.big { width: 6rem; height: 5rem; }
.kd-tank.small { width: 3rem; height: 2.5rem; }
.kd-water { position: absolute; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--sky) 60%, transparent); border-radius: 0 0 7px 7px; }
.kd-water.full { top: 0; }
.kd-water.part { height: 30%; }
.kd-week, .kd-months { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.kd-day { min-width: 3rem; }
.kd-cal { display: grid; gap: 3px; justify-content: center; }
.kd-dhead { text-align: center; font-weight: 900; color: var(--muted); }
.kd-box { border: 2px solid var(--border); border-radius: 5px; text-align: center; font: 800 .8rem var(--font, sans-serif); padding: 3px 0; }

/* ===================================================== virtual labs */
/* js/lab.js and the labs in js/labs-*.js: a scene, controls, instruments, a results table, a graph and challenges.
   Big touch targets (44 px), no page-wide scrolling at 360 px (only the table scrolls inside its box). */
.lab { max-width: 1060px; margin: 0 auto 24px; }
.lab h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.lab h2 { font-size: 1.2rem; }
.lab .btn { min-height: 44px; }
.lab-head .lead { margin-bottom: .4em; }
.lab-calm { font-weight: 700; }
.lab-grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .lab-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; } }
.lab-stage, .lab-controls, .lab-data, .lab-graph, .lab-chs { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px 16px; min-width: 0; }
.lab-data, .lab-graph, .lab-chs { margin-top: 16px; }
.lab-scene .diagram { max-width: 100%; margin: 0 auto; }
.lab-status { min-height: 1.6em; margin: 6px 0; font-weight: 700; }
.lab-first { border: 2px dashed var(--primary); border-radius: 14px; background: var(--primary-soft); padding: 10px 12px; margin: 0 0 10px; }
.lab-first p { margin: 0 0 6px; }
.lab-first .cta-row { margin: 0; }
.lab-waiting [inert] { opacity: .55; } /* held until the prediction is saved (js/lab.js, predict first) */
.lab-run { margin: 6px 0; }
.lab-inst, .lab-meters { display: flex; flex-wrap: wrap; gap: 10px; }
.lab-inst { margin: 10px 0; }
.lab-watch, .lab-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 14px; padding: 8px 12px; }
.lab-inst-name { font-weight: 800; }
.lab-watch output, .lab-meter output { font: 800 1.25rem/1 ui-monospace, Menlo, Consolas, monospace; min-width: 6ch; text-align: right; padding: 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.lab-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lab-msg { margin: 0; font-weight: 700; color: var(--muted); }
.lab-ctl { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.lab-ctl legend, .lab-ctl > label { font-weight: 800; padding: 0; margin-bottom: 4px; display: block; }
.lab-val { font-weight: 900; color: var(--primary); margin-left: 4px; }
.lab-range { display: flex; align-items: center; gap: 8px; }
.lab-range input { flex: 1; min-width: 0; height: 44px; margin: 0; accent-color: var(--primary); }
.lab-step { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: 900 1.3rem var(--font); cursor: pointer; }
.lab-step:hover { border-color: var(--primary); }
.lab-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-chip { min-height: 44px; padding: 6px 12px; }
.lab-switch { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; min-height: 44px; }
.lab-switch input, .lab-opt input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); flex: none; }
.lab-noise { border-top: 1px solid var(--border); padding-top: 10px; }
.lab-scroll { overflow-x: auto; position: relative; }
.lab-data table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.lab-data th, .lab-data td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: top; }
.lab-data th { font-size: .95rem; line-height: 1.2; }
.lab-data abbr { text-decoration: none; }
.lab-unit { font-weight: 600; color: var(--muted); font-size: .8rem; }
.lab-trials { display: block; font-size: .75rem; color: var(--muted); }
.lab-same { font-weight: 700; }
.lab-del { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.lab-del:hover { color: var(--wrong); border-color: var(--wrong); }
.lab-axes { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.lab-axes label { display: flex; align-items: center; gap: 6px; font-weight: 800; max-width: 100%; }
.lab-axes select { font: inherit; min-height: 44px; max-width: 100%; min-width: 0; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); color: var(--text); padding: 4px 8px; }
.lab-plot { max-width: 520px; }
.lab-fit { font-weight: 700; }
.diagram .lab-gl { stroke: var(--gridline); stroke-width: 1; }
.diagram .lab-axis { stroke: currentColor; stroke-width: 2; }
.diagram .lab-axis-t { font: 800 13px var(--font); fill: currentColor; }
.diagram .lab-pt { fill: var(--primary); stroke: var(--fig-bg); stroke-width: 1.5; }
.diagram .lab-curve { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.diagram .lab-fitline { stroke: var(--coral); stroke-width: 2; stroke-dasharray: 7 5; }
.diagram .lab-hit { fill: transparent; }
.lab-drag { cursor: grab; touch-action: none; }
.lab-ch { border: 2px solid var(--border); border-radius: 16px; margin: 0 0 10px; background: var(--surface); }
.lab-ch.done { border-color: color-mix(in srgb, var(--climb) 50%, var(--border)); }
.lab-ch summary { cursor: pointer; padding: 10px 14px; font-weight: 800; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; min-height: 44px; }
.lab-tick { color: var(--climb); }
.lab-ch-body { padding: 0 14px 14px; }
.lab-lvl { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.lab-lvl.lvl-1 { background: var(--climb-soft); color: var(--climb); }
.lab-lvl.lvl-3 { background: var(--primary-soft); color: var(--primary); }
.lab-ask { border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
.lab-ask legend, .lab-ask > label { font-weight: 800; padding: 0; }
.lab-opt { display: flex; gap: 10px; align-items: center; min-height: 40px; font-weight: 600; }
.lab-num { display: inline-flex; align-items: center; gap: 6px; }
.lab-num input { font: inherit; width: 7em; min-height: 44px; padding: 4px 10px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); color: var(--text); }
.lab-pred { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.lab-pred-msg { margin: 6px 0 0; }
.lab-hint { background: color-mix(in srgb, var(--sun) 20%, var(--surface)); padding: 8px 12px; border-radius: 10px; }
.lab-vs { font-weight: 700; }
/* the pictures */
.diagram .lab-ruler { fill: color-mix(in srgb, var(--sun) 35%, var(--fig-bg)); stroke: currentColor; stroke-width: 1; }
.diagram .lab-beam { stroke: currentColor; stroke-width: 5; stroke-linecap: round; }
.diagram .lab-string { stroke: currentColor; stroke-width: 1.5; }
.diagram .lab-bob { fill: var(--coral); stroke: currentColor; stroke-width: 2; }
.diagram .lab-pivot, .diagram .lab-node { fill: currentColor; }
.diagram .lab-wire { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; }
.diagram .lab-flow { fill: none; stroke: var(--sky); stroke-width: 3; stroke-dasharray: 3 9; stroke-linecap: round; animation: lab-flow 1s linear infinite; }
@keyframes lab-flow { to { stroke-dashoffset: -24; } }
.diagram .lab-gap { fill: var(--fig-bg); }
.diagram .lab-plate { stroke: currentColor; stroke-width: 5; }
.diagram .lab-plate.thin { stroke-width: 2.5; }
.diagram .lab-glow, .diagram .lab-bulb-lit { fill: var(--sun); }
.diagram .lab-bulb, .diagram .lab-res, .diagram .lab-meter-c { fill: var(--fig-bg); stroke: currentColor; stroke-width: 2.5; }
.diagram .lab-meter-t { font: 900 14px var(--font); fill: currentColor; }
.diagram .lab-lead { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 4 3; }
.diagram .lab-tank { fill: none; stroke: currentColor; stroke-width: 2.5; }
.diagram .lab-liq { fill: color-mix(in srgb, var(--sky) 32%, transparent); }
.diagram .lab-liq.liq-salt { fill: color-mix(in srgb, var(--mint) 34%, transparent); }
.diagram .lab-liq.liq-oil { fill: color-mix(in srgb, var(--sun) 48%, transparent); }
.diagram .lab-surface { stroke: var(--sky); stroke-width: 2; }
.diagram .lab-obj { fill: color-mix(in srgb, var(--coral) 40%, var(--fig-bg)); stroke: currentColor; stroke-width: 2; }
@media (prefers-reduced-motion: reduce) { .diagram .lab-flow { animation: none; } }
/* the list, and the links to it */
.lab-entry { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.lab-list { margin-bottom: 24px; }
.lab-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.lab-card { display: flex; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.lab-card:hover { border-color: var(--primary); color: var(--text); }
.lab-card-icon { font-size: 2.2rem; line-height: 1; }
.lab-card-body { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.lab-link { margin: 18px 0 0; font-weight: 700; }
/* ================================================= end virtual labs */

/* ===================================================== maths what-ifs */
/* js/labs-maths.js on the lab framework: function graphs with a point to drag, strips, bars, polygons, solids. */
.lab-maths .lab-meter output { font: 800 1.02rem/1.35 var(--font); min-width: 0; text-align: left; white-space: normal; }
.lab-maths .lab-meter { max-width: 100%; }
.lab-maths .lab-status { font-weight: 700; overflow-wrap: anywhere; }
.lab-x { color: var(--muted); font-weight: 700; }
.lab-card-lvl { font-weight: 800; color: var(--primary); }
.whatif-link a { font-weight: 800; }
/* a point to drag: big target, a ring when focused, and the page does not scroll under the finger */
.diagram .lab-pt-drag { fill: var(--coral); stroke: var(--fig-bg); stroke-width: 2.5; }
.lab-drag:hover .lab-pt-drag { stroke: var(--text); }
.lab-drag:focus { outline: none; }
.lab-drag:focus-visible .lab-hit { fill: color-mix(in srgb, var(--coral) 18%, transparent); stroke: var(--coral); stroke-width: 2.5; }
.lab-scene.dragging, .lab-scene.dragging .lab-drag { cursor: grabbing; }
.diagram .lab-lbl { font: 800 13px var(--font); fill: var(--text); paint-order: stroke; stroke: var(--fig-bg); stroke-width: 4px; stroke-linejoin: round; }
.diagram .lab-lbl.strong { fill: var(--coral); }
.diagram .lab-lbl.muted { fill: var(--muted); }
.diagram .lab-aux { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 5; }
.diagram .q-root { fill: var(--sky); }
.diagram .q-yint { fill: var(--mint); }
/* graph transformations and gradients */
.diagram .tr-base { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 5; }
.diagram .tr-key { fill: var(--muted); }
.diagram .tr-move { stroke: var(--coral); stroke-width: 1.5; stroke-dasharray: 3 4; }
.diagram .gr-tangent { stroke: var(--coral); stroke-width: 2.5; }
.diagram .gr-chord { stroke: var(--sky); stroke-width: 2; stroke-dasharray: 7 4; }
.diagram .gr-q { fill: var(--sky); }
.diagram .gr-trail { fill: var(--mint); }
.diagram .gr-deriv { fill: none; stroke: var(--mint); stroke-width: 2; stroke-dasharray: 6 4; }
/* strips under a curve, and bars */
.diagram .rs-strip { fill: color-mix(in srgb, var(--sky) 30%, transparent); stroke: var(--sky); stroke-width: 1; }
.diagram .rs-strip.alt { fill: color-mix(in srgb, var(--sky) 18%, transparent); }
.diagram .ch-bar { fill: color-mix(in srgb, var(--sky) 55%, var(--fig-bg)); stroke: var(--sky); stroke-width: 1; }
.diagram .ch-bar.hit { fill: color-mix(in srgb, var(--coral) 55%, var(--fig-bg)); stroke: var(--coral); }
.diagram .ch-theory { stroke: var(--text); stroke-width: 2.5; stroke-dasharray: 4 3; }
.diagram .ch-run { fill: none; stroke: var(--coral); stroke-width: 2.5; stroke-linejoin: round; }
/* compound interest */
.diagram .ci-simple { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 5; }
.diagram .ci-cont { fill: none; stroke: var(--mint); stroke-width: 2; stroke-dasharray: 2 4; stroke-linecap: round; }
/* polygons */
.diagram .pg-tri.a { fill: color-mix(in srgb, var(--sun) 40%, var(--fig-bg)); stroke: currentColor; stroke-width: 1.5; }
.diagram .pg-tri.b { fill: color-mix(in srgb, var(--sky) 30%, var(--fig-bg)); stroke: currentColor; stroke-width: 1.5; }
.diagram .pg-fill { fill: color-mix(in srgb, var(--primary) 12%, var(--fig-bg)); }
.diagram .pg-edge { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; }
.diagram .pg-arc { fill: none; stroke: var(--primary); stroke-width: 2; }
.diagram .pg-ext { fill: none; stroke: var(--coral); stroke-width: 2.5; }
.diagram .pg-ext-line { stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 4 4; }
.diagram .pg-ang { font: 800 12px var(--font); fill: var(--primary); paint-order: stroke; stroke: var(--fig-bg); stroke-width: 3.5px; }
.diagram .pg-ang.ext { fill: var(--coral); }
.diagram .pg-num { font: 900 15px var(--font); fill: var(--text); }
.diagram .pg-dot { fill: currentColor; }
/* scale factor: the first shape dashed, the new one shaded */
.diagram .sc-new { fill: color-mix(in srgb, var(--sky) 32%, transparent); stroke: var(--sky); stroke-width: 2.5; stroke-linejoin: round; }
.diagram .sc-orig { fill: none; stroke: var(--coral); stroke-width: 2.5; stroke-dasharray: 6 4; stroke-linejoin: round; }
.diagram .sc-top { fill: color-mix(in srgb, var(--sky) 22%, var(--fig-bg)); stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.diagram .sc-side { fill: color-mix(in srgb, var(--sky) 45%, var(--fig-bg)); stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.diagram .sc-front { fill: color-mix(in srgb, var(--sky) 32%, var(--fig-bg)); stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.diagram .sc-grid { fill: none; stroke: currentColor; stroke-width: .6; opacity: .45; }
/* ================================================= end maths what-ifs */

/* ===================================================== sound labs */
/* js/labs-sound.js with js/audio.js: the sound row (▶ buttons, a light, what is playing, the device's mute and volume),
   a canvas layer under a scene (the Chladni sand), and each exploration's marks. */
.lab-sound { margin: 8px 0; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.lab-sound-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-play { min-height: 44px; }
.lab-play[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); }
.lab-light { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--sun); background: var(--sun); opacity: .25; flex: none; margin-left: auto; }
@media (prefers-reduced-motion: reduce) {
  .lab-light { opacity: 1; background: transparent; }
  .lab-light.on { background: var(--sun); }
}
/* a reading in words ("5 of 8 harmonics match", a ratio as a fraction) is set in the text font, and wraps */
.lab-meter output.lab-txt { font: 800 1.02rem/1.35 var(--font); min-width: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.lab-meter { max-width: 100%; }
.lab-caption { margin: 8px 0 4px; font-weight: 700; overflow-wrap: anywhere; }
.lab-sound-set { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.lab-sound-set .lab-switch { min-height: 40px; font-weight: 600; }
.lab-vol { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; max-width: 100%; }
.lab-vol input { width: 140px; max-width: 45vw; height: 40px; accent-color: var(--primary); }
.lab-layer { position: relative; margin: 0 auto; }
.lab-layer > svg, .lab-layer > svg.diagram { position: relative; display: block; width: 100%; max-width: none; margin: 0; }
.lab-canvas { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--text); pointer-events: none; }
/* the string */
.diagram .st-string { fill: none; stroke: var(--coral); stroke-width: 3; stroke-linejoin: round; }
.diagram .st-string.st-other { stroke-dasharray: 6 5; stroke-width: 2; opacity: .8; }
.diagram .st-bridge { fill: currentColor; }
.diagram .st-node { fill: var(--primary); stroke: var(--fig-bg); stroke-width: 1.5; }
.diagram .st-pluck { fill: var(--primary); }
/* the pipes */
.diagram .pp-air { fill: color-mix(in srgb, var(--sky) 14%, var(--fig-bg)); }
.diagram .pp-wall { stroke: currentColor; stroke-width: 4; }
.diagram .pp-cap { stroke: currentColor; stroke-width: 9; }
.diagram .pp-wave { fill: none; stroke: var(--sky); stroke-width: 2.5; }
.diagram .pp-wave.other { stroke-dasharray: 6 5; }
.diagram .pp-bar { fill: color-mix(in srgb, var(--sky) 45%, var(--fig-bg)); stroke: var(--sky); stroke-width: 1.5; }
.diagram .pp-bar.off { fill: none; stroke: var(--muted); stroke-dasharray: 4 3; }
.diagram .pp-bar.on { fill: color-mix(in srgb, var(--coral) 60%, var(--fig-bg)); stroke: var(--coral); }
/* the timbre mixer */
.diagram .tm-wave { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; }
.diagram .tm-target { fill: none; stroke: var(--coral); stroke-width: 2.5; stroke-dasharray: 5 3; }
/* beats */
.diagram .bt-str { stroke: currentColor; stroke-width: 2; }
.diagram .bt-str.two { stroke: var(--coral); }
.diagram .bt-peg { fill: var(--fig-bg); stroke: var(--coral); stroke-width: 3; }
.diagram .bt-env { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.diagram .bt-cursor { stroke: var(--coral); stroke-width: 2.5; }
/* the Chladni plate: the plate, the nodal lines, the post it stands on (the sand is on the canvas) */
.diagram .cl-plate { fill: color-mix(in srgb, var(--sun) 18%, transparent); stroke: currentColor; stroke-width: 3; }
.diagram .cl-line { fill: none; stroke: var(--coral); stroke-width: 2; stroke-linecap: round; }
.diagram .cl-post { fill: currentColor; }
/* stacking fifths */
.diagram .cm-ring { fill: none; stroke: var(--gridline); stroke-width: 1; }
.diagram .cm-path { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.diagram .cm-dot { fill: var(--primary); stroke: var(--fig-bg); stroke-width: 1.5; }
.diagram .cm-dot.start { fill: var(--mint); }
.diagram .cm-dot.last { fill: var(--coral); }
.diagram .cm-dot.now { fill: var(--sun); stroke: currentColor; stroke-width: 2; }
/* the tuning comparer: just, Pythagorean and equal on a cents ruler */
.diagram .tu-mark { stroke-width: 4; }
.diagram .tu-mark.now { stroke-width: 7; }
.diagram .tu-just { stroke: var(--mint); }
.diagram .tu-pyth { stroke: var(--coral); }
.diagram .tu-et { stroke: var(--primary); }
.diagram .lab-lbl.tu-just-t { fill: var(--mint); }
.diagram .lab-lbl.tu-pyth-t { fill: var(--coral); }
.diagram .lab-lbl.tu-et-t { fill: var(--primary); }
/* ================================================= end sound labs */

/* ===================================================== explore tasks */
/* Low floor, high ceiling tasks (js/explore.js), and the gentler practice feedback. */
:root { --climb: #138a52; --climb-soft: #e3f7ec; --counter-red: #e2483a; --counter-yel: #f5b80c; --fb-retry: #fff4d6; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --climb: #4fd394; --climb-soft: #183c33; --counter-red: #ff7a6b; --counter-yel: #ffd25a; --fb-retry: #3a2f17; }
}
:root[data-theme="dark"] { --climb: #4fd394; --climb-soft: #183c33; --counter-red: #ff7a6b; --counter-yel: #ffd25a; --fb-retry: #3a2f17; }

.how-calm { margin: 14px 0 0; color: var(--muted); font-weight: 700; }
.fb-retry { background: var(--fb-retry); border: 2px solid color-mix(in srgb, var(--sun) 60%, transparent); }
.fb-retry .fb-title { color: var(--text); }
.fb .way-btn { margin-top: 10px; margin-left: 6px; }
.fixed-note { font-weight: 800; color: var(--right); }
.look-again { max-width: 560px; margin: 16px auto; text-align: left; }
.look-again h2 { font-size: 1.15rem; }
.look-again ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.explore-next { font-weight: 700; }
.topic-actions .btn { min-height: 44px; }
.explore-mark { color: var(--climb); font-weight: 900; }
.explore-teaser { margin: 28px 0 8px; padding: 18px 20px; border-radius: 16px; background: var(--climb-soft); border: 2px solid color-mix(in srgb, var(--climb) 35%, transparent); }
.explore-teaser h2 { font-size: 1.3rem; }
.explore-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.explore-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.explore-progress { margin-bottom: 24px; }

.explore { max-width: 820px; margin: 0 auto 24px; }
.explore h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.explore-calm { font-weight: 700; color: var(--muted); }
.explore-launch { margin: 8px 0 18px; padding: 16px 18px; border-radius: 16px; background: var(--surface-2); overflow-x: auto; }
.explore-launch .callout { margin-bottom: 0; }
.explore-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 24px; border-top: 1px solid var(--border); padding-top: 14px; }
.explore-foot .btn, .xpart .btn, .explore-teaser .btn, .explore-back .btn, .look-again .btn { min-height: 44px; }
.explore-back { justify-content: center; }

/* the staircase: one rung per step, each a little higher */
.climb { list-style: none; display: flex; align-items: flex-end; gap: 6px; padding: 0; margin: 4px 0 18px; overflow-x: auto; }
.climb li { flex: 1 1 0; min-width: 72px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; font-size: .8rem; font-weight: 800; color: var(--muted); text-align: center; line-height: 1.2; }
.climb .rung { display: grid; place-items: center; width: 100%; height: calc(16px + var(--h) * 12px); border-radius: 8px 8px 4px 4px; background: var(--surface-2); border: 2px solid var(--border); font-size: 1rem; }
.climb li.rung-done .rung { background: var(--climb); border-color: var(--climb); color: var(--on-primary); }
.climb li.rung-now .rung { background: var(--climb-soft); border-color: var(--climb); }
.climb li.rung-done, .climb li.rung-now { color: var(--text); }

.xpart { border: 2px solid var(--border); border-radius: 18px; padding: 16px 18px; margin: 0 0 16px; background: var(--surface); }
.xpart h2 { font-size: 1.1rem; margin-bottom: .3em; color: var(--climb); }
.xpart h2:focus { outline: none; }
.xpart h2:focus-visible { outline: 3px solid var(--sun); }
.xpart.done { border-color: color-mix(in srgb, var(--climb) 50%, var(--border)); }
.xpart-tick { color: var(--climb); }
.xpart .prompt { margin-top: 0; }
.xpart .fb { margin-top: 12px; }
.xpart .walk-box:not(:empty) { margin-top: 12px; }
.xmsg { color: var(--text); }
.xnew { color: var(--right); font-weight: 900; }
.explore-ceiling { margin-top: 26px; }
.explore-ceiling .ceil-h { color: var(--climb); }
.explore-ceiling .xpart { border-style: dashed; }
.explore-ceiling .xpart.done { border-style: solid; }

.found-count { font-weight: 800; margin: 12px 0 6px; }
.found-shelf { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.found-item { background: var(--climb-soft); border: 1px solid color-mix(in srgb, var(--climb) 35%, transparent); border-radius: 12px; padding: 6px 12px; font-weight: 700; max-width: 100%; overflow-x: auto; }
.found-item.shown { background: var(--surface-2); border-style: dashed; border-color: var(--border); }
.found-shelf.stairs { flex-direction: column; align-items: flex-start; }
.xway { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.xgrid { display: inline-block; vertical-align: middle; max-width: 100%; height: auto; }
.xgrid rect { fill: var(--diagram-fill); stroke: currentColor; stroke-width: 1.2; }
.xloose { display: flex; flex-wrap: wrap; gap: 5px; max-width: 420px; margin: 8px 0; }
.xloose i { width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 3px; background: var(--diagram-fill); }
.xloose i:nth-child(3n) { transform: rotate(14deg); }
.xloose i:nth-child(4n + 1) { transform: rotate(-10deg); }
.xfigs { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.xfig { margin: 0; text-align: center; }
.xfig figcaption { font-size: .85rem; font-weight: 800; color: var(--muted); }
.xtiles { display: flex; gap: 10px; }
.xtiles span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--surface); border: 3px solid var(--primary); font-size: 1.6rem; font-weight: 900; box-shadow: 0 3px 0 var(--border); }

/* red and yellow counters */
.xspill { display: inline-grid; grid-template-columns: repeat(5, 28px); gap: 6px; vertical-align: middle; }
.xspill i { width: 28px; height: 28px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text) 50%, transparent); }
.xspill i.red { background: var(--counter-red); }
.xspill i.yel { background: var(--counter-yel); }
.found-item .xspill { grid-template-columns: repeat(10, 18px); gap: 3px; }
.found-item .xspill i { width: 18px; height: 18px; }
.xcounters { display: flex; flex-wrap: wrap; gap: 10px; max-width: 360px; }
.xc { width: 56px; height: 56px; border-radius: 50%; cursor: pointer; background: var(--counter-yel); border: 3px solid color-mix(in srgb, var(--text) 45%, transparent); box-shadow: 0 3px 0 var(--border); }
.xc[aria-pressed="true"] { background: var(--counter-red); }
.xc:disabled { cursor: default; }
.xc-status { font-weight: 800; margin: 8px 0 0; }

.xfields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 800; }
.xfield { font: inherit; width: 4.2ch; min-width: 56px; min-height: 48px; text-align: center; padding: 6px 4px; border-radius: 12px; border: 3px solid var(--border); background: var(--surface); color: var(--text); }
.xfield:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }
.xboard { display: grid; grid-template-columns: repeat(7, minmax(36px, 1fr)); gap: 6px; max-width: 420px; margin: 8px 0 10px; }
.xcell { display: grid; place-items: center; min-height: 40px; border-radius: 10px; border: 2px dashed var(--border); font-weight: 900; color: var(--muted); }
.xcell.on { border-style: solid; border-color: var(--climb); background: var(--climb); color: var(--on-primary); }

.explore.kid .prompt { font-size: 1.35rem; }
.explore.kid .choice { font-size: 1.9rem; min-height: 76px; }
.explore.kid .choices.wordy .choice { font-size: 1.2rem; }

@media (max-width: 520px) {
  .climb li { min-width: 56px; font-size: .72rem; }
  .xpart { padding: 14px 12px; }
  .xc { width: 52px; height: 52px; }
  .xtiles span { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) { .xloose i { transform: none !important; } }

/* Onboarding: syllabus → year → quiz → a few suggested topics */
.onboard-steps { display: flex; flex-wrap: wrap; gap: 6px 4px; padding: 0; margin: 0 0 14px; font-size: .8rem; font-weight: 800; color: var(--muted); }
.onboard-steps span { display: flex; white-space: nowrap; align-items: center; gap: 6px; }
.onboard-steps span + span::before { content: ''; width: 14px; height: 2px; background: var(--border); margin-right: 2px; }
.onboard-steps .step-done { color: var(--mint); }
.onboard-steps .step-now { color: var(--primary); }
.placement .syl-options { margin-bottom: 8px; }
.level-pick .btn[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.level-pick .btn[aria-pressed="true"]::before { content: '✓ '; }
.suggest { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 8px; text-align: left; }
.suggest li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 2px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--surface); }
.suggest li:hover { border-color: var(--primary); }
.suggest a { flex: 1; min-width: 12em; display: grid; gap: 2px; text-decoration: none; color: var(--text); }
.suggest a .muted { font-size: .85rem; }
.suggest .pill { font-size: .75rem; }
.now-more { margin-top: 18px; }
details.report { margin: 18px 0 8px; text-align: left; }
details.report > summary { cursor: pointer; font-weight: 800; color: var(--primary); }
.hero-note { margin-top: 12px; }

/* Maths | Science tabs in the catalog */
.subject-tabs { margin: 4px 0 12px; }
.subject-tabs .seg-btn { text-decoration: none; }
.subject-tabs .seg-btn[aria-current="page"] { background: var(--primary); color: var(--on-primary); }

/* Home: one card per subject */
.subjects { margin: 32px 0; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.subject-card { display: block; padding: 18px; border: 2px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
a.subject-card:hover { border-color: var(--primary); }
.subject-card h3 { margin: 6px 0 4px; }
.subject-card p { margin: 0; color: var(--muted); font-size: .95rem; font-weight: 400; }
.subject-card.soon { opacity: .7; border-style: dashed; box-shadow: none; }
.subject-icon { font-size: 1.8rem; }

/* ===================================================== long answers (js/structured.js) */
/* The progress dots share the class of the dice pictures (.dots, 120 × 120): keep them one row. */
.practice > .dots { width: auto; height: auto; }
.practice-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.long-toggle[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.long-note { font-size: .9rem; color: var(--muted); background: var(--surface-2); border-radius: 12px; padding: 8px 12px; margin: 8px 0 10px; }
.long-marks { font-weight: 800; }
.sa-intro { font-size: .92rem; margin: 0 0 8px; }
.sa-part { border-top: 2px solid var(--border); padding-top: 12px; margin-top: 12px; }
.sa-part:first-child { border-top: 0; margin-top: 0; padding-top: 4px; }
.sa-ask { font-size: 1.05rem; font-weight: 800; margin-bottom: .6em; }
.sa-label { color: var(--primary); }
.sa-max { color: var(--muted); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.sa-q { font-weight: 800; margin: 0 0 6px; }
.sa-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-bottom: 8px; }
.sa-method { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 3px solid var(--border); min-height: 44px; }
.sa-method:hover:not(:disabled) { border-color: var(--primary); }
.sa-method:disabled { cursor: default; opacity: .75; }
.sa-method.is-right { border-color: var(--right); background: var(--right-soft); opacity: 1; }
.sa-method.is-wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.sa-mname { font-weight: 900; font-size: 1.05rem; }
.sa-mblurb { font-size: .85rem; color: var(--muted); }
.sa-why { font-size: .95rem; margin: 4px 0 8px; padding: 8px 12px; border-radius: 12px; }
.sa-why.ok { background: var(--right-soft); }
.sa-why.no { background: var(--wrong-soft); }
.sa-lines { list-style: none; margin: 8px 0 0; padding: 0; }
.sa-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 10px; border-left: 4px solid var(--border); margin-bottom: 6px; border-radius: 0 10px 10px 0; background: var(--surface); }
.sa-line.given { border-left-style: dashed; color: var(--muted); }
.sa-line.cur { border-left-color: var(--primary); background: var(--primary-soft); flex-direction: column; align-items: stretch; }
.sa-line.done { border-left-color: var(--right); }
.sa-line.done.lost { border-left-color: var(--wrong); }
.sa-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.sa-work { font-size: 1.1rem; font-weight: 700; overflow-wrap: anywhere; }
.sa-reason { font-size: .85rem; color: var(--muted); font-style: italic; }
.sa-reason::before { content: '← '; font-style: normal; }
.sa-in { font: inherit; font-size: 1.1rem; font-weight: 800; width: 6.5em; max-width: 100%; padding: 6px 10px; border-radius: 10px; border: 3px solid var(--border); background: var(--surface); color: var(--text); vertical-align: middle; }
.sa-in:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }
.sa-val { display: inline-block; min-width: 2ch; padding: 0 6px; border-bottom: 2px solid currentColor; }
.sa-was { color: var(--wrong); text-decoration-thickness: 2px; }
.sa-fix { font-size: .9rem; font-weight: 800; color: var(--right); }
.sa-split { font-weight: 700; }
.sa-ref.sa-ft { background: color-mix(in srgb, var(--sun) 35%, transparent); border-radius: 4px; padding: 0 3px; }
.sa-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.sa-mark { font-size: .8rem; font-weight: 900; border-radius: 12px; padding: 1px 9px; margin-left: auto; max-width: 100%; overflow-wrap: anywhere; }
.sa-mark.got { background: var(--right-soft); color: var(--right); border: 1px solid var(--right); }
.sa-mark.lost { background: var(--wrong-soft); color: var(--wrong); border: 1px solid var(--wrong); }
.sa-q .sa-mark { margin-left: 8px; }
.sa-msg, .sa-note { font-size: .95rem; margin: 6px 0 0; }
.sa-msg:empty { display: none; }
.sa-msg .sa-btns { margin-top: 6px; display: flex; }
.sa-note { color: var(--muted); }
.sa-codes { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .02em; }
@media (max-width: 480px) {
  .sa-methods { grid-template-columns: 1fr; }
  .sa-work { font-size: 1.02rem; }
  .sa-mark { margin-left: 0; }
}

/* ======================================== My Way (Caraku): one card at a time */
.myway { max-width: 760px; margin: 0 auto 24px; }
.mw-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.mw-head .eyebrow { font-size: .95rem; margin: 0; }
.mw-sub { margin: 2px 0 0; }
.mw-progress { display: grid; gap: 8px; margin-bottom: 12px; }
.mw-goal { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: .92rem; }
.mw-goal .pbar { flex: 1; }
.mw-steps { display: flex; gap: 4px; }
.mw-steps span { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.mw-steps .done { background: var(--primary); border-color: var(--primary); }
.mw-steps .cur { background: var(--primary-soft); border-color: var(--primary); }
.mw-card { border-top: 6px solid var(--stage, var(--primary)); padding: clamp(18px, 4vw, 32px); margin-bottom: 12px; }
.mw-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mw-kind { background: var(--primary-soft); color: var(--primary); }
.mw-review .mw-kind { background: color-mix(in srgb, var(--sun) 30%, var(--surface)); color: var(--text); }
.mw-check .mw-kind, .mw-fix .mw-kind { background: color-mix(in srgb, var(--coral) 22%, var(--surface)); color: var(--text); }
.mw-challenge .mw-kind { background: color-mix(in srgb, var(--lvl-college) 20%, var(--surface)); color: var(--text); }
.mw-topic { font-weight: 800; color: var(--text); text-decoration: none; }
.mw-topic:hover { text-decoration: underline; }
.mw-lesson > :first-child { margin-top: 0; }
.mw-next { margin-top: 18px; }
.mw-why { margin: 18px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: .92rem; }
.mw-why-label { font-weight: 800; color: var(--text); }
.mw-event:empty { display: none; }
.mw-event { margin-top: 12px; }
.mw-event .notice { margin: 0; padding: 12px 16px; }
.mw-event > * + * { margin-top: 8px; }
/* Check sets: visibly a check ("Check · no hints"), with what it's for and a dot per question. */
.mw-set .mw-kind { background: var(--surface); color: var(--text); border: 2px solid var(--primary); }
.mw-set { border-top-style: double; }
.mw-set-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: -4px 0 12px; font-size: .9rem; color: var(--muted); }
.mw-set-why { font-weight: 800; color: var(--text); }
.mw-set-dots { display: inline-flex; gap: 5px; }
.mw-set-dots span { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--primary); background: var(--surface); }
.mw-set-dots .done { background: var(--primary); }
.mw-set-dots .cur { background: var(--primary-soft); }
.mw-look .mw-kind { background: color-mix(in srgb, var(--sun) 30%, var(--surface)); color: var(--text); }
.mw-result { padding: 12px 16px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface-2); }
.mw-result.passed { border-color: color-mix(in srgb, var(--mint) 55%, var(--border)); background: var(--right-soft); }
.mw-result.missed { border-color: color-mix(in srgb, var(--sun) 60%, var(--border)); background: color-mix(in srgb, var(--sun) 14%, var(--surface)); }
.mw-result p { margin: 0; }
.mw-result-head { font-weight: 700; }
.mw-result-tier { margin-top: 6px !important; font-size: .95rem; }
.mw-steps .extra { flex: .5; border-style: dashed; }
/* The day's end card: today's summary, the level with today's progress, and tomorrow's first card. */
.mw-day-tier { display: grid; justify-items: center; gap: 4px; margin: 6px auto 14px; max-width: 380px; }
.mw-day-tier .tier-pips { width: 100%; margin-top: 4px; }
.mw-day-tier .tier-next, .mw-day-made { margin: 0; }
.mw-day-made { font-weight: 800; }
.mw-next-up { font-weight: 700; margin: 0 0 10px; }
.mw-end { text-align: center; }
.mw-sum { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.mw-alt { text-align: center; }
.mw-settings { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mw-goal-set { align-items: center; }
.mw-goal-label { font-size: .85rem; font-weight: 800; color: var(--muted); padding: 0 6px 0 8px; white-space: nowrap; }
.mw-goal-set .seg-btn { min-width: 34px; }
.mw-skip-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.mw-skip { color: var(--muted); }
.mw-note { margin: 0; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--sun) 22%, var(--surface)); font-size: .92rem; }
/* Forgetting, site-wide: "Worth a review" on topics, courses, the Progress page and a topic's page */
.mem-note { margin: 6px 0 12px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--sun) 18%, var(--surface)); font-size: .92rem; }
.notice .mem-note { margin: 8px 0 0; padding: 0; background: none; }
.tile-review { color: var(--text); font-weight: 700; }
.review-summary { margin-bottom: 26px; padding: 16px 18px; }
.review-summary h2 { margin-top: 0; }
.review-list { margin: 8px 0 10px; padding-left: 1.3em; display: grid; gap: 4px; }
.review-list li { overflow-wrap: anywhere; line-height: 1.35; }
.review-list li .muted { display: block; }
.review-summary .cta-row { align-items: center; }
.mw-run-line { margin: -4px 0 6px; font-size: .9rem; font-weight: 700; }
.mw-break h2 { font-size: 1.8rem; }
.mw-grownup { margin-top: 18px; }
.mw-card.kid .choice { font-size: 1.9rem; min-height: 76px; }
.mw-card.kid .choices { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.mw-card.kid .choices.wordy .choice { font-size: 1.15rem; }
.mw-card.kid .choices.wordy { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.mw-card.kid .prompt, .mw-card.kid .mw-lesson { font-size: 1.3rem; }
.mw-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; background: var(--surface); border: 2px dashed color-mix(in srgb, var(--primary) 45%, var(--border)); border-radius: var(--radius); padding: 16px 20px; margin: 12px 0 20px; }
.mw-banner h2 { font-size: 1.2rem; margin: 0 0 2px; }
.mw-banner p { margin: 0; }
.placement .mw-banner { margin-top: 18px; text-align: left; }
@media (max-width: 520px) {
  .mw-banner .btn { width: 100%; justify-content: center; }
}

/* ======================================================== worksheet */
/* #/worksheet/<subject>: the gap worksheet (js/worksheet.js). On screen a card with a toolbar; printed, just the sheet. */
.ws-bar { max-width: 860px; margin: 0 auto 16px; }
.ws-bar-end { margin-top: -8px; }
.ws-actions { margin: 0 0 12px; }
.ws-choose { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; }
.ws-choose summary { font-weight: 800; cursor: pointer; }
.ws-pick { list-style: none; padding: 0; margin: 8px 0 0; }
.ws-pick li { margin: 6px 0; }
.ws-pick label { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.ws-pick input { width: 18px; height: 18px; flex: none; transform: translateY(3px); }
.ws-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0; }
.ws-progress { margin: 4px 0 0; font-weight: 700; }
.worksheet { max-width: 860px; margin: 0 auto 16px; }
.ws-head h1 { margin-bottom: .4em; }
.ws-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 18px; }
.ws-meta div { display: flex; gap: 6px; }
.ws-meta dt { color: var(--muted); font-weight: 700; }
.ws-meta dt::after { content: ':'; }
.ws-meta dd { margin: 0; font-weight: 800; }
.ws-sub { font-size: 1.1rem; margin-top: .6em; }
.ws-list { padding-left: 1.4em; margin: 0 0 12px; }
.ws-list li { margin-bottom: .3em; }
.ws-how { font-size: .95rem; }
.ws-topic { border-top: 2px dashed var(--border); margin-top: 28px; padding-top: 24px; }
.ws-topic > h2 { display: flex; align-items: baseline; gap: 10px; margin-bottom: .2em; }
.ws-num { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .3em; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .85em; font-weight: 900; flex: none; }
.ws-why { margin-bottom: 14px; }
.ws-read h3, .ws-practice h3 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 1.2em; }
.ws-read .lesson-body { font-size: 1rem; }
.ws-read .lesson-body h3 { margin-top: 1em; }
.ws-qs { list-style: none; padding: 0; margin: 0; }
.ws-q { position: relative; padding: 14px 0 14px 2.4em; border-bottom: 1px solid var(--border); }
.ws-q::before { content: attr(value) "."; position: absolute; left: 0; top: 14px; font-weight: 900; font-size: 1.1rem; }
.ws-q:last-child { border-bottom: 0; }
.ws-q.is-done::before { content: "✓"; color: var(--right); }
.ws-tier { margin: 0 0 .2em; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ws-q .prompt { margin-top: 0; font-size: 1.08rem; }
.ws-q .prompt .big { font-size: 1.6rem; }
.ws-choices { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.ws-choices.wordy { flex-direction: column; gap: 6px; }
.ws-choices li { display: flex; align-items: center; gap: 8px; }
.ws-letter { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border: 2px solid currentColor; border-radius: 999px; font-weight: 900; font-size: .9rem; flex: none; }
.ws-choice { font-weight: 700; }
.ws-lines { display: none; margin: 10px 0 0; }
.ws-lines i { display: block; height: 8mm; border-bottom: 1px solid #9a9a9a; }
.ws-answer-line { display: none; margin: 10px 0 0; font-weight: 800; }
.ws-answer-line i { display: inline-block; width: 50%; border-bottom: 1.5px solid #000; height: 1em; vertical-align: baseline; }
.ws-box { display: none; height: 24mm; margin: 12px 0 0; border: 2px solid #777; border-radius: 12px; padding: 6px 10px; }
.ws-box span { font-weight: 800; color: #555; }
.ws-check { margin-top: 10px; }
.ws-try { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.ws-try-label { font-weight: 700; }
.ws-letters { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.ws-letter-btn { min-width: 44px; }
.ws-letter-btn.is-right { border-color: var(--right); background: var(--right-soft); }
.ws-letter-btn.is-wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.ws-in.answer-input { font-size: 1.1rem; padding: 8px 12px; max-width: 220px; border-width: 2px; border-radius: 10px; }
.ws-done { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); cursor: pointer; margin-left: auto; }
.ws-done input { width: 18px; height: 18px; }
.ws-fb { margin: .4em 0 0; font-weight: 800; min-height: 1.2em; }
.ws-fb.is-right { color: var(--right); }
.ws-fb.is-wrong { color: var(--wrong); }
.ws-sol-btn { font-size: .92rem; }
.ws-inline-sol { margin-top: 10px; padding: 12px 16px; background: var(--surface-2); border-radius: 12px; }
.ws-key { border-top: 3px solid var(--text); margin-top: 32px; padding-top: 22px; }
.ws-key.is-closed .ws-key-body { display: none; }
.ws-key-topic h3 { display: flex; align-items: baseline; gap: 8px; margin-top: 1.2em; }
.ws-key-list { padding-left: 2.2em; }
.ws-key-list > li { margin-bottom: 14px; }
.ws-key-list > li::marker { font-weight: 900; }
.ws-key-ans { margin: 0 0 .3em; }
.ws-sol .steps.sol { margin-bottom: .4em; }
.ws-gate { max-width: 680px; margin: 0 auto; }
.worksheet .formulas th { white-space: normal; }
.worksheet .lesson-body, .ws-sol, .ws-inline-sol { overflow-x: auto; }
/* Kindergarten and primary topics: bigger print, and room for pictures */
.ws-kid .prompt, .ws-kid .lesson-body { font-size: 1.2rem; }
.ws-kid-k .prompt, .ws-kid-k .lesson-body { font-size: 1.35rem; }
.ws-kid .ws-choices { gap: 12px 28px; }
.ws-kid .ws-choice { font-size: 1.3rem; }
.ws-kid-k .ws-choice { font-size: 1.6rem; }
.ws-kid .ws-letter { font-size: 1rem; width: 1.9em; height: 1.9em; }
.ws-kid .ws-lines i { height: 11mm; }
@media (max-width: 520px) {
  .ws-q { padding-left: 1.9em; }
  .ws-key-list { padding-left: 1.8em; }
  .ws-done { margin-left: 0; }
  .ws-in.answer-input { max-width: 100%; flex: 1 1 140px; }
  .ws-meta { gap: 4px 16px; }
}

/* ============================================================ print */
/* Dark mode is screen-only (its @media blocks say "screen"), so a printout always starts from the light tokens; here they
   turn black on white. Only the page's content prints: no header, footer, buttons or answer checks. The page size is
   left to the printer, with margins that suit A4 and Letter alike. */
@media print {
  @page { margin: 14mm 13mm 16mm; }
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --muted: #333; --border: #999;
    --primary: #000; --primary-soft: #e6e6e6; --sky: #000; --diagram-fill: #e8e8e8; --gridline: rgba(0, 0, 0, .3);
    --right: #000; --right-soft: #fff; --wrong: #000; --wrong-soft: #fff; --shadow: none;
  }
  html, body { background: #fff !important; color: #000; }
  body { display: block; font-size: 11.5pt; line-height: 1.45; }
  .site-header, .site-footer, .skip-link, .no-print, .crumbs, .lang-note { display: none !important; }
  main, main.wrap { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; margin: 0; border-radius: 0; }
  a { color: #000; text-decoration: none; }
  h1 { font-size: 20pt; }
  h2 { font-size: 15pt; }
  .eyebrow { color: #000; }
  .example { background: #fff; border: 1px solid #999; border-left: 4px solid #000; }
  .callout, .formula, .hint, .mw-note { background: #fff; border: 1px solid #999; }
  .ex-title, .lesson-body h3, .formulas th { color: #000; }
  .diagram, .example .diagram, .callout .diagram { --fig-bg: #fff; }
  svg, figure, table, .example, .callout, .formula { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  /* the worksheet: topics follow each other (a rule between them), the answer key starts a new page and prints the
     brief solutions where there are any, to keep a printed sheet short */
  .worksheet { max-width: none; margin: 0; }
  .ws-topic { border-top: 1.5px solid #000; margin-top: 14px; padding-top: 10px; }
  .ws-head + .ws-topic { border-top: 0; margin-top: 12px; padding-top: 0; }
  .ws-key { break-before: page; border-top: 0; margin-top: 0; padding-top: 0; }
  .ws-key li.has-brief .sol-view[data-view="full"] { display: none !important; }
  .ws-key li.has-brief .sol-view[data-view="brief"] { display: block !important; }
  .ws-read .example, .ws-read .callout { margin: 8px 0; padding: 8px 10px; }
  .ws-q .prompt .big { font-size: 1.45rem; }
  .ws-key.is-closed .ws-key-body { display: block; }
  .ws-key-list > li, .ws-q { break-inside: avoid; }
  .ws-q { border-bottom: 0; padding: 8px 0 10px 2.2em; }
  .ws-q.is-done::before { content: attr(value) "."; color: #000; }
  .ws-num { background: #fff; border: 1.5px solid #000; color: #000; }
  .ws-lines, .ws-answer-line, .ws-box { display: block; }
  .ws-read .lesson-body { font-size: 11pt; }
  .ws-kid .prompt, .ws-kid .lesson-body { font-size: 14pt; }
  .ws-kid-k .prompt, .ws-kid-k .lesson-body { font-size: 16pt; }
  .ws-kid .ws-choice { font-size: 15pt; }
  .ws-kid-k .ws-choice { font-size: 19pt; }
  .worksheet { font-size: 10.5pt; line-height: 1.35; }
  .worksheet h1 { font-size: 17pt; } .worksheet h2 { font-size: 13pt; margin: .3em 0 .2em; }
  .worksheet .ws-read h3, .worksheet .ws-practice h3 { margin: .5em 0 .2em; font-size: 10pt; }
  .worksheet .ws-read .lesson-body, .worksheet .ws-sol { font-size: 10pt; }
  .worksheet .ws-read .lesson-body p, .worksheet .ws-sol p { margin: .3em 0; }
  .worksheet .ws-lines i { height: 7mm; }
  .worksheet .ws-q { padding: 5px 0 6px 2em; } .worksheet .ws-q::before { top: 5px; font-size: 10.5pt; }
  .worksheet .ws-choices { margin: 4px 0; }
  .worksheet .ws-key-list > li { margin-bottom: 4px; }
  /* practice questions in two columns on paper, read across in pairs (kindergarten pages keep one wide column);
     a question too wide for a column (ws-wide, measured in app.js) takes the whole row */
  .worksheet .ws-topic:not(.ws-kid-k) .ws-qs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 9mm; align-items: start; }
  .worksheet .ws-topic:not(.ws-kid-k) .ws-qs .ws-q { break-inside: avoid; min-width: 0; }
  .worksheet .ws-topic:not(.ws-kid-k) .ws-qs .ws-q.ws-wide { grid-column: 1 / -1; }
  .worksheet .ws-qs svg, .worksheet .ws-qs .diagram, .worksheet .ws-qs table { max-width: 100%; height: auto; }
  /* a question with a display-size line (an equation on its own line) takes the full width, so nothing is cut off */
  .worksheet .ws-qs .katex-display, .worksheet .ws-qs .tx-line { margin: .4em 0; }
  .tx .tx-line { overflow: visible; font-size: 1em !important; } /* on paper it wraps instead of shrinking for the screen */
  .worksheet .ws-q .prompt .big { font-size: 1rem; }
  .worksheet .ws-q .prompt .big .katex { font-size: 1.05em; } /* about 12.5 pt: an equation line fits a column */
  .worksheet table td, .worksheet table th { padding: 2px 6px; }
  .prompt, .worksheet .lesson-body, .ws-sol { overflow: visible; }
}

/* ============================================================ tiers
   The learner's rank and tier (js/tiers.js): a colour per tier, used only as an accent, never as text colour. html[data-tier]
   is set for the subject in view once its placement quiz is done; badges and pips carry their own data-tier. */
:root {
  --tier-wood: #8a5a2e; --tier-stone: #6f7682; --tier-iron: #4f5d6e; --tier-copper: #b85c26;
  --tier-bronze: #9a6a1f; --tier-silver: #7a8699; --tier-gold: #b08400; --tier-platinum: #3f8e9e;
  --tier-emerald: #138a55; --tier-sapphire: #2357d6; --tier-ruby: #c0244e; --tier-diamond: #0b8fb3;
}
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tier-wood: #c9935f; --tier-stone: #aab1bc; --tier-iron: #8fa1b6; --tier-copper: #ec8a52;
    --tier-bronze: #d6a35a; --tier-silver: #c8d1de; --tier-gold: #f2c94c; --tier-platinum: #8fd3e0;
    --tier-emerald: #4fd394; --tier-sapphire: #7aa7ff; --tier-ruby: #ff7092; --tier-diamond: #7fe0ff;
  }
}
:root[data-theme="dark"] {
  --tier-wood: #c9935f; --tier-stone: #aab1bc; --tier-iron: #8fa1b6; --tier-copper: #ec8a52;
  --tier-bronze: #d6a35a; --tier-silver: #c8d1de; --tier-gold: #f2c94c; --tier-platinum: #8fd3e0;
  --tier-emerald: #4fd394; --tier-sapphire: #7aa7ff; --tier-ruby: #ff7092; --tier-diamond: #7fe0ff;
}
/* A registered colour, so a step up fades softly from the old tier's colour to the new one. */
@property --tier { syntax: '<color>'; inherits: true; initial-value: transparent; }
[data-tier="wood"] { --tier: var(--tier-wood); }
[data-tier="stone"] { --tier: var(--tier-stone); }
[data-tier="iron"] { --tier: var(--tier-iron); }
[data-tier="copper"] { --tier: var(--tier-copper); }
[data-tier="bronze"] { --tier: var(--tier-bronze); }
[data-tier="silver"] { --tier: var(--tier-silver); }
[data-tier="gold"] { --tier: var(--tier-gold); }
[data-tier="platinum"] { --tier: var(--tier-platinum); }
[data-tier="emerald"] { --tier: var(--tier-emerald); }
[data-tier="sapphire"] { --tier: var(--tier-sapphire); }
[data-tier="ruby"] { --tier: var(--tier-ruby); }
[data-tier="diamond"] { --tier: var(--tier-diamond); }
html[data-tier] { transition: --tier .9s ease; }

/* The accents: a thin line under the header, progress bars, My Way's session dots and card edge, a right answer's glow. */
html[data-tier] .site-header { box-shadow: inset 0 -3px 0 var(--tier); }
html[data-tier] .pbar span { background: linear-gradient(90deg, color-mix(in srgb, var(--tier) 70%, var(--surface)), var(--tier)); }
html[data-tier] .mw-steps .done { background: var(--tier); border-color: var(--tier); }
html[data-tier] .mw-steps .cur { background: color-mix(in srgb, var(--tier) 22%, var(--surface)); border-color: var(--tier); }
html[data-tier] .mw-card { border-top-color: var(--tier); }
html[data-tier] .fb-right { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tier) 30%, transparent), 0 0 22px color-mix(in srgb, var(--tier) 28%, transparent); }

/* The rank emblem by the logo: inline SVG in the tier's colour, with an edge that keeps it visible on any surface. */
.emblem .e-f { fill: var(--tier, var(--primary)); stroke: color-mix(in srgb, var(--tier, var(--primary)) 55%, var(--text)); stroke-width: .7; paint-order: stroke; }
.emblem .e-s { fill: none; stroke: var(--tier, var(--primary)); }
.rank-emblem { position: relative; display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; margin-left: -6px; }
.rank-emblem:hover { background: var(--surface-2); }
.rank-emblem:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.rank-emblem[hidden] { display: none; }
.tier-chip {
  position: absolute; top: calc(100% + 2px); left: 50%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  background: var(--surface); color: var(--text); border: 2px solid var(--tier); border-radius: 999px; padding: 1px 10px;
  font-size: .78rem; font-weight: 900; box-shadow: var(--shadow); animation: chip 2.6s ease forwards;
}
.rank-emblem.stepped svg { animation: stepped .8s ease; }
.rank-emblem.ranked svg { animation: ranked 1.4s ease; }
@keyframes chip { 0% { opacity: 0; transform: translate(-50%, -4px) scale(.9); } 12%, 80% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, 0); } }
@keyframes stepped { 40% { transform: scale(1.18); } }
@keyframes ranked { 25% { transform: scale(1.35) rotate(-8deg); filter: drop-shadow(0 0 6px var(--tier)); } 55% { transform: scale(1.2) rotate(6deg); filter: drop-shadow(0 0 4px var(--tier)); } }

/* The badge: emblem, "Journeyman · Gold", the year underneath; and the year's twelve tiers as pips. */
.tier-badge { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: 16px;
  background: var(--surface); border: 2px solid color-mix(in srgb, var(--tier) 55%, var(--border)); text-align: left; max-width: 100%; }
.tier-text { display: grid; line-height: 1.25; min-width: 0; }
.tier-subj { font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tier-title { font-size: 1.1rem; font-weight: 900; }
.tier-year { font-size: .88rem; color: var(--muted); font-weight: 700; }
.tier-badge.compact { padding: 4px 12px 4px 6px; gap: 8px; border-radius: 12px; }
.tier-badge.compact .tier-title { font-size: .95rem; }
.tier-badge.compact .tier-year { font-size: .8rem; }
.tier-next { margin: 6px 0 0; font-size: .92rem; font-weight: 700; }
.tier-pips { display: flex; gap: 4px; margin: 10px 0 0; max-width: 360px; }
.tier-pips span { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.tier-pips span.on { background: var(--tier); border-color: color-mix(in srgb, var(--tier) 60%, var(--text)); }
.tier-pips span.cur { height: 12px; margin-top: -2px; }
.tier-result { display: grid; justify-items: center; margin: 0 auto 16px; }
.tier-result .tier-pips { width: min(360px, 100%); }
.level-summary { margin-bottom: 28px; }
.level-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.level-card { margin: 0; padding: 16px 18px; border-top: 4px solid var(--tier); }
.level-card .tier-badge { border: 0; padding: 0; background: none; }
.level-topics { margin: 8px 0 0; }
.mw-tiers { display: flex; flex-wrap: wrap; gap: 6px; }
.mw-tier .tier-next { display: none; }
.mw-tier .tier-next.tier-cap { display: block; margin: 2px 0 0; font-size: .8rem; }
/* Held at Wood by gaps below: kind, not alarming. The tiers the year has earned show faded, with a dashed edge: locked. */
.tier-next.tier-cap::before { content: "🔒 "; }
.tier-pips span.locked { background: color-mix(in srgb, var(--tier) 30%, var(--surface-2)); border: 1px dashed color-mix(in srgb, var(--tier) 70%, var(--border)); }
.tier-fix { margin: 4px 0 0; }
/* A move down: the same calm card as a step up, no animation, no warning colours. */
.mw-leveldown { text-align: center; }
.mw-leveldown .tier-badge, .mw-leveldown .tier-pips { margin-left: auto; margin-right: auto; }
.mw-leveldown .tier-pips { width: min(320px, 100%); margin-bottom: 12px; }
.mw-leveldown .levelup-emblem { animation: none; }
.mw-levelup { text-align: center; }
.mw-levelup .tier-badge, .mw-levelup .tier-pips { margin-left: auto; margin-right: auto; }
.mw-levelup .tier-pips { width: min(320px, 100%); margin-bottom: 12px; }
.levelup-emblem { display: grid; place-items: center; margin: 0 auto 10px; animation: ranked 1.4s ease; }
@media (prefers-reduced-motion: reduce) {
  html[data-tier] { transition: none; }
  .tier-chip, .rank-emblem.stepped svg, .rank-emblem.ranked svg, .levelup-emblem { animation: none; }
}
@media print { .rank-emblem, .tier-chip { display: none; } html[data-tier] .site-header { box-shadow: none; } }

/* ============================================================== pet
   The Nomo (js/pet-ui.js): its picture, the #/pet page, the corner badge, the reward line on an exercise and the
   "earned!" moment, and the picker's tiles. Quiet everywhere but its own page. */
:root { --nomo-line: #2b2d55; --nomo-ink: #2b2d55; --nomo-cheek: #ff9fb0; --pet-soft: #fff4dc; --pet-edge: #f2d79a; }
/* Dark: the outline turns light so the creature stands out from the page; the face stays dark ink on its colour. */
@media screen and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --nomo-line: #d7d4fb; --nomo-cheek: #ff8fa3; --pet-soft: #2e2a45; --pet-edge: #5a4f7a; } }
:root[data-theme="dark"] { --nomo-line: #d7d4fb; --nomo-cheek: #ff8fa3; --pet-soft: #2e2a45; --pet-edge: #5a4f7a; }
.nomo { display: block; overflow: visible; }
.nomo .nomo-eye { fill: var(--nomo-ink); }
.nomo .nomo-lid { fill: none; stroke: var(--nomo-ink); stroke-width: 3; stroke-linecap: round; }
.nomo .nomo-mouth { fill: var(--nomo-ink); }
.nomo .nomo-cheek { fill: var(--nomo-cheek); opacity: .7; }
.nomo .nomo-shadow { fill: var(--nomo-ink); opacity: .12; }
.nomo .nomo-z { font: 900 15px var(--font); fill: var(--muted); }
.nomo .nomo-heart { fill: #ff6b8a; }
.nomo .nomo-rumble { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
/* A small idle movement: breathing, a swaying antenna; a hop when playful or delighted. None with reduced motion. */
.nomo .nomo-bob { transform-box: fill-box; transform-origin: 50% 100%; animation: nomo-breathe 3.2s ease-in-out infinite; }
.nomo .nomo-ant { transform-box: fill-box; transform-origin: 0% 100%; animation: nomo-sway 4s ease-in-out infinite; }
.nomo-playful .nomo-bob, .nomo-delighted .nomo-bob { animation: nomo-hop 1.1s ease-in-out infinite; }
.nomo-asleep .nomo-bob { animation-duration: 5s; }
.nomo-asleep .nomo-z { animation: nomo-z 3s ease-in-out infinite; }
.nomo-asleep .nomo-z2 { animation-delay: 1.5s; }
@keyframes nomo-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, .985); } }
@keyframes nomo-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
@keyframes nomo-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px); } 60% { transform: translateY(-5px); } }
@keyframes nomo-z { 0%, 100% { opacity: .3; transform: translateY(2px); } 50% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .nomo .nomo-bob, .nomo .nomo-ant, .nomo .nomo-z { animation: none !important; } }

/* An item: its icon and its (long, funny) name. */
.pet-item { display: inline; font-weight: 800; }
.pet-item-ic { margin-right: .25em; }
.pet-item.legend .pet-item-name { background: linear-gradient(90deg, #e6b422, #ff8a6b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pet-reward { font-size: .92rem; background: var(--pet-soft); border: 1px dashed var(--pet-edge); border-radius: 14px; padding: 8px 12px; margin: 10px 0; overflow-wrap: anywhere; }
.pet-wanted { display: inline-block; font-size: .82rem; font-weight: 800; color: var(--coral); }
.pet-earned { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--pet-soft); border: 1px solid var(--pet-edge); border-radius: 16px; padding: 8px 12px; margin: 12px 0; overflow-wrap: anywhere; }
.pet-earned .nomo { flex: none; }
.pet-earned p { margin: 0; }
.pet-earned.wanted { border-color: var(--coral); }
.pet-give-link { display: inline-block; margin-left: .3em; white-space: nowrap; }
.pet-bonus { display: block; font-size: .85rem; color: var(--muted); }
.mw-event .pet-earned, .summary .pet-earned { margin-left: auto; margin-right: auto; max-width: 560px; }

/* The corner badge: small, still, and out of the way (bottom right, above the footer). */
.pet-badge { position: fixed; right: 12px; bottom: 12px; z-index: 30; }
.pet-badge-link { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow); text-decoration: none; position: relative; }
.pet-badge-link:hover { border-color: var(--primary); }
.pet-badge .nomo .nomo-bob, .pet-badge .nomo .nomo-ant { animation: none; }
.pet-badge-want { position: absolute; top: -6px; left: -8px; width: 26px; height: 26px; display: grid; place-items: center; font-size: 15px; background: var(--surface); border: 2px solid var(--pet-edge); border-radius: 50%; }
.pet-badge-tip { position: absolute; right: 64px; bottom: 14px; white-space: nowrap; font-size: .8rem; font-weight: 800; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }
.pet-badge-x { position: absolute; top: -8px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer; padding: 0; }
@media (max-width: 520px) { .pet-badge-tip { display: none; } .pet-badge-link { width: 50px; height: 50px; } .pet-badge .nomo { width: 40px; height: 40px; } }
@media print { .pet-badge { display: none; } }
body.picking .pet-badge { display: none; }

/* The pet page. */
.pet-hero { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
.pet-pic { display: grid; place-items: center; background: radial-gradient(circle at 50% 60%, var(--pet-soft), transparent 70%); border-radius: 50%; padding: 6px; }
.pet-hero-text h1 { margin-bottom: .2em; }
.pet-say { font-size: 1.1rem; min-height: 2.6em; }
.pet-meters { display: grid; gap: 6px; margin: 8px 0; }
.pet-meter { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 320px; font-weight: 800; font-size: .95rem; }
.pet-pips { display: inline-flex; gap: 5px; }
.pet-pips span { width: 22px; height: 12px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.pet-pips span.on { background: var(--mint); border-color: var(--mint); }
.pet-want-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.pet-want-list li { background: var(--pet-soft); border-radius: 16px; padding: 12px 14px; overflow-wrap: anywhere; }
.pet-want-list p { margin: 0; }
.pet-earn { margin-top: 6px !important; font-size: .92rem; }
.pet-stores { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.pet-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pet-slot { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; font: inherit; font-size: .92rem; color: var(--text);
  background: var(--surface-2); border: 2px solid var(--border); border-radius: 14px; padding: 8px 12px; cursor: pointer; overflow-wrap: anywhere; }
.pet-slot:hover { border-color: var(--primary); }
.pet-slot.wanted { border-color: var(--coral); }
.pet-slot-give { flex: none; font-weight: 900; color: var(--primary); }
.pet-about summary { cursor: pointer; font-weight: 900; }
.pet-settings { text-align: center; }
/* Choosing a Nomo. */
.pet-choose { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.pet-egg { display: grid; place-items: center; padding-top: 10px; }
.pet-set { border: 0; padding: 0; margin: 12px 0; min-width: 0; }
.pet-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.pet-swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--border); cursor: pointer; }
.pet-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--primary); }
.pet-patterns { flex-wrap: wrap; }
.pet-form .who-input { max-width: 320px; }
/* The picker's tile and Progress. */
.who-tile .who-pet { display: block; margin-top: -4px; }
.pet-progress .btn { margin-top: 4px; }
.pet-lab .pet-reward { margin-top: 0; }
@media (max-width: 640px) {
  .pet-hero, .pet-choose { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .pet-hero .pet-meter { margin: 0 auto; }
  .pet-stores { grid-template-columns: 1fr; }
  .pet-choose-text { text-align: left; width: 100%; }
}

/* ============================================================ teacher and parent mode
   The class overview (a table on a wide screen, a card per learner on a phone), class gaps, the teacher PIN and a
   learner's summary (js/app.js, js/teacher.js). */
.who-av-xs { width: 26px; height: 26px; font-size: .95rem; }
.teach-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.teach-tools .seg-btn { padding: 6px 12px; font-size: .9rem; }
.mg-class { border-left: 4px solid var(--primary); }
.cl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.cl-sortby { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 800; max-width: 100%; min-width: 0; }
.cl-sortby select { font: inherit; font-weight: 700; padding: 6px 10px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); max-width: 100%; min-width: 0; width: 15em; }
.cl-group { padding: 12px 16px; margin: 0 0 14px; }
.cl-group p { margin: 0 0 6px; }
.cl-group .cta-row { margin: 6px 0 0; }
.cl-note-edit { padding: 14px 16px; margin: 0 0 14px; }
.cl-note-edit textarea { width: 100%; }
/* A fixed layout: the columns' widths come from the <col>s, not from measuring every cell (40 rows lay out quickly). */
.cl-table { table-layout: fixed; }
/* The percentages (81% in all) leave room for the two fixed columns (40px + 112px) on the narrowest table, about 868px
   at the 900px breakpoint where the table replaces the cards. The actions stack in their column: Summary on top, then
   the two icon buttons. */
.cl-table .c-sel { width: 40px; } .cl-table .c-who { width: 15%; } .cl-table .c-level { width: 14%; } .cl-table .c-week { width: 10%; }
.cl-table .c-num { width: 7%; } .cl-table .c-gaps { width: 13%; } .cl-table .c-fade { width: 13%; } .cl-table .c-checks { width: 9%; } .cl-table .c-acts { width: 112px; }
.cl-table tbody th, .cl-table td { overflow-wrap: break-word; } /* break inside a word only when it cannot fit at all */
.cl-table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cl-table th, .cl-table td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.cl-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
.cl-table tbody tr:last-child > * { border-bottom: 0; }
.cl-table tbody th { font-weight: 400; }
.cl-sort { font: inherit; font-weight: 900; color: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; padding: 4px 2px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; border-radius: 6px; }
.cl-sort:hover { color: var(--text); }
th[aria-sort="ascending"] .cl-sort, th[aria-sort="descending"] .cl-sort { color: var(--primary); }
.cl-arrow { font-size: .8em; opacity: .8; }
.cl-sel { width: 32px; }
.cl-tick { width: 20px; height: 20px; accent-color: var(--primary); margin: 2px 0 0; }
.cl-name { display: flex; align-items: center; gap: 8px; font-weight: 800; overflow-wrap: anywhere; }
.cl-name a { text-decoration: none; }
.cl-note { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.cl-tier { display: flex; align-items: flex-start; gap: 6px; line-height: 1.25; margin: 0 0 4px; }
.cl-tier .emblem { flex: none; margin-top: 1px; }
.cl-tier > span { display: grid; }
.cl-topics { display: block; color: var(--muted); overflow-wrap: anywhere; }
.cl-dots { display: flex; gap: 3px; margin: 3px 0 4px; }
.cl-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); }
.cl-dots i.on { background: var(--right); border-color: var(--right); }
.cl-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-table .cl-acts { flex-wrap: wrap; }
.cl-table .cl-acts > :first-child { flex: 1 0 100%; text-align: center; justify-content: center; }
.cl-icon { padding-left: 9px; padding-right: 9px; }
.cl-acts .btn { overflow-wrap: normal; white-space: nowrap; }
.cl-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cl-card { padding: 14px 16px; }
.cl-card-top { display: flex; align-items: center; gap: 10px; }
.cl-card-top h3 { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.cl-card-top h3 a { text-decoration: none; }
.cl-card-level { margin: 8px 0 4px; }
.cl-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 8px 0 10px; }
.cl-facts div { min-width: 0; }
.cl-facts dt { font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cl-facts dd { margin: 0; overflow-wrap: anywhere; }
.cl-facts .cl-dots { display: inline-flex; vertical-align: middle; margin: 0 4px 0 0; }
@media (max-width: 899px) { .cl-wide { overflow-x: auto; } } /* the table on a phone only until the cards are drawn */
@media (max-width: 340px) { .cl-facts { grid-template-columns: minmax(0, 1fr); } }
/* Class gaps */
.cg-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; }
.cg-item { padding: 14px 18px; }
.cg-line { font-size: 1.1rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.cg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.cg-faces { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
/* The teacher PIN */
.pin-gate { max-width: 560px; margin: 0 auto; padding: 22px; }
.pin-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pin-input { width: 9ch; max-width: 100%; letter-spacing: .3em; text-align: center; }
.pin-msg, .pin-file-msg, .pin-set-msg { min-height: 1.4em; margin: 8px 0 0; font-weight: 800; color: var(--wrong); }
.pin-forgot { margin: 14px 0; border-top: 1px solid var(--border); padding-top: 10px; }
.pin-forgot summary { cursor: pointer; font-weight: 800; min-height: 32px; }
.pin-pair { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 6px 0 10px; }
.pin-set[hidden] { display: none; }
.cl-for { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
/* A learner's summary */
.sum { max-width: 820px; margin: 0 auto 18px; padding: 24px; }
.sum-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.sum-head h1 { margin: 2px 0; overflow-wrap: anywhere; }
.sum-head > div { min-width: 0; }
.sum-head p { margin: 0; }
.sum-sec { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 14px; }
.sum-sec h2 { font-size: 1.2rem; margin-bottom: .4em; }
.sum-sec p { margin: 0 0 .5em; }
.sum-list { margin: .2em 0 .7em; padding-left: 1.3em; }
.sum-list li { overflow-wrap: anywhere; }
.sum-badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 18px; }
.sum-badge p { margin-top: 6px; }
.sum-week { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding: 0; margin: 4px 0 10px; max-width: 420px; }
.sum-week li { display: grid; justify-items: center; padding: 4px 0; border-radius: 10px; border: 1px solid var(--border); font-size: .8rem; font-weight: 700; color: var(--muted); }
.sum-week li b { font-size: 1.1rem; color: var(--muted); }
.sum-week li.on { background: var(--right-soft); border-color: var(--right); color: var(--text); }
.sum-week li.on b { color: var(--right); }
.sum-pet-in { display: flex; align-items: center; gap: 14px; }
.sum-pet-in p { margin: 0; }
.sum-note p { white-space: normal; overflow-wrap: anywhere; }
.sum-foot { margin-top: 16px; }
.sum-acts { justify-content: center; align-items: center; max-width: 820px; margin: 0 auto 12px; }
.sum-note-pick { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.sum-link .btn { margin-top: 2px; }
@media (max-width: 480px) {
  .sum { padding: 16px; }
  .sum-head .who-av-lg { width: 64px; height: 64px; font-size: 2.2rem; }
}
@media print {
  .sum { max-width: none; padding: 0; margin: 0; font-size: 10.5pt; }
  .sum-sec { break-inside: avoid; margin-top: 8px; padding-top: 6px; }
  .sum-week li { border-color: #999; }
  .sum-week li.on { background: #fff; border: 2px solid #000; }
  .teach-tools, .cl-bar, .cl-group, .cl-acts { display: none !important; }
}

/* ======================================== W4: learnt, then mastered (pedagogy review C2) */
/* A topic learnt in a round waits for a no-hint check on a later day ("Check it's still there"); then it is mastered. */
.pill-learnt { background: var(--right-soft); color: var(--text); border: 1px dashed color-mix(in srgb, var(--right) 55%, transparent); }
.pill-check { background: var(--primary-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent); font-weight: 800; }
.pill-check:hover, .pill-check:focus-visible { border-color: var(--primary); }
.check-note { background: var(--right-soft); }
.check-note .muted { display: inline; }
.check-card { margin: 6px 0 14px; padding: 12px 14px; border-radius: 14px; border: 2px solid color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--primary-soft); }
.check-card p { margin: 0 0 8px; }
.check-card .btn { margin-top: 2px; }
.check-summary { margin-bottom: 18px; padding: 16px 18px; border-style: dashed; }
.check-summary h2 { margin-top: 0; }
.check-summary .cta-row { align-items: center; }
.check-list { margin: 8px 0 10px; padding-left: 1.3em; display: grid; gap: 4px; }
.check-list li { overflow-wrap: anywhere; line-height: 1.35; }
.check-list li .muted { display: block; }
.check-next { margin: 4px auto 10px; max-width: 560px; }
.stat-learnt .stat-num { color: var(--right); }
.cl-learnt { white-space: nowrap; }

/* ======================================== W4: comparisons without two-way guessing (pedagogy review C8) */
/* A choice with its reason, or an order of three: one option to a line (.choices.lines, shared with js/acts.js below;
   the option's text sits in one .opt span). */
.choices.lines .choice .frac { font-size: 1.05em; vertical-align: middle; }
.practice.kid .choices.lines .choice, .mw-card.kid .choices.lines .choice { font-size: 1.15rem; }
/* Kindergarten comparisons of three: a yellow ribbon or tower beside the red and blue ones. */
.ribbon.yellow, .tower.yellow i { background: #f2b705; }
.kd-bar.yellow i { background: var(--sun); }
.kd-bars.up.three { grid-template-columns: auto auto auto; }
/* ===== Young learners: reading-light and voice (A9), the quiet chrome (C6, C13), the short first turn (C12) ===== */
.can-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0; font-weight: 700; font-size: 1.02rem; }
.can-line span { min-width: 0; overflow-wrap: anywhere; }
.can-line .can-next a { font-weight: 800; }
.mw-can { flex: 1 1 260px; min-width: 0; }
.mw-day-end .can-line, #app > .can-line { justify-content: center; margin: 10px 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); }
.grownups-fold { margin: 14px 0; border: 2px dashed var(--border); border-radius: 14px; background: var(--surface); }
.grownups-fold > summary { cursor: pointer; padding: 10px 14px; min-height: 44px; display: flex; align-items: center; font-weight: 800; color: var(--muted); }
.grownups-fold > summary:hover, .grownups-fold[open] > summary { color: var(--text); }
.grownups-body { padding: 0 14px 12px; display: grid; gap: 10px; min-width: 0; }
.grownups-body > .mw-why { margin: 0; }
.grownups-body .mw-alt { text-align: left; margin: 0; }
.grownups-body .level-summary h2 { font-size: 1.1rem; }
.grownups-fold .screens-card, .grownups-fold .level-summary { margin: 0; }
.say-line { min-width: 44px; min-height: 44px; margin-left: 4px; padding: 0 8px; border: 2px solid var(--primary); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 1rem; cursor: pointer; vertical-align: middle; }
.say-line:hover { background: var(--surface-2); }
/* No Indonesian voice on this device: the 🔊 buttons say they will speak English (Voice.mark). */
[data-voice="no-id"] .say-btn::after, [data-voice="no-id"] .wbtn.narrate::after { content: "EN"; display: inline-block; margin-left: 5px; padding: 0 4px; border-radius: 5px; font-size: .62rem; font-weight: 800; line-height: 1.5; vertical-align: middle; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.voice-tip { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 12px 16px; margin-bottom: 14px; font-size: .95rem; }
.voice-tip span { flex: 1 1 260px; min-width: 0; }
.screens-card .mg-switch { margin: 12px 0 2px; }
.quick-note { margin: 8px 0 12px; }
.quick-card { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 14px 18px; margin-bottom: 18px; }
.quick-card p { margin: 0; flex: 1 1 260px; min-width: 0; }
.quick-card .cta-row { margin: 0; }
.mw-first { padding: 12px 16px; margin: 0 0 16px; font-weight: 700; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.paper-place { max-width: 820px; margin: 0 auto 18px; }
.paper-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.paper-form select { flex: 1 1 220px; min-width: 0; min-height: 44px; }
/* ==== Activities (docs/research/activity-designs.md, F3 and A1): pick steps (js/acts.js), mixed reviews, the activity
   page and the built-in comparison. Site tokens only. ==== */
.mw-mixed .mw-kind { background: color-mix(in srgb, var(--sky) 22%, var(--surface)); color: var(--text); }
.mw-hidden-topic { font-weight: 800; color: var(--muted); }
.mw-reveal { font-weight: 800; margin: 0 0 8px; }
.mw-result.mixed { border-color: color-mix(in srgb, var(--sky) 55%, var(--border)); background: color-mix(in srgb, var(--sky) 12%, var(--surface)); }
/* numbered steps inside a card: done, now, later (a later step is inert until it opens) */
.act-steps { list-style: none; margin: 0; padding: 0; }
.act-step { margin-top: 16px; }
.act-step-h { display: flex; align-items: center; gap: 10px; font-weight: 900; margin: 0 0 10px; font-size: 1.05rem; }
.act-step-h:focus { outline: none; }
.act-step-h:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 8px; }
.act-step-n { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: .9rem; }
.act-step.act-done .act-step-n { background: var(--right); }
.act-step.act-later { opacity: .55; }
.act-step.act-later .act-step-n { background: var(--surface-2); color: var(--muted); border: 2px solid var(--border); }
.act-note { margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; font-weight: 700; font-size: .98rem; max-width: 640px; }
.act-note.ok { background: var(--right-soft); color: var(--text); border: 2px solid color-mix(in srgb, var(--right) 40%, transparent); }
.act-note.no { background: var(--wrong-soft); color: var(--text); border: 2px solid color-mix(in srgb, var(--wrong) 40%, transparent); }
.act-ask { font-weight: 800; margin: 0 0 8px; }
.act-say { margin-top: 8px; }
/* one-column choices for sentences (kinds, reasons, what went wrong); two a row on wider screens */
.choices.lines { grid-template-columns: 1fr; max-width: 640px; }
.choices.lines .choice { font-size: 1.02rem; font-weight: 700; text-align: left; padding: 12px 14px; display: flex; gap: 10px; align-items: baseline; line-height: 1.4; min-height: 48px; }
.choices.lines .choice .opt { overflow-wrap: anywhere; }
@media (min-width: 760px) { .choices.lines { grid-template-columns: repeat(2, minmax(260px, 1fr)); max-width: 820px; } }
.choice .ltr { flex: none; display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--surface-2); font-weight: 900; font-size: .9em; }
.choice.is-right .ltr { background: var(--right); color: var(--on-primary); }
.choice.is-wrong .ltr { background: var(--wrong); color: var(--on-primary); }
.choices.lines .choice.is-right::after { content: '✅'; margin-left: auto; }
.choices.lines .choice.is-wrong::after { content: '✖'; margin-left: auto; color: var(--wrong); }
.act-page { max-width: 900px; margin: 0 auto; }
/* the class overview: an activity on for half the class */
.cl-trial { margin-top: 14px; }
.cl-trial summary { font-weight: 800; cursor: pointer; }
.cl-trial-list, .cl-trial-halves { margin: 6px 0; padding-left: 1.2em; }
.cl-trial-list > li { margin: 6px 0; overflow-wrap: anywhere; }

/* ===================================================== music staff (js/music-staff.js, MB) */
/* Units: 1 staff space = 10 user units; the SVG's viewBox scales with sp. Ink is currentColor (light, dark, print). */
.diagram.mus-staff { width: auto; max-width: 100%; height: auto; overflow: visible; }
.mus-staff .mus-sl { fill: none; stroke: currentColor; stroke-width: 1; }
.mus-staff .mus-ll { fill: none; stroke: currentColor; stroke-width: 1.6; }
.mus-staff .mus-stem { fill: none; stroke: currentColor; stroke-width: 1.2; }
.mus-staff .mus-blk { fill: none; stroke: currentColor; stroke-width: 5; }
.mus-staff .mus-beam, .mus-staff .mus-tie, .mus-staff .mus-slur, .mus-staff .mus-ink { fill: currentColor; stroke: none; }
.mus-staff .mus-tie, .mus-staff .mus-slur { stroke: currentColor; stroke-width: 0.4; }
.mus-staff .mus-tbr { fill: none; stroke: currentColor; stroke-width: 1.2; }
.mus-staff .mus-ts { font-family: var(--font); font-weight: 800; font-size: 28.4px; fill: currentColor; }
.mus-staff .mus-tup { font-family: var(--font); font-weight: 800; font-style: italic; font-size: 13px; fill: currentColor; }
.mus-staff .mus-row { font-family: var(--font); font-weight: 700; font-size: 15px; fill: currentColor; }
.mus-staff .mus-solfege { font-style: italic; }
.mus-staff .mus-num { font-weight: 800; }
.mus-staff .mus-fig { font-family: var(--font); font-weight: 700; font-size: 13px; fill: currentColor; }
.mus-staff .mus-mlbl { font-family: var(--font); font-weight: 700; font-size: 14px; fill: var(--primary); }
/* highlight: colour AND a ring, so colour is never the only cue */
.mus-staff .mus-hl { color: var(--primary); stroke: var(--primary); }
.mus-staff use.mus-hl { fill: var(--primary); }
.mus-staff .mus-ring { fill: none; stroke: var(--primary); stroke-width: 1.6; }
.mus-staff .mus-mark { color: var(--primary); }
.mus-staff .mus-ghost { color: var(--primary); opacity: 0.5; }
.mus-staff .mus-band { fill: color-mix(in srgb, var(--primary) 22%, transparent); }
@media print { .mus-staff .mus-hl, .mus-staff .mus-mark, .mus-staff .mus-mlbl { color: #000; fill: #000; } }
.mus-stack { max-width: 100%; margin: 10px 0 16px; }
.mus-stack > svg.diagram { display: block; width: 100%; max-width: none; height: auto; margin: 0; }
.mus-kbd { width: auto; max-width: 100%; }
.mus-kbd .kb-white { fill: var(--surface); stroke: currentColor; stroke-width: 1.5; }
.mus-kbd .kb-black { fill: currentColor; stroke: currentColor; stroke-width: 1; }
.mus-kbd .kb-mark { fill: color-mix(in srgb, var(--primary) 30%, var(--surface)); }
.mus-kbd .kb-black.kb-mark { fill: var(--primary); }
.mus-kbd .kb-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 1.5; }
.mus-walk { display: block; }
.mus-walk .mus-walk-pic svg { margin: 0 auto; }
/* the staff input (MI.staff) */
.msi-staff { touch-action: none; cursor: pointer; border-radius: 10px; padding: 4px 0; }
.msi-staff:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.msi-staff .mus-staff { margin: 0; }
.msi-staff.is-right { box-shadow: 0 0 0 3px var(--right, #2a9d5c); }
.msi-staff.is-wrong { box-shadow: 0 0 0 3px var(--coral); }
.msi-live { min-height: 1.4em; margin: 4px 0; font-weight: 700; }
.msi-pad { display: flex; flex-wrap: wrap; gap: 6px; }
.msi-btn { min-width: 44px; min-height: 44px; font-size: 1.15rem; touch-action: manipulation; }
/* ================================================= end music staff */

/* ===================================================== misconceptions (js/mis.js: the line under a wrong answer, the
   teacher's common mix-ups on the class gaps page and a learner's summary) */
.fb-mis { margin: .4em 0 .6em; padding: 8px 12px; border-left: 4px solid var(--sun); border-radius: 8px; background: color-mix(in srgb, var(--sun) 12%, var(--surface)); color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.fb-mis .frac { vertical-align: middle; }
.cg-mixups { margin-top: 24px; }
.cg-mixups > h2 { font-size: 1.35rem; margin-bottom: .3em; }
.cg-mix .cg-line { margin-bottom: .2em; }
.cg-tip { margin: .4em 0 0; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: .92rem; overflow-wrap: anywhere; }
.sum-mix li { margin-bottom: .45em; }
@media print { .fb-mis { background: none; border-left-color: #000; } }
/* ================================================= end misconceptions */

/* ===================================================== music (js/music-*.js): the numbered view, rhythms, hand signs,
   the play buttons with their lights (the visual twin of every sound), the answer widgets and the music pages */
.mus-fig { color: var(--text); display: block; height: auto; width: 100%; margin: 6px 0; overflow: visible; }
.mus-cipher text { fill: currentColor; font-family: var(--font); }
.mus-cipher .cy-head { font-size: 13px; font-weight: 800; fill: var(--muted); }
.mus-cipher .cy-num, .mus-cipher .cy-rest { font-size: 19px; font-weight: 800; }
.mus-cipher .cy-rest { fill: var(--muted); }
.mus-cipher .cy-acc { font-size: 13px; font-weight: 700; }
.mus-cipher .cy-syl, .mus-cipher .cy-lyr { font-size: 12px; fill: var(--muted); }
.mus-cipher .cy-dash, .mus-cipher .cy-under, .mus-cipher .cy-bar { stroke: currentColor; stroke-width: 1.6; }
.mus-cipher .cy-bar.final { stroke-width: 3; }
.mus-cipher .cy-oct, .mus-cipher .cy-dotr { fill: currentColor; }
.mus-cipher .cy-arc { fill: none; stroke: currentColor; stroke-width: 1.4; }
.mus-cipher .cy-hl { fill: var(--primary); }
.mus-cipher .cy-ring { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.mus-rhythm .ry-line { stroke: var(--border); stroke-width: 1.2; }
.mus-rhythm.sticks .ry-line { stroke: transparent; }
.mus-rhythm .ry-head { fill: currentColor; stroke: currentColor; stroke-width: 1.2; }
.mus-rhythm .ry-head.open { fill: var(--surface); stroke-width: 2; }
.mus-rhythm .ry-stem, .mus-rhythm .ry-bar, .mus-rhythm .ry-ledger { stroke: currentColor; stroke-width: 2; fill: none; }
.mus-rhythm .ry-bar.final { stroke-width: 4; }
.mus-rhythm .ry-beam { stroke: currentColor; stroke-width: 4.5; }
.mus-rhythm .ry-flag, .mus-rhythm .ry-tie { fill: none; stroke: currentColor; stroke-width: 2.2; }
.mus-rhythm .ry-dot, .mus-rhythm .ry-rest { fill: currentColor; }
.mus-rhythm .ry-syl { font-size: 13px; font-weight: 800; fill: var(--muted); font-family: var(--font); }
.mus-rhythm .ry-tup { font-size: 12px; font-weight: 800; fill: currentColor; }
.mus-rhythm .ry-hl { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 2; }
.hand-sign { display: inline-block; width: 64px; vertical-align: middle; }
.hand-sign .hs-hand { fill: color-mix(in srgb, var(--sun) 35%, var(--surface)); stroke: currentColor; stroke-width: 2.2; }
.hand-sign .hs-line { fill: none; stroke: currentColor; stroke-width: 1.4; opacity: .6; }
.hand-signs > span { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.mus-steps .st-step { stroke: var(--border); stroke-width: 2; }
.mus-steps .st-dot { fill: var(--primary); }
.choice .mus-steps, .choice .mus-rhythm { max-width: 100% !important; margin: 0; }
.choice .hand-sign { width: 56px; }
.choice .mus-cipher { width: auto; height: 64px; max-width: 100% !important; margin: 0 auto; }
/* kindergarten picture choices */
.kc { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1.1; }
.kc-e { font-size: 2.1rem; }
.kc-w { font-size: 1rem; font-weight: 800; }
.kc-w.pat { font-size: 1.5rem; letter-spacing: .05em; white-space: pre; }
.pat-rows { line-height: 1.5 !important; letter-spacing: .1em; }
.beats { display: inline-block; letter-spacing: .1em; white-space: pre; }
/* the play button and its lights */
.mus-play { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 4px 4px 4px 0; vertical-align: middle; }
.mus-play.big { font-size: 1.15rem; min-height: 56px; padding: 10px 22px; }
.mus-lights { display: inline-flex; gap: 4px; margin-left: 4px; }
.mus-lights i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--primary); background: transparent; }
.mus-lights i.on { background: color-mix(in srgb, var(--primary) 35%, transparent); }
.mus-lights i.lit { background: var(--primary); transform: scale(1.35); }
.mus-play.playing .mus-play-icon { color: var(--primary); }
@media (prefers-reduced-motion: reduce) { .mus-lights i.lit { transform: none; } }
.mus-sound-off { color: var(--muted); margin: 4px 0; }
.mus-caption { margin: 2px 0 10px; }
.mus-listen-play { margin: 0 0 12px; }
/* answer widgets */
.mus-answer { max-width: 640px; }
.mus-answer.is-right .mus-cy-line, .mus-answer.is-right .mus-bar-view { outline: 3px solid var(--right); border-radius: 12px; }
.mus-answer.is-wrong .mus-cy-line, .mus-answer.is-wrong .mus-bar-view { outline: 3px solid var(--wrong); border-radius: 12px; }
.mus-choices .choice { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; }
.mus-choices.kid .choice, .practice.kid .mus-choices .choice { min-height: 76px; }
.mus-choice-play { color: var(--primary); }
.mus-choices .mus-lights i { width: 10px; height: 10px; }
.mus-pad { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.mus-pad-key { font: inherit; font-size: 1.25rem; font-weight: 900; min-width: 48px; min-height: 48px; padding: 6px 12px; border-radius: 12px; border: 3px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; touch-action: manipulation; }
.mus-pad-key:hover:not(:disabled), .mus-pad-key:focus-visible { border-color: var(--primary); }
.mus-pad-key.selected { border-color: var(--primary); background: var(--primary-soft); }
.mus-pad-key.bs { margin-left: auto; }
.mus-name-shown { font-size: 1.6rem; font-weight: 900; color: var(--primary); min-height: 1.4em; margin: 0; }
.mus-cy-line { min-height: 70px; padding: 6px 8px; background: var(--surface-2); border-radius: 12px; overflow-x: auto; }
.mus-cy-line .mus-fig { max-width: 100%; }
/* the piano and the xylophone */
.mus-keys-scroll { overflow-x: auto; padding-bottom: 6px; max-width: 100%; touch-action: pan-x; }
.mus-piano { position: relative; height: 150px; touch-action: none; margin: 4px 0; }
.mus-key { position: absolute; top: 0; border: 2px solid var(--text); cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font: inherit; font-weight: 800; touch-action: none; }
.mus-key.white { width: 44px; height: 150px; background: #fff; color: #22254a; border-radius: 0 0 8px 8px; z-index: 1; }
.mus-key.black { width: 30px; height: 92px; background: #22254a; color: #fff; border-radius: 0 0 6px 6px; z-index: 2; font-size: .75rem; }
.mus-key.mid-c::before { content: ''; position: absolute; bottom: 30px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.mus-key.selected, .mus-key.flash { background: var(--primary); color: #fff; }
.mus-key:focus-visible, .mus-bar-key:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; z-index: 3; }
.mus-xylo { display: flex; gap: 8px; align-items: flex-end; touch-action: none; }
.mus-bar-key { width: 52px; border-radius: 10px; border: 3px solid var(--text); font: inherit; font-size: 1.3rem; font-weight: 900; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; color: #22254a; }
.mus-bar-key.c0 { background: #ffb3a7; }
.mus-bar-key.c1 { background: #ffd28a; }
.mus-bar-key.c2 { background: #fff09a; }
.mus-bar-key.c3 { background: #b6efb0; }
.mus-bar-key.c4 { background: #a8dcff; }
.mus-bar-key.c5 { background: #c9b9ff; }
.mus-bar-key.c6 { background: #ffc0e3; }
.mus-bar-key.flash { filter: brightness(.8); transform: translateY(3px); }
.mus-seq { font-size: 1.3rem; font-weight: 900; min-height: 1.6em; }
.mus-seq-item { display: inline-block; min-width: 1.6em; text-align: center; background: var(--surface-2); border-radius: 8px; margin: 2px; }
/* the tap pad and the beat light */
.mus-tap-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 10px; }
.mus-beat i { display: inline-block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--primary); }
.mus-beat.on i { animation: musBeat .25s ease-out; }
@keyframes musBeat { from { background: var(--primary); transform: scale(1.3); } to { background: transparent; transform: none; } }
.mus-count { font-size: 1.5rem; font-weight: 900; color: var(--primary); min-width: 2em; }
.mus-pad-big { display: grid; place-items: center; width: 100%; max-width: 420px; min-height: max(160px, 30vh); border-radius: 24px; border: 4px solid var(--primary); background: var(--primary-soft); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.mus-pad-big:disabled { opacity: .55; cursor: default; }
.mus-pad-big.on { animation: musPad .18s ease-out; }
@keyframes musPad { from { background: var(--primary); } to { background: var(--primary-soft); } }
.mus-pad-face { font-size: 3.5rem; }
@media (prefers-reduced-motion: reduce) { .mus-beat.on i, .mus-pad-big.on { animation: none; } .mus-beat.on i { background: var(--primary); } }
.mus-timeline .tl-mark { stroke: var(--muted); stroke-width: 2; }
.mus-timeline .tl-on { fill: var(--right); }
.mus-timeline .tl-off { fill: var(--wrong); }
.mus-timeline .tl-extra { fill: var(--wrong); font-size: 16px; font-weight: 900; }
.mus-cant { margin-top: 6px; }
/* build a bar */
.mus-bar-view { min-height: 90px; padding: 6px; background: var(--surface-2); border-radius: 12px; overflow-x: auto; }
.mus-meter { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-weight: 800; }
.mus-meter-bar { flex: 0 1 220px; height: 12px; border-radius: 999px; background: var(--surface-2); border: 2px solid var(--border); overflow: hidden; }
.mus-meter-bar span { display: block; height: 100%; background: var(--primary); transition: width .2s; }
.mus-meter.full .mus-meter-bar span { background: var(--right); }
.mus-meter.over .mus-meter-bar span { background: var(--wrong); }
.mus-tile { min-width: 64px; min-height: 64px; padding: 2px 6px; border-radius: 12px; border: 3px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.mus-tile:hover:not(:disabled), .mus-tile:focus-visible { border-color: var(--primary); }
.mus-tile .mus-fig { width: 60px; margin: 0; }
/* music pages */
.mus-bar-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.mus-vol input { width: 120px; vertical-align: middle; }
.mus-settings fieldset { border: 2px solid var(--border); border-radius: 14px; margin: 14px 0; padding: 10px 14px; min-width: 0; }
.mus-settings legend { font-weight: 900; padding: 0 6px; }
.mus-set-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 10px; cursor: pointer; }
.mus-set-opt.on { background: var(--primary-soft); }
.mus-set-opt input { margin-top: 5px; flex: none; width: 20px; height: 20px; }
.mus-set-tune { display: block; margin-top: 4px; }
.mus-inst-list { list-style: none; padding: 0; }
.mus-inst-list li { margin: 8px 0; }
.mus-place-card { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
@media print { .mus-play, .mus-pad-big, .mus-bar-strip { display: none; } }
/* a picture choice named inside a sentence (feedback, written solutions): on one line */
.fb .kc, .sol .kc, .sol-brief .kc, .alg .kc { display: inline-flex; flex-direction: row; gap: 4px; vertical-align: middle; }
.fb .kc-e, .sol .kc-e, .sol-brief .kc-e, .alg .kc-e { font-size: 1.15rem; }
/* ================================================= end music */
/* ================================================= site search (js/search.js) */
/* The header box: a field on wide screens, a 🔍 button below 1200px that opens the field over the header row. */
.site-search { display: flex; align-items: center; flex-shrink: 0; }
.search-svg { display: block; }
.search-open { display: none; place-items: center; width: 44px; height: 40px; padding: 0; border: 2px solid var(--border); border-radius: 10px; background: none; color: var(--text); cursor: pointer; flex-shrink: 0; }
.search-open:hover { border-color: var(--primary); color: var(--primary); }
.search-open:focus-visible, .search-close:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.search-panel { position: relative; display: flex; align-items: center; gap: 6px; }
.search-glass { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-glass .search-svg { width: 18px; height: 18px; }
.search-input { width: clamp(150px, 15vw, 230px); height: 40px; padding: 0 32px 0 36px; border: 2px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 1rem; -webkit-appearance: none; appearance: none; }
.search-input::placeholder { color: var(--muted); opacity: 1; }
.search-input:focus { outline: 3px solid var(--primary); outline-offset: 1px; border-color: var(--primary); background: var(--surface); }
.search-input::-webkit-search-decoration { -webkit-appearance: none; }
.search-key { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font: inherit; font-size: .75rem; font-weight: 800; color: var(--muted); line-height: 1.4; pointer-events: none; }
.search-input:focus ~ .search-key, .search-input:not(:placeholder-shown) ~ .search-key { display: none; }
.search-close { display: none; width: 44px; height: 40px; flex-shrink: 0; border: 2px solid var(--border); border-radius: 10px; background: none; color: var(--text); font-size: 1.1rem; cursor: pointer; }
.search-pop { position: absolute; top: calc(100% + 10px); right: 0; width: min(540px, calc(100vw - 32px)); max-height: min(72vh, 680px); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 30; }
@media (max-width: 1199px) {
  .header-inner { position: relative; }
  .search-open { display: grid; }
  .search-panel { display: none; }
  .site-search.open .search-panel { display: flex; position: absolute; inset: 0; z-index: 25; background: var(--surface); padding: 0 16px; }
  .site-search.open .search-input { flex: 1; width: auto; min-width: 0; height: 44px; }
  .site-search.open .search-glass { left: 27px; }
  .site-search.open .search-close { display: block; }
  .search-key { display: none; }
  .search-pop { left: 16px; right: 16px; width: auto; top: calc(100% + 6px); max-height: calc(100vh - 90px); }
}
@media (max-width: 420px) { .search-open { width: 40px; } .site-search.open .search-panel { padding: 0 10px; } .site-search.open .search-glass { left: 21px; } .search-pop { left: 8px; right: 8px; } }
/* A result, in the dropdown and on the results page: icon, name (and the other language's name when that matched), where
   it sits and the learner's status, and one line with the match marked. Targets are 48px or more for small fingers. */
.search-group + .search-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.search-group-h { font-size: .74rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 8px 10px 2px; }
.sr-item { display: flex; gap: 12px; align-items: flex-start; min-height: 48px; padding: 9px 10px; border-radius: 12px; color: var(--text); text-decoration: none; cursor: pointer; }
.search-list .sr-item:hover, .sr-item[aria-selected="true"] { background: var(--primary-soft); }
.sr-item[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--primary); }
.sr-icon { flex-shrink: 0; width: 1.7em; font-size: 1.35rem; line-height: 1.25; text-align: center; }
.sr-body { display: grid; gap: 2px; min-width: 0; }
.sr-title { font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.sr-other { font-weight: 600; color: var(--muted); }
.sr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: .82rem; color: var(--muted); }
.sr-status { font-weight: 800; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.sr-st-mastered { border-color: color-mix(in srgb, var(--right) 50%, transparent); }
.sr-st-review { border-color: color-mix(in srgb, var(--sun) 70%, transparent); }
.sr-st-learnt, .sr-st-check { border-color: color-mix(in srgb, var(--mint) 60%, transparent); }
.sr-st-locked, .sr-st-soon { border-style: dashed; }
.sr-line { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.search-list .sr-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-item mark, .sr-title mark { background: color-mix(in srgb, var(--sun) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-all { align-items: center; color: var(--primary); font-weight: 800; }
.sr-all .search-svg { width: 20px; height: 20px; margin: 0 8px 0 6px; }
.search-note:empty { display: none; }
.search-none, .search-partial { padding: 10px 12px; }
.search-none p { margin: 0 0 8px; }
.search-cat { display: flex; flex-wrap: wrap; gap: 6px; }
/* The results page (#/search?q=…) */
.search-head h1 { display: flex; align-items: center; gap: 10px; }
.search-head h1 .search-svg { width: 30px; height: 30px; color: var(--primary); }
.search-form { margin-top: 12px; }
.search-row { display: flex; gap: 8px; }
.search-page-input { flex: 1; min-width: 0; min-height: 50px; padding: 0 16px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; font-size: 1.1rem; }
.search-page-input:focus { outline: 3px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.search-count { font-weight: 800; margin: 8px 0 0; }
.search-sec h2 .count { font-size: .85rem; color: var(--muted); font-weight: 800; margin-left: 4px; }
.sr-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.sr-list .sr-item { background: var(--surface); border: 2px solid var(--border); }
.sr-list .sr-item:hover { border-color: var(--primary); }
.sr-list .sr-item:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.search-tips .chips { margin-top: 8px; }
/* The Nomo in the corner would sit on the results while the list is open. */
body:has(.search-pop:not([hidden])) #pet-corner { display: none; }
@media print { .site-search { display: none !important; } }
/* ============================================= end site search */
/* ==== Sure / not sure (docs/research/activity-designs.md, A10): the two Check buttons (js/acts.js Acts.confirm), the
   feedback line, the weekly calibration block (day-end card, Progress) and the summary's line. Site tokens only. ==== */
.act-conf { display: inline-flex; flex-wrap: wrap; gap: 10px; }
.act-conf .conf-btn { min-height: 48px; }
.act-conf .conf-unsure { border: 2px solid var(--primary); color: var(--primary); }
@media (max-width: 520px) { .act-conf { display: flex; width: 100%; } .act-conf .conf-btn { flex: 1 1 140px; padding-inline: 8px; font-size: .95rem; } }
.fb-conf { margin: 6px 0 10px; padding-left: 10px; border-left: 4px solid var(--primary); font-weight: 700; max-width: 640px; }
.cal-block { margin: 14px 0; padding: 12px 14px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface-2); text-align: left; }
.cal-block h3 { margin: 0 0 8px; font-size: 1.05rem; }
.cal-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'label label' 'bar n'; align-items: center; gap: 2px 10px; margin: 6px 0; }
.cal-row .cal-label { grid-area: label; font-weight: 700; }
.cal-row .pbar { grid-area: bar; }
.cal-row .cal-n { grid-area: n; font-weight: 800; white-space: nowrap; }
@media (min-width: 760px) { .cal-row { grid-template-columns: minmax(14em, auto) 1fr auto; grid-template-areas: 'label bar n'; } }
.cal-say { font-weight: 800; margin: 8px 0 4px; }
.conf-progress .cal-block { background: var(--surface); }
.sum-sure { margin: 8px 0 0; }
/* ==== Diagnostic questions (docs/research/activity-designs.md, A2; js/diagnostics.js): answer choices with letters A–D,
   so a learner (or a teacher over a shoulder) can say "B"; a wrong first pick is marked and disabled, the second try
   follows. Right and wrong also carry an icon, never colour alone. Site tokens only. ==== */
.choices.lettered { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); max-width: 760px; }
.choices.lettered .choice { display: flex; align-items: center; gap: 10px; text-align: left; min-height: 56px; }
.choices.lettered .choice .opt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.choices.lettered.wordy { grid-template-columns: 1fr; max-width: 640px; }
.choices.lettered.wordy .choice { font-size: 1.02rem; font-weight: 700; line-height: 1.4; padding: 12px 14px; }
@media (min-width: 760px) { .choices.lettered.wordy { grid-template-columns: repeat(2, minmax(260px, 1fr)); max-width: 820px; } }
.choices.lettered .choice.selected .ltr { background: var(--primary); color: var(--on-primary); }
.choices.lettered .choice.is-right::after { content: '✅'; margin-left: auto; }
.choices.lettered .choice.is-wrong::after { content: '✖'; margin-left: auto; color: var(--wrong); }
.choices.lettered .choice:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
/* ==== end diagnostic questions */

/* ===================================================== explain the step, fill in the last step (activity-designs.md A3:
   the walkthrough's "why" pause, its "Ask me why" mode, My Way's fill card, long answers' choose-the-reason line) */
.walk-mode { flex-wrap: wrap; max-width: 100%; border-radius: 18px; }
.walk-why { margin-top: 12px; padding: 12px 14px; border: 2px solid var(--now); border-radius: var(--radius); background: color-mix(in srgb, var(--now) 7%, var(--surface)); }
.walk-why[hidden] { display: none; }
.walk-why-count { margin: 0 0 4px; font-size: .85rem; font-weight: 800; color: var(--muted); }
.walk-why-h { margin: 0 0 10px; font-size: 1.12rem; line-height: 1.35; }
.walk-why-h:focus { outline: none; }
.walk-why-h:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
.walk-why .choices.lines { margin: 0; }
.walk-why .act-note { margin-top: 10px; }
.walk-carry-row { margin: 10px 0 0; }
.mw-fill-intro { margin: 0 0 10px; overflow-wrap: anywhere; }
.mw-fill-result { font-weight: 800; margin: .4em 0; }
.sa-choose { margin: 8px 0 4px; }
.sa-choose .act-ask { font-size: .95rem; }
.sa-reason.sa-reason-ask { font-weight: 800; color: var(--muted); }
.sa-reason.sa-reason-ok::before { content: '✅ '; }
.sa-reason.sa-reason-no::before { content: '✖ '; color: var(--wrong); }
@media print { .walk-why { border-color: #000; background: none; } }
/* ================================================= end explain the step */

/* ===================================================== find and fix (activity-designs.md A4: tap the wrong line,
   Acts.lines; the two workings side by side, Acts.pair; the lesson's "Spot the mistake" with conceptual errors). Lines
   wrap rather than scroll (C4). Right and wrong also carry an icon or words, never colour alone. Site tokens only. */
.ff-intro { margin: 0 0 4px; overflow-wrap: anywhere; }
.ff-face { font-size: 1.4em; vertical-align: middle; }
.ff-opt { font-weight: 600; color: var(--muted); font-size: .9em; }
.act-line-list { padding-left: 1.8em; max-width: 640px; }
.act-line-list > li { padding-left: 2px; }
.act-line { font-weight: 500; width: 100%; min-height: 48px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.act-line-m { flex: 1 1 auto; min-width: 0; }
.act-line .frac { vertical-align: middle; }
.act-line:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.act-line:disabled { cursor: default; color: var(--text); }
.act-line.ok { opacity: 1; }
.act-line-tag { flex: none; font-size: .82em; font-weight: 800; }
.act-line.ok .act-line-tag { color: var(--right); }
.act-line.bad .act-line-tag { color: var(--wrong); }
.act-pair { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
@media (min-width: 760px) { .act-pair { grid-template-columns: 1fr 1fr; } }
.act-pair-p { min-width: 0; padding: 10px 12px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.act-pair-h { margin: 0 0 6px; font-size: 1rem; overflow-wrap: anywhere; }
.ff-work { margin: 0; padding-left: 1.8em; display: grid; gap: 4px; overflow-wrap: anywhere; line-height: 1.5; }
.ff-work .frac { vertical-align: middle; }
.ff-work li { padding: 2px 6px; border-radius: 8px; }
.ff-work li.ff-bad { background: var(--wrong-soft); border: 2px solid color-mix(in srgb, var(--wrong) 45%, transparent); }
.ff-work li.ff-good { background: var(--right-soft); border: 2px solid color-mix(in srgb, var(--right) 45%, transparent); }
.ff-work li.ff-bad::after { content: ' ✖'; color: var(--wrong); font-weight: 900; }
.ff-work li.ff-good::after { content: ' ✔'; color: var(--right); font-weight: 900; }
.ff-marks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; font-weight: 700; }
.ff-right { margin: 8px 0 0; padding: 8px 12px; border-left: 4px solid var(--sun); border-radius: 8px; background: color-mix(in srgb, var(--sun) 12%, var(--surface)); overflow-wrap: anywhere; }
.ff-fix .ff-fix-in { max-width: 520px; }
.ff-fix .actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.ff-lesson-link { margin: 10px 0 0; }
.spot-ff .act-note { margin-top: 8px; }
.spot-why { display: block; margin-top: 6px; overflow-wrap: anywhere; }
@media print { .ff-work li.ff-bad, .ff-work li.ff-good, .act-pair-p { background: none; border-color: #000; } }
/* ================================================= end find and fix */
/* ===================================================== class starter (docs/research/activity-designs.md A8: the printable
   page #/who/class/starter/<topic>, its exit ticket's results, the class question card, the hand-over line) */
.st-bar, .starter, .st-after { max-width: 860px; margin-left: auto; margin-right: auto; }
.st-bar { margin-bottom: 12px; }
.st-bar .cta-row { margin: 8px 0; }
.starter { margin-bottom: 16px; overflow-wrap: anywhere; }
.st-head h1 { margin: .1em 0 .2em; }
.st-meta { margin: 0 0 6px; }
.st-sec { border-top: 1.5px solid var(--border); padding-top: 10px; margin-top: 12px; min-width: 0; }
.st-sec h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 1.15rem; margin: 0 0 8px; }
.st-num { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: .9rem; flex: none; }
.st-time { font-size: .8rem; font-weight: 800; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.st-q { margin: 6px 0; }
.st-opts { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.st-opts li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.st-how { margin: 6px 0; }
.st-notes { margin: 6px 0; padding-left: 1.2em; }
.st-notes li { margin: 3px 0; }
.st-tip { color: var(--muted); }
.st-near, .st-none { font-style: italic; color: var(--muted); }
.st-votes { margin: 8px 0 0; font-weight: 700; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.st-votes i { display: inline-block; width: 2.4em; border-bottom: 1.5px solid currentColor; margin-right: 4px; }
.st-again { margin-left: 10px; }
.st-wodb { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.st-wodb li { border: 2px solid var(--border); border-radius: 12px; padding: 10px; text-align: center; font-size: 1.2rem; font-weight: 700; min-width: 0; }
.st-wodb-tag { font-weight: 800; margin-right: 4px; }
.st-why { font-size: .92rem; }
.st-talk { font-size: 1.15rem; }
.st-exit { margin: 6px 0; padding-left: 1.6em; }
.st-exit > li { margin: 4px 0 8px; min-width: 0; }
.st-exit .prompt { margin: 0; }
.st-exit .prompt .big { font-size: 1.1rem; }
.st-choices { margin: 4px 0; }
.st-key { margin: 8px 0 0; }
.st-after h2 { margin-top: 0; }
.st-vote-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.st-vote-form legend { font-weight: 800; margin-bottom: 6px; }
.st-vote-grid { display: grid; grid-template-columns: auto repeat(var(--k, 4), minmax(0, 4.5em)); gap: 6px 8px; align-items: center; }
.st-vote-grid label { display: flex; align-items: center; gap: 4px; }
.st-vote-grid input { width: 100%; min-width: 0; padding: 6px; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.st-vote-row-h { font-size: .9rem; color: var(--muted); }
.st-cq { margin: 12px 0; }
.st-ticket { max-width: 760px; }
.st-ticket-qs { padding-left: 1.4em; margin: 0 0 8px; }
.st-ticket-qs .st-tq .big { font-size: 1em; font-weight: 400; }
.st-grid { border-collapse: collapse; width: 100%; margin: 8px 0 12px; }
.st-grid th, .st-grid td { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: center; }
.st-grid th[scope="row"], .st-grid thead th:first-child { text-align: left; overflow-wrap: anywhere; }
.st-grid input { width: 24px; height: 24px; margin: 0; cursor: pointer; }
.st-grid input:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.st-grid tr:has(.st-here:not(:checked)) th { color: var(--muted); text-decoration: line-through; }
.cl-starter p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0; }
.cl-cq-votes { font-weight: 800; }
.handover { margin: 10px auto; max-width: 30em; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.handover .say-btn { min-width: 44px; min-height: 44px; }
.cg-foot .btn + .btn { margin-left: 6px; }
@media (min-width: 640px) {
  .st-wodb { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media print {
  .st-bar, .st-after { display: none !important; }
  .starter { max-width: none; margin: 0; font-size: 9.5pt; line-height: 1.28; }
  .starter h1 { font-size: 14pt; margin: 0; }
  .starter .eyebrow { margin: 0; font-size: 8.5pt; }
  .st-meta { font-size: 8.5pt; margin: 1px 0 0; }
  .st-sec { border-top: 1.2px solid #000; padding-top: 4px; margin-top: 5px; }
  .st-sec h2 { font-size: 11pt; margin: 0 0 3px; gap: 6px; break-after: avoid; }
  .st-num { background: #fff; color: #000; border: 1.5px solid #000; font-size: 8.5pt; }
  .st-time { border-color: #000; color: #000; font-size: 8pt; padding: 0 6px; }
  .st-q, .st-how, .st-notes, .st-votes, .st-key, .st-strat, .st-near, .st-none { margin: 2px 0; }
  .starter .prompt p { margin: 1px 0; }
  .starter .prompt .big, .st-talk { font-size: 10.5pt; }
  .st-notes { font-size: 9pt; }
  .st-notes li { margin: 0; }
  .st-tip { color: #333; }
  .st-opts { margin: 3px 0; gap: 3px 20px; }
  .st-wodb { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 3px 0; }
  .st-wodb li { border: 1.2px solid #000; border-radius: 8px; padding: 3px 5px; font-size: 11pt; }
  .st-why { font-size: 8.5pt; columns: 2; column-gap: 8mm; }
  .st-why li { break-inside: avoid; }
  .st-exit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 6mm; padding-left: 0; list-style: none; counter-reset: stx; margin: 2px 0; }
  .st-exit > li { margin: 0; counter-increment: stx; break-inside: avoid; }
  .st-exit > li::before { content: counter(stx) "."; font-weight: 800; float: left; margin-right: 4px; }
  .st-exit svg, .st-exit .diagram, .st-q svg, .st-q .diagram { max-width: 100%; max-height: 32mm; height: auto; }
  .st-exit table td, .st-exit table th { padding: 1px 4px; }
  .starter .ws-letter { width: 1.5em; height: 1.5em; font-size: 8pt; }
  .starter .ws-choices { gap: 1px 12px; margin: 2px 0; }
  .st-near, .st-none { color: #333; }
  .st-how { font-size: 9pt; }
  .starter .prompt { font-size: 10pt; line-height: 1.3; }
  .starter .prompt table { font-size: 9pt; margin: 2px 0; }
  .starter .prompt table td, .starter .prompt table th { padding: 1px 6px; }
  .st-exit .prompt { font-size: 9pt; }
  .st-exit .prompt table { font-size: 8pt; }
  .st-exit .prompt table td, .st-exit .prompt table th { padding: 0 3px; }
}
/* ================================================= end class starter */
/* ===================================================== card sort (activity-designs.md A11; js/sort.js): a row per card
   with its select (categorise, match, always/sometimes/never), the groups below as a picture of the selects and where a
   tapped card goes; or a line of cards with ↑ ↓ (order, Parsons). Right and wrong carry ✔ / ✖ and words, never colour
   alone. Groups stack on phones; cards at least 48 px tall; site tokens only (light and dark). */
.sort { margin: 6px 0 4px; max-width: 760px; }
.prompt .sort-host { font-size: 1rem; text-align: left; } /* (on the widget seam the sort sits in the prompt, where the printed form was) */
.sort-help { margin: 0 0 8px; }
.sort-card, .sort-chip {
  font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
  box-shadow: 0 2px 0 var(--border); cursor: pointer; text-align: left; overflow-wrap: anywhere; line-height: 1.4;
}
.sort-card { min-height: 48px; padding: 8px 12px; font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
.sort-card[aria-pressed="true"], .sort-chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft), 0 4px 0 var(--primary); }
.sort-card:focus-visible, .sort-chip:focus-visible, .sort-sel:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.sort-card:disabled, .sort-chip:disabled { cursor: default; color: var(--text); opacity: 1; }
.sort-card .frac, .sort-chip .frac, .sort-start .frac, .sort-key .frac { vertical-align: middle; }
.sort-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sort-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.sort-row .sort-card { flex: 1 1 9.5em; }
.sort-pick { display: block; flex: 0 1 auto; min-width: 0; }
.sort-card svg.fracpic { width: 120px; height: auto; }
.sort-sel { font: inherit; font-weight: 700; min-height: 48px; width: 9.5em; max-width: 100%; padding: 8px 10px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.sort-row.placed .sort-sel { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.sort-mark { flex: 1 1 100%; grid-column: 1 / -1; font-weight: 700; overflow-wrap: anywhere; }
.sort-why { font-weight: 500; }
.is-right > .sort-mark { color: var(--right); }
.is-wrong > .sort-mark { color: var(--wrong); }
.sort-row.is-right .sort-card, .sort-item.is-right .sort-card, .sort-chip.is-right { border-color: var(--right); background: var(--right-soft); box-shadow: none; }
.sort-row.is-wrong .sort-card, .sort-item.is-wrong .sort-card, .sort-chip.is-wrong { border-color: var(--wrong); background: var(--wrong-soft); box-shadow: none; }
.sort-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.sort-pics .sort-bins { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.sort-bin { border: 2px dashed var(--border); border-radius: var(--radius); padding: 6px; background: var(--surface-2); min-width: 0; cursor: default; }
.sort.armed .sort-bin { border-color: var(--primary); cursor: pointer; }
.sort-bin-head { font: inherit; font-weight: 800; color: var(--text); background: none; border: 0; padding: 4px; width: 100%; text-align: left; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: inherit; min-height: 40px; }
.sort-bin-label { min-width: 0; overflow-wrap: anywhere; }
.sort-put { display: none; font-size: .8em; color: var(--primary); }
.sort.armed .sort-put { display: inline; }
.sort-bin-cards { display: flex; flex-wrap: wrap; gap: 4px; min-height: 30px; padding: 2px; }
.sort-chip { padding: 2px 8px; font-size: .9em; font-weight: 700; min-height: 32px; }
.sort-chip svg, .sort-chip .sort-pic svg { width: 56px; max-width: 100%; height: auto; }
.sort-chip .sort-tab { font-size: .8em; }
.sort-ltr, .sort-start-tag { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 .4em; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 900; font-size: .85em; }
.sort-thumb { display: block; max-width: 180px; width: 100%; }
.sort-thumb svg { width: 100%; height: auto; max-width: 180px; display: block; }
.sort-pic svg { width: 120px; max-width: 100%; height: auto; display: block; }
.sort-big { font-size: 1.35em; }
.sort-over { text-decoration: overline; }
.sort-tab { border-collapse: collapse; font-size: .95em; }
.sort-tab th, .sort-tab td { border: 1px solid var(--border); padding: 1px 7px; text-align: center; }
.sort-tab th { background: var(--surface-2); }
.sort-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: sortn; }
.sort-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; counter-increment: sortn; }
.sort-item::before { content: counter(sortn); font-weight: 900; color: var(--muted); min-width: 1.2em; text-align: right; }
.sort-item .sort-card { width: 100%; }
.sort-moves { display: flex; gap: 4px; }
.sort-moves .btn { min-width: 44px; min-height: 44px; padding: 4px 10px; font-size: 1.1rem; }
.sort-item .sort-mark { grid-column: 2 / -1; }
.sort-end { margin: 4px 0; font-size: .85em; font-weight: 800; color: var(--muted); }
.sort-start { margin: 0 0 8px; padding: 8px 12px; border-left: 4px solid var(--primary); border-radius: 8px; background: var(--surface-2); overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sort-start-line { font-weight: 700; }
.sort-ask { margin: 8px 0 0; }
.sort-answer { margin: 8px 0; }
.sort-answer-h { margin: 0 0 4px; font-weight: 800; }
.sort-key { overflow-wrap: anywhere; }
.sort-key-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.sort-key-bin { border: 2px solid var(--border); border-radius: 12px; padding: 6px 8px; background: var(--surface); min-width: 0; }
.sort-key-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 800; margin-bottom: 4px; }
.sort-key-head .sort-thumb { max-width: 120px; }
.sort-key-bins:has(.sort-thumb) { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.sort-key-cards { display: flex; flex-wrap: wrap; gap: 4px; }
.sort-key-card { display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-weight: 700; }
.sort-key-card svg { max-width: 70px; height: auto; }
.sort-key-list { margin: 0; padding-left: 1.8em; display: grid; gap: 4px; }
.sort-start-key { margin: 0 0 4px; font-weight: 700; }
.sort-tie { font-weight: 900; color: var(--muted); }
@media (max-width: 480px) {
  .sort-sel { width: 8.5em; }
  .sort-pic svg { width: 96px; }
}
/* the worksheet's cards to cut out (pair work) */
.ws-sort-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 6px 0; }
.ws-sort-card { border: 1.5px dashed #888; padding: 8px; font-size: 1.15em; font-weight: 700; min-height: 22mm; display: flex; align-items: center; justify-content: center; text-align: center; overflow-wrap: anywhere; }
.ws-sort-card svg { max-width: 34mm; height: auto; }
.ws-sort-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(40mm, 1fr)); gap: 6px; margin: 6px 0; }
.ws-sort-bin { border: 2px solid #888; border-radius: 6px; padding: 6px; min-height: 30mm; font-weight: 800; }
.ws-sort-bin svg { max-width: 38mm; height: auto; display: block; }
@media print { .sort-card, .sort-chip, .sort-key-card, .sort-key-bin { background: none; box-shadow: none; } .sort-bins, .sort-help, .sort-moves { display: none; } }
/* the printed form in the prompt (the widget takes its place on screen) */
.sort-static-h { margin: 6px 0 2px; font-weight: 800; }
.sort-static-groups, .sort-static-cards { margin: 0 0 6px; padding-left: 1.6em; overflow-wrap: anywhere; }
.sort-static svg { max-width: 150px; height: auto; vertical-align: middle; }
/* ================================================= end card sort */
/* ===================================================== number line and estimate first (activity-designs.md A5;
   js/widgets.js WIDGETS.numberline, Q.numberLine): the marker is a slider; a tap on the line moves it there, ◀ ▶ step it;
   the right place shows as a dashed ✓ marker next to the learner's own after the answer. Colours from the theme tokens. */
.nl-widget { margin: 6px 0 10px; }
.nl-svg { display: block; width: 100%; max-width: 560px; height: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.nl-svg .nl-hit { cursor: pointer; }
.nl-svg .nl-tick { stroke-width: 1.2; }
.nl-marker { cursor: grab; touch-action: none; outline: none; }
.nl-marker .nl-head { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.nl-marker .nl-stem, .nl-ghost .nl-stem { stroke: var(--primary); stroke-width: 3; }
.nl-marker .nl-mark { fill: var(--on-primary); font-size: 15px; font-weight: 900; pointer-events: none; }
.nl-marker.nl-unset .nl-head { fill: var(--muted); opacity: .55; }
.nl-marker.nl-unset .nl-stem { stroke: var(--muted); opacity: .55; stroke-dasharray: 3 3; }
.nl-marker:focus-visible .nl-head { stroke: var(--sun); stroke-width: 5; }
.nl-marker.is-right .nl-head { fill: var(--right); }
.nl-marker.is-right .nl-stem { stroke: var(--right); }
.nl-marker.is-wrong .nl-head { fill: var(--wrong); }
.nl-marker.is-wrong .nl-stem { stroke: var(--wrong); }
.nl-ghost .nl-head { fill: var(--surface); stroke: var(--right); stroke-width: 3; stroke-dasharray: 5 3; }
.nl-ghost .nl-stem { stroke: var(--right); stroke-dasharray: 4 3; }
.nl-ghost .nl-mark { fill: var(--right); font-size: 15px; font-weight: 900; }
.nl-locked .nl-svg .nl-hit, .nl-locked .nl-marker { cursor: default; }
.nl-steps { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 560px; }
.nl-step { min-width: 48px; min-height: 48px; padding: 0 12px; font-size: 1.1rem; }
.nl-help { font-size: .85rem; text-align: center; }
.nl-locked .nl-steps { display: none; }
.nl-swap:not([hidden]) { display: inline-block; margin-top: 4px; font-size: .9rem; }
.nl-box:not([hidden]) { display: grid; gap: 6px; max-width: 420px; }
.nl-box-q { font-weight: 700; }
.nl-cap { margin: 2px 0 0; font-size: .92rem; }
.nl-key { display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; border-radius: 50%; font-weight: 900; font-size: .85em; }
.nl-key-right { color: var(--right); border: 2px dashed var(--right); }
.nl-key-mine { color: var(--on-primary); background: var(--wrong); }
.nl-key-mine.is-right { background: var(--right); }
.nl-key-mine.is-open { background: var(--primary); }
.nl-note { font-weight: 700; }
.nl-big .nl-svg { max-width: 640px; }
.nl-svg .tick { font-size: 16px; }
.nl-big .nl-svg .tick { font-size: 18px; }
/* Estimate first: three ranges, or a marker on an unmarked line (P1–P3), then the question; the comparison after it. */
.est-line { margin: 4px 0 0; }
.est-result { margin: 8px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-weight: 700; }
.est-result.is-near { background: var(--right-soft); }
.est-msg.is-said { color: var(--text); font-weight: 700; }
@media print { .nl-steps, .nl-swap { display: none; } }
/* Worksheets: on screen the line is the widget (in the no-print check box); on paper the printed line, to draw on. */
@media screen { .ws-q.has-nl .prompt .nl-static { display: none; } }
.ws-nl-key .diagram.numline { max-width: 320px; }
/* ================================================= end number line */
/* ===================================================== two ways (activity-designs.md A6; js/twoways.js): one problem
   worked two ways in Acts.pair (stacked below 760 px, side by side above), the lines that are not in both marked with a
   thick left bar and a tint (and words for screen readers), then the pick and "your turn" as Acts.steps. Lines wrap
   rather than scroll (C4). Site tokens only. */
.tw-intro { margin: 0 0 6px; overflow-wrap: anywhere; }
.tw-prompt { margin: 0 0 4px; }
.tw-work { margin: 0; padding-left: 1.8em; display: grid; gap: 4px; overflow-wrap: anywhere; line-height: 1.5; }
.tw-work .frac { vertical-align: middle; }
.tw-work li { padding: 2px 6px; border-radius: 6px; border-left: 4px solid transparent; }
.tw-work li.tw-diff { border-left-color: var(--sun); background: color-mix(in srgb, var(--sun) 16%, var(--surface)); }
.tw-key { margin: -4px 0 8px; display: flex; align-items: center; gap: 6px; }
.tw-swatch { display: inline-block; width: 18px; height: 14px; border-left: 4px solid var(--sun); background: color-mix(in srgb, var(--sun) 16%, var(--surface)); border-radius: 3px; flex: none; }
.tw-turn { margin: 0 0 8px; color: var(--muted); }
.mw-two .act-pair-p { padding: 8px 10px; }
@media print { .tw-work li.tw-diff { background: none; border-left-color: #000; } }
/* ================================================= end two ways */
/* ===================================================== predict, then explain in labs (activity-designs.md A7): "Why did
   that happen?" after a step's check, a step on its own (Lab.mount with only), and the lab step card in My Way */
.lab-explain { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.lab-why-h { font-size: 1.05rem; margin: 0 0 8px; }
.lab-why-right { display: block; margin-top: 6px; }
.lab-one .lab-head { margin-bottom: 8px; }
.lab-one .lab-one-t { font-size: 1.15rem; margin: 0; }
.lab-one .lab-chs { margin-bottom: 12px; }
.mw-lab .lab { margin-bottom: 8px; }
.mw-lab .lab-head .eyebrow { display: none; }
.mw-lab .lab-grid { grid-template-columns: minmax(0, 1fr); }
.mw-lab-intro { font-weight: 700; margin: 0 0 8px; }
.mw-lab-done { margin-top: 12px; }
/* ================================================= end predict, then explain */
/* ===================================================== plan and look back (activity-designs.md A12): the day's plan
   card, "What happened?" under a missed practice question, the look back on the day's end and break cards, the
   summary's line. The picks are js/acts.js's (neutral: nothing marked right or wrong, the choice said back). */
.mw-plan .act-ask { font-size: 1.2rem; margin-bottom: 10px; }
.mw-plan .plan-pick .choices.lines { grid-template-columns: minmax(0, 1fr); }
.mw-what, .lb-block { margin: 14px 0 0; padding: 12px 14px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface-2); text-align: left; }
.mw-what .act-ask, .lb-block .act-ask { font-size: 1.02rem; }
.lb-block h3 { margin: 0 0 8px; font-size: 1.05rem; }
.lb-block .act-pick + .act-pick { margin-top: 14px; }
.lb-block.lb-done p { margin: 0; }
/* Young learners (the break card): bigger chips, one to a row. */
.mw-break .lb-block .choices.lines { grid-template-columns: minmax(0, 1fr); }
.mw-break .lb-block .choice { min-height: 64px; font-size: 1.1rem; }
.sum-refl { margin: .6em 0; }
/* ================================================= end plan and look back */
/* ===================================================== open and "convince me" (activity-designs.md A14; js/open.js): the
   claim as a quote, the pick (js/acts.js), then "Convince me": each example box an ordinary answer box, the result and
   the reason. Lines wrap rather than scroll (C4). Site tokens only. */
.op-intro { margin: 0 0 8px; font-weight: 700; overflow-wrap: anywhere; }
.op-claim { margin: 0 0 12px; padding: 12px 14px; border-left: 6px solid var(--sky); border-radius: 12px; background: var(--surface-2); font-size: 1.12rem; line-height: 1.5; overflow-wrap: anywhere; }
.op-claim p { margin: 0; }
.op-lead { margin: 0 0 8px; color: var(--muted); }
.op-ex + .op-ex { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.op-want { margin: 0 0 4px; }
.op-ask { margin: 0 0 4px; }
.op-end { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); overflow-wrap: anywhere; }
.op-end p { margin: 0 0 8px; }
.op-why-l { font-weight: 700; }
.op-end .cta-row { margin: 4px 0 0; }
@media print { .op-claim { border-left-color: #000; background: none; } }
/* ================================================= end open and convince me */
/* ===================================================== build it, draw it, write it (activity-designs.md A13; js/build.js):
   the tap-only build widget (a ten frame or two whose cells are buttons, place-value columns of base-ten pieces, plates
   or rows of counters, each with − and + of at least 72 px), the simpler drawings to match, and "How did you see it?".
   Counters in the Explore counters' colours; a frame's given counters blue. Site tokens only; no animation. */
.bd { display: grid; justify-items: center; gap: 10px; margin: 6px 0 10px; min-width: 0; }
.bd-frames { display: grid; gap: 10px; width: min(100%, 340px); }
.bd-tf { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 3px solid var(--text); border-radius: 8px; background: var(--surface); }
.bd-cell { aspect-ratio: 1; min-width: 0; padding: 0; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font: inherit; cursor: pointer; }
.bd-cell::after { content: ''; width: 74%; height: 74%; border-radius: 50%; }
.bd-cell.on::after { background: var(--counter-red); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.bd-cell.given::after { background: var(--sky); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.bd-cell.given { cursor: default; }
.bd-cell:focus-visible, .bd-btn:focus-visible, .bd-see-opt:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.bd-pm { display: flex; gap: 12px; justify-content: center; }
.bd-btn { min-width: 72px; min-height: 72px; padding: 0; font-size: 2.1rem; line-height: 1; background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.bd-btn:hover { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }
.bd-locked .bd-pm { display: none; }
.bd-locked .bd-cell { cursor: default; }
/* Place-value columns: + above −, so three columns fit a 360 px phone. */
.bd-cols { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 6px; width: 100%; max-width: 520px; }
.bd-cols.bd-n3 { --n: 3; }
.bd-col { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 6px; min-width: 0; padding: 6px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.bd-col-h { margin: 0; font-weight: 800; }
.bd-col .bd-pm { flex-wrap: wrap-reverse; gap: 6px; }
.bd-pieces { display: flex; flex-wrap: wrap; align-content: flex-end; align-items: flex-end; justify-content: center; gap: 3px; min-height: 76px; width: 100%; }
.bd-rod { display: block; width: 10px; height: 70px; border: 1px solid #1565c0; background: repeating-linear-gradient(to bottom, #64b5f6 0 6px, #1565c0 6px 7px); }
.bd-cube { display: block; width: 12px; height: 12px; border: 1px solid #e65100; background: #ffb74d; }
.bd-flat { display: block; width: 36px; height: 36px; border: 1px solid #1565c0; background-color: #64b5f6; background-image: linear-gradient(#1565c0 1px, transparent 1px), linear-gradient(90deg, #1565c0 1px, transparent 1px); background-size: 3.5px 3.5px; }
/* Plates, groups and rows of counters; a pile to share above them. */
.bd-pile, .bd-plates { width: 100%; max-width: 520px; }
.bd-pile { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border: 2px dashed var(--border); border-radius: 12px; }
.bd-pile-h, .bd-plate-h { font-weight: 800; font-size: .92rem; }
.bd-plates { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bd-plate { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "h pm" "on pm"; align-items: center; gap: 4px 8px; padding: 6px 8px 6px 12px; border: 2px solid var(--border); border-radius: 16px; background: var(--surface-2); }
.bd-plate-h { grid-area: h; }
.bd-plate .bd-on { grid-area: on; min-height: 22px; }
.bd-plate .bd-pm { grid-area: pm; }
.bd-on { display: flex; flex-wrap: wrap; gap: 3px; }
.bd-dot { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--counter-red); }
.bd-pile .bd-dot { background: var(--counter-yel); }
/* Pictures: the right way (after a wrong build), the model above "draw it", and paper. */
.bd-pic { display: inline-flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 8px; max-width: 100%; }
.bd-pic-tf { display: inline-grid; grid-template-columns: repeat(5, 20px); gap: 2px; padding: 3px; border: 2px solid var(--text); border-radius: 5px; background: var(--surface); }
.bd-pic-tf .bd-cell { width: 20px; height: 20px; border-radius: 3px; cursor: default; }
.bd-pic-tens { gap: 14px; }
.bd-pic-tens .bd-pieces { min-height: 0; width: auto; max-width: 140px; }
.bd-pic-groups { display: grid; gap: 6px; justify-items: start; }
.bd-pic-groups .bd-on { min-width: 44px; min-height: 26px; padding: 3px 8px; border: 2px solid var(--border); border-radius: 999px; }
.bd-pic-groups.rows .bd-on { border: 0; padding: 0; min-height: 18px; }
.bd-mark { margin: 0; font-weight: 800; }
.bd.is-right .bd-mark { color: var(--right); }
.bd.is-wrong .bd-mark { color: var(--wrong); }
.bd-key { display: grid; justify-items: center; gap: 6px; padding: 8px 12px; border: 2px dashed var(--right); border-radius: 12px; max-width: 100%; }
.bd-key-h { margin: 0; font-weight: 800; color: var(--right); }
.bd-model { justify-content: center; }
.bd-tip { margin: 12px 0 0; }
.bd-steps .act-later .act-step-b { display: none; }
/* The simpler drawings: dots in fives, sticks and dots, rings of dots, in the text colour. */
.bd-sketch { fill: currentColor; max-width: 100%; height: auto; }
.bd-sketch .bd-sk-stick { stroke: currentColor; stroke-width: 4; stroke-linecap: round; }
.bd-sketch .bd-sk-ring, .bd-sketch .bd-sk-flat { fill: none; stroke: currentColor; stroke-width: 2; }
.choice .bd-sketch { display: block; margin: 0 auto; }
/* "How did you see it?": pictures of groupings to tap, not scored. */
.bd-see { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.bd-see-h { margin: 0 0 8px; font-weight: 800; }
.bd-see-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.bd-see-opt { display: grid; justify-items: center; gap: 4px; min-width: 96px; min-height: 72px; max-width: 100%; padding: 8px 10px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.bd-see-opt[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.bd-see-pic { display: block; width: auto; max-width: 150px; height: 60px; }
.bd-see-dot { fill: currentColor; }
.bd-see-box { fill: none; stroke: var(--border); stroke-width: 1.5; }
.bd-see-ring { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.bd-see-say { margin: 8px 0 0; font-weight: 700; }
.bd-see-say:empty { display: none; }
@media print { .bd-pm, .bd-see { display: none; } }
/* ================================================= end build it, draw it, write it */
/* ===================================================== the teacher's view of the new activities (js/teacher.js
   Teacher.how, classHow, classRefl): "How they work" on a learner's summary, the class's look back and "How the class
   works" on the class gaps page, who would like to ask the teacher on the overview; the worksheet's "Two ways" and
   "Always, sometimes or never?" sections. Site tokens only; lines wrap rather than scroll. */
.sum-how-list { list-style: none; padding-left: 0; }
.sum-how-list > li { margin-bottom: .5em; overflow-wrap: anywhere; }
.sum-how-list .tiny { display: inline-block; margin-top: 2px; }
.cg-refl-sec, .cg-how-sec { margin-top: 24px; }
.cg-refl-sec > h2, .cg-how-sec > h2 { font-size: 1.35rem; margin-bottom: .3em; }
.cg-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.cg-names { overflow-wrap: anywhere; }
.cg-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.cg-help { padding: 12px 18px; margin-bottom: 12px; border-left: 6px solid var(--sun); }
.cg-help-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.cg-help-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; overflow-wrap: anywhere; }
.cg-how-most { border-left: 6px solid var(--right); }
.cl-help { margin-top: 14px; padding: 12px 18px; border-left: 6px solid var(--sun); }
.cl-help > h2 { font-size: 1.1rem; margin: 0 0 4px; }
/* the worksheet's "Two ways" (both workings side by side, on paper too) and "Always, sometimes or never?" */
.ws-two-pair { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 8px 0; }
@media (min-width: 600px) { .ws-two-pair { grid-template-columns: 1fr 1fr; } }
.ws-two-side { min-width: 0; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 10px; }
.ws-two-side h4 { margin: 0 0 4px; font-size: 1rem; overflow-wrap: anywhere; }
.ws-two-work { margin: 0; padding-left: 1.6em; display: grid; gap: 2px; overflow-wrap: anywhere; line-height: 1.45; }
.ws-two-work .frac { vertical-align: middle; }
.ws-two-q { margin: 6px 0 2px; font-weight: 800; }
.ws-claim { margin: 6px 0 8px; padding: 8px 12px; border-left: 5px solid var(--sky); border-radius: 8px; background: var(--surface-2); font-size: 1.08rem; overflow-wrap: anywhere; }
.ws-claim p { margin: 0; }
.ws-claim-ex { margin: 8px 0 0; font-weight: 800; }
@media print {
  .ws-two-pair { grid-template-columns: 1fr 1fr; gap: 6px; }
  .ws-two-side { border-color: #000; padding: 4px 6px; }
  .ws-two-work { font-size: 10pt; }
  .ws-claim { border-left-color: #000; background: none; padding: 4px 8px; margin: 4px 0; font-size: 11pt; }
  .worksheet .ws-two h3, .worksheet .ws-claim-sec h3 { margin: .6em 0 .2em; font-size: 11pt; }
  .worksheet .ws-two > p, .worksheet .ws-claim-sec > p { margin: .2em 0; }
  .worksheet .ws-two .prompt { margin: .2em 0; font-size: 11pt; }
  .worksheet .ws-two .ws-choices, .worksheet .ws-claim-sec .ws-choices { margin: 4px 0; gap: 4px 22px; }
  .ws-key-two p, .ws-key-claim p { margin: .25em 0; }
  .ws-two-pair, .ws-claim, .ws-choices li { break-inside: avoid; } /* the section may span two pages; the workings and the claim don't */
  .ws-two h3, .ws-claim-sec h3, .ws-two .prompt { break-after: avoid; }
}
/* ================================================= end the teacher's view of the new activities */

/* =========================================================== sponsors (js/sponsors.js): the footer's credit line */
.sponsors-line a { color: inherit; font-weight: 800; }
