/* M8Thor landing page: a phosphor tube (CRT) or a reflective LCD.
   Surfaces mirror M8Thor/Theme/M8Theme.swift (dark palette = CRT,
   light palette = LCD); the accent is one of the app's five accents. */
:root {
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --strip: 56px;
  --gutter: max(24px, 5vw);
  --r-sm: 4px;
  --r-md: 6px;
  /* Amber is the default, on the website and in the app. */
  --accent: #ffb23a;
  --lcd-ph: 40%;
}

/* M8Theme.Accent. --lcd-ph: how much accent the LCD text colour keeps; the
   light accents need less to reach 4.5:1 on the LCD glass. */
:root[data-accent="pink"] { --accent: #ff3a82; --lcd-ph: 55%; }
:root[data-accent="lime"] { --accent: #b8ff3a; --lcd-ph: 35%; }
:root[data-accent="cyan"] { --accent: #3ae6ff; --lcd-ph: 35%; }
:root[data-accent="violet"] { --accent: #a855f7; --lcd-ph: 55%; }

/* CRT: M8Theme.Palette.dark */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --void: #060708;
  --bg0: #0e0f14;
  --bg1: #14161d;
  --bg2: #1b1e28;
  --bg3: #252935;
  --lcd: #0b0d11;
  --ink0: #e8ecf2;
  --ink1: #a8b0bf;
  --ink2: #6b7385;
  --ink3: #3e4350;
  --grid-line: #1e2029;
  --border0: #232733;
  --border1: #1a1d26;
  --lcd-dim: #2a3040;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --accent-ink: #14060c;
  --sd-pin: #0b0d11;
  /* tube */
  --glass: #070908;
  --ph: var(--accent);
  --ph-hi: color-mix(in srgb, var(--accent) 45%, #fff);
  --ph-mid: color-mix(in srgb, var(--accent) 70%, #9aa3a0);
  --ph-dim: color-mix(in srgb, var(--accent) 38%, #1a1d1c);
  --glow: 0 0 2px color-mix(in srgb, var(--accent) 80%, transparent), 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 40%, transparent);
  --bezel: linear-gradient(180deg, #1c1e22, #0d0e11 60%, #16181c);
  --scan: .22;
  --focus: var(--accent);
}

/* LCD: M8Theme.Palette.light */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --void: #d9d4c8;
    --bg0: #faf8f4;
    --bg1: #f2efe8;
    --bg2: #ebe7de;
    --bg3: #e0dccf;
    --lcd: #ede9de;
    --ink0: #14120e;
    --ink1: #4a4739;
    --ink2: #76725f;
    --ink3: #a8a493;
    --grid-line: #dcd7c9;
    --border0: #c8c3b3;
    --border1: #dcd7c9;
    --lcd-dim: #b8b3a0;
    --ok: #15803d;
    --warn: #b45309;
    --err: #b91c1c;
    --accent-ink: #14060c;
    --sd-pin: #faf8f4;
    --glass: #dcd8c8;
    --ph: color-mix(in srgb, var(--accent) var(--lcd-ph), #14120e);
    --ph-hi: #14120e;
    --ph-mid: #4a4739;
    --ph-dim: #9c9886;
    --glow: none;
    --accent-glow: color-mix(in srgb, var(--accent) 25%, transparent);
    --bezel: linear-gradient(180deg, #ecE8dd, #cfcabc 60%, #e2ddd1);
    --scan: 0;
    --focus: var(--ph-hi);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --void: #d9d4c8;
  --bg0: #faf8f4;
  --bg1: #f2efe8;
  --bg2: #ebe7de;
  --bg3: #e0dccf;
  --lcd: #ede9de;
  --ink0: #14120e;
  --ink1: #4a4739;
  --ink2: #76725f;
  --ink3: #a8a493;
  --grid-line: #dcd7c9;
  --border0: #c8c3b3;
  --border1: #dcd7c9;
  --lcd-dim: #b8b3a0;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --accent-ink: #14060c;
  --sd-pin: #faf8f4;
  --glass: #dcd8c8;
  --ph: color-mix(in srgb, var(--accent) var(--lcd-ph), #14120e);
  --ph-hi: #14120e;
  --ph-mid: #4a4739;
  --ph-dim: #9c9886;
  --glow: none;
  --accent-glow: color-mix(in srgb, var(--accent) 25%, transparent);
  --bezel: linear-gradient(180deg, #ece8dd, #cfcabc 60%, #e2ddd1);
  --scan: 0;
  --focus: var(--ph-hi);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-bottom: calc(var(--strip) + 8px); }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  padding-bottom: var(--strip);
  background: var(--void);
  color: var(--ink0);
  font: 14px/1.5 var(--mono);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
p, h1, h2, h3, ol, ul, dl, dd { margin: 0; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: -80px;
  left: 16px;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 800 12px/1 var(--mono);
  text-transform: uppercase;
}

.skip-link:focus { top: 16px; }

/* Visually hidden, still read by screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ───────────── Device strip (bottom) ───────────── */

.strip {
  position: fixed;
  z-index: 20;
  inset: auto 0 0;
  height: var(--strip);
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bezel);
  border-top: 1px solid var(--border0);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .35);
}

.led {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink3);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
  transition: background-color .15s ease-out, box-shadow .15s ease-out;
}

.brand {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 800 12px/1 var(--mono);
  letter-spacing: .22em;
  text-decoration: none;
  white-space: nowrap;
}

.brand .led { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.brand-mark { width: 16px; height: 16px; fill: var(--accent); }
.brand em { color: var(--ink1); font-size: 9px; font-style: normal; letter-spacing: .18em; }

.keys { flex: 1; display: flex; justify-content: center; gap: 6px; }
.knobs { display: flex; align-items: center; gap: 10px; }

.key {
  position: relative;
  min-height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border0);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, var(--bg3), var(--bg1));
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: var(--ink1);
  font: 700 10px/1 var(--mono);
  letter-spacing: .14em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .15s ease-out, border-color .15s ease-out, translate .1s ease-out;
}

.key:hover { color: var(--ink0); border-color: var(--ink3); }
.key:active { translate: 0 1px; }
.key.on, .key[aria-pressed="true"] { color: var(--ink0); }
.key.on .led, .key[aria-pressed="true"] .led { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.key .meter {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 3px;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--lcd-dim) 0 4px, transparent 4px 6px);
}

.key .meter::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: min(var(--fill, 0px), 100%);
  background: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 6px);
}

.key.dl { white-space: nowrap; border-color: var(--accent); background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 16px var(--accent-glow); }
.key.dl[aria-disabled="true"] { pointer-events: none; opacity: .5; }

/* ───────────── The monitor's controls ─────────────
   The phosphor knob, the CRT|LCD and EN|DE rocker switches, the SCANLINES
   key, POWER with its LED: real controls (a slider, radios, toggle
   buttons), each at least 32 px. On the monitor's case when it is drawn (see "The monitor");
   otherwise a row above the strip. */
.controls {
  --key-hi: var(--bg3);
  --key-lo: var(--bg1);
  --key-in: var(--bg0);
  --key-ink: var(--ink1);
  --edge: var(--border0);
  position: fixed;
  z-index: 13;
  right: 12px;
  bottom: calc(var(--strip) + 8px);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--key-ink);
  font: 700 9px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.no-js .controls { display: none; }
.ctl { position: relative; flex: none; min-width: 0; margin: 0; padding: 0; border: 0; }
.ctl-legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.knob-print { display: none; }
.ctl-knob { display: flex; align-items: center; gap: 8px; }

.knob {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, var(--key-hi) 0 16%, var(--key-lo) 17% 55%, var(--key-in) 56%);
  box-shadow: 0 0 0 2px var(--edge), 2px 3px 0 2px rgba(0, 0, 0, .35);
  cursor: grab;
  touch-action: none;
}

/* The pointer: five positions, -72° (amber) to 72° (violet). */
.knob::after {
  content: "";
  position: absolute;
  left: calc(50% - 2px);
  top: 3px;
  width: 4px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--edge);
  rotate: calc(-72deg + var(--turn, 0) * 36deg);
  transform-origin: 50% 13px;
  transition: rotate .15s ease-out;
}

.knob:active { cursor: grabbing; }
.knob:focus-visible, .power:focus-visible, .scan:focus-visible, .flip label:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.knob-name { min-width: 6ch; }

.flip { display: flex; }

.flip label {
  position: relative;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  background: linear-gradient(var(--key-hi) 0 45%, var(--key-lo) 45%);
  box-shadow: 0 0 0 2px var(--edge), 2px 3px 0 2px rgba(0, 0, 0, .35);
  cursor: pointer;
  transition: color .15s ease-out;
}

.flip label:first-of-type { border-radius: 5px 0 0 5px; }
.flip label:last-of-type { margin-left: 2px; border-radius: 0 5px 5px 0; }
.flip label:hover { color: var(--ink0); }
/* The side that is down: pressed in, its legend lit. */
.flip label:has(:checked) { background: var(--key-in); box-shadow: 0 0 0 2px var(--edge), inset 0 3px 0 rgba(0, 0, 0, .45); color: var(--accent); }
.flip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }

/* SCANLINES: a key, pressed in and lit while the scanlines show; it rests
   on the LCD, which has none. */
.ctl-scan { display: grid; justify-items: center; }
.scan {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(var(--key-hi) 0 45%, var(--key-lo) 45%);
  box-shadow: 0 0 0 2px var(--edge), 2px 3px 0 2px rgba(0, 0, 0, .35);
  color: var(--key-ink);
  cursor: pointer;
  transition: color .15s ease-out;
}
.scan:hover { color: var(--ink0); }
.scan[aria-pressed="true"] { background: var(--key-in); box-shadow: 0 0 0 2px var(--edge), inset 0 3px 0 rgba(0, 0, 0, .45); color: var(--accent); }
.scan:disabled { color: var(--key-ink); opacity: .45; cursor: default; }
.scan svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
/* Scanlines off: only their layer goes; glare, vignette and the lens stay. */
:root[data-scanlines="off"] .scanlines, :root[data-scanlines="off"] .glass-fx::before { display: none; }

.power {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(var(--key-hi) 0 45%, var(--key-lo) 45%);
  box-shadow: 0 0 0 2px var(--edge), 2px 3px 0 2px rgba(0, 0, 0, .35);
  color: var(--key-ink);
  cursor: pointer;
}

.power:hover { color: var(--ink0); }
.power:active { translate: 0 1px; }
.power svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.power .led { position: absolute; top: -3px; right: -9px; }
.power[aria-pressed="true"] .led { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* Off: only the controls answer (the page returns when it is on again). */
.off body > :not(.controls, .monitor, .glass-fx) { visibility: hidden; }

/* ───────────── Tube ───────────── */

.bezel {
  padding: 18px;
  background: var(--bezel);
  border-radius: 34px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 -2px 6px rgba(0, 0, 0, .5), 0 20px 60px rgba(0, 0, 0, .45);
}

.glass {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 24px / 30px;
  background: radial-gradient(ellipse at 50% 42%, color-mix(in srgb, var(--accent) 7%, var(--glass)), var(--glass) 72%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .75), inset 0 0 0 2px rgba(0, 0, 0, .6);
  color: var(--ph-hi);
  text-shadow: var(--glow);
}

:root[data-theme="light"] .glass { box-shadow: inset 0 2px 10px rgba(0, 0, 0, .18), inset 0 0 0 1px rgba(0, 0, 0, .2); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .glass { box-shadow: inset 0 2px 10px rgba(0, 0, 0, .18), inset 0 0 0 1px rgba(0, 0, 0, .2); } }

/* Scanlines, a slow rolling band and the tube's vignette */
.scanlines {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  opacity: var(--scan);
  background:
    linear-gradient(transparent 0 46%, rgba(255, 255, 255, .05) 50%, transparent 54%) 0 0 / 100% 300% no-repeat,
    repeating-linear-gradient(rgba(0, 0, 0, .9) 0 1px, transparent 1px 3px);
  animation: roll 9s linear infinite;
}

.glass::after {
  content: "";
  position: absolute;
  z-index: 9;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(0, 0, 0, calc(var(--scan) * 2.4)) 100%);
}

@keyframes roll { from { background-position: 0 -100%, 0 0; } to { background-position: 0 200%, 0 0; } }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .985; } 50% { opacity: .96; } 53% { opacity: .99; } }

/* ───────────── Boot terminal ───────────── */

.boot {
  position: relative;
  height: calc(100svh - var(--strip));
  min-height: 560px;
  padding: 14px;
  background: var(--void);
}

.boot .bezel { height: 100%; min-width: 0; }
/* The tube only flickers while it prints the log; a steady picture after. */
.boot:not(.cleared) .glass { animation: flicker 5s steps(1) infinite; }

.term-log {
  position: absolute;
  inset: 34px 44px 60px;
  margin: 0;
  overflow: hidden;
  font: 400 clamp(11px, 1.05vw, 14px)/1.55 var(--mono);
  white-space: pre-wrap;
  transition: opacity .35s ease-out;
}

.term-log .dim { color: var(--ph-dim); }
.term-log .mid { color: var(--ph-mid); }
.term-log .ok { color: var(--ph-hi); }
.term-log .bar { color: var(--ph); letter-spacing: -.5px; }
.boot.cleared .term-log { opacity: 0; }

.term-hero {
  position: absolute;
  inset: 34px 44px 56px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

/* Centred while it fits; when it doesn't, it starts at the top instead of
   spilling over both edges (which cut off the logo). */
.term-hero > :first-child { margin-top: auto; }
.term-hero > :last-child { margin-bottom: auto; }
/* In the grid the command line, its hints and the download sit at the
   glass's foot, so nothing above (fewer lines on short screens, the
   command output) ever moves them; the banner floats above. */
.grid-on .term-hero > :last-child { margin-bottom: 0; }
.grid-on .term-hero > .prompt { margin-top: auto; }

.term-hero > *,
.term-grid > *,
.neo > * { transition: opacity .12s steps(2), transform .12s steps(2); }

/* Hero lines start transparent, so clearing the log never flashes them
   before their staggered .shown arrives. */
.boot:not(.cleared) .term-hero { visibility: hidden; }
.term-hero > *:not(.shown) { opacity: 0; }

.logo { flex: none; width: min(560px, 60vw, 62svh); height: auto; fill: var(--ph-hi); filter: drop-shadow(0 0 6px var(--accent-glow)); overflow: visible; }
:root[data-theme="light"] .logo { filter: none; fill: var(--ph-hi); }

.tag { display: flex; gap: 14px; align-items: center; color: var(--ph-mid); font-size: 13px; letter-spacing: .06em; }

.term-grid { display: grid; grid-template-columns: auto 1fr; gap: 36px; align-items: center; margin-top: 6px; }
.rune { display: grid; place-items: center; width: clamp(110px, 13vw, 180px); aspect-ratio: 1; }
.rune svg { width: 100%; height: 100%; fill: var(--ph); filter: drop-shadow(0 0 10px var(--accent-glow)); }

.whoami { color: var(--ph-mid); font-size: 13px; }
.whoami b { color: var(--ph-hi); }

.term-copy h1 {
  margin: 6px 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--ph-dim);
  font: 800 clamp(30px, 3.6vw, 52px)/1 var(--mono);
  letter-spacing: -.03em;
  text-transform: uppercase;
}

.term-copy h1 span { color: var(--ph); }
/* boot.js types the second line: every line sits in the same cell, hidden,
   so the headline keeps the height of the longest and never jumps. */
.term-copy h1 [data-type] { display: grid; grid-template-columns: minmax(0, 1fr); }
.term-copy h1 [data-type] > * { grid-area: 1 / 1; }
.term-copy h1 [data-type] .sizer { visibility: hidden; }
.term-copy h1 [data-type] .typed::after, .term-copy h1 [data-type] .sizer::after { content: ""; display: inline-block; width: .55em; height: .8em; margin-left: .08em; vertical-align: -.02em; background: currentColor; box-shadow: var(--glow); animation: blink 1s steps(1) infinite; }
.term-copy .lede { max-width: 62ch; color: var(--ph-mid); font-size: clamp(12px, 1.05vw, 14px); line-height: 1.6; }

.neo { display: grid; grid-template-columns: 110px 1fr; gap: 3px 16px; margin-top: 14px; font-size: 13px; }
.neo dt { color: var(--ph); font-weight: 700; }
.neo dd { color: var(--ph-hi); }

.note { display: flex; gap: 12px; color: var(--ph-mid); font-size: 13px; }
.note b { color: var(--ph); }
.term-grid + .note { margin-top: 6px; }

/* Command line (term.js): prompt, a real input with a block caret, a hint */
.prompt { display: flex; align-items: center; gap: 10px 12px; margin-top: 6px; font-size: 14px; }
.ps1 { flex: none; color: var(--ph-mid); }
.ps1 b { color: var(--ph-hi); }
.cmd-line { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; min-height: 32px; }
.cmd-line:focus-within { box-shadow: inset 0 -2px 0 var(--focus); }

.cmd {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ph-hi);
  caret-color: transparent;
  font: inherit;
  letter-spacing: 0;
  text-shadow: inherit;
}

.cmd:focus-visible { outline: none; }
.cmd::selection { background: var(--ph); color: var(--glass); }
.caret { position: absolute; left: 0; top: 50%; width: 1ch; height: 18px; margin-top: -9px; background: var(--ph-hi); box-shadow: var(--glow); pointer-events: none; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* The grey suggestion: the rest of a known command, after the typed text. */
.ghost { position: absolute; top: 50%; right: 0; overflow: hidden; color: var(--ph-dim); letter-spacing: 0; text-shadow: none; white-space: pre; translate: 0 -50%; pointer-events: none; }
.cmd-hint { flex: none; color: var(--ph-mid); font-size: 11px; letter-spacing: .06em; }
/* How to move between screens: keys with a mouse, swipes on touch. */
.nav-hint { flex: none; color: var(--ph-mid); font-size: 11px; letter-spacing: .06em; text-align: right; }
.nav-hint kbd { display: inline-block; min-width: 1.7em; margin-right: 3px; padding: 0 4px; border: 1px solid var(--ph-dim); border-radius: var(--r-sm); color: var(--ph-hi); font: inherit; text-align: center; }
.nav-hint .hint-touch { display: none; }
/* The keys live in the status bar, centred; the hero's own copy is for the
   narrow layout, where the status bar gives way to the menu line. */
.term-hero > .nav-hint { display: none; }
.statusbar .nav-hint { flex: none; font-size: 10px; letter-spacing: .04em; }
.statusbar .nav-hint kbd { min-width: 1.6em; line-height: 1.5; }
@media (pointer: coarse) {
  .nav-hint .hint-keys { display: none; }
  .nav-hint .hint-touch { display: inline; }
}

/* Output: grows between the banner and the prompt; while it holds text the
   banner copy steps aside (still read by screen readers). */
.term-out { position: relative; min-height: 0; overflow-y: auto; color: var(--ph-hi); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; overscroll-behavior: contain; }
.term-out p { margin: 0; padding-left: 2ch; text-indent: -2ch; }
.term-out .hi, .term-out .ps1b { font-weight: 700; }
.term-out .ps1 { color: var(--ph-mid); }
.term-out .dim { color: var(--ph-mid); }
.term-out .ok { color: var(--ph); font-weight: 700; }
.term-out .err { color: var(--err); font-weight: 700; }
.term-out .ref { color: var(--ph); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.term-out .type { animation: type var(--t) steps(var(--n)) both; }
.term-out .glitching { position: relative; color: transparent; }
.term-out .glitch { position: absolute; left: 0; top: 0; color: var(--err); }
@keyframes type { from { clip-path: inset(0 100% 0 0); } }
.term-hero.console .term-out { flex: 1 1 auto; }
.term-hero.console .term-grid, .term-hero.console .note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The download and the release block: side by side where the width
   allows, the block under the button on phones. */
.cta { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 28px; }

/* The release, drawn like a scene info file: a single-line box in the
   phosphor, its title set into the top edge, key ... value lines with dot
   leaders that shorten with the width. */
.nfo {
  position: relative;
  flex: 0 1 auto;
  width: min(100%, 44ch);
  max-width: 100%;
  margin-top: 6px;
  padding: 11px 14px 6px;
  border: 1px solid var(--ph-dim);
  color: var(--ph-mid);
  font-size: 12px;
  line-height: 1.5;
}
.nfo-title { position: absolute; top: 0; left: 10px; padding: 0 4px; background: var(--glass); color: var(--ph-hi); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; translate: 0 -50%; }
.nfo-title::before { content: "─[ "; color: var(--ph-dim); }
.nfo-title::after { content: " ]─"; color: var(--ph-dim); }
.nfo dl { margin: 0; }
.nfo dl > div { display: flex; gap: 1ch; }
.nfo dt { flex: 1; display: flex; gap: 1ch; min-width: 0; color: var(--ph); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.nfo dt::after { content: ""; flex: 1; min-width: 2ch; margin-bottom: .45em; border-bottom: 2px dotted var(--ph-dim); }
.nfo dd { margin: 0; color: var(--ph-hi); white-space: nowrap; }
.nfo a { color: var(--ph-hi); font-weight: 700; text-transform: uppercase; text-underline-offset: 3px; }
.nfo a:hover { color: var(--ph); }

/* Short phones: the block keeps its frame but reads as one line (the keys
   stay for screen readers), so the copy above keeps its room. */
@media (max-width: 820px) and (max-height: 700px) {
  .nfo { width: auto; padding: 10px 12px 4px; }
  .nfo dl { display: flex; flex-wrap: wrap; gap: 0 2ch; }
  .nfo dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

/* The terminal fits its glass without scrolling on wider screens: by the
   room the hero really has (a size container, so the monitor's case is
   counted), the secondary lines give way first. */
.grid-on .term-hero { container: hero / size; }
@media (min-width: 821px) {
  .grid-on .term-hero .logo { width: min(560px, 60vw, 70cqh); }
  @container hero (max-height: 840px) {
    .note, .whoami { display: none; }
  }
  @container hero (max-height: 740px) {
    .neo { display: none; }
  }
  @container hero (max-height: 520px) {
    .rune, .term-copy .lede { display: none; }
    .term-grid { grid-template-columns: 1fr; }
  }
  @container hero (max-height: 400px) {
    .tag { display: none; }
  }
}

.statusbar {
  position: absolute;
  z-index: 7;
  inset: auto 0 0;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 44px;
  background: color-mix(in srgb, var(--ph) 12%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--ph) 40%, transparent);
  color: var(--ph-mid);
  font: 400 11px/1 var(--mono);
  white-space: nowrap;
}

.statusbar > b { padding: 3px 7px; background: var(--ph); color: var(--glass); text-shadow: none; }
.statusbar .grow { flex: 1; }

.skip {
  position: absolute;
  right: 60px;
  top: 44px;
  z-index: 10;
  color: var(--ph-mid);
  font: 400 10px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: opacity .3s;
}

.boot.cleared .skip { opacity: 0; }

.button {
  min-height: 44px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent);
  box-shadow: 0 0 22px var(--accent-glow);
  color: var(--accent-ink);
  font: 800 12px/1 var(--mono);
  letter-spacing: .12em;
  text-decoration: none;
  text-shadow: none;
  text-transform: uppercase;
  transition: box-shadow .15s ease-out, translate .15s ease-out;
}

.button:hover { box-shadow: 0 0 36px var(--accent-glow); translate: 0 -1px; }
.button svg { width: 18px; height: 18px; fill: currentColor; }
.button[aria-disabled="true"] { pointer-events: none; filter: saturate(.15); opacity: .58; box-shadow: none; }

/* ───────────── The grid: one screen at a time, like the M8's views ───────────── */

/* grid.js adds .grid-on to <html>; before that, and without JavaScript, the
   screens stack as one ordinary page. The page never scrolls in the grid:
   wheel and trackpad only move areas inside a screen. */
.grid-on, .grid-on body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.grid-on body { padding-bottom: 0; }
.grid-on main.grid { position: fixed; inset: 0 0 var(--strip); overflow: hidden; touch-action: pinch-zoom; }
.grid-on .screen { position: absolute; inset: 0; overflow: hidden; }
.grid-on .screen:not(.current):not(.leaving) { visibility: hidden; }
/* A band at the top holds the floating map and the ▲ arrow, so they never
   cover a screen's content. The terminal fills its screen: the map docks
   into its status bar there. */
.grid-on { --band: 60px; }
.grid-on .screen:not(.boot) { top: var(--band); }
/* Headings take focus after a move (for screen readers); they are no control. */
.grid-on .screen [tabindex="-1"]:focus { outline: none; }
.grid-on body > footer { display: none; }
/* Download: the closing chapter is the last column's one screen. */
.grid-on main.grid > .final { display: flex; flex-direction: column; justify-content: center; align-items: center; overflow-y: auto; overscroll-behavior: contain; border-top: 0; touch-action: pan-y pinch-zoom; }
.grid-on .doc-glass, .grid-on [data-term-out], .grid-on .term-grid, .grid-on .side .headed li.on .step { touch-action: pan-y pinch-zoom; }

/* Terminal: the tube fills its screen. On desktops the copy fits (see "The
   terminal fits its glass"); on phones the copy between logo and prompt
   scrolls, so prompt and download stay in view. */
.grid-on .boot { height: 100%; min-height: 0; }
.grid-on .term-grid { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* Info screens: the standalone pages' text, scrolling inside the tube. */
.grid-on .doc-screen { background: var(--void); }
.grid-on .doc-screen > .bezel { height: 100%; }
.grid-on .doc-screen .doc-glass { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.grid-on .doc-screen .scanlines { display: none; }
.info-list { margin-top: 20px; }
.info-tm { margin-top: 28px; color: var(--ink1); font-size: 12px; line-height: 1.5; }
.info-owner { margin-top: 12px; font-size: 12px; }
.info-owner a { color: var(--ink1); text-underline-offset: 3px; }

/* Edge arrows name the neighbour: sideways ones stand upright at the sides,
   clear of the copy; up and down sit at the top and bottom. */
.edges { position: fixed; z-index: 15; inset: 0 0 var(--strip); pointer-events: none; }
.edge { position: absolute; pointer-events: auto; opacity: .9; }
.edge[hidden] { display: none; }
/* Side arrows keep one size on every screen (a long name is cut), so they
   never shift with the neighbour they name. */
.edge.left, .edge.right { top: 50%; min-height: 0; height: 140px; padding: 12px 0; width: 32px; overflow: hidden; writing-mode: vertical-rl; white-space: nowrap; transform: translateY(-50%); }
.edge .edge-label { min-height: 0; overflow: hidden; text-overflow: ellipsis; }
.edge.left { left: 6px; }
.edge.right { right: 6px; }
.edge.up, .edge.down { left: 50%; transform: translateX(-50%); }
.edge.up { top: 6px; }
.edge.down { bottom: 6px; }
.edge:active { translate: none; }

/* The map: which column and row, like the M8's view map; opens the list. */
.map { position: fixed; z-index: 16; top: 8px; right: 48px; }
.map-key {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border: 1px solid var(--border0);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--bg1) 90%, transparent);
  color: var(--ph-hi);
  font: 700 10px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}

.map-key:hover { border-color: var(--ink3); }
.map-grid { display: flex; gap: 5px; }
.map-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.map-col b { color: var(--ink2); font-size: 9px; line-height: 1; }
.map-col.on b { color: var(--ph); }
.map-col i { width: 4px; height: 3px; background: var(--ink3); }
.map-col i.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
/* The map's label is for screen readers: the map keeps one size on every
   screen (the screen names are on the screens). */
.map-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Arrows and map wait for the boot log to clear, then fade in. */
.grid-on .edges, .grid-on .map { transition: opacity .25s ease-out; }
.grid-on.booting .edges, .grid-on.booting .map { opacity: 0; visibility: hidden; transition: none; }

.map-panel {
  position: fixed;
  inset: calc(var(--band, 48px) + 4px) 48px auto auto;
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100svh - var(--strip) - var(--band, 48px) - 12px);
  margin: 0;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border0);
  border-radius: var(--r-md);
  background: var(--bezel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: var(--ink1);
  font: 12px/1.4 var(--mono);
}

.map-panel h2 { margin: 0 0 6px; color: var(--ink0); font: 800 11px/1 var(--mono); letter-spacing: .18em; text-shadow: none; }
.map-panel ul { margin: 0; padding: 0; list-style: none; }
.map-panel > ul > li { margin-top: 12px; }
.map-panel ul ul { padding-left: 24px; }
.map-letter { display: inline-block; width: 24px; color: var(--ph); font-weight: 800; }
.map-panel a, .map-head { color: var(--ink0); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; text-underline-offset: 3px; }
.map-panel ul ul a { display: block; min-height: 24px; overflow: hidden; color: var(--ink1); font-weight: 400; letter-spacing: 0; line-height: 24px; text-decoration: none; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.map-panel a:hover { color: var(--ink0); }
.map-panel a[aria-current="page"] { color: var(--ph-hi); font-weight: 700; }
.map-panel a[aria-current="page"]::before { content: "▸ "; color: var(--ph); }

/* Tour: one screen for every step, a shared stage behind the copy. */
.tour { position: relative; background: var(--void); }

.stage {
  position: relative;
  height: calc(100svh - var(--strip));
  min-height: 480px;
  overflow: hidden;
  background: radial-gradient(ellipse at 62% 50%, color-mix(in srgb, var(--accent) 6%, var(--glass)), var(--void) 75%);
}

.grid-on .tour .stage { position: absolute; inset: 0; height: auto; min-height: 0; }

.stage .scanlines { opacity: calc(var(--scan) * .6); }

.grid-floor {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px;
  opacity: .3;
  mask-image: radial-gradient(ellipse at 50% 55%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 55%, #000 20%, transparent 75%);
}

/* ───────────── Copy ───────────── */

/* One copy block per chapter; the one on screen fades in. */
.chapter { position: absolute; z-index: 5; }
.chapter:not([hidden]) { animation: panel-in .25s ease-out; }
@keyframes panel-in { from { opacity: 0; } }

/* The closing chapter: its own section after the tour. */
.final {
  position: relative;
  padding: clamp(48px, 10vh, 96px) var(--gutter);
  text-align: center;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 6%, var(--glass)), var(--void) 70%);
  border-top: 1px dashed var(--ph-dim);
}

.side { left: var(--gutter); top: 50%; width: min(380px, 29vw); translate: 0 -50%; }

.eyebrow, .kicker {
  color: var(--ph-mid);
  font: 700 10px/1.3 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.signal-dot { display: inline-block; width: 7px; height: 7px; margin-right: 9px; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); vertical-align: 1px; }

.kicker { display: flex; align-items: center; }
.kicker b { font-weight: 700; }
.kicker span { min-width: 26px; margin-right: 10px; padding: 3px 5px; background: var(--ph); color: var(--glass); text-align: center; }

h2 {
  margin: 16px 0 14px;
  color: var(--ph-hi);
  font: 800 clamp(30px, 3.2vw, 46px)/.98 var(--mono);
  letter-spacing: -.04em;
  text-transform: uppercase;
  text-shadow: var(--glow);
}

.final h2 { margin: 18px 0 8px; font-size: clamp(40px, 6vw, 84px); }
.final h2 span { color: var(--ph); }

.chapter-lede { margin-bottom: 16px; color: var(--ink1); font-size: 14px; line-height: 1.55; text-wrap: pretty; }

.side ol { padding: 0; list-style: none; border-top: 1px dashed var(--ph-dim); }

.side li {
  position: relative;
  padding: 10px 0 10px 30px;
  border-bottom: 1px dashed color-mix(in srgb, var(--ph-dim) 60%, transparent);
  color: var(--ink1);
  font-size: 14px;
  line-height: 1.5;
  text-wrap: pretty;
  transition: color .25s ease-out, text-shadow .25s ease-out;
}

.side li::before {
  content: "1";
  position: absolute;
  left: 0;
  top: 11px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border0);
  color: var(--ink3);
  font: 700 10px/1 var(--mono);
  transition: background-color .25s ease-out, color .25s ease-out, border-color .25s ease-out;
}

.side li:nth-child(2)::before { content: "2"; }
.side li:nth-child(3)::before { content: "3"; }
.side li:nth-child(4)::before { content: "4"; }
.side li:nth-child(5)::before { content: "5"; }
.side li:nth-child(6)::before { content: "6"; }
.side li:nth-child(7)::before { content: "7"; }
/* Each step is a window with a headline: closed ones show just their
   headline, the open one (the current step) its text too. Enter or Space
   on a headline opens it (it is the step's button, aria-expanded). */
.side .headed b { display: block; color: var(--ph-hi); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
/* A button centres its content; a window's starts at its top. */
.side .headed .step { display: flex; flex-direction: column; justify-content: flex-start; }
.grid-on .side .headed li:not(.on) .step { max-height: 1lh; overflow: hidden; }
/* In the grid a chapter shows its current step open, with the step before
   it above (▲, from step 2 on) and the step after it right under its text
   (▼, up to the last step), each as a dimmed number and headline that opens
   it on a click; the other steps are out of sight but still read by screen
   readers. The list keeps the room of its tallest step at the current width
   and language below the ▼ row (scene.js, --list-h), so the card never
   changes its height; where the glass has less room, a longer text scrolls
   in its window (--text-max). */
.grid-on .side .headed { display: flex; flex-direction: column; min-height: var(--list-h, auto); counter-reset: step; }
.grid-on .side .headed li { counter-increment: step; }
.grid-on .side .headed li.prev, .grid-on .side .headed li.next { opacity: .55; }
.grid-on .side .headed li.prev::before { content: "▲"; }
.grid-on .side .headed li.next::before { content: "▼"; }
.grid-on .side .headed li:is(.prev, .next) b::before { content: counter(step) "\00a0\00a0"; }
.grid-on .side .headed li:not(.on, .prev, .next) { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.grid-on .side .headed li.on .step { max-height: var(--text-max, none); overflow-y: auto; overscroll-behavior: contain; }
/* scene.js measures each step as the current one in a copy of the list. */
.side .step-probe { position: absolute; left: 0; top: 0; visibility: hidden; pointer-events: none; }
.grid-on .side .headed.step-probe { min-height: 0; }
.grid-on .side .headed.step-probe li.on .step { max-height: none; overflow: visible; }
.side li.on { color: var(--ph-hi); text-shadow: var(--glow); }
/* In the grid each bullet is a button to its step. */
.side .step { width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; line-height: inherit; text-align: left; text-shadow: inherit; cursor: pointer; transition: color .15s ease-out; }
.side li:not(.on) .step:hover { color: var(--ph); }

.side li.on::before { background: var(--ph); border-color: var(--ph); color: var(--glass); text-shadow: none; }

.actions { display: flex; justify-content: center; gap: 12px; margin: 26px 0 12px; }
.beta-state { color: var(--ph-mid); font: 600 11px/1.5 var(--mono); }
.beta-state.ended { color: var(--warn); }
.req { margin-top: 10px; color: var(--ink1); font: 600 11px/1.5 var(--mono); }

/* ───────────── Scene ───────────── */

.viewport { position: absolute; z-index: 1; inset: 0; pointer-events: none; }

.cam {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1280px;
  height: 800px;
  margin: -400px 0 0 -640px;
  will-change: transform;
}

/* The tour: a text column and a fixed stage for the app (16:10), both
   top-aligned at the same height on every step, so nothing jumps; the
   stage shows a crop of the app, scaled to fill it (scene.js). Fixed
   gutters keep the side arrows off both. Phones: the card on top, the
   stage at the bottom. */
.grid-on .tour .stage { container-type: size; --col: min(360px, 30cqw); --tour-top: 16px; --stage-l: calc(var(--gutter) + var(--col) + 40px); }
.grid-on .tour .side { top: var(--tour-top); width: var(--col); translate: none; }
.grid-on .tour .viewport {
  inset: var(--tour-top) auto auto var(--stage-l);
  width: min(calc(100cqw - var(--stage-l) - 44px), calc((100cqh - var(--tour-top) - 16px) * 1.6));
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg0);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ph) 30%, transparent);
}

/* Pictures of the app (scene.js places them): a step with one hides the
   rebuilt window. */
.shot-on .cam { visibility: hidden; }
.shots { position: absolute; z-index: 2; inset: 0; }
.shot { position: absolute; left: 50%; top: 50%; display: block; }
.shot[hidden] { display: none; }
.shot img { display: block; width: 100%; height: 100%; }

/* A picture not taken yet: a dim frame of its size, naming it (data-crop). */
.pending {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  margin: 0;
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ph) 6%, var(--glass)) 0 10px, var(--glass) 10px 20px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ph) 30%, transparent);
  color: var(--ph-mid);
  font: 700 11px/1.4 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.pending[hidden] { display: none; }
.pending b { color: var(--ph-hi); }

/* ───────────── Footer ───────────── */

footer {
  position: relative;
  z-index: 1;
  min-height: 80px;
  padding: 18px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  background: var(--void);
  border-top: 1px dashed var(--ph-dim);
}

.footer-links { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.trademark { max-width: 62ch; color: var(--ink1); font-size: 10px; line-height: 1.5; }
.footer-links a[aria-current="page"] { color: var(--ph-hi); }

/* ───────────── Document pages (licenses, 404, thanks) ───────────── */

.doc { padding: 14px; }
.doc-glass { height: auto; min-height: calc(100svh - var(--strip) - 64px); padding: 44px clamp(20px, 5vw, 64px) 48px; }
.doc-glass > :not(.scanlines) { position: relative; z-index: 1; max-width: 78ch; }
/* Document glass can be many screens tall (the manual: ~13k px); rolling the
   band over it repaints one huge layer per frame and blanks it on the GPU. */
.doc-glass .scanlines { animation: none; }
.doc-cmd { color: var(--ph-mid); font-size: 13px; }
.doc-cmd b { color: var(--ph-hi); }
.doc h1 { margin: 18px 0 12px; font: 800 clamp(28px, 3.4vw, 44px)/1 var(--mono); letter-spacing: -.03em; text-transform: uppercase; }
.doc .lede { color: var(--ph-mid); font-size: 14px; line-height: 1.6; }
.pkg { margin-top: 34px; padding-top: 22px; border-top: 1px dashed var(--ph-dim); }
.pkg h2 { margin: 0 0 12px; font-size: clamp(20px, 2vw, 26px); }
.pkg h3 { margin: 18px 0 6px; color: var(--ph); font: 700 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.pkg > p { margin-top: 12px; color: var(--ph-mid); font-size: 13px; line-height: 1.6; }
.pkg .neo { margin-top: 0; }
.neo-wide { grid-template-columns: max-content 1fr; row-gap: 6px; }
.pkg .neo a, .pkg > p a, .files a, .doc-back a, .doc .lede a { color: var(--ph-hi); text-underline-offset: 3px; }
.doc a { overflow-wrap: anywhere; }
.files { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.5; }
.files li { padding: 4px 0 4px 18px; position: relative; color: var(--ph-mid); }
.files li::before { content: "›"; position: absolute; left: 0; color: var(--ph); }
.files small { display: block; color: var(--ph-mid); font-size: 10px; overflow-wrap: anywhere; }
.doc-back { margin-top: 40px; font-size: 13px; }
.doc-actions { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.doc-actions > a:not(.button) { color: var(--ph-hi); font-size: 13px; text-underline-offset: 3px; }
.doc-note { margin-top: 12px; color: var(--ph-mid); font-size: 13px; }

/* Manual (manual.html, generated from manual.js) */
.doc code, .doc kbd { font: inherit; overflow-wrap: anywhere; }
.doc code { color: var(--ph-hi); }
.doc kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; border: 1px solid var(--ph-dim); border-bottom-width: 2px; border-radius: var(--r-sm); color: var(--ph-hi); text-align: center; line-height: 1.45; }
.man-toc h2 { margin: 28px 0 8px; font-size: clamp(18px, 1.8vw, 22px); }
.man-toc small { font-size: 11px; }
.man-sum { color: var(--ph-mid); }
.man-topic { scroll-margin-top: 16px; }
/* The manual in English and German: the one matching the page's language. */
:root:not([lang="de"]) .man-lang[lang="de"], :root[lang="de"] .man-lang[lang="en"] { display: none; }
.man-keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 8px 0 0; font-size: 13px; line-height: 1.5; }
.man-keys div { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }
.man-keys dt { color: var(--ph-hi); }
.man-keys dd { margin: 0; color: var(--ph-mid); }
.steps { counter-reset: step; }
.steps li { padding-left: 30px; counter-increment: step; }
.steps li::before { content: counter(step, decimal-leading-zero); }
.footer-links a { min-height: 32px; display: inline-flex; align-items: center; color: var(--ink1); font-size: 11px; text-decoration: none; }
.footer-links a:hover { color: var(--ph-hi); }

/* ───────────── Without JS: a readable page, no scroll scene ───────────── */

.no-js .boot { height: auto; }
.no-js .glass { min-height: 80vh; }
.no-js .term-hero { position: relative; inset: auto; visibility: visible; padding: 40px; }
.no-js .term-hero > * { opacity: 1; }
.no-js .prompt, .no-js .nav-hint { display: none; }
.no-js .term-log, .no-js .skip { display: none; }
.no-js .viewport { display: none; }
.no-js .stage { height: auto; min-height: 0; padding: 48px var(--gutter); display: grid; gap: 56px; }
.no-js .chapter { position: static; translate: none; width: auto; max-width: 640px; }

/* ───────────── Narrow screens ───────────── */

@media (max-width: 1100px) {
  .brand em { display: none; }
}

@media (max-width: 900px) {
  .keys { display: none; }
  .knobs { margin-left: auto; }
}

@media (max-width: 820px) {
  :root { --gutter: 16px; }
  .strip { gap: 10px; padding: 0 10px; }
  .brand span { display: none; }
  .knobs { gap: 6px; }
  .key { padding: 0 8px; }
  /* The tube grows with the hero instead of clipping it: at least one
     screen tall, taller when the larger phone type needs it. */
  .boot { height: auto; min-height: calc(100svh - var(--strip)); padding: 8px; display: flex; }
  .boot .bezel { flex: 1; height: auto; display: flex; }
  .boot .glass { flex: 1; height: auto; }
  .bezel { padding: 8px; border-radius: 22px; }
  .glass { border-radius: 16px / 20px; }
  .term-log { inset: 18px 16px 44px; font-size: 10px; white-space: pre; }
  .skip { display: none; }
  .term-hero { position: relative; inset: auto; min-height: 100%; padding: 18px 16px 48px; gap: 10px; justify-content: flex-start; }
  .logo { width: 100%; }
  .term-grid { grid-template-columns: 1fr; gap: 10px; }
  .rune, .whoami { display: none; }
  .term-copy h1 { font-size: clamp(26px, 8vw, 36px); }
  .neo { grid-template-columns: 76px 1fr; font-size: 11px; }
  .note { font-size: 11px; }
  .note { display: none; }
  .prompt { flex-wrap: wrap; }
  .ps1 b { display: none; }
  .cmd-hint { flex-basis: 100%; margin-top: -6px; }
  .nav-hint { letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cta .button { width: 100%; }
  .statusbar { padding: 0 16px; gap: 10px; font-size: 9px; }
  .statusbar [data-mode-label], .statusbar > span:nth-child(2) { display: none; }

  .side {
    left: var(--gutter);
    right: var(--gutter);
    top: auto;
    bottom: 16px;
    width: auto;
    translate: none;
    padding: 16px;
    background: var(--bg0);
    border: 1px solid var(--border0);
    border-radius: var(--r-md);
  }

  .side h2 { margin: 10px 0 8px; font-size: 24px; }
  /* Hidden on screen only: screen readers still get the whole chapter. */
  .chapter-lede { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* Only the current step's bullet shows; the other steps are screens below
     (in the grid: above). */
  :root:not(.grid-on) .side li:not(.on) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* The map floats at the top right: the copy starts below it. */
  .grid-on .term-hero { height: 100%; min-height: 0; padding-top: var(--band); }
  /* Phones: arrows show only their glyph (the name stays for screen readers);
     the map is a small pill at the top. */
  .edge .edge-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .edge.left, .edge.right { width: 28px; height: 44px; padding: 10px 0; }
  .map { top: 6px; right: 8px; }
  .map-key { min-height: 28px; gap: 8px; padding: 3px 8px; font-size: 12px; }
  .grid-on { --band: 54px; }
  .map-panel { inset: calc(var(--band, 44px) + 4px) 8px auto; width: auto; }
  .edge.up { top: 6px; left: 6px; transform: none; }
  .edge.down { bottom: 6px; left: 6px; transform: none; }
  /* The tour: the card on top, the stage below it at the bottom. */
  .grid-on .tour .side { top: 8px; bottom: auto; width: auto; }
  .grid-on .tour .viewport { inset: auto 18px 12px; width: auto; height: min(calc(100cqw - 36px), calc(100cqh - var(--card))); aspect-ratio: auto; }
  .grid-on .tour .stage { --card: 270px; }
  .side li { padding: 6px 0 6px 28px; }
  .side li::before { top: 6px; }
  .actions .button { width: 100%; }
  footer { flex-direction: column; align-items: flex-start; }
  .doc { padding: 8px; }
  .neo { grid-template-columns: 1fr; gap: 0; }
  .neo dd { margin-bottom: 6px; }
  .footer-links { flex-wrap: wrap; gap: 6px 18px; }
}

/* Phones and tablets: a type scale for reading at arm's length. Body copy
   16 px, secondary lines 14 px, labels and keys 12 px bold. */
@media (max-width: 820px) {
  .term-copy .lede, .chapter-lede, .side li,
  .doc .lede, .pkg > p, .files, .doc-back, .doc-actions > a:not(.button), .doc-note,
  .man-keys, .footer-links a { font-size: 16px; line-height: 1.5; }
  .neo, .tag, .cmd-hint, .nav-hint, .term-out, .beta-state, .req, .trademark,
  .files small, .man-toc small, .doc-cmd, .note { font-size: 14px; }
  .neo dt, .kicker, .eyebrow, .pkg h3 { font-size: 12px; font-weight: 700; }
  .neo dd { font-weight: 400; }
  .key { font-size: 12px; }
  .side li::before { top: 8px; }
  /* Label beside value, so the hero keeps its download button on screen. */
  .term-copy .neo { grid-template-columns: 64px 1fr; gap: 4px 12px; }
  .term-copy .neo dd { margin-bottom: 0; }
}

/* Short phone screens: a slimmer chapter card leaves the app window room;
   the bullet itself keeps its 16 px. */
@media (max-width: 820px) and (max-height: 640px) {
  .side { bottom: 8px; padding: 10px 12px; }
  .grid-on .tour .stage { --card: 250px; }
  .side h2 { margin: 6px 0 4px; font-size: 18px; }
  .side .kicker { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* The card ends above the stage (the open step's text scrolls where it must). */
  .side ol { border-top: 0; }
  /* The bullet a size down here, so the app keeps room below the card. */
  .side li { padding-top: 2px; padding-bottom: 2px; border-bottom: 0; font-size: 14px; line-height: 1.4; }
  .side li::before { top: 4px; }
  /* The terminal: tighter lines, so the headline keeps its room above the
     prompt, the download and the release block. */
  .grid-on .term-hero { gap: 6px; }
}

/* Phones, upright or on their side, and tablets upright: the tour is text
   only. The stage is hidden (its pictures never load, scene.js), so the
   chapter card has the glass to itself; beside it on a wide phone or an
   upright tablet the card takes the room. Tablets on their side and
   desktops keep the pictures. */
@media (max-width: 600px), (max-height: 500px), (orientation: portrait) and (max-width: 1100px) {
  .grid-on .tour .viewport { display: none; }
}
@media (min-width: 821px) and (max-height: 500px), (min-width: 821px) and (max-width: 1100px) and (orientation: portrait) {
  .grid-on .tour .stage { --col: min(680px, calc(100cqw - 2 * var(--gutter))); }
}

/* Touch screens: text fields at 16 px, so iOS never zooms in on focus. */
@media (max-width: 820px), (pointer: coarse) {
  .prompt { font-size: 16px; }
}

@media (max-width: 480px) {
  /* The status bar keeps its badge. */
  .grid-on .statusbar [data-phos-label], .grid-on .statusbar [data-clock] { display: none; }
  .man-keys { grid-template-columns: 1fr; row-gap: 2px; }
  .man-keys dd { margin-bottom: 8px; }
}

@media (max-width: 360px) {
  .strip { gap: 8px; padding: 0 8px; }
  .knobs { gap: 4px; }
  .key { padding: 0 6px; }
}

/* Short screens: drop the secondary lines first so logo, headline and the
   download prompt always fit inside the glass. */
@media (max-height: 900px) and (min-width: 821px) {
  .term-hero { gap: 10px; }
  .note, .whoami { display: none; }
}

@media (max-height: 760px) and (min-width: 821px) {
  .neo { display: none; }
}

@media (max-height: 640px) and (min-width: 821px) {
  .rune, .term-copy .lede { display: none; }
  .term-grid { grid-template-columns: 1fr; }
}

/* Landscape phones: slimmer margins, so the download button stays whole. */
@media (max-height: 500px) and (min-width: 821px) {
  .term-hero { inset: 16px 44px 40px; gap: 8px; }
  .term-grid { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Print: the document only, black on white, no tube effects. */
@media print {
  .strip, .controls, .skip-link, .scanlines, .doc-cmd, .doc-back, .footer-links { display: none !important; }
  body { padding: 0; background: #fff; color: #000; }
  .doc, .bezel, .glass, .doc-glass { min-height: 0; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .glass::after { display: none; }
  *, *::before { color: #000 !important; text-shadow: none !important; filter: none !important; }
  .doc kbd { border-color: #000; }
  .pkg { break-inside: auto; border-top-color: #999; }
  h2, h3 { break-after: avoid; }
  footer { border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}

/* scene.js: a cut to another tour step shows its frame at once. */
.tour.cut, .tour.cut * { transition: none !important; }

/* ───────────── The monitor ─────────────
   Every page sits inside one monitor, drawn like a comic panel in CSS and
   SVG (assets/monitor/; no bitmaps): a battered dark CRT, or a beige LCD
   with a flat panel, swapped with <html data-mode> (set before the first
   paint by each page, kept current by controls.js). One fixed layer, never
   redrawn by a screen change: .monitor is the case with a hole cut for the
   glass (clip-path shape(), evenodd), its .recess the bevel planes (the
   borders: top light, bottom dark, sides between) and the gasket, .rim the
   lit edge of the CRT's barrel glass, .decal the wear and the stickers.
   .glass-fx lies over the glass: scanlines, reflection, vignette. The grid
   and the pages are inset to the hole (--gt --gr --gb --gl); text keeps
   its own insets from the glass's corners (check-grid.mjs checks it).
   Without shape() (or JavaScript) the pages keep their own flat tube.
   On the start page lens.js puts what the glass shows (the screens, the
   map, the edge arrows, the menu line) into one layer, .lens, which the
   CRT bends like its barrel glass; elsewhere the layer is no box at all. */
.monitor, .glass-fx { display: none; }
.lens { display: contents; }

@media screen {
  @supports (clip-path: shape(from 0 0, line to 1px 1px)) {
    :root[data-mode] {
      --m: 10px;
      --pad-t: 20px;
      --pad-x: 28px;
      --pad-b: 40px;
      --panel: 0px;
      --dots: 5px;
      --gt: calc(var(--m) + var(--pad-t) + var(--bevel) + var(--gasket));
      --gl: calc(var(--m) + var(--pad-x) + var(--bevel) + var(--gasket));
      --gr: calc(var(--gl) + var(--panel));
      --gb: calc(var(--m) + var(--pad-b) + var(--bevel) + var(--gasket));
      /* The glass in its own box: corners rounded by --corner, edges bowed
         out by --bow (0 on the LCD). */
      --barrel: shape(from var(--corner) var(--bow),
        curve to calc(100% - var(--corner)) var(--bow) with 50% calc(var(--bow) * -1),
        curve to calc(100% - var(--bow)) var(--corner) with calc(100% - var(--bow)) var(--bow),
        curve to calc(100% - var(--bow)) calc(100% - var(--corner)) with calc(100% + var(--bow)) 50%,
        curve to calc(100% - var(--corner)) calc(100% - var(--bow)) with calc(100% - var(--bow)) calc(100% - var(--bow)),
        curve to var(--corner) calc(100% - var(--bow)) with 50% calc(100% + var(--bow)),
        curve to var(--bow) calc(100% - var(--corner)) with var(--bow) calc(100% - var(--bow)),
        curve to var(--bow) var(--corner) with calc(var(--bow) * -1) 50%,
        curve to var(--corner) var(--bow) with var(--bow) var(--bow), close);
      /* The monitor: all of it but the same glass, inset by --gt --gr --gb --gl. */
      --hole: shape(evenodd from 0 0, hline to 100%, vline to 100%, hline to 0, close,
        move to calc(var(--gl) + var(--corner)) calc(var(--gt) + var(--bow)),
        curve to calc(100% - var(--gr) - var(--corner)) calc(var(--gt) + var(--bow)) with calc((var(--gl) + 100% - var(--gr)) / 2) calc(var(--gt) - var(--bow)),
        curve to calc(100% - var(--gr) - var(--bow)) calc(var(--gt) + var(--corner)) with calc(100% - var(--gr) - var(--bow)) calc(var(--gt) + var(--bow)),
        curve to calc(100% - var(--gr) - var(--bow)) calc(100% - var(--gb) - var(--corner)) with calc(100% - var(--gr) + var(--bow)) calc((var(--gt) + 100% - var(--gb)) / 2),
        curve to calc(100% - var(--gr) - var(--corner)) calc(100% - var(--gb) - var(--bow)) with calc(100% - var(--gr) - var(--bow)) calc(100% - var(--gb) - var(--bow)),
        curve to calc(var(--gl) + var(--corner)) calc(100% - var(--gb) - var(--bow)) with calc((var(--gl) + 100% - var(--gr)) / 2) calc(100% - var(--gb) + var(--bow)),
        curve to calc(var(--gl) + var(--bow)) calc(100% - var(--gb) - var(--corner)) with calc(var(--gl) + var(--bow)) calc(100% - var(--gb) - var(--bow)),
        curve to calc(var(--gl) + var(--bow)) calc(var(--gt) + var(--corner)) with calc(var(--gl) - var(--bow)) calc((var(--gt) + 100% - var(--gb)) / 2),
        curve to calc(var(--gl) + var(--corner)) calc(var(--gt) + var(--bow)) with calc(var(--gl) + var(--bow)) calc(var(--gt) + var(--bow)), close);
      --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .96 0 0 0 0 .9 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
    }

    /* CRT: anthracite plastic, a deep bevel, the barrel glass */
    :root[data-mode="crt"] {
      --bevel: 18px;
      --gasket: 7px;
      --corner: 44px;
      --bow: 9px;
      --ink: #050505;
      --case-hi: #4a4944;
      --case: #36352f;
      --case-lo: #292824;
      --dot: rgba(0, 0, 0, .6);
      --bevel-c: #4f4e48 rgba(8, 8, 7, .55) rgba(5, 5, 5, .72) #3f3e39;
      --gasket-c: #0a0a0a;
      --emboss: rgba(255, 255, 255, .34);
      --wear: url("/assets/monitor/wear-crt.svg");
    }

    /* LCD: beige plastic, a thin bevel, a flat panel */
    :root[data-mode="lcd"] {
      --bevel: 12px;
      --gasket: 4px;
      --corner: 8px;
      --bow: 0px;
      --ink: #1d1a14;
      --case-hi: #f1ebdb;
      --case: #ddd4bd;
      --case-lo: #c8bea3;
      --dot: rgba(88, 70, 38, .38);
      --bevel-c: #f6f1e4 rgba(70, 56, 30, .3) rgba(60, 48, 26, .55) #e9e2d0;
      --gasket-c: #3b3831;
      --emboss: rgba(60, 48, 26, .55);
      --wear: url("/assets/monitor/wear-lcd.svg");
    }

    [data-mode] .monitor {
      position: fixed;
      z-index: 12;
      inset: 0 0 var(--strip);
      display: block;
      background: var(--void);
      clip-path: var(--hole);
      /* Its own layer, painted once: without it Chrome left parts of the
         hole unpainted after a screen change (seen in headless Chrome 152). */
      will-change: transform;
      /* Scrolling hit-tests layers without their clip-path: the case must
         not take the wheel or a touch meant for the page in the hole. */
      pointer-events: none;
    }

    /* The case: flat light, mid and shadow bands, an ink outline, the seam */
    [data-mode] .monitor::before {
      content: "";
      position: absolute;
      inset: var(--m);
      border-radius: 26px;
      background: var(--grain), linear-gradient(162deg, var(--case-hi) 0 14%, var(--case) 14% 64%, var(--case-lo) 64%);
      box-shadow: inset 3px 3px 0 -1px rgba(255, 255, 255, .13), inset -4px -5px 0 -1px rgba(0, 0, 0, .3), 0 0 0 3px var(--ink), 8px 10px 0 3px rgba(0, 0, 0, .45);
      outline: 1.5px solid var(--ink);
      outline-offset: -9px;
    }

    /* Halftone dots in the case's shadow (lower right) */
    [data-mode] .monitor::after {
      content: "";
      position: absolute;
      inset: var(--m);
      border-radius: 26px;
      background: radial-gradient(circle, var(--dot) 1.1px, transparent 1.5px) 0 0 / var(--dots) var(--dots);
      -webkit-mask-image: linear-gradient(162deg, transparent 56%, #000 90%);
      mask-image: linear-gradient(162deg, transparent 56%, #000 90%);
    }

    [data-mode] .monitor > i { position: absolute; z-index: 1; display: block; }

    [data-mode] .recess {
      inset: calc(var(--gt) - var(--gasket) - var(--bevel)) calc(var(--gr) - var(--gasket) - var(--bevel)) calc(var(--gb) - var(--gasket) - var(--bevel)) calc(var(--gl) - var(--gasket) - var(--bevel));
      border: var(--bevel) solid;
      border-color: var(--bevel-c);
      border-radius: calc(var(--corner) * .5 + var(--bevel));
      background:
        linear-gradient(var(--gasket-c), var(--gasket-c)) padding-box,
        radial-gradient(circle, var(--dot) 1.1px, transparent 1.5px) 0 0 / var(--dots) var(--dots) border-box,
        linear-gradient(var(--case), var(--case)) border-box;
      box-shadow: 0 0 0 2.5px var(--ink), inset 0 0 0 2px var(--ink), inset 0 5px 0 rgba(0, 0, 0, .5);
    }

    /* The CRT glass's edge catches the light: its outline, 1.5 px larger. */
    [data-mode] .rim {
      inset: calc(var(--gt) - 1.5px) calc(var(--gr) - 1.5px) calc(var(--gb) - 1.5px) calc(var(--gl) - 1.5px);
      background: linear-gradient(160deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .05) 55%, rgba(255, 255, 255, .1));
      clip-path: var(--barrel);
    }

    [data-mode="lcd"] .rim { display: none; }

    /* Wear and stickers on the case (own designs only); the hole cuts
       anything that would reach the glass. */
    [data-mode] .decal {
      inset: var(--m);
      border-radius: 26px;
      background:
        url("/assets/monitor/sticker-signal.svg") left calc(var(--pad-x) + 40px) top 2px / 84px auto no-repeat,
        url("/assets/monitor/sticker-logo.svg") left calc(var(--pad-x) + 130px) bottom 2px / 46px auto no-repeat,
        url("/assets/monitor/sticker-keep.svg") right calc(var(--pad-x) + 70px) top 3px / 150px auto no-repeat,
        var(--wear) 0 0 / 100% 100% no-repeat;
    }

    /* The name on the chin, embossed */
    [data-mode] .decal::before {
      content: "";
      position: absolute;
      left: calc(var(--pad-x) + 14px);
      bottom: calc(var(--pad-b) / 2 - 6px);
      width: 96px;
      height: 12px;
      background: var(--emboss);
      -webkit-mask: url("/assets/monitor/badge.svg") 0 0 / contain no-repeat;
      mask: url("/assets/monitor/badge.svg") 0 0 / contain no-repeat;
    }

    [data-mode] .glass-fx {
      position: fixed;
      z-index: 11;
      inset: var(--gt) var(--gr) calc(var(--gb) + var(--strip)) var(--gl);
      display: block;
      overflow: hidden;
      border-radius: var(--corner);
      pointer-events: none;
    }

    /* CRT: hand-drawn highlights, a faint reflection from the top left, the
       vignette; scanlines and a slow rolling band (moved, not repainted). */
    [data-mode="crt"] .glass-fx {
      background:
        url("/assets/monitor/glare.svg") 0 0 / 100% 100% no-repeat,
        radial-gradient(ellipse 50% 40% at 22% 10%, rgba(255, 255, 255, .05), transparent 70%),
        linear-gradient(158deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .01) 20%, transparent 32%),
        radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, .62) 100%);
      box-shadow: inset 0 0 70px rgba(0, 0, 0, .6), inset 0 0 14px rgba(0, 0, 0, .5);
    }

    [data-mode="crt"] .glass-fx::before,
    [data-mode="crt"] .glass-fx::after { content: ""; position: absolute; inset: 0; opacity: var(--scan); }
    [data-mode="crt"] .glass-fx::before { background: repeating-linear-gradient(rgba(0, 0, 0, .9) 0 1px, transparent 1px 3px); }
    [data-mode="crt"] .glass-fx::after { bottom: auto; height: 34%; background: linear-gradient(transparent, rgba(255, 255, 255, .05), transparent); animation: band 9s linear infinite; }
    @keyframes band { from { translate: 0 -100%; } to { translate: 0 300%; } }

    /* LCD: a matte panel, lit from the top left, recessed a little */
    [data-mode="lcd"] .glass-fx {
      background: linear-gradient(160deg, rgba(255, 255, 255, .16), transparent 35%);
      box-shadow: inset 0 3px 6px rgba(0, 0, 0, .22), inset 0 0 0 1px rgba(0, 0, 0, .25);
    }

    /* The CRT's curve (lens.js): what the glass shows, in one fixed layer
       under the glass effects, bent by one filter as the last step. The
       layer takes no pointer; the parts in it keep their own. The LCD is
       flat. */
    [data-mode] .lens { position: fixed; z-index: 10; inset: 0; display: block; pointer-events: none; }
    [data-mode] .lens > :not(.edges) { pointer-events: auto; }
    /* The lens filter is off for now: redrawn with every frame of the glass, it kept the GPU at 100 %.
       It comes back once it only redraws when the glass changes. */

    /* The controls on the case: plastic keys with ink edges, on the chin
       (the control column on wide screens, a rail on short ones: below). */
    [data-mode] .controls {
      --edge: var(--ink);
      right: calc(var(--m) + var(--pad-x) + 16px);
      bottom: calc(var(--strip) + var(--m) + var(--pad-b) / 2 - 16px);
      color: var(--key-ink);
      text-shadow: none;
    }
    [data-mode="crt"] .controls { --key-hi: #5e5d56; --key-lo: #43423c; --key-in: #141412; --key-ink: #d3cebf; }
    [data-mode="lcd"] .controls { --key-hi: #fbf7ec; --key-lo: #e2d9c2; --key-in: #3e392d; --key-ink: #3a3326; }
    [data-mode] .knob-name { color: var(--emboss); }

    /* POWER: the glass goes dark. The CRT's picture collapses to a bright
       line, then a dot (a window in a black cover that shrinks); the LCD's
       backlight fades. */
    [data-mode] .screen-off { position: absolute; inset: 0; display: none; }
    [data-mode]:is(.off, .power-down, .power-up) .screen-off { display: block; }
    [data-mode="crt"] .screen-off::before {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      width: 0;
      height: 0;
      translate: -50% -50%;
      box-shadow: 0 0 0 0 transparent, 0 0 0 200vmax #030404;
    }
    [data-mode="crt"].power-down .screen-off::before { animation: crt-off .45s ease-in forwards; }
    [data-mode="crt"].power-up .screen-off::before { animation: crt-on .6s ease-out forwards; }
    @keyframes crt-off {
      0% { width: 100%; height: 100%; background: transparent; box-shadow: 0 0 0 0 transparent, 0 0 0 200vmax #030404; }
      45% { width: 100%; height: 2px; background: rgba(255, 255, 255, .9); box-shadow: 0 0 14px 3px rgba(255, 255, 255, .55), 0 0 0 200vmax #030404; }
      80% { width: 3px; height: 2px; background: #fff; box-shadow: 0 0 10px 3px rgba(255, 255, 255, .6), 0 0 0 200vmax #030404; }
      100% { width: 2px; height: 2px; background: transparent; box-shadow: 0 0 0 0 transparent, 0 0 0 200vmax #030404; }
    }
    @keyframes crt-on {
      0% { width: 2px; height: 2px; background: #fff; box-shadow: 0 0 10px 3px rgba(255, 255, 255, .6), 0 0 0 200vmax #030404; }
      35% { width: 100%; height: 2px; background: rgba(255, 255, 255, .9); box-shadow: 0 0 14px 3px rgba(255, 255, 255, .55), 0 0 0 200vmax #030404; }
      100% { width: 100%; height: 100%; background: transparent; box-shadow: 0 0 0 0 transparent, 0 0 0 200vmax #030404; }
    }
    [data-mode="lcd"] .screen-off { background: #23221c; opacity: .94; }
    [data-mode="lcd"].power-down .screen-off { animation: lcd-off .5s ease-in both; }
    [data-mode="lcd"].power-up .screen-off { animation: lcd-on .5s ease-out both; }
    @keyframes lcd-off { from { opacity: 0; } }
    @keyframes lcd-on { to { opacity: 0; } }

    /* The pages inside: the grid fills the glass; the standalone pages
       scroll under the case, their text starting inside the glass. Each
       screen's own tube goes flat (the glass above is shared). */
    :root[data-mode] { --strip: 0px; --menu: 32px; }
    [data-mode] body { background: var(--glass); }
    .grid-on[data-mode] main.grid { inset: var(--gt) var(--gr) calc(var(--gb) + var(--menu)) var(--gl); }
    [data-mode]:not(.grid-on) body { padding: var(--gt) var(--gr) calc(var(--gb) + var(--menu)) var(--gl); }
    [data-mode]:not(.grid-on) { scroll-padding: calc(var(--gt) + 8px) 0 calc(var(--gb) + var(--menu) + 8px); }
    [data-mode] .boot, [data-mode] .doc { padding: 0; }
    [data-mode] .bezel { padding: 0; border-radius: 0; background: none; box-shadow: none; }
    [data-mode] .glass { border-radius: 0; box-shadow: none; }
    [data-mode] .glass::after, [data-mode] .scanlines { display: none; }
    [data-mode] .doc-glass { min-height: calc(100svh - var(--gt) - var(--gb) - var(--menu)); }
    [data-mode] footer { background: none; }

    /* Navigation in the glass, drawn like a tracker's screen (our own
       type and glyphs): phosphor on the glass, square cells, the current
       item in inverse video. The menu line (the device strip) sits at the
       glass's foot, the map at its top right in a band no screen enters,
       ▲ at the band's left, ▼ at the menu line's left, ◀ ▶ as slim cells
       at the glass's sides (their hit area reaches out over the bevel).
       Everything stays clear of the glass's corners. */
    [data-mode].grid-on { --band: 48px; }
    [data-mode] .strip {
      z-index: 10;
      inset: auto var(--gr) var(--gb) var(--gl);
      height: var(--menu);
      padding: 0 calc(var(--corner) + 6px) 0 calc(var(--corner) + 150px);
      gap: 10px;
      background: color-mix(in srgb, var(--ph) 12%, var(--glass));
      border-top: 0;
      box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ph) 40%, transparent);
      color: var(--ph-mid);
      text-shadow: var(--glow);
    }
    [data-mode] .strip .led { display: none; }
    [data-mode] .brand { min-height: 32px; gap: 8px; color: var(--ph-hi); }
    [data-mode] .brand-mark { fill: var(--ph); }
    [data-mode] .brand em { color: var(--ph-mid); }
    [data-mode] .keys { display: flex; gap: 2px; }
    [data-mode] .strip .key {
      min-height: 32px;
      padding: 0 6px;
      gap: 0;
      border: 0;
      border-radius: 0;
      background: none;
      box-shadow: none;
      color: var(--ph-mid);
      font-size: 11px;
    }
    [data-mode] .keys .key::before { content: "["; }
    [data-mode] .keys .key::after { content: "]"; }
    [data-mode] .strip .key:hover { background: color-mix(in srgb, var(--ph) 18%, transparent); color: var(--ph-hi); }
    [data-mode] .strip .key.on { background: var(--ph); color: var(--glass); text-shadow: none; }
    /* The column's meter: step cells after the name */
    [data-mode] .key .meter { position: relative; inset: auto; width: 28px; height: 7px; margin: 0 2px 0 6px; background: repeating-linear-gradient(90deg, color-mix(in srgb, currentColor 30%, transparent) 0 4px, transparent 4px 6px); }
    [data-mode] .key .meter::after { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 6px); }
    [data-mode] .strip .key.dl { margin-left: auto; padding: 0 12px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 12px var(--accent-glow); text-shadow: none; }
    [data-mode] .knobs { margin-left: auto; }
    /* Six chapter keys: where the menu line is short of room, the brand's
       tag line gives way first, then the meters, then the names (the keys
       show their map letter, as on phones). */
    [data-mode] .strip { container: menu / inline-size; }
    @container menu (max-width: 1040px) { [data-mode] .brand em { display: none; } }
    @container menu (max-width: 935px) { [data-mode] .key .meter { display: none; } }
    @container menu (max-width: 720px) {
      [data-mode] .keys .key { width: 32px; padding: 0; justify-content: center; font-size: 0; }
      [data-mode] .keys .key::before { content: attr(data-letter); font-size: 12px; }
      [data-mode] .keys .key::after { content: none; }
    }

    [data-mode] .map { z-index: 10; top: calc(var(--gt) + 8px); right: calc(var(--gr) + var(--corner) + 2px); }
    [data-mode] .map-key, [data-mode] .edge {
      min-height: 32px;
      border: 1px solid color-mix(in srgb, var(--ph) 45%, transparent);
      border-radius: 0;
      background: color-mix(in srgb, var(--glass) 85%, transparent);
      box-shadow: none;
      color: var(--ph-hi);
      text-shadow: var(--glow);
    }
    [data-mode] .map-key { gap: 8px; padding: 0 6px; }
    [data-mode] .map-key:hover, [data-mode] .edge:hover { border-color: var(--ph); }
    [data-mode] .map-grid { gap: 2px; }
    [data-mode] .map-col { gap: 1px; }
    [data-mode] .map-col b { padding: 1px 2px; color: var(--ph-mid); font-size: 9px; }
    [data-mode] .map-col.on b { background: var(--ph); color: var(--glass); text-shadow: none; }
    [data-mode] .map-col i { width: 5px; height: 2px; background: var(--ph-dim); }
    [data-mode] .map-col i.on { background: var(--ph-hi); box-shadow: var(--glow); }
    [data-mode] .map-panel {
      inset: calc(var(--gt) + var(--band)) calc(var(--gr) + var(--corner)) auto auto;
      max-height: calc(100svh - var(--gt) - var(--gb) - var(--menu) - var(--band) - 8px);
      border: 1px solid color-mix(in srgb, var(--ph) 45%, transparent);
      border-radius: 0;
      background: var(--glass);
      box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
      color: var(--ph-mid);
    }
    [data-mode] .map-panel h2, [data-mode] .map-panel a, [data-mode] .map-head { color: var(--ph-hi); }
    [data-mode] .map-panel ul ul a { color: var(--ph-mid); }

    [data-mode] .edges { z-index: 10; inset: var(--gt) var(--gr) calc(var(--gb) + var(--menu)) var(--gl); }
    [data-mode] .edge { opacity: 1; font-size: 10px; }
    [data-mode] .edge:active { translate: none; }
    /* Centred on the glass (the arrows' box ends above the menu line). */
    [data-mode] .edge.left, [data-mode] .edge.right { top: calc(50% + var(--menu) / 2); width: 22px; padding: 10px 0; overflow: visible; }
    [data-mode] .edge.left { left: 4px; }
    [data-mode] .edge.right { right: 4px; }
    [data-mode] .edge.left::before, [data-mode] .edge.right::before { content: ""; position: absolute; inset: 0 -10px; }
    [data-mode] .edge.up, [data-mode] .edge.down { left: calc(var(--corner) + 6px); transform: none; }
    [data-mode] .edge.up { top: 8px; }
    [data-mode] .edge.down { top: 100%; bottom: auto; border-width: 0 1px; }

    /* Chapter bullets: numbered cells, the current one inverse */
    [data-mode] .side li::before { border: 0; background: color-mix(in srgb, var(--ph) 14%, transparent); color: var(--ph-mid); }

    /* Short desktop screens: the glass is lower than the window, so the
       chapter card drops its lede (still read by screen readers) and
       tightens up to fit beside the app window. */
    @media (min-width: 821px) and (max-height: 820px) {
      [data-mode] .chapter-lede { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
      [data-mode] .side h2 { margin: 10px 0; font-size: clamp(24px, 2.6vw, 34px); }
      [data-mode] .side li { padding-top: 6px; padding-bottom: 6px; }
      [data-mode] .side li::before { top: 7px; }
    }


    /* Wide screens: a control column beside the glass */
    @media (min-width: 1200px) and (min-height: 700px) {
      :root[data-mode] { --panel: 110px; }
      [data-mode] .controls {
        top: calc(var(--m) + var(--pad-t) + 16px);
        bottom: calc(var(--strip) + var(--m) + var(--pad-b) / 2 - 16px);
        right: calc(var(--m) + var(--pad-x));
        width: calc(var(--panel) - 24px);
        flex-direction: column;
        gap: 16px;
      }
      [data-mode] .ctl-knob { flex-direction: column; }
      [data-mode] .flip { justify-content: center; }
      [data-mode] .ctl-legend { position: static; width: auto; height: auto; margin: 0 auto 6px; overflow: visible; clip-path: none; color: var(--emboss); font-size: 7px; letter-spacing: .16em; }
      [data-mode] .ctl-knob { gap: 30px; }
      [data-mode] .knob { width: 40px; height: 40px; }
      [data-mode] .knob::after { top: 4px; height: 12px; transform-origin: 50% 16px; }
      [data-mode] .knob-print { display: block; }
      [data-mode] .knob-print b { position: absolute; left: 50%; top: 50%; color: var(--emboss); font-size: 6px; letter-spacing: .06em; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-31px) rotate(calc(-1 * var(--a))); }
      [data-mode] .knob-print b:nth-child(1) { --a: -72deg; }
      [data-mode] .knob-print b:nth-child(2) { --a: -36deg; }
      [data-mode] .knob-print b:nth-child(3) { --a: 0deg; }
      [data-mode] .knob-print b:nth-child(4) { --a: 36deg; }
      [data-mode] .knob-print b:nth-child(5) { --a: 72deg; }
      [data-mode] .knob-name { display: none; }
      [data-mode] .power { margin-top: auto; }
      [data-mode] .decal {
        background:
          url("/assets/monitor/sticker-signal.svg") left calc(var(--pad-x) + 40px) top 2px / 84px auto no-repeat,
          url("/assets/monitor/sticker-logo.svg") left calc(var(--pad-x) + 130px) bottom 2px / 46px auto no-repeat,
          url("/assets/monitor/sticker-keep.svg") right calc(var(--pad-x) + var(--panel) + 92px) bottom 6px / 150px auto no-repeat,
          url("/assets/monitor/sticker-rsync.svg") right calc(var(--pad-x) + 10px) top 344px / 70px auto no-repeat,
          url("/assets/monitor/sticker-hex.svg") right calc(var(--pad-x) + 6px) bottom 120px / 74px auto no-repeat,
          repeating-linear-gradient(transparent 0 3px, var(--ink) 3px 6px, rgba(255, 255, 255, .1) 6px 7px, transparent 7px 10px) right calc(var(--pad-x) + 23px) top 400px / 40px 110px no-repeat,
          var(--wear) 0 0 / 100% 100% no-repeat;
      }
    }

    /* Phones and tablets upright: a slim housing, two small stickers on the
       chin; the glass keeps the page's type size. */
    @media (max-width: 820px) {
      :root[data-mode] { --m: 4px; --pad-t: 9px; --pad-x: 9px; --pad-b: 40px; --dots: 4px; }
      :root[data-mode="crt"] { --bevel: 8px; --gasket: 3px; --corner: 22px; --bow: 4px; }
      :root[data-mode="lcd"] { --bevel: 6px; --gasket: 3px; --corner: 6px; }
      [data-mode] .monitor::before { border-radius: 18px; box-shadow: inset 2px 2px 0 -1px rgba(255, 255, 255, .13), inset -3px -3px 0 -1px rgba(0, 0, 0, .3), 0 0 0 2px var(--ink); outline-width: 1px; outline-offset: -5px; }
      [data-mode] .monitor::after, [data-mode] .decal { border-radius: 18px; }
      [data-mode] .recess { box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 1.5px var(--ink), inset 0 3px 0 rgba(0, 0, 0, .5); }
      [data-mode] .decal {
        background:
          url("/assets/monitor/sticker-logo.svg") left 40px top 0 / 24px auto no-repeat,
          var(--wear) 0 0 / 100% 100% no-repeat;
      }
      [data-mode].grid-on { --band: 58px; }
      [data-mode] .decal::before { left: 16px; bottom: 18px; width: 60px; height: 8px; }
      [data-mode] .controls { right: calc(var(--m) + var(--pad-x) + 14px); gap: 10px; }
      [data-mode] .knob-name { display: none; }
      [data-mode].grid-on { --band: 44px; }
      /* The menu line: ▼, then B R W as letter keys, the download. */
      [data-mode] .strip { padding: 0 calc(var(--corner) + 2px) 0 calc(var(--corner) + 40px); gap: 4px; }
      [data-mode] .brand { display: none; }
      [data-mode] .keys { flex: none; }
      /* Keys show their map letter (B R W); the name stays for screen readers. */
      [data-mode] .keys .key { width: 32px; padding: 0; justify-content: center; font-size: 0; }
      [data-mode] .keys .key::before { content: attr(data-letter); font-size: 12px; }
      [data-mode] .keys .key::after { content: none; }
      [data-mode] .key .meter { display: none; }
      [data-mode] .strip .key.dl { padding: 0 8px; font-size: 10px; }
      [data-mode] .edge.left, [data-mode] .edge.right { width: 12px; height: 36px; padding: 8px 0; font-size: 10px; }
      [data-mode] .edge.left { left: 2px; }
      [data-mode] .edge.right { right: 2px; }
      [data-mode] .edge.left::before, [data-mode] .edge.right::before { inset: 0 -12px; }
      [data-mode] .edge.up, [data-mode] .edge.down { left: calc(var(--corner) + 2px); width: 32px; padding: 0; }
      /* The terminal: its status bar gives way to the menu line; the copy
         starts below the map. */
      [data-mode] .boot .statusbar { display: none; }
      [data-mode] .term-hero > .nav-hint { display: block; }
      [data-mode].grid-on .term-hero { padding-top: var(--band); padding-bottom: 8px; }
      [data-mode="crt"] .glass-fx { background-image: url("/assets/monitor/glare-small.svg"), radial-gradient(ellipse 50% 40% at 22% 10%, rgba(255, 255, 255, .05), transparent 70%), linear-gradient(158deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .01) 20%, transparent 32%), radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, .62) 100%); }
    }

    /* Narrow phones: the controls take the whole chin. */
    @media (max-width: 420px) {
      [data-mode] .decal::before { display: none; }
    }

    /* Narrow phones: the menu line takes two rows (▼ and the six letter
       keys, then the download). */
    @media (max-width: 429px) {
      :root[data-mode] { --menu: 64px; }
      [data-mode] .strip { flex-wrap: wrap; align-content: stretch; row-gap: 0; }
      [data-mode] .knobs { flex-basis: 100%; }
      [data-mode] .strip .key.dl { flex: 1; }
      [data-mode] .edge.down { height: 32px; }
    }
    /* The second row takes its room from the stage, not from the card. */
    @media (max-width: 429px) and (min-height: 641px) {
      .grid-on[data-mode] .tour .stage { --card: 350px; }
    }

    /* Short landscape screens: a thin housing, no chin, no stickers. */
    @media (max-height: 500px) {
      :root[data-mode] { --m: 4px; --pad-t: 8px; --pad-x: 10px; --pad-b: 8px; --dots: 4px; --panel: 58px; }
      [data-mode] .controls {
        top: calc(var(--m) + var(--pad-t) + 10px);
        bottom: auto;
        right: calc(var(--m) + var(--pad-x));
        width: calc(var(--panel) - 10px);
        flex-direction: column;
        gap: 12px;
      }
      [data-mode] .flip { flex-direction: column; }
      /* The menu line: names without meters, no brand. */
      [data-mode] .strip { padding-left: calc(var(--corner) + 120px); }
      [data-mode] .brand, [data-mode] .key .meter { display: none; }
      [data-mode] .flip label { width: 40px; }
      [data-mode] .flip label:first-of-type { border-radius: 5px 5px 0 0; }
      [data-mode] .flip label:last-of-type { margin: 2px 0 0; border-radius: 0 0 5px 5px; }
      [data-mode] .knob-name { display: none; }
      :root[data-mode="crt"] { --bevel: 8px; --gasket: 3px; --corner: 22px; --bow: 4px; }
      :root[data-mode="lcd"] { --bevel: 6px; --gasket: 3px; --corner: 6px; }
      [data-mode] .monitor::before { border-radius: 16px; outline-width: 1px; outline-offset: -4px; }
      [data-mode] .monitor::after, [data-mode] .decal { border-radius: 16px; }
      [data-mode] .decal { background: var(--wear) 0 0 / 100% 100% no-repeat; }
      [data-mode] .decal::before { display: none; }
      [data-mode="crt"] .glass-fx { background-image: url("/assets/monitor/glare-small.svg"), radial-gradient(ellipse 50% 40% at 22% 10%, rgba(255, 255, 255, .05), transparent 70%), linear-gradient(158deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .01) 20%, transparent 32%), radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, .62) 100%); }
    }
  }
}
