/* Gopher School — one stylesheet, no build step.
   1 fonts · 2 tokens · 3 base · 4 layout & navigation · 5 components · 6 pages · 7 game · 8 projector · 9 responsive, motion, print

   Design rules (see README "Design"): borders before shadows · colour only for state and action ·
   every state is colour + shape + word · one primary action per screen · code is always dark. */

/* ---- 1 · fonts (self-hosted: the CSP allows nothing else; all SIL OFL 1.1, licences in fonts/) ---- */
@font-face { font-family: "Atkinson Next"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Next"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Next"; font-style: italic; font-weight: 200 800; font-display: swap; src: url(fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Next"; font-style: italic; font-weight: 200 800; font-display: swap; src: url(fonts/atkinson-hyperlegible-next-latin-ext-wght-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Bricolage"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/bricolage-grotesque-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/bricolage-grotesque-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url(fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url(fonts/jetbrains-mono-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---- 2 · tokens ----
   Every colour is a light-dark() pair, so a theme is one switch: `color-scheme`. The system setting
   decides unless the header toggle stored a choice (cookie → <html data-theme>, rendered by the server).
   A subtree can flip itself the same way — code blocks and the "next step" panel are always dark.
   The first block is a plain light theme for browsers without light-dark() (before 2024). */
:root {
  --bg: #f6f8fa; --surface: #fff; --tint: #ebeff3; --ink: #15202b; --muted: #55626f; --line: #dbe2e8; --line-strong: #8a98a6;
  --accent: #00677f; --accent-hover: #00536a; --accent-ink: #fff; --accent-soft: #e0f1f6; --brand: #00add8; --sun: #fddd00; --sun-ink: #4a3f00;
  --ok: #176b3a; --ok-soft: #e1f3e6; --bad: #b3261e; --bad-soft: #fbe9e7; --warn: #7a5200; --warn-soft: #fdf3d3;
  --code-bg: #111a26; --code-ink: #e4ebf3; --code-muted: #8696a8; --code-line: #26323f;
  --tok-k: #6fd3ee; --tok-s: #f3d675; --tok-c: #8fa0b3; --tok-f: #8be0b0; --tok-n: #f5b27a; --tok-t: #b9b4f5;
  --core: #00677f; --stretch: #6a3fc4; --boss: #b3400f;
  --ws-floor: #fff; --ws-grid: #dbe2e8; --ws-wall: #2b3a4d; --ws-trail: #9adbea; --ws-square: #00758d; --ws-nose: #fff;

  --radius: 12px; --radius-s: 8px; --radius-xs: 5px;
  --shadow-float: 0 1px 2px rgb(10 30 50 / .08), 0 4px 10px rgb(10 30 50 / .08), 0 12px 28px rgb(10 30 50 / .1);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --sans: "Atkinson Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage", "Atkinson Next", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --text: clamp(1.0625rem, 1.03rem + .16vw, 1.15rem);
  --head-h: 3.5rem;
}
@supports (color: light-dark(#000, #fff)) {
  :root {
    color-scheme: light dark;
    --bg: light-dark(oklch(97.8% .005 225), oklch(16.5% .014 240));
    --surface: light-dark(#fff, oklch(20.5% .017 240));
    --tint: light-dark(oklch(94.5% .008 225), oklch(25.5% .02 240));
    --ink: light-dark(oklch(23% .025 240), oklch(94% .008 225));
    --muted: light-dark(oklch(46% .022 240), oklch(76% .018 230));
    --line: light-dark(oklch(89.5% .01 225), oklch(30% .02 240));
    --line-strong: light-dark(oklch(62% .025 235), oklch(55% .025 235));
    --accent: light-dark(oklch(47% .095 222), oklch(81% .105 215));
    --accent-hover: light-dark(oklch(40% .085 222), oklch(88% .085 215));
    --accent-ink: light-dark(#fff, oklch(19% .04 230));
    --accent-soft: color-mix(in oklch, var(--accent) 13%, var(--surface));
    --sun: light-dark(#fddd00, oklch(86% .16 98));
    --sun-ink: light-dark(oklch(34% .07 95), oklch(24% .05 95));
    --ok: light-dark(oklch(45% .115 152), oklch(82% .15 152));
    --ok-soft: color-mix(in oklch, var(--ok) 17%, var(--surface));
    --bad: light-dark(oklch(48% .17 27), oklch(79% .12 25));
    --bad-soft: color-mix(in oklch, var(--bad) 11%, var(--surface));
    --warn: light-dark(oklch(45% .1 75), oklch(85% .12 88));
    --warn-soft: color-mix(in oklch, var(--warn) 14%, var(--surface));
    --code-bg: oklch(15.5% .018 245); --code-line: oklch(29% .022 245);
    --core: var(--accent);
    --stretch: light-dark(oklch(47% .19 295), oklch(78% .12 295));
    --boss: light-dark(oklch(50% .16 45), oklch(80% .12 55));
    --ws-floor: light-dark(#ffffff, #222e3e); --ws-grid: light-dark(#dbe2e8, #33425a); --ws-wall: light-dark(#2b3a4d, #0a0f17);
    --ws-trail: light-dark(#9adbea, #2b7f92); --ws-square: light-dark(#00758d, #1497b3);
    --shadow-float: 0 1px 2px light-dark(rgb(10 30 50 / .08), rgb(0 0 0 / .4)), 0 4px 10px light-dark(rgb(10 30 50 / .08), rgb(0 0 0 / .35)), 0 12px 28px light-dark(rgb(10 30 50 / .1), rgb(0 0 0 / .4));
  }
  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"] { color-scheme: dark; }
}

/* ---- 3 · base ---- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 1.25rem); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font: var(--text)/1.55 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration-thickness: .07em; text-underline-offset: .2em; }
a:hover { color: var(--accent-hover); text-decoration-thickness: .12em; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.9rem, 1.45rem + 1.9vw, 2.75rem); font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 650; margin: 1.6rem 0 .5rem; }
h3 { font-size: 1.12rem; font-weight: 650; letter-spacing: -.01em; margin: 1.2rem 0 .4rem; }
p { margin: .6rem 0; text-wrap: pretty; }
strong, b { font-weight: 650; }
code, pre, kbd, .mono, textarea.code { font-family: var(--mono); font-variant-ligatures: none; }
code { background: var(--tint); padding: .1em .35em; border-radius: var(--radius-xs); font-size: .86em; }
pre { color-scheme: dark; background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--code-line); padding: 1rem 1.15rem; border-radius: var(--radius-s); overflow-x: auto; overscroll-behavior-x: contain; font-size: .9rem; line-height: 1.6; tab-size: 4; margin: .9rem 0; }
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.tok-k { color: var(--tok-k); font-weight: 600; } .tok-s { color: var(--tok-s); } .tok-c { color: var(--tok-c); font-style: italic; }
.tok-f { color: var(--tok-f); } .tok-n { color: var(--tok-n); } .tok-t { color: var(--tok-t); }
kbd { font-size: .74em; font-weight: 500; border: 1px solid currentColor; border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; opacity: .85; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .85rem; }
tbody tr:last-child > * { border-bottom: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:target { scroll-margin-top: calc(var(--head-h) + 1.25rem); }
::selection { background: var(--sun); color: #1a1a00; }
main:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: .6rem; left: .6rem; z-index: 50; background: var(--ink); color: var(--bg); padding: .55rem 1rem; border-radius: var(--radius-s); font-weight: 600; transform: translateY(-300%); }
.skip:focus { transform: none; color: var(--bg); }
.i { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.17em; }
.i.fill { fill: currentColor; stroke: none; }

/* ---- 4 · layout & navigation ---- */
header.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; min-height: var(--head-h); margin: 0 auto; padding: 0 1.25rem; display: flex; align-items: center; gap: 1.75rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font: 700 1.18rem/1 var(--display); letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand .logo { color: var(--ink); }
.logo-mark { stroke: var(--surface); } .logo-cursor { stroke: var(--brand); }
.main-nav { display: flex; gap: .25rem; flex: 1; align-self: stretch; }
.main-nav a { display: flex; align-items: center; padding: 0 .8rem; text-decoration: none; color: var(--muted); font-weight: 550; font-size: 1rem; border-block: 3px solid transparent; }
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current] { color: var(--ink); border-bottom-color: var(--brand); }
.user-nav { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.icon-btn { width: 2.5rem; height: 2.5rem; padding: 0; justify-content: center; border-color: transparent; background: none; color: var(--muted); border-radius: 50%; }
.icon-btn:hover { color: var(--ink); background: var(--tint); }
.icon-btn .i { width: 1.25rem; height: 1.25rem; }
/* show the icon of the theme you would switch TO */
.icon-btn .sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-btn .sun { display: block; } :root:not([data-theme="light"]) .icon-btn .moon { display: none; } }
:root[data-theme="dark"] .icon-btn .sun { display: block; } :root[data-theme="dark"] .icon-btn .moon { display: none; }

.menu { position: relative; }
.menu summary { list-style: none; display: flex; align-items: center; gap: .55rem; cursor: pointer; padding: .3rem .6rem .3rem .3rem; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-size: .95rem; color: var(--ink); }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: ""; width: .45em; height: .45em; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-25%) rotate(45deg); }
.menu summary:hover, .menu[open] summary { background: var(--tint); }
.avatar { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--bg); font: 700 .9rem/1 var(--display); text-transform: uppercase; }
.role { font-size: .75rem; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: .1rem .5rem; border-radius: 999px; }
.menu-panel { position: absolute; right: 0; top: calc(100% + .5rem); min-width: 15rem; padding: .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-float); transform-origin: top right; }
.menu[open] .menu-panel { animation: pop .16s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.menu-id { margin: .3rem .7rem .5rem; font-size: .85rem; color: var(--muted); }
.menu-panel a, .menu-item { display: block; width: 100%; padding: .6rem .7rem; border: 0; border-radius: var(--radius-s); background: none; color: var(--ink); font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.menu-panel a:hover, .menu-item:hover { background: var(--tint); color: var(--ink); }
.menu-panel a[aria-current] { color: var(--accent); }
.inline { display: inline; }

main.wrap { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.foot p { max-width: 1240px; margin: 0 auto; padding: 1.1rem 1.25rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem 3rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.page-head h1 { max-width: 22ch; }
.eyebrow { margin: 0 0 .35rem; font-weight: 600; font-size: .95rem; color: var(--muted); }
.lede { max-width: 68ch; color: var(--muted); margin: -.5rem 0 1.75rem; }
.section-title { font-size: 1.15rem; margin: 2.5rem 0 1rem; color: var(--muted); font-weight: 600; letter-spacing: -.01em; }
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.6rem; margin-bottom: 1.25rem; }
.card > :first-child, .panel > :first-child { margin-top: 0; }
.card > :last-child, .panel > :last-child { margin-bottom: 0; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }
.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 1.25rem; align-items: start; }
.scroll { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.scroll.plain { border: 0; border-radius: 0; background: none; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; color: var(--muted); font-size: .95rem; margin: -.5rem 0 1.25rem; }
.crumbs a { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem 0; text-decoration: none; font-weight: 550; }
.crumbs a:hover { text-decoration: underline; }

/* ---- 5 · components ---- */
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.ok { color: var(--ok); }
.danger { color: var(--bad); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.count { font: 500 .85em var(--mono); color: var(--muted); margin-left: .3rem; }
.empty { color: var(--muted); padding: 1.5rem; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-s); max-width: none; }
td.empty { border: 0; }
.error, .notice, p.ok { padding: .7rem 1rem; border-radius: var(--radius-s); font-weight: 500; }
.error { color: var(--bad); background: var(--bad-soft); }
.error::before { content: "✕  "; font-weight: 700; }
.notice { color: var(--ink); background: var(--warn-soft); }
p.ok { background: var(--ok-soft); }
p.ok a { color: inherit; }
.callout { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.4rem; margin: 0 0 1.5rem; background: var(--surface); }
.callout h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.callout > :last-child { margin-bottom: 0; }
.callout.help { background: var(--bad-soft); border-color: color-mix(in oklch, var(--bad) 35%, var(--surface)); }
.callout.help h2 { color: var(--bad); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 35%, var(--surface)); }
.callout.calm h2 { color: var(--ok); }
.chip { display: inline-flex; align-items: center; gap: .25rem; font: 600 .78rem/1.2 var(--sans); padding: .2rem .55rem; border-radius: 999px; color: var(--muted); background: var(--tint); vertical-align: .1em; white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--ok-soft); }
.chip.now { color: var(--sun-ink); background: var(--sun); }

label { display: block; margin: 1rem 0 .35rem; font-weight: 600; font-size: .95rem; }
.hint-inline { font-weight: 400; color: var(--muted); margin-left: .35rem; }
input[type=text], input[type=password], input:not([type]), textarea, select { width: 100%; min-height: 2.75rem; padding: .6rem .8rem; border: 1px solid var(--line-strong); border-radius: var(--radius-s); font: inherit; color: var(--ink); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
input:hover, textarea:hover, select:hover { border-color: var(--ink); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--bad); border-width: 2px; }
textarea { resize: vertical; display: block; }
select { width: auto; min-height: 2.25rem; padding: .3rem .5rem; }
::placeholder { color: var(--muted); opacity: .75; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.5rem; padding: .45rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, scale .1s var(--ease); }
button:hover, .btn:hover { background: var(--tint); border-color: var(--ink); color: var(--ink); }
button:active, .btn:active { scale: .97; }
button:disabled { opacity: .55; cursor: progress; }
.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover, button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.check, .check:hover { background: var(--ok); color: var(--surface); border-color: var(--ok); }
.check:hover { filter: brightness(1.1); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); }
.btn.quiet:hover { background: var(--tint); color: var(--ink); }
.btn.small, button.small { min-height: 2rem; padding: .25rem .7rem; font-size: .85rem; }
.btn.big, button.big { min-height: 3rem; padding: .6rem 1.4rem; font-size: 1.05rem; }
.wide { width: 100%; }
.btn.danger, button.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
form:not(.inline) > button.primary { margin-top: 1rem; }

progress { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: .5rem; border: 0; border-radius: 999px; background: var(--tint); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--tint); }
progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
.complete progress::-webkit-progress-value { background: var(--ok); }
.complete progress::-moz-progress-bar { background: var(--ok); }

/* one segment per task: passed is solid, tried is hatched — not colour alone */
.seg { display: flex; gap: 3px; list-style: none; margin: 0; padding: 0; }
.seg li { width: 1.5rem; height: .5rem; border-radius: 2px; background: var(--line); }
.seg li.done { background: var(--brand); }
.seg li.tried { background: repeating-linear-gradient(135deg, var(--line-strong) 0 3px, var(--line) 3px 6px); }
.complete .seg li.done { background: var(--ok); }

ul.tasks { list-style: none; padding: 0; margin: .4rem 0 0; }
ul.tasks li { display: flex; gap: .7rem; align-items: center; border-bottom: 1px solid var(--line); }
ul.tasks li:last-child { border-bottom: 0; }
ul.tasks a { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: .6rem; padding: .65rem 0; text-decoration: none; color: var(--ink); font-weight: 500; }
ul.tasks a:hover .task-name { text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 2px; text-underline-offset: .25em; }
ul.tasks.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(21rem, 100%), 1fr)); gap: 0 2.5rem; }
ul.tasks.cols li { border-bottom: 1px solid var(--line); }
.task-id { font: 500 .82rem var(--mono); color: var(--muted); white-space: nowrap; }
.tier { flex: none; display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tier::before { content: "●"; color: var(--core); font-size: .8em; }
.tier.stretch::before { content: "◆"; color: var(--stretch); }
.tier.boss::before { content: "★"; color: var(--boss); font-size: 1em; }
.status { flex: none; display: inline-flex; align-items: center; gap: .25rem; min-width: 4.6rem; justify-content: flex-end; font-size: .82rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.status.ok { color: var(--ok); }
.side .status { min-width: 1.6rem; }

.pager { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 1rem; margin-top: 3rem; }
.pager a, .pager-locked { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--surface); }
.pager a:hover { border-color: var(--ink); }
.pager [rel=next], .pager-locked { text-align: right; align-items: flex-end; }
.pager-label { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.pager a .pager-label { color: var(--accent); }
.pager-title { font: 650 1.05rem/1.25 var(--display); }
.pager-locked { border-style: dashed; background: none; color: var(--muted); }
.pager.small { margin-top: 2rem; }
.pager.small a { padding: .7rem 1rem; }
.pager.small .pager-title { font-size: .95rem; }

/* prose: lesson text, task statements, teacher notes */
.theory { max-width: 68ch; line-height: 1.65; }
.theory > :first-child { margin-top: 0; }
.theory h2 { font-size: 1.6rem; margin: 3rem 0 .8rem; }
.theory h2::before { content: ""; display: block; width: 2.5rem; height: 4px; background: var(--brand); border-radius: 2px; margin-bottom: 1rem; }
.theory h3 { margin-top: 1.8rem; }
.theory p, .theory ul, .theory ol { margin: .8rem 0; }
.theory li { margin: .3rem 0; }
.theory li::marker { color: var(--accent); font-weight: 650; }
.theory strong { background: linear-gradient(transparent 62%, color-mix(in oklch, var(--sun) 55%, transparent) 62%); }
.theory table { margin: 1.1rem 0 1.4rem; font-size: .95em; line-height: 1.5; }
.theory thead th { border-bottom: 2px solid var(--ink); color: var(--ink); }
.theory blockquote { margin: 1.4rem 0; padding: .9rem 1.2rem; background: var(--accent-soft); border-radius: var(--radius-s); font-size: 1.04em; }
.theory blockquote > :first-child { margin-top: 0; } .theory blockquote > :last-child { margin-bottom: 0; }
.theory .btn.primary { color: var(--accent-ink); }
.theory img { max-width: 100%; height: auto; }
.codeblock { position: relative; }
.copy { position: absolute; top: .5rem; right: .5rem; min-height: 1.9rem; padding: .15rem .6rem; font-size: .78rem; color-scheme: dark; color: var(--code-ink); background: var(--code-bg); border-color: var(--code-line); opacity: 0; transition: opacity .15s; }
.codeblock:hover .copy, .copy:focus-visible, .copy.done { opacity: 1; }
.copy:hover { background: var(--code-line); color: #fff; border-color: var(--code-muted); }
.copy.done { color: var(--tok-f); }
@media (hover: none) { .copy { opacity: 1; } }

/* ---- 6 · pages ---- */
/* dashboard */
.total { min-width: min(17rem, 100%); }
.total-num { margin: 0 0 .5rem; color: var(--muted); font-size: .95rem; }
.total-num strong { font: 700 1.9rem/1 var(--display); color: var(--ink); margin-right: .15rem; }
.next { color-scheme: dark; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem 3rem; flex-wrap: wrap; padding: 1.75rem 2rem; border-radius: var(--radius); background: var(--code-bg); color: var(--ink); border: 1px solid var(--code-line); position: relative; overflow: hidden; }
.next::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--sun); }
.next h2 { margin: .1rem 0 .3rem; font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); }
.next h2 .mono { font-size: .6em; font-weight: 500; color: var(--muted); letter-spacing: 0; vertical-align: .15em; margin-right: .3rem; }
.next p { margin: 0; max-width: 60ch; }
.next-label { font-weight: 600; font-size: .95rem; color: var(--sun); }
.next-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.next .btn.primary { background: var(--sun); border-color: var(--sun); color: #1d1a00; }
.next .btn.primary:hover { filter: brightness(1.08); }
.next.done::after { background: var(--ok); }
.next.done .next-label { color: var(--ok); }

.path { list-style: none; margin: 0; padding: 0; }
.week { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); gap: 0 1.25rem; position: relative; padding-bottom: 1.25rem; }
.week::before { content: ""; position: absolute; left: calc(1.375rem - 1px); top: 2.75rem; bottom: 0; width: 2px; background: var(--line); }
.week:last-child::before { display: none; }
.week.complete::before { background: var(--ok); }
.node { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); font: 700 1.1rem/1 var(--display); color: var(--ink); z-index: 1; }
.week.current .node { border-color: var(--ink); background: var(--sun); color: #1d1a00; }
.week.complete .node { border-color: var(--ok); background: var(--ok); color: var(--surface); }
.week.locked .node { border-style: dashed; background: var(--bg); color: var(--muted); }
.week-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; min-width: 0; }
.week.current .week-body { border-color: var(--ink); }
.week.locked .week-body { background: none; border-style: dashed; }
.week.locked h3 { color: var(--muted); }
.week-head { display: flex; gap: 1rem 2rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.week-title { flex: 1 1 24rem; min-width: 0; }
.week-title h3 { font-size: 1.35rem; margin: .15rem 0 .25rem; letter-spacing: -.02em; }
.week-title h3 a { color: var(--ink); text-decoration: none; }
.week-title h3 a:hover { text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 3px; text-underline-offset: .2em; }
.week-title p { margin: 0; max-width: 62ch; }
.week-no { font: 500 .85rem var(--mono); color: var(--muted); display: flex; align-items: center; gap: .6rem; }
.week-note { margin: 1rem 0 0; }
.week-tasks { margin-top: 1.1rem; border-top: 1px solid var(--line); }
.week-tasks summary { display: flex; align-items: center; gap: .9rem; padding: .8rem 0 .3rem; cursor: pointer; list-style: none; color: var(--muted); font-size: .9rem; font-weight: 500; }
.week-tasks summary::-webkit-details-marker { display: none; }
.seg-label { white-space: nowrap; }
.week-tasks summary::after { content: "Show tasks"; margin-left: auto; font-weight: 600; color: var(--accent); }
.week-tasks[open] summary::after { content: "Hide"; }
.week-tasks summary:hover::after { text-decoration: underline; }

/* login, password, errors */
.auth { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: 3rem; align-items: center; max-width: 60rem; margin: 6vh auto 0; }
.auth.single { grid-template-columns: minmax(0, 28rem); justify-content: center; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.25rem; }
.auth-card h1 { font-size: 2rem; margin-bottom: .4rem; }
.auth-card form { margin: 1.25rem 0 1rem; }
.auth-art pre { font-size: clamp(.85rem, .6rem + .9vw, 1.1rem); padding: 1.6rem 1.8rem; margin: 0; border-radius: var(--radius); }
.auth-art p { font: 600 1.25rem/1.3 var(--display); letter-spacing: -.01em; color: var(--muted); margin: 1.25rem 0 0; max-width: 24ch; }

/* lesson */
.lesson-grid { display: grid; grid-template-columns: 13rem minmax(0, 1fr) 19rem; gap: 2.5rem; align-items: start; }
.lesson-grid:has(> .toc[hidden]) { grid-template-columns: minmax(0, 1fr) 19rem; }
.lesson { min-width: 0; }
.lesson.solo { max-width: 68ch; margin: 0 auto; }
.lesson-head h1 { margin-bottom: .6rem; }
.lesson-head .row { margin-top: 1.25rem; }
.theme { font-size: 1.2rem; line-height: 1.45; color: var(--muted); margin: 0; max-width: 56ch; }
.objectives-box { border-block: 1px solid var(--line); padding: 1.25rem 0; margin: 2rem 0 2.5rem; max-width: 68ch; }
.objectives-box h2 { font: 600 .95rem var(--sans); letter-spacing: 0; color: var(--muted); margin: 0 0 .6rem; }
.objectives-box ol { margin: 0; padding-left: 1.4rem; }
.objectives-box li { margin: .3rem 0; }
.objectives-box li::marker { font: 600 .85em var(--mono); color: var(--accent); }
.toc, .side { position: sticky; top: calc(var(--head-h) + 1.5rem); max-height: calc(100vh - var(--head-h) - 3rem); overflow-y: auto; }
.toc summary { font-weight: 650; font-size: .9rem; color: var(--ink); list-style: none; cursor: default; margin-bottom: .6rem; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: .35rem 0 .35rem .9rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: .9rem; line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current] { color: var(--ink); font-weight: 600; border-left-color: var(--brand); }
.side .panel { padding: 1.15rem 1.3rem; }
.side h2 { font-size: 1.1rem; margin-bottom: .4rem; }
.side ul.tasks a { flex-wrap: wrap; gap: 0 .5rem; padding: .55rem 0; font-size: .95rem; }
.side .tier { font-size: 0; gap: 0; } /* the shape alone: the full word is on the dashboard and the task page */
.side .tier::before { font-size: .7rem; }
.side .tier.boss::before { font-size: .85rem; }

/* task */
.task-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.25rem; align-items: start; }
.task-meta { display: flex; align-items: center; gap: .9rem; margin: 0 0 .5rem; }
.task-meta .status { min-width: 0; }
.statement h1 { font-size: clamp(1.5rem, 1.3rem + .8vw, 1.9rem); margin-bottom: 1rem; }
.statement .theory { font-size: 1rem; line-height: 1.6; }
.statement .theory h2 { font-size: 1.25rem; margin-top: 2rem; }
.statement .theory h2::before { display: none; }
.test-spec { margin: .6rem 0 1rem; }
.test-spec pre { margin: .2rem 0 .5rem; }
.editor-pane { position: sticky; top: calc(var(--head-h) + 1rem); }
.toolbar { display: flex; align-items: center; gap: .5rem .75rem; flex-wrap: wrap; margin-bottom: .9rem; }
.toolbar-main { display: flex; gap: .5rem; flex-wrap: wrap; margin-right: auto; }
.save-state { font: 500 .8rem var(--mono); color: var(--muted); }
.editor { color-scheme: dark; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius-s); overflow: hidden; }
.editor:focus-within { outline: 3px solid var(--brand); outline-offset: 1px; }
.editor-bar { display: flex; align-items: center; gap: .5rem; padding: .45rem .9rem; border-bottom: 1px solid var(--code-line); font: 500 .78rem var(--mono); color: var(--code-muted); }
.editor-bar .dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--brand); }
textarea.code { color-scheme: dark; display: block; width: 100%; min-height: 360px; margin: 0; background: var(--code-bg); color: var(--code-ink); caret-color: var(--sun); border: 1px solid var(--code-line); border-radius: var(--radius-s); padding: .9rem 1.1rem; font-size: .92rem; line-height: 1.6; tab-size: 4; white-space: pre; overflow: auto; }
textarea.code:hover { border-color: var(--code-muted); }
.editor textarea.code { border: 0; border-radius: 0; }
.editor textarea.code:focus-visible { outline: none; }
textarea.code.small { min-height: 60px; }
textarea.code::placeholder { color: var(--code-muted); opacity: 1; }
.two-col textarea.code { min-height: 200px; }
details summary { cursor: pointer; color: var(--muted); font-size: .92rem; font-weight: 550; padding: .3rem 0; }
details summary:hover { color: var(--ink); }
details.stdin { margin: .7rem 0; }
details.stdin textarea { margin-top: .4rem; }
.output { margin-top: .9rem; }
.output pre { margin: .4rem 0; white-space: pre-wrap; word-break: break-word; }
.verdict { font-weight: 650; padding: .7rem 1rem; border-radius: var(--radius-s); margin: .4rem 0; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.next-task { margin: .4rem 0 .6rem; }
.test { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .7rem 1rem; margin: .5rem 0; }
.test.ok > strong { color: var(--ok); }
.test.bad { border-color: color-mix(in oklch, var(--bad) 45%, var(--surface)); }
.test.bad > strong { color: var(--bad); }
.test .msg { white-space: pre-wrap; margin: .3rem 0; }
.test .cols { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.hints { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: .4rem; }
.hint { background: var(--warn-soft); border-radius: var(--radius-s); padding: .7rem 1rem; margin: .6rem 0; }
.hint > strong { display: block; font-size: .85rem; color: var(--warn); }
.hint p { margin: .3rem 0; }
.hint pre { margin: .5rem 0 .2rem; }

/* teacher tables */
.grid { font-size: .92rem; border-collapse: separate; border-spacing: 0; }
.grid th, .grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.grid tr > :last-child { border-right: 0; }
.grid tbody th { vertical-align: middle; font-size: .95rem; font-weight: 550; color: var(--ink); white-space: nowrap; }
.grid thead th { background: var(--tint); white-space: nowrap; vertical-align: bottom; }
.grid thead a { text-decoration: none; font-weight: 650; }
.grid thead a:hover { text-decoration: underline; }
.grid tr > :first-child { position: sticky; left: 0; z-index: 1; min-width: 12rem; box-shadow: 1px 0 0 var(--line-strong); }
.grid tbody tr:hover > * { background: var(--tint); }
.matrix-wrap, .scroll:has(.matrix) { max-height: calc(100vh - var(--head-h) - 2rem); }
.matrix thead tr:first-child th { position: sticky; top: 0; z-index: 2; height: 2.4rem; padding-block: 0; vertical-align: middle; }
.matrix thead tr:nth-child(2) th { position: sticky; top: 2.4rem; z-index: 2; left: auto; min-width: 0; box-shadow: none; text-align: center; font-family: var(--mono); font-size: .8rem; }
.matrix thead th.corner { z-index: 3; left: 0; vertical-align: bottom; padding-bottom: .55rem; }
.matrix thead th.stretch a { color: var(--stretch); } .matrix thead th.boss a { color: var(--boss); }
.matrix td.cell { width: 2.9rem; min-width: 2.9rem; text-align: center; vertical-align: middle; font-weight: 700; color: var(--line-strong); }
.grid td.ok, .grid tbody tr:hover td.ok, span.cell.ok { background: var(--ok-soft); color: var(--ok); }
.grid td.tried, span.cell.tried { color: var(--muted); font-weight: 500; font-family: var(--mono); font-size: .85rem; }
.grid td.stuck, .grid tbody tr:hover td.stuck, span.cell.stuck { background: var(--bad); color: var(--surface); }
.matrix td.num { font-weight: 650; vertical-align: middle; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; list-style: none; margin: 0 0 .9rem; padding: 0; font-size: .9rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: .5rem; }
span.cell { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: var(--radius-xs); border: 1px solid var(--line); font-weight: 700; color: var(--line-strong); background: var(--surface); }
.stuck-list { display: flex; flex-wrap: wrap; gap: .4rem .6rem; list-style: none; margin: .5rem 0; padding: 0; }
.stuck-list li { background: var(--surface); border: 1px solid color-mix(in oklch, var(--bad) 35%, var(--surface)); border-radius: 999px; padding: .25rem .8rem; font-size: .95rem; }
.stuck-list a { font: 600 .85rem var(--mono); margin-left: .3rem; }
.refresh-note { margin: 0; }
/* live class and game progress (teacher) */
.live-count { margin: 0 0 1rem; }
.live-table td, .live-table th { vertical-align: middle; }
.live-table tr.live-stuck th[scope=row] { box-shadow: inset 4px 0 0 var(--bad); }
.live-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .35rem; }
#live.stale { opacity: .55; }
.gp-matrix td.cell a { display: block; color: inherit; text-decoration: none; font-family: var(--mono); font-size: .85rem; }
.gp-matrix td.cell a:hover { text-decoration: underline; }
.gp-stars { display: block; font: 600 .68rem/1 var(--sans); color: var(--sun-ink); }
.gp-hint { margin-left: .15em; font: 600 .68rem/1 var(--sans); color: var(--muted); }
.ws-hint-cost { font-weight: 600; color: var(--sun-ink); }
.gp-matrix tfoot th, .gp-matrix tfoot td { color: var(--muted); font-weight: 500; }
.gp-code { margin: .6rem 0; padding: .8rem 1rem; max-height: 28rem; overflow: auto; background: var(--tint); border-radius: var(--radius-s); font: .9rem/1.5 var(--mono); tab-size: 4; }

.modules th .th-sub { display: block; font-weight: 400; font-size: .82rem; white-space: normal; min-width: 13rem; }
.modules thead th a { font-size: 1rem; }
.modules .class-row > * { background: var(--tint); border-bottom: 2px solid var(--line-strong); vertical-align: top; }
.modules .class-row th { color: var(--ink); font-size: .95rem; font-weight: 650; vertical-align: middle; }
.modules .state { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .4rem; font-weight: 650; margin-bottom: .5rem; }
.modules td.open .state { color: var(--ok); }
.modules .state .muted { font-weight: 400; flex-basis: 100%; }
.modules td { vertical-align: middle; }
.access { display: flex; align-items: center; gap: .5rem; }
.access-icon { color: var(--muted); display: inline-flex; }
td.open .access-icon { color: var(--ok); }
.modules select { font-size: .88rem; max-width: 100%; border-color: var(--line); background: transparent; }
.modules td.override select { border-color: var(--ink); font-weight: 600; background: var(--surface); }

.roster td, .creds td { vertical-align: middle; }
.creds code { font-size: .95rem; }
.callout.warn table th, .callout.warn table td { border-color: color-mix(in oklch, var(--warn) 25%, var(--surface)); }

.question { margin: 0 0 1.75rem; padding: 0 0 0 1.25rem; border-left: 4px solid var(--brand); font: 600 1.3rem/1.35 var(--display); letter-spacing: -.01em; max-width: 50ch; }
.count-note { margin: 0; color: var(--muted); }
.count-note strong { font: 700 1.6rem/1 var(--display); color: var(--ink); }
.tickets { list-style: none; margin: 0; padding: 0; columns: 22rem; column-gap: 1.25rem; }
.tickets li { break-inside: avoid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 0 0 1.25rem; }
.ticket-text { margin: 0 0 .6rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-who { margin: 0; font-size: .85rem; font-weight: 600; color: var(--muted); }

/* ---- 7 · Walking Square game ---- */
.game-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; align-items: start; }
.game-grid h1 { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); margin-bottom: .8rem; }
.game-grid .theory { font-size: 1rem; line-height: 1.6; }
.ws-levels { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.25rem 0; }
.ws-level { min-width: 2.75rem; min-height: 2.75rem; padding: .3rem .6rem; font: 700 1rem var(--display); border-radius: 999px; }
.ws-level.solved { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); border-radius: 999px; }
.ws-level.active { border-color: var(--ink); background: var(--sun); color: #1d1a00; }
.ws-maps { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .4rem 0; }
.ws-map.active { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--brand); }
.ws-map.good { color: var(--ok); }
.ws-map.bad { color: var(--bad); }
.ws-stage { margin: .9rem 0 .6rem; line-height: 0; }
.ws-stage canvas { border-radius: var(--radius-s); border: 1px solid var(--line); max-width: 100%; }
.ws-legend { display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; }
.ws-key { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; margin-left: .6rem; }
.ws-key.square { background: var(--ws-square); margin-left: 0; }
.ws-key.target { border: 3px solid var(--ok); border-radius: 50%; }
.ws-key.wall { background: var(--ws-wall); }
.ws-key.star { width: auto; height: auto; color: var(--sun); -webkit-text-stroke: 1px var(--ws-wall); line-height: 1; }
.ws-key.sign { background: var(--sun); border: 1px solid var(--sun-ink); }
.ws-key.door { background: var(--boss); }
.ws-vars { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin: .2rem 0 .6rem; font: .85rem var(--mono); }
.ws-vars-label { font: 600 .8rem var(--sans); color: var(--muted); margin-right: .2rem; }
.ws-var { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); overflow: hidden; }
.ws-var-name { padding: .15rem .5rem; background: var(--tint); }
.ws-var-value { padding: .15rem .6rem; font-weight: 700; background: var(--sun); color: var(--sun-ink); min-width: 2rem; text-align: center; }
.ws-stars { font-size: .8em; letter-spacing: -.05em; }
.ws-legend-item { white-space: nowrap; }
.ws-score { margin-left: auto; align-self: center; font-weight: 650; white-space: nowrap; }
.ws-speed { display: flex; align-items: center; gap: .4rem; margin: 0; font-weight: 500; color: var(--muted); }
.ws-editor { display: flex; }
.ws-editor textarea.code { flex: 1; min-width: 0; min-height: 300px; padding-left: .6rem; tab-size: 2; }
.ws-gutter { flex: none; min-width: 2.6rem; padding: .9rem 0; overflow: hidden; text-align: right; color: var(--code-muted); user-select: none; font: .92rem/1.6 var(--mono); }
.ws-gutter div { padding: 0 .5rem; }
.ws-gutter .active { background: var(--sun); color: #1d1a00; font-weight: 700; }
.ws-gutter .error { background: #d92d20; color: #fff; font-weight: 700; }
.ws-save-state { margin-left: auto; }
.ws-timer { font: 600 .95rem var(--mono); padding: .3rem .75rem; border-radius: 999px; background: var(--tint); color: var(--ink); white-space: nowrap; }
.ws-timer.soon { color: var(--bad); background: var(--bad-soft); }
.ws-timer.over { color: var(--muted); }
.test-start { max-width: 46rem; margin: 0 auto; }
.test-facts { list-style: none; margin: 1.25rem 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.test-facts li { display: flex; gap: .6rem; align-items: flex-start; }
.test-facts .i { width: 1.2rem; height: 1.2rem; flex: none; margin-top: .15rem; }
.test-start-form { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: 1.5rem; }
.gp-time { white-space: nowrap; }
.gp-time .inline { margin-left: .4rem; }
.ce-minutes { margin-left: .6rem; display: inline-flex; gap: .4rem; align-items: center; }
.ce-minutes input { width: 4.5rem; }
#ws-count { margin: .5rem 0; min-height: 1.3em; font-family: var(--mono); font-size: .8rem; }
#ws-message .btn { margin-bottom: .6rem; }
.ws-help, .ws-solution { margin-top: .9rem; }
.ws-help pre, .ws-solution pre { font-size: .8rem; margin: .5rem 0; }

/* ---- 7b · Be the Computer (review game) and its results page ---- */
.rv-score { margin: 0; font: 700 1.6rem/1 var(--display); white-space: nowrap; }
.rv-score .muted { font-size: 1rem; font-weight: 500; }
.rv-star { color: var(--sun); -webkit-text-stroke: 1px var(--sun-ink); }
.rv-streak { margin-left: .6rem; font: 600 .78rem/1.2 var(--sans); padding: .25rem .6rem; border-radius: 999px; background: var(--sun); color: var(--sun-ink); vertical-align: .3em; }
.rv-intro { padding-block: 1rem; }
.rv-intro summary { font-weight: 650; cursor: pointer; }
.rv-rounds { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin-bottom: 1.25rem; }
.rv-round-title { margin: 0 0 .35rem; font-weight: 600; font-size: .85rem; color: var(--muted); }
.rv-round .ws-levels { margin: 0; }
.rv-q.failed { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.rv-q.locked { border-style: dashed; color: var(--line-strong); background: none; cursor: not-allowed; opacity: 1; }
.rv-q.active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.rv-prompt { font-size: 1.15rem; font-weight: 550; }
.rv-prompt code { font-weight: 500; }
.rv-code pre { font-size: 1rem; margin-bottom: 0; }
.rv-lines { color-scheme: dark; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius-s); padding: .5rem 0; overflow-x: auto; }
.rv-line { display: flex; justify-content: flex-start; width: 100%; min-height: 2rem; align-items: center; gap: .9rem; padding: 0 1rem 0 0; border: 0; border-radius: 0; background: none; color: var(--code-ink); font: 1rem/1.6 var(--mono); text-align: left; cursor: pointer; }
.rv-line code { background: none; padding: 0; font-size: inherit; white-space: pre; color: inherit; }
.rv-line-no { flex: none; width: 2.6rem; text-align: right; color: var(--code-muted); user-select: none; }
.rv-line:hover:not(:disabled) { background: var(--code-line); }
.rv-line[aria-checked="true"] { background: var(--sun); color: #1d1a00; }
.rv-line[aria-checked="true"] span { color: inherit; }
.rv-line.right { box-shadow: inset 4px 0 0 var(--tok-f); }
.rv-line:disabled { cursor: default; opacity: 1; }
.rv-tries { min-height: 1.5em; color: var(--muted); font-size: .9rem; }
.rv-terminal textarea.code { width: 100%; display: block; min-height: 0; resize: vertical; font-size: 1rem; }
.rv-options { display: grid; gap: .5rem; }
.rv-option { justify-content: flex-start; text-align: left; gap: .8rem; min-height: 2.75rem; white-space: normal; font-family: var(--mono); font-size: .95rem; font-weight: 500; }
.rv-option-key { flex: none; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); font: 700 .8rem var(--sans); }
.rv-option[aria-checked="true"] { border-color: var(--ink); background: var(--sun); color: #1d1a00; }
.rv-option.right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.rv-option:disabled { opacity: 1; cursor: default; }
.rv-option.wrong, .rv-line.wrong { text-decoration: line-through; opacity: .55; }
.rv-line-pick { font-weight: 600; }
#rv-form .row { margin-top: 1rem; }
.rv-feedback { margin-top: 1rem; }
.rv-result { border: 1px solid var(--line); border-left-width: 5px; border-radius: var(--radius-s); padding: .8rem 1.1rem; margin: 0; }
.rv-result.good { border-color: var(--ok); background: var(--ok-soft); }
.rv-result.bad { border-color: var(--bad); background: var(--bad-soft); }
.rv-result > :first-child { margin-top: 0; } .rv-result > :last-child, .rv-result .theory > :last-child { margin-bottom: 0; }
.rv-verdict { font-weight: 700; }
.rv-result.good .rv-verdict { color: var(--ok); } .rv-result.bad .rv-verdict { color: var(--bad); }
.rv-solution { font-size: .95rem; margin: .4rem 0 .6rem; padding: .6rem .9rem; }
.rv-summary:focus { outline: none; }
.rv-summary-list { padding-left: 1.2rem; }
.rv-summary-list.ok li::marker { content: "✓  "; color: var(--ok); }
.rv-summary-list.warn li::marker { content: "↻  "; color: var(--warn); }
.chip.bad { color: var(--bad); background: var(--bad-soft); }
.rv-concepts { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .45rem; }
.rv-concepts li { display: grid; grid-template-columns: minmax(12rem, 2fr) minmax(6rem, 3fr) 6.5rem 5rem; gap: 1rem; align-items: center; }
.rv-concepts progress { width: 100%; height: .6rem; appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: var(--line); accent-color: var(--ok); }
.rv-concepts progress::-webkit-progress-bar { background: var(--line); }
.rv-concepts progress::-webkit-progress-value { background: var(--ok); }
.rv-concepts progress::-moz-progress-bar { background: var(--ok); }
.rv-concepts .weak progress::-webkit-progress-value { background: var(--bad); } .rv-concepts .weak progress::-moz-progress-bar { background: var(--bad); }
.rv-concepts .mid progress::-webkit-progress-value { background: var(--warn); } .rv-concepts .mid progress::-moz-progress-bar { background: var(--warn); }
.rv-concept-num { font-weight: 650; white-space: nowrap; text-align: right; }
.rv-matrix thead tr:nth-child(2) th a { display: block; }
.rv-questions td.num, .rv-questions th.num { white-space: nowrap; text-align: right; }
.rv-answer { white-space: pre-wrap; display: inline-block; vertical-align: top; }
@media (max-width: 700px) { .rv-concepts li { grid-template-columns: 1fr auto; } .rv-concepts progress { grid-column: 1 / -1; grid-row: 2; } .rv-concepts .chip { display: none; } }

/* ---- 7c · playground ---- */
.pg-note { max-width: 46ch; margin: 0; }
.pg-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.pg-grid .card h2 { font-size: 1.15rem; }
.pg-grid .output { margin-top: 0; }
.pg-loaded { padding-block: .7rem; }
.pg-runs { list-style: none; margin: 0 0 .6rem; padding: 0; max-height: 22rem; overflow: auto; }
.pg-runs li { border-bottom: 1px solid var(--line); }
.pg-runs a { display: flex; align-items: baseline; gap: .6rem; padding: .45rem .2rem; text-decoration: none; color: var(--ink); min-width: 0; }
.pg-runs a:hover { background: var(--tint); }
.pg-runs code, .pg-entry summary code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pg-when { flex: none; font: 500 .8rem var(--mono); color: var(--muted); }
.pg-verdict { flex: none; font: 600 .75rem/1.2 var(--sans); padding: .15rem .5rem; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.pg-verdict.compile_error, .pg-verdict.runtime_error { background: var(--bad-soft); color: var(--bad); }
.pg-verdict.timeout { background: var(--warn-soft); color: var(--warn); }
.pg-entry { padding: .7rem 1.2rem; margin-bottom: .5rem; }
.pg-entry summary { display: flex; align-items: baseline; gap: .7rem; cursor: pointer; min-width: 0; }
.pg-entry pre { font-size: .85rem; max-height: 24rem; }

/* ---- 7d · content editor (admin) ---- */
.ce-block { margin-bottom: 2.25rem; }
.ce-block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; padding-bottom: .6rem; margin-bottom: 1rem; border-bottom: 2px solid var(--brand); }
.ce-block-head h2 { margin: 0; }
.ce-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1rem; align-items: start; }
.ce-group { padding: 1.1rem 1.3rem; margin: 0; }
.ce-group h3 { margin: 0 0 .4rem; }
.ce-group h3 a { font-family: var(--mono); font-size: .95rem; }
.ce-new { border-style: dashed; }
.ce-note { font: 500 .9rem var(--sans); letter-spacing: 0; }
.ce-files { list-style: none; margin: 0; padding: 0; }
.ce-files li { display: flex; align-items: center; gap: .4rem; }
.ce-files li + li { border-top: 1px solid var(--line); }
.ce-files a { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .7rem; padding: .4rem .2rem; text-decoration: none; }
.ce-files a:hover { background: var(--tint); }
.ce-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.ce-card-foot { margin-top: .6rem; text-align: right; }
.ce-form { display: grid; gap: .6rem; }
.ce-form label { display: grid; gap: .2rem; font-weight: 600; font-size: .9rem; }
.ce-form button { justify-self: start; }
.ce-title { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.9rem); overflow-wrap: anywhere; }
.ce-title code { background: none; padding: 0; }
.ce-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.25rem; align-items: start; }
.ce-grid.with-preview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
textarea.ce-text { min-height: 70vh; resize: vertical; }
textarea.ce-text.prose { white-space: pre-wrap; }
.ce-preview { max-height: 70vh; overflow: auto; font-size: 1rem; }
.ce-problem { white-space: pre-wrap; overflow-wrap: anywhere; }
.ce-grid .card h2 { font-size: 1.15rem; }
@media (max-width: 900px) { .ce-grid, .ce-grid.with-preview { grid-template-columns: minmax(0, 1fr); } }

/* ---- 8 · projector mode: light by default (lit classrooms wash out dark slides), T switches; sized in vw ---- */
body.bare { display: block; }
main.present { min-height: 100vh; padding: 0 0 3.2rem; }
.deck .slide { display: none; min-height: calc(100vh - 3.2rem); padding: 3rem 6vw; font-size: clamp(1.4rem, 2.4vw, 2.2rem); line-height: 1.45; }
.deck .slide.active, .deck.all .slide { display: block; }
.deck .slide.active { animation: slide-in .25s var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } }
.deck.all .slide { min-height: 0; border-bottom: 1px solid var(--line); animation: none; }
.slide.title-slide { display: none; align-content: center; }
.slide.title-slide.active { display: grid; }
.slide h1 { font-size: clamp(2.4rem, 5.4vw, 4.6rem); line-height: 1.04; letter-spacing: -.035em; margin: .2em 0 .3em; max-width: 18ch; }
.slide h2 { font-size: clamp(1.9rem, 3.8vw, 3.1rem); letter-spacing: -.025em; margin: 0 0 .7em; }
.slide h2::after { content: ""; display: block; width: 1.6em; height: .14em; border-radius: 99px; background: var(--brand); margin-top: .35em; }
.slide .kicker { font: 500 .7em var(--mono); color: var(--muted); margin: 0; }
.slide .theme { font-size: 1.1em; max-width: 40ch; }
.slide .objectives { color: var(--muted); font-size: .85em; }
.slide .objectives li::marker { color: var(--accent); font-weight: 700; }
.slide-body { max-width: 62ch; }
.slide-body:has(pre, table) { max-width: none; }
.slide pre { font-size: clamp(1rem, 1.75vw, 1.65rem); line-height: 1.45; padding: .8em 1em; border-radius: 12px; }
.slide code { font-size: .88em; }
.slide strong { background: linear-gradient(transparent 62%, color-mix(in oklch, var(--sun) 55%, transparent) 62%); }
.slide table { font-size: .85em; }
.slide th { font-size: .75em; border-bottom: 2px solid var(--ink); color: var(--ink); }
.slide th, .slide td { padding: .4em .6em; }
.slide blockquote { background: var(--accent-soft); padding: .5em 1em; margin: .6em 0; border-radius: 12px; }
.slide a.btn.primary { font-size: .8em; color: var(--accent-ink); }
.slide li { margin: .25em 0; }
.slide li::marker { color: var(--accent); }
.slide p:has(> a.btn) { margin: 0 0 .8em; }
.deck-progress { position: fixed; left: 0; right: 0; bottom: 3.2rem; height: 4px; background: var(--line); }
.deck-progress span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s var(--ease); }
.deck-bar { position: fixed; left: 0; right: 0; bottom: 0; height: 3.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1.2rem; background: var(--surface); color: var(--muted); font-size: .9rem; }
.deck-bar a { color: var(--muted); text-decoration: none; font-weight: 600; }
.deck-bar a:hover { color: var(--ink); }
.deck-pos { font-family: var(--mono); }

/* ---- 9 · responsive, motion, print ---- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(*) { animation-duration: .18s; }
}
@media (max-width: 1100px) {
  .lesson-grid, .lesson-grid:has(> .toc[hidden]) { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .toc, .side { position: static; max-height: none; }
  .toc { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .7rem 1rem; background: var(--surface); }
  .toc summary { cursor: pointer; margin: 0; }
  .toc summary::after { content: " ▾"; color: var(--muted); }
  .toc details[open] summary { margin-bottom: .6rem; }
  .side { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); gap: 1.25rem; align-items: start; border-top: 1px solid var(--line); padding-top: 1.5rem; }
  .side .panel { margin: 0; }
}
@media (max-width: 900px) {
  .task-grid, .two-col, .game-grid, .auth { grid-template-columns: minmax(0, 1fr); }
  .auth { gap: 1.5rem; margin-top: 1rem; }
  .auth-art { order: 2; }
  .editor-pane { position: static; }
  .card { padding: 1.15rem 1.2rem; }
  main.wrap { padding-top: 1.5rem; }
}
@media (max-width: 640px) {
  .top-in { flex-wrap: wrap; gap: 0 1rem; }
  .brand { min-height: var(--head-h); }
  .main-nav { order: 3; flex-basis: 100%; overflow-x: auto; margin: 0 -1.25rem; padding: 0 .5rem; border-top: 1px solid var(--line); }
  .main-nav a { min-height: 2.75rem; white-space: nowrap; }
  .who, .menu .role { display: none; }
  .menu summary { padding: .25rem; border: 0; }
  .menu summary::after { display: none; }
  html { scroll-padding-top: 7.5rem; }
  .week { grid-template-columns: 2rem minmax(0, 1fr); gap: 0 .75rem; }
  .week::before { left: calc(1rem - 1px); top: 2rem; }
  .node { width: 2rem; height: 2rem; font-size: .9rem; }
  .node .i { width: 1rem; height: 1rem; }
  .week-body { padding: 1rem 1.1rem; }
  .week-head .actions { width: 100%; }
  .next { padding: 1.4rem 1.25rem 1.4rem 1.6rem; }
  .next-actions, .next-actions .btn.primary { width: 100%; }
  ul.tasks li { flex-wrap: wrap; gap: 0 .7rem; padding-bottom: .5rem; }
  ul.tasks a { flex-basis: 100%; padding-bottom: .15rem; }
  .status { min-width: 0; margin-left: auto; }
  .seg li { width: .8rem; }
  .auth-card { padding: 1.5rem 1.25rem; }
  .grid tr > :first-child { min-width: 8.5rem; white-space: normal; }
  .grid tbody th .muted { display: none; }
  .test .cols { grid-template-columns: 1fr; }
  .deck-help { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .seg li.done, .node, .chip { forced-color-adjust: none; }
}
@media print {
  header.top, .foot, .side, .toc, .crumbs, .lesson-head .row, .skip, .pager, .copy, [data-print], form { display: none !important; }
  :root { color-scheme: light; }
  body { background: #fff; font-size: 11pt; }
  .lesson-grid, .two-col { display: block; }
  .card, .callout { border: 0; padding: 0; background: none; }
  pre { color-scheme: light; border: 1px solid #999; background: #fff; color: #000; white-space: pre-wrap; }
  pre span { color: #000 !important; }
  .creds td, .creds th { padding: .5rem 1rem; border: 1px solid #999; }
}

/* ---- tests: a Walking Square game the teacher opens on its own ---- */
.btn.test { border-color: var(--accent); }
.btn.locked { border-style: dashed; color: var(--muted); background: none; cursor: default; }
.btn.locked:hover { border-color: var(--line-strong); background: none; color: var(--muted); }
.btn.locked:active { scale: 1; }
.test-panel { border-color: var(--accent); }
.lessons { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.25rem; }
.lessons a { padding: .3rem .8rem; border: 1px solid var(--line-strong); border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; }
.lessons a[aria-current] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.modules th.test-col a { color: var(--accent); }
