:root {
  color-scheme: dark;
  --bg: #1c2433;
  --bg-elev: #273246;
  --ink: #e8e2d6;
  --ink-strong: #f6f1e7;
  --muted: #c4bdb0;
  --faint: #a39888;
  --line: #3e4a62;
  --mark: #e4b15a;
  --paper: #f3eee4;
  --paper-ink: #1c2433;
  --note: #b7c7e2;
  --teal: var(--paper);
  --teal-soft: var(--note);
  --teal-ink: var(--paper-ink);
  --link: var(--ink-strong);
  --amber: #e4b15a;
  --amber-ink: #1c2433;
  --blue: #8ea0bf;
  --coral: #e38b84;
  --good: #9cbfa4;
  --bad: #e38b84;
  --shadow: none;
  --serif: Newsreader, "Iowan Old Style", Palatino, serif;
  --sans: "Atkinson Hyperlegible", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 0px;
  --radius-sm: 2px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.625;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "calt", "rlig";
}

::selection { background: var(--mark); color: var(--paper-ink); }

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

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  background: var(--teal);
  color: var(--teal-ink);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.skip:focus { top: 12px; }

a { color: var(--link); text-underline-offset: 0.16em; }
a:hover { color: var(--mark); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--ink-strong);
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0 0 0.4em;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 500;
  line-height: 0.98;
  max-width: 18ch;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 500;
  max-width: 28ch;
}

h3 { font-family: var(--sans); font-size: 1.15rem; font-weight: 700; }
.examples-head { margin: 28px 0 14px; }

p { margin: 0 0 0.8em; }

.wrap {
  width: min(1100px, calc(100% - 32px));
  margin-inline: auto;
}

.kicker {
  margin: 0 0 0.6rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.lede {
  color: var(--ink);
  font-size: 1.125rem;
  line-height: 1.55;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  flex: 0 0 auto;
}

.mark {
  display: inline;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--mark);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 560;
}

.nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar { display: none; }

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.nav a:hover,
.nav a.is-active {
  color: var(--ink);
  background: var(--bg-elev);
}

.nav a.is-active { box-shadow: inset 0 0 0 1px var(--line); }

.has-toc .nav { margin-left: auto; }
.has-toc header .wrap,
.has-toc footer .wrap { width: min(1280px, calc(100% - 32px)); }

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 8px auto 0;
}
.page-shell .wrap { width: 100%; margin-inline: 0; }

.toc { display: none; }
.toc h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  max-width: none;
}
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a {
  display: block;
  margin-left: -2px;
  padding: 7px 8px 7px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
}
.toc a:hover,
.toc a.is-active { color: var(--ink); border-left-color: var(--mark); }

.mobile-toc { display: none; margin: 16px 0 4px; }
.mobile-toc summary {
  cursor: pointer;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
}
.mobile-toc ol { list-style: none; margin: 8px 0 0; padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.mobile-toc a { display: block; padding: 8px 12px; color: var(--link); text-decoration: none; }
.mobile-toc a.is-active { color: var(--ink); }

@media (min-width: 980px) {
  .page-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
  .toc {
    display: block;
    position: sticky;
    top: 84px;
    max-height: calc(100svh - 100px);
    overflow: auto;
    padding: 12px 0 24px;
  }
}

@media (max-width: 979px) {
  .mobile-toc { display: block; }
}

.hero { padding: 56px 0 20px; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 36px;
  align-items: center;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 2px;
  padding: 12px 16px;
  background: var(--teal);
  color: var(--teal-ink);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover { background: var(--mark); color: var(--paper-ink); }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--ink);
  border-radius: 0;
}

.btn.ghost:hover { background: var(--bg-elev); }

.btn.amber { background: var(--amber); color: var(--amber-ink); }

.btn.small { padding: 7px 12px; font-size: 0.92rem; }

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 0; list-style: none; }

.chip {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  padding: 0;
}

.stage {
  position: relative;
  min-height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  overflow: hidden;
}

.road {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 46%;
  height: 54px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(237, 241, 247, 0.2) 0 18px, transparent 18px 34px),
    #1b2433;
  box-shadow: inset 0 0 0 2px rgba(237, 241, 247, 0.08);
}

.car {
  position: absolute;
  top: 50%;
  width: 46px;
  height: 22px;
  margin-top: -11px;
  border-radius: 7px;
  background: var(--amber);
  animation: drive 7s linear infinite;
}

.car::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 4px;
  width: 10px;
  height: 8px;
  background: #fff4d2;
  border-radius: 2px;
}

.node {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(228, 177, 90, 0.22);
}

.node.a { top: 18%; left: 16%; }
.node.b { top: 22%; right: 18%; background: var(--blue); box-shadow: 0 0 0 6px rgba(228, 177, 90, 0.18); }
.node.c { bottom: 16%; left: 38%; background: var(--coral); box-shadow: 0 0 0 6px rgba(255, 139, 120, 0.15); }

.page-card {
  position: absolute;
  right: 14%;
  bottom: 18%;
  width: 92px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: #222a3a;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--amber);
}

.stage-caption {
  position: absolute;
  left: 16px;
  bottom: 12px;
  margin: 0;
  font-size: 0.78rem;
  color: var(--faint);
}

section.block, .hero { scroll-margin-top: 76px; }

section.block { padding: 48px 0 8px; border-top: 0; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: #f5f6f7;
}

.section-head { margin-bottom: 18px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.card, .lab, .callout, .map-card, .fn, .q, .check-list, .worked {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.lab, .worked, .q {
  background: var(--bg-elev);
  padding: 18px 18px 16px;
  border-left: 3px solid var(--teal);
}

.card h3, .map-card h3, .fn h3 { font-family: var(--sans); letter-spacing: 0; font-size: 1.02rem; }

.map-card {
  color: inherit;
  text-decoration: none;
  display: block;
  min-height: 100%;
}

.map-card:hover,
.topic.ready:hover {
  border-color: var(--teal);
  box-shadow: var(--shadow);
}

.map-card span {
  display: block;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--teal);
  margin-bottom: 6px;
}

.callout { padding: 2px 0 2px 16px; }

.card p:last-child, .fn p:last-child, .callout p:last-child { margin-bottom: 0; }

.card, .map-card, .fn, .check-list { padding: 16px 0 20px; border-bottom: 1px solid var(--line); }
.card.internet, .card.www, .fn { padding-left: 16px; }
.fn { border-left: 3px solid var(--line); border-bottom: 0; }
.fn.is-lit { border-color: var(--teal); box-shadow: none; }

.card ul, .q ul { margin: 0.3em 0 0; padding-left: 1.1em; }
.card li + li { margin-top: 0.35em; }

.card.internet { box-shadow: inset 3px 0 0 var(--teal); }
.card.www { box-shadow: inset 3px 0 0 var(--amber); }

.callout.exam { box-shadow: inset 3px 0 0 var(--mark); }
.callout.note { box-shadow: inset 3px 0 0 var(--blue); }
.callout strong { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; letter-spacing: 0; text-transform: none; display: block; margin-bottom: 6px; }
.callout.exam strong { color: var(--mark); }
.callout.note strong { color: var(--blue); }

.lab { margin-top: 16px; }
.lab h3 { margin-bottom: 6px; }
.lab > * + * { margin-top: 12px; }

main .wrap > * + .card,
main .wrap > * + .lab,
main .wrap > * + .callout,
main .wrap > * + .worked,
main .wrap > * + .tabset,
main .wrap > * + .check-list,
main .wrap > * + .scoreboard,
main .wrap > * + .grid-2,
main .wrap > * + .grid-3,
main .wrap > * + .grid-6,
main .wrap > * + .fn,
main .wrap > * + .q,
main .wrap > * + .stack,
main .wrap > * + .sim-grid,
main .wrap > * + .row-actions,
main .wrap > * + .media-set,
main .wrap > * + .q-check,
main .wrap > * + .compare {
  margin-top: 20px;
}

table.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.compare th,
table.compare td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

table.compare th { color: var(--teal); font-weight: 600; }

.q-check {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.q-check summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-strong);
}

.q-check p { margin: 0.7em 0 0; }

.media-set { display: grid; gap: 20px; width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.media-set > .worked { min-width: 0; justify-self: stretch; margin-inline: 0; }
.media-body { display: grid; gap: 16px; width: 100%; min-width: 0; align-items: center; }
.media-scroll { overflow-x: auto; max-width: 100%; min-width: 0; overscroll-behavior-x: contain; }
.media-notes { margin: 0; padding-left: 1.15em; }
.media-notes li + li { margin-top: 0.35em; }
.media-svg { margin: 0; }
.media-svg .disc { fill: var(--bg); stroke: var(--teal); stroke-width: 3; }
.media-svg .track { fill: none; stroke: var(--line); stroke-width: 2; }
.media-svg .hub { fill: var(--teal); }
.media-svg .sector { fill: rgba(228, 177, 90, 0.38); stroke: var(--teal); stroke-width: 2; }
.media-svg .arm { fill: none; stroke: var(--muted); stroke-width: 4; stroke-linecap: round; }
.media-svg .head { fill: var(--amber); }
.media-svg .surface { fill: var(--bg); stroke: var(--teal); stroke-width: 2; }
.media-svg .laser { fill: var(--bg-elev); stroke: var(--amber); stroke-width: 2; }
.media-svg .beam { fill: none; stroke: var(--amber); stroke-width: 2.5; stroke-linecap: round; }
.media-svg .beam-miss { fill: none; stroke: var(--coral); stroke-width: 2.5; stroke-dasharray: 5 4; stroke-linecap: round; }
.media-svg .gate { fill: var(--bg); stroke: var(--teal); stroke-width: 2; }
.media-svg .float { fill: var(--bg-elev); stroke: var(--amber); stroke-width: 2; }
.media-svg .base { fill: var(--bg); stroke: var(--blue); stroke-width: 2; }
.media-svg .charge { fill: var(--amber); }
.media-svg .leader { fill: none; stroke: var(--faint); stroke-width: 1.5; }

label.field { display: block; font-size: 0.92rem; color: var(--muted); margin-bottom: 8px; }

input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 0.95rem;
}

textarea { min-height: 110px; resize: vertical; font-family: var(--sans); }

.pc-shell { display: grid; gap: 14px; }
.pc-editor {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  min-width: 0;
}
.pc-files {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.pc-filetab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--faint);
  padding: 8px 14px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
}
.pc-filetab.is-active {
  background: var(--bg-elev);
  color: var(--ink-strong);
}
.pc-filetab-mode {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.pc-files input.pc-filename {
  width: 9rem;
  max-width: 42vw;
  min-height: 0;
  margin: 0;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.3;
}
.pc-filetab.is-active input.pc-filename {
  border-color: var(--line);
  background: var(--bg);
}
.pc-files input.pc-filename:focus {
  border-color: var(--teal);
  outline: none;
  color: var(--ink-strong);
}
.pc-pane {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
}
.pc-pane.is-hidden { display: none; }
.pc-gutter {
  margin: 0;
  padding: 12px 10px;
  overflow: hidden;
  text-align: right;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  user-select: none;
  border-right: 1px solid var(--line);
}
.pc-code {
  position: relative;
  min-width: 0;
  min-height: 280px;
  background: var(--bg-elev);
}
.pc-highlight,
.pc-code textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  border: 0;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: normal;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  white-space: pre;
  tab-size: 4;
  overflow: auto;
}
.pc-highlight {
  position: absolute;
  inset: 0;
  height: 100%;
  pointer-events: none;
  background: transparent;
  border-radius: 0;
  color: #d6deeb;
}
.pc-code textarea {
  position: relative;
  z-index: 1;
  display: block;
  min-height: 280px;
  resize: vertical;
  color: transparent;
  caret-color: var(--ink-strong);
  background: transparent;
  border-radius: 0;
}
.pc-data textarea {
  color: #d6deeb;
  caret-color: var(--ink-strong);
}
.pc-data textarea[readonly] { caret-color: transparent; }
.pc-example { margin: 0; min-width: min(100%, 220px); }
.pc-example select { margin-top: 6px; }
.pc-results {
  border-left: 3px solid var(--teal);
  background: var(--bg-elev);
  padding: 16px 18px;
}
.pc-results.has-error { border-left-color: var(--coral); }
.pc-results h3 { margin-bottom: 8px; }
.pc-status { margin: 0 0 10px; }
.pc-error { color: var(--coral); }
.pc-out {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.92rem;
}
.pc-ask {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}
.pc-ask[hidden],
.pc-shell .btn[hidden] { display: none !important; }
.pc-ask .field { flex: 1 1 220px; margin: 0; }
.pc-ask .btn { margin-bottom: 2px; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

.url-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  min-height: 58px;
}

.part {
  border: 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 0.92rem;
  color: #0c1118;
  text-align: left;
}

.part small { display: block; font-family: var(--sans); font-size: 0.72rem; opacity: 0.75; }
.part.protocol { background: var(--blue); }
.part.domain { background: var(--teal); }
.part.path { background: var(--amber); }
.part.extra { background: #d7dbe4; }
.part.is-picked { outline: 3px solid white; }
.part.muted { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line); cursor: default; }

.define {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.cite {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 0.86rem;
}

.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.pane { border-radius: var(--radius); padding: 16px; background: var(--bg-elev); border: 1px solid var(--line); min-height: 140px; }
.pane h4 { font-family: var(--serif); font-size: 1.05rem; letter-spacing: 0; text-transform: none; margin-bottom: 8px; font-weight: 500; }
.pane.http h4 { color: var(--coral); }
.pane.https h4 { color: var(--teal); }
.pane pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 0.86rem; }

.flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.flow li {
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  border: 1px solid var(--line);
  color: var(--faint);
  background: var(--bg-elev);
}

.flow li strong { display: block; color: var(--ink); font-size: 0.95rem; }
.flow li.is-on {
  color: var(--teal-ink);
  background: var(--teal);
  border-color: var(--teal);
}
.flow li.is-on strong { color: inherit; }

.step-readout { min-height: 4.5em; }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.sort-grid, .pool, .chosen { display: grid; gap: 8px; }
.sort-grid { margin-top: 8px; }
.pool, .chosen { margin: 8px 0; }

.sort-card, .step-btn, .opt {
  text-align: left;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  padding: 10px 12px;
}

.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.choice {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 6px 10px;
  cursor: pointer;
}

.choice.is-correct, .sort-card.is-correct, .opt.is-correct {
  background: rgba(228, 177, 90, 0.22);
  border-color: rgba(156, 191, 164, 0.75);
}

.choice.is-wrong, .opt.is-wrong {
  background: rgba(227, 139, 132, 0.16);
  border-color: rgba(227, 139, 132, 0.7);
}

.feedback { min-height: 1.4em; color: var(--muted); font-size: 0.95rem; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

.fn.is-lit { border-color: var(--teal); box-shadow: var(--shadow); }

.jars { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.jar { background: var(--bg-elev); border-radius: var(--radius); padding: 16px; border: 1px dashed rgba(79, 93, 117, 0.4); min-height: 150px; }
.jar h4 { margin-bottom: 8px; font-family: var(--sans); font-size: 0.95rem; }
.jar.ram { border-color: rgba(183, 199, 226, 0.55); }
.jar.disk { border-color: rgba(184, 214, 168, 0.45); }
.jar-list { display: grid; gap: 8px; }
.cookie { background: var(--bg); border-radius: var(--radius-sm); padding: 8px 10px; }
.cookie b { font-family: var(--mono); font-weight: 560; font-size: 0.86rem; }
.empty { color: var(--faint); margin: 0; }

.q + .q { margin-top: 12px; }
.marks { font-family: var(--sans); font-size: 0.95rem; color: var(--amber); letter-spacing: 0; }

.scheme { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.scheme ol { margin: 0; padding-left: 1.2em; }
.award { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 0.92rem; }
.award input { width: 80px; }

.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.scoreboard div {
  flex: 0 1 auto;
  border-radius: 0;
  padding: 0 28px 0 0;
  background: transparent;
  border: 0;
}

.scoreboard strong { display: block; font-family: var(--serif); font-size: 2rem; font-weight: 500; }

.check-list { display: grid; gap: 8px; }
.check-list label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.check-list label:hover { background: var(--bg-elev); }
.check-list input { margin-top: 5px; accent-color: var(--teal); }

footer {
  padding: 40px 0 48px;
  color: var(--muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--line);
}

.stack { display: grid; gap: 8px; }

.paper-label {
  margin: 36px 0 8px;
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.chapter { margin: 18px 0 26px; }
.chapter h2 { font-size: 1.55rem; }
.chapter.later h2 { color: var(--muted); }
.chapter .count { color: var(--faint); font-family: var(--sans); font-size: 0.92rem; letter-spacing: 0; font-weight: 520; }

.topics { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 800px) {
  .topics { grid-template-columns: 1fr 1fr; column-gap: 40px; }
}

.topic {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 12px;
  min-height: 0;
  padding: 11px 0;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-decoration: none;
}

.topic strong { font-family: var(--sans); font-weight: 400; letter-spacing: 0; font-size: 1.05rem; }
.topic .code { font-family: var(--serif); font-size: 1.15rem; color: var(--mark); min-width: 2.4rem; }
.topic em { display: none; }
.topic.ready { box-shadow: none; }
.topic.ready:hover { border-color: var(--line); box-shadow: none; }
.topic.ready:hover strong { color: var(--mark); }
.topic.later { color: var(--faint); cursor: default; }
.topic.later .code, .topic.later strong, .topic.later em { color: var(--faint); }
.topic .note { margin-left: auto; font-family: var(--sans); font-size: 0.92rem; color: var(--faint); }

.chain { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bcard { border-radius: var(--radius); padding: 16px; background: var(--bg-elev); border: 1px solid var(--line); }
.bcard h4 { font-family: var(--sans); letter-spacing: 0; font-size: 0.95rem; margin-bottom: 8px; }
.bcard p { margin: 0 0 6px; font-size: 0.92rem; }
.bcard code { display: block; word-break: break-all; }
.bcard.bad { border-color: rgba(255, 139, 120, 0.7); box-shadow: inset 3px 0 0 var(--coral); }
.bcard.ok { border-color: rgba(156, 191, 164, 0.75); }
.flow.six { grid-template-columns: repeat(3, 1fr); }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
select {
  width: 100%;
  margin-top: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  padding: 12px 16px;
}
table.sheet { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.88rem; margin-top: 12px; }
table.sheet.fit { table-layout: fixed; }
table.sheet.fit th:first-child, table.sheet.fit td:first-child { width: 46%; }
table.sheet.fit th, table.sheet.fit td { white-space: normal; overflow-wrap: anywhere; }
table.sheet th, table.sheet td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; }
table.sheet th { background: var(--bg-elev); font-weight: 500; }
.out { overflow-x: auto; }
.out table.sheet { width: max-content; min-width: 100%; }
.out table.sheet th, .out table.sheet td { white-space: nowrap; }
.step-btn, .choice, .opt { cursor: pointer; }
.teaching + .teaching { margin-top: -0.2em; }
.worked { margin-top: 16px; }
.worked h3 { font-family: var(--sans); letter-spacing: 0; font-size: 1.02rem; }
.steps { margin: 0.3em 0 0; padding-left: 1.25em; }
.steps li + li { margin-top: 0.45em; }
.grid-2 + .grid-2, .teaching + .grid-2, .grid-2 + .worked, .grid-2 + .grid-3 { margin-top: 16px; }
.tabset { margin-top: 16px; }
.tabbar { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
}
.tab.is-active { background: var(--teal); color: var(--teal-ink); border-color: var(--teal); }
.tabpanel { margin-top: 12px; }
.tabpanel.is-hidden { display: none; }
.tabpanel h3 { font-family: var(--sans); letter-spacing: 0; font-size: 1rem; margin-top: 14px; }
.tabpanel h3:first-child { margin-top: 0; }
.teach-list {
  margin: 0.35em 0 0;
  padding-left: 1.25em;
}
.teach-list li + li { margin-top: 0.35em; }
.answer-reveal {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 16px;
  padding-bottom: 8px;
}
.answer-reveal .btn {
  width: 100%;
  max-width: 280px;
  min-height: 44px;
  touch-action: manipulation;
}
.answer-scheme {
  margin-top: 4px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}
.answer-scheme.is-hidden { display: none; }
.answer-scheme h3 {
  font-family: var(--sans);
  letter-spacing: 0;
  font-size: 1rem;
  margin: 0 0 8px;
}
.answer-sheet-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.answer-sheet {
  width: 100%;
  min-width: 520px;
  margin-top: 0;
}
.answer-sheet th,
.answer-sheet td {
  white-space: normal;
  vertical-align: top;
  overflow-wrap: break-word;
}
.answer-sheet th:first-child,
.answer-sheet td:first-child {
  width: 4.5rem;
  white-space: nowrap;
}
@media (max-width: 860px) {
  .answer-reveal .btn {
    max-width: none;
    width: 100%;
  }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tab { width: 100%; text-align: center; }
}
.pseudo {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  color: #d6deeb;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 0 0;
}
.tabpanel .pseudo {
  height: 20rem;
  max-height: 50vh;
}
.pseudo .tok-key { color: #c4b5fd; }
.pseudo .tok-type { color: var(--blue); }
.pseudo .tok-fn { color: var(--teal); }
.pseudo .tok-string { color: var(--amber); }
.pseudo .tok-number { color: var(--coral); }
.pseudo .tok-comment { color: var(--faint); font-style: italic; }
.pc-code .pc-highlight.pseudo {
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.chart { display: flex; flex-direction: column; align-items: center; margin-top: 8px; }
.chart-card + .chart-card { margin-top: 18px; }
.shape, .diamond {
  font-family: var(--mono);
  font-size: 0.86rem;
  text-align: center;
}
.shape {
  border: 2px solid var(--blue);
  background: var(--bg-elev);
  min-width: 190px;
  max-width: min(460px, 100%);
  padding: 10px 16px;
}
.shape.term { border-radius: 999px; border-color: var(--teal); }
.shape.process { border-radius: 4px; }
.shape.io { transform: skewX(-14deg); border-color: var(--amber); padding-inline: 22px; }
.shape.io .unskew { display: inline-block; transform: skewX(14deg); }
.shape.sub {
  position: relative;
  border-color: var(--teal);
  border-radius: 4px;
  padding: 12px 36px;
}
.shape.sub::before,
.shape.sub::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 4px;
  background: var(--teal);
}
.shape.sub::before { left: 12px; }
.shape.sub::after { right: 12px; }
.diamond {
  width: 200px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 42px;
}
.diamond::before {
  content: "";
  position: absolute;
  inset: 18px 10px;
  border: 2px solid var(--coral);
  background: var(--bg-elev);
  transform: rotate(45deg);
}
.diamond span { position: relative; z-index: 1; }
.flow-arrow {
  width: 2px;
  height: 22px;
  background: var(--muted);
  position: relative;
  margin: 2px 0;
}
.flow-arrow::after {
  content: "";
  position: absolute;
  left: -4px;
  bottom: -1px;
  border: 5px solid transparent;
  border-top-color: var(--muted);
}
.flow-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: min(680px, 100%);
  margin-top: 4px;
}
.flow-col { display: flex; flex-direction: column; align-items: center; }
.flow-label { margin: 0 0 6px; font-family: var(--sans); font-size: 0.95rem; color: var(--amber); }
.flow-back { margin: 8px 0 0; max-width: 26ch; text-align: center; color: var(--teal); font-size: 0.88rem; }
.flow-svg { width: min(720px, 100%); height: auto; display: block; margin: 8px auto 0; }
.flow-svg.idea-svg { width: 100%; min-width: 720px; margin: 0; }
.flow-svg.media-svg { width: auto; height: auto; max-width: none; min-width: 0; margin: 0; display: block; }
.flow-svg .flow-small { font-size: 13px; }
.flow-svg .flow-drop { fill: var(--faint); }
.flow-svg .flow-keep { fill: var(--teal); }
.idea > * + * { margin-top: 12px; }
.struct-svg { width: min(960px, 100%); }
.flow-svg .flow-line { fill: none; stroke: var(--muted); stroke-width: 2; }
.flow-svg .flow-head { fill: var(--muted); }
.flow-svg .flow-term,
.flow-svg .flow-process,
.flow-svg .flow-io,
.flow-svg .flow-decision { fill: var(--bg-elev); stroke-width: 2; }
.flow-svg .flow-term { stroke: var(--teal); }
.flow-svg .flow-process { stroke: var(--blue); }
.flow-svg .struct-root,
.flow-svg .struct-part { fill: var(--bg-elev); stroke-width: 2; }
.flow-svg .struct-root { stroke: var(--teal); }
.flow-svg .struct-part { stroke: var(--blue); }
.flow-svg .flow-io { stroke: var(--amber); }
.flow-svg .flow-decision { stroke: var(--coral); }
.flow-svg text {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
}
.flow-svg .flow-tag { fill: var(--amber); font-size: 13px; }
.flow-svg .flow-back { fill: var(--teal); font-size: 13px; max-width: none; margin: 0; text-align: left; }
.sim-grid { margin-top: 16px; }
#ledger { margin: 8px 0 0; padding-left: 1.15em; }
#ledger li + li { margin-top: 0.35em; }

@media (min-width: 861px) {
  .media-body { grid-template-columns: auto minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .hero-grid, .grid-2, .grid-3, .grid-6, .panes, .jars, .flow, .flow.six, .chain, .calc-grid, .flow-split { grid-template-columns: 1fr; }
  .header-row { flex-wrap: wrap; padding-bottom: 8px; }
  .hero { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .car { animation: none; left: 18%; }
}

@keyframes drive {
  from { left: 10%; }
  to { left: 68%; }
}

html.locked body > :not(#site-gate) { display: none !important; }

#site-gate {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

#site-gate form {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
}

#site-gate h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }

#site-gate input { background: var(--bg); }

#site-gate .btn { width: 100%; margin-top: 14px; }

#site-gate .feedback { margin: 12px 0 0; }

@media print {
  body { background: white; color: black; }
  body::before, header, .toc, .mobile-toc, .stage, .lab, .actions, footer .fine { display: none !important; }
  .page-shell { display: block; width: auto; }
  .card, .callout, .q, .fn, .map-card, .worked, .shape, .diamond::before { break-inside: avoid; border-color: #ccc; background: white; }
  .shape.sub::before, .shape.sub::after { background: black; }
  .flow-svg .flow-term,
  .flow-svg .flow-process,
  .flow-svg .flow-io,
  .flow-svg .flow-decision,
  .flow-svg .struct-root,
  .flow-svg .struct-part { fill: white; stroke: black; }
  .flow-svg text, .flow-svg .flow-tag, .flow-svg .flow-back { fill: black; }
  .flow-svg .flow-line { stroke: black; }
  .flow-svg .flow-head { fill: black; }
  .flow-svg.idea-svg, .flow-svg.media-svg { min-width: 0; width: 100%; max-width: 100%; height: auto; }
  .media-svg .disc,
  .media-svg .surface,
  .media-svg .laser,
  .media-svg .gate,
  .media-svg .float,
  .media-svg .base { fill: white; stroke: black; }
  .media-svg .track,
  .media-svg .arm,
  .media-svg .leader,
  .media-svg .beam,
  .media-svg .beam-miss { stroke: black; }
  .media-svg .hub,
  .media-svg .head,
  .media-svg .charge,
  .media-svg .sector { fill: #ddd; stroke: black; }
  .tabpanel.is-hidden { display: block !important; }
  .tabbar { display: none; }
  .pseudo, .pseudo span { color: black; background: white; font-style: normal; }
  a { color: black; }
}
