:root {
  --bg: #f6f3ec;
  --bg-elev: #fffdf8;
  --ink: #1d1b17;
  --muted: #6b665c;
  --line: #ddd6c8;
  --accent: #c2541b;
  --accent-ink: #fff;
  --pass: #2f8f5b;
  --fail: #b8403a;
  --warn: #b7862a;
  --grid: #d9d2c3;
  --glow: #e07a3f;
  --stage-bg: #efe9dd;
  --font-body: "Inter", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --bg-elev: #171a21; --ink: #ebe7df; --muted: #9a958b; --line: #2a2e38;
    --accent: #f08a4b; --accent-ink: #1a1009; --pass: #4fc488; --fail: #f0706a; --warn: #e8b552;
    --grid: #262a33; --glow: #ff9a5c; --stage-bg: #0b0d11; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --bg-elev: #171a21; --ink: #ebe7df; --muted: #9a958b; --line: #2a2e38;
  --accent: #f08a4b; --accent-ink: #1a1009; --pass: #4fc488; --fail: #f0706a; --warn: #e8b552;
  --grid: #262a33; --glow: #ff9a5c; --stage-bg: #0b0d11; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.7 var(--font-body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
code, .mono { font-family: var(--font-mono); font-size: .88em; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--font-display); font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; }
#act-nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
#act-nav a { font-size: 13px; color: var(--muted); text-decoration: none; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
#act-nav a.active { background: var(--ink); color: var(--bg); }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; }

/* Layout: text column on the left, sticky 3D stage on the right. */
.layout { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 0; max-width: 1600px; margin: 0 auto; }
.layout > main { grid-column: 1; grid-row: 1; padding: 0 28px 20vh 36px; position: relative; z-index: 2; }
.stage-wrap { grid-column: 2; grid-row: 1; position: sticky; top: 55px; height: calc(100vh - 55px); }
#stage { position: absolute; inset: 0; background: var(--stage-bg); border-left: 1px solid var(--line); overflow: hidden; }
#stage canvas { display: block; }
.stage-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; padding: 24px; text-align: center; }
.stage-fallback[hidden] { display: none; }
.stage-caption { position: absolute; left: 16px; bottom: 14px; right: 16px; font: 500 12px/1.4 var(--font-mono); color: var(--muted); pointer-events: none; }
.label3d { font: 500 12px/1.25 var(--font-mono); color: var(--ink); background: color-mix(in srgb, var(--bg-elev) 85%, transparent); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.label3d.wrap { white-space: normal; max-width: 240px; text-align: center; }
.label3d.accent { border-color: var(--accent); color: var(--accent); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .stage-wrap { grid-column: 1; grid-row: 1; top: 55px; height: 40vh; z-index: 1; }
  .layout > main { grid-row: 2; padding: 0 16px 30vh; }
}

.hero { padding: 12vh 0 8vh; }
.kicker { font: 500 12px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.lede { font-size: 1.15rem; color: var(--ink); }
.legend { font-size: 13px; color: var(--muted); line-height: 2; }

.act { padding-top: 10vh; }
.act-head { margin-bottom: 4vh; }
.step { padding: 3.5vh 0; min-height: 38vh; opacity: .45; transition: opacity .35s; }
.step.active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .step { transition: none; } }
.step p { margin: 0 0 1em; }

/* Claim badges */
.claim { border-bottom: 1px dotted var(--muted); }
.badge { display: inline-block; font: 500 10px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; padding: 3px 5px; border-radius: 4px; vertical-align: 2px; margin-left: 3px; text-decoration: none; white-space: nowrap; }
.badge-stated { background: color-mix(in srgb, var(--pass) 16%, transparent); color: var(--pass); }
.badge-secondary { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge-inferred { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.badge-sim { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

/* Prediction blocks */
.predict { border: 1px solid var(--line); background: var(--bg-elev); border-radius: var(--radius); padding: 14px 16px; margin: 1.2em 0; }
.predict .q { font-weight: 600; margin-bottom: 10px; }
.predict .q::before { content: "Predict first · "; font: 500 11px var(--font-mono); text-transform: uppercase; color: var(--accent); }
.predict .opts { display: grid; gap: 6px; }
.predict button.opt { text-align: left; font: inherit; font-size: 15px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.predict button.opt:hover:not(:disabled) { border-color: var(--ink); }
.predict button.opt.right { border-color: var(--pass); background: color-mix(in srgb, var(--pass) 12%, var(--bg)); }
.predict button.opt.wrong { border-color: var(--fail); background: color-mix(in srgb, var(--fail) 10%, var(--bg)); }
.predict .reveal { margin-top: 12px; }
.predict .reveal[hidden] { display: none; }

/* Expanders: one level down */
details.expand { border-left: 2px solid var(--line); padding: 2px 0 2px 14px; margin: .8em 0; }
details.expand summary { cursor: pointer; font-weight: 500; list-style: none; }
details.expand summary::before { content: "+ "; color: var(--accent); font-family: var(--font-mono); }
details.expand[open] summary::before { content: "− "; }
details.expand .teaser { color: var(--muted); font-weight: 400; font-size: 14px; }
details.expand .body { margin-top: 8px; font-size: 15.5px; }

/* Widgets */
.widget { margin: 1.2em 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); font-size: 15px; }
.widget label { display: block; font-size: 13px; color: var(--muted); }
.widget input[type="range"] { width: 100%; accent-color: var(--accent); }
.widget .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.widget button, .seg button { font: 500 14px var(--font-body); background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.stat { font: 500 22px/1.2 var(--font-mono); }
.stat-label { font-size: 12px; color: var(--muted); }
.widget table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.widget th, .widget td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.widget svg { width: 100%; height: auto; display: block; }
.widget svg text { fill: var(--muted); font: 11px var(--font-mono); }

.site-footer { margin-top: 12vh; padding-top: 4vh; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.site-footer ol { padding-left: 1.2em; }

/* quiz ─────────────────────────────────────────────────────────── (owner: quiz agent) */
.widget.quiz { padding: 16px 18px; }
.quiz-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 10px; outline: none; }
.quiz-count { font: 500 12px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.quiz-dots { display: inline-flex; gap: 4px; }
.quiz-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); }
.quiz-dots i.cur { border-color: var(--accent); background: var(--accent); }
.quiz-dots i.ok { border-color: var(--pass); background: var(--pass); }
.quiz-dots i.miss { border-color: var(--fail); background: color-mix(in srgb, var(--fail) 35%, var(--bg)); }
.quiz-tag { font: 500 11px/1 var(--font-mono); padding: 4px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.quiz-tag.recovery { border-color: var(--warn); color: var(--warn); }
.quiz-situation { font-weight: 500; margin: 0 0 12px; }
.quiz code, .quiz-opt code { font-size: .85em; background: color-mix(in srgb, var(--muted) 12%, transparent); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }
.quiz-opts { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; min-width: 0; }
.quiz-opts legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.widget .quiz-opt { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; line-height: 1.5; }
.quiz-opt:hover { border-color: var(--ink); }
.quiz-opt:has(input:checked) { border-color: var(--accent); }
.quiz-opt:has(input:disabled) { cursor: default; }
.quiz-opt:has(input:disabled):hover { border-color: var(--line); }
.quiz-opt input { margin-top: 5px; accent-color: var(--accent); flex: none; }
.quiz-opt-text { flex: 1; min-width: 0; }
.quiz-opt.is-best { border-color: var(--pass); background: color-mix(in srgb, var(--pass) 10%, var(--bg)); }
.quiz-opt.is-picked:not(.is-best) { border-color: var(--fail); background: color-mix(in srgb, var(--fail) 8%, var(--bg)); }
.quiz-grade { flex: none; font: 500 10px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; padding: 4px 6px; border-radius: 4px; margin-top: 3px; }
.quiz-grade.g-best { background: color-mix(in srgb, var(--pass) 18%, transparent); color: var(--pass); }
.quiz-grade.g-second { background: color-mix(in srgb, var(--pass) 10%, transparent); color: var(--pass); }
.quiz-grade.g-flawed { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.quiz-grade.g-harmful { background: color-mix(in srgb, var(--fail) 16%, transparent); color: var(--fail); }
.quiz-grade.g-distractor { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.quiz-error { color: var(--fail); font-size: 14px; margin: 8px 0 0; }
.quiz-error[hidden] { display: none; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.widget button.quiz-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.widget button.quiz-reset { color: var(--fail); }
.quiz-feedback { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.quiz-feedback p { margin: 0 0 .7em; }
.quiz-verdict { font-weight: 600; outline: none; }
.quiz-verdict .quiz-grade { vertical-align: 2px; margin-right: 4px; }
.quiz-best { border-left: 2px solid var(--pass); padding-left: 12px; margin: 0 0 .8em; }
.quiz-best blockquote { margin: 0 0 .5em; font-style: italic; }
.quiz-expl { color: var(--ink); }
.quiz-sub { font-size: 12px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.quiz-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: .6em; }
.quiz-chip { display: inline-flex; gap: 5px; align-items: baseline; font-size: 13px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); cursor: default; white-space: nowrap; }
.quiz-chip b { font: 600 11px var(--font-mono); color: var(--accent); }
.quiz-chip:hover, .quiz-chip:focus-visible { background: color-mix(in srgb, var(--accent) 20%, var(--bg)); outline: none; }
.quiz-links { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.quiz-why { font-weight: 500; text-decoration: none; }
.quiz-why:hover { text-decoration: underline; }
.quiz-evidence { font-size: 12.5px; color: var(--muted); }
.quiz-evidence a { color: var(--muted); }
details.quiz-write { margin-top: 10px; border-left: 2px solid var(--line); padding-left: 12px; }
details.quiz-write summary { cursor: pointer; font-weight: 500; }
details.quiz-write .teaser { color: var(--muted); font-weight: 400; font-size: 13px; }
.quiz-write textarea { width: 100%; margin: 8px 0; font: 14px/1.5 var(--font-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.quiz-write textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
.quiz-rubric { display: grid; gap: 4px; }
.widget .quiz-rubric-item { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink); cursor: pointer; }
.quiz-rubric-item input { margin-top: 4px; accent-color: var(--accent); }
.quiz-tally { font: 500 12px var(--font-mono); color: var(--muted); margin-top: 6px; }
.quiz-summary-head { outline: none; }
.quiz-summary-head .kicker { margin-bottom: 6px; }
.quiz-score { margin: 0 0 12px; }
.widget .quiz-table td { vertical-align: middle; }
.quiz-table tr.is-weak td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.quiz-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; vertical-align: middle; }
.quiz-bar i { display: block; height: 100%; background: var(--accent); }
.quiz-weak { margin-top: 14px; }
.quiz-weak-item { border-left: 2px solid var(--accent); padding: 2px 0 2px 12px; margin: 8px 0; }
.quiz-weak-item p { margin: 6px 0 4px; font-size: 14.5px; }
@media (max-width: 520px) {
  .quiz-chip { white-space: normal; }
  .quiz-table th:nth-child(2), .quiz-table td:nth-child(2) { display: none; }
}
/* end quiz */
/* v2 blog layer: Gwern-style long read on top of the v1 stylesheet.
   Mostly monochrome paper/ink, one accent, serif body, small caps, sidenotes, popups. */
:root {
  --bg: #fcfbf8; --bg-elev: #ffffff; --ink: #161514; --muted: #6d6a64; --line: #e3dfd6;
  --accent: #a3471a; --stage-bg: #f3f0e9; --grid: #dcd7cc;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --measure: 64ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #121212; --bg-elev: #1a1a1a; --ink: #e8e6e1; --muted: #9b978f; --line: #2c2c2c; --accent: #e08a55; --stage-bg: #0c0c0c; --grid: #2a2a2a; }
}
:root[data-theme="dark"] { --bg: #121212; --bg-elev: #1a1a1a; --ink: #e8e6e1; --muted: #9b978f; --line: #2c2c2c; --accent: #e08a55; --stage-bg: #0c0c0c; --grid: #2a2a2a; }

body { font: 400 19px/1.62 var(--font-body); font-variant-numeric: oldstyle-nums proportional-nums; hyphens: auto; }
h1, h2, h3 { font-family: var(--font-body); font-weight: 600; }
.topbar, .widget, .predict, .quiz, .legend, .meta-line, .stage-caption, .toc, .badge, #act-nav a { font-family: var(--font-ui); font-variant-numeric: lining-nums tabular-nums; }
.widget, .predict { font-size: 15.5px; line-height: 1.55; }

/* Three columns on wide screens: sidenotes | text | sticky stage. */
.layout { grid-template-columns: 230px minmax(0, 640px) minmax(0, 1fr); column-gap: 36px; max-width: 1720px; }
.layout > .margin { grid-column: 1; grid-row: 1; position: relative; }
.layout > main { grid-column: 2; grid-row: 1; padding: 0 0 20vh; }
.stage-wrap { grid-column: 3; }
@media (max-width: 1279px) {
  .layout { grid-template-columns: minmax(0, 620px) minmax(0, 1fr); column-gap: 28px; }
  .layout > .margin { display: none; }
  .layout > main { grid-column: 1; padding-left: 28px; }
  .stage-wrap { grid-column: 2; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .layout > main { grid-column: 1; grid-row: 2; padding: 0 16px 30vh; }
  .stage-wrap { grid-column: 1; grid-row: 1; }
}

/* Header block */
.essay-head { padding: 9vh 0 4vh; }
.essay-head h1 { font-size: clamp(2.4rem, 5vw, 3.3rem); font-variant: small-caps; letter-spacing: 0.02em; margin-bottom: .2em; }
.subtitle { font-style: italic; font-size: 1.15rem; color: var(--muted); margin: 0 0 1em; }
.meta-line { font-size: 12.5px; color: var(--muted); margin: 0 0 1.4em; line-height: 1.6; }
.meta-line b { font-weight: 600; color: var(--ink); }
.abstract { border-left: 3px solid var(--ink); padding: 2px 0 2px 18px; margin: 0 0 1.4em; }
.abstract p { margin: 0; }
.abstract::before { content: "Abstract"; display: block; font-variant: small-caps; font-weight: 600; letter-spacing: .04em; margin-bottom: 4px; }
.legend-term { border-bottom: 1px dotted var(--ink); }
.toc { border: 1px solid var(--line); padding: 8px 14px; font-size: 14px; background: var(--bg-elev); }
.toc summary { cursor: pointer; font-weight: 600; }
.toc ol { margin: 8px 0 4px; padding-left: 1.3em; }
.toc ol ol { margin: 2px 0; font-size: 13px; color: var(--muted); }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* Acts read as chapters. */
.act { padding-top: 6vh; }
.act::before { content: "⁂"; display: block; text-align: center; color: var(--muted); font-size: 1.4rem; margin-bottom: 5vh; }
.act:first-child::before { display: none; }
.act-head h2 { font-variant: small-caps; letter-spacing: .02em; font-size: clamp(1.7rem, 3.2vw, 2.2rem); }
.act-head .kicker { font-family: var(--font-ui); }
.step { min-height: 0; padding: 2vh 0 3vh; opacity: .55; }
.step.active { opacity: 1; }
.step h3 { font-variant: small-caps; font-size: 1.2rem; letter-spacing: .02em; margin: 1.2em 0 .5em; }
.act .step:first-of-type .prose > p:first-child::first-letter {
  float: left; font-size: 3.6em; line-height: .82; padding: 4px 8px 0 0; font-weight: 600; color: var(--ink);
}
.prose p { margin: 0 0 1em; max-width: var(--measure); }
.prose code, .reveal code { font-size: .8em; background: var(--bg-elev); border: 1px solid var(--line); padding: 1px 4px; border-radius: 3px; }

/* Hover terms and cross-references */
.term { border-bottom: 1px dotted currentColor; cursor: help; }
.term:hover, .term:focus { color: var(--accent); outline: none; }
a.xref { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
a.xref::after { content: "↗"; font-size: .7em; vertical-align: super; color: var(--accent); margin-left: 1px; }
a.xref:hover { border-bottom-color: var(--accent); }

/* Sidenotes: margin notes on wide screens, numbered popups otherwise. */
.sn-ref { font: 600 11px var(--font-ui); vertical-align: super; color: var(--accent); cursor: pointer; padding: 0 1px; }
.sn-body { display: none; }
.margin-note { position: absolute; left: 0; right: 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.margin-note .n { font: 600 11px var(--font-ui); color: var(--accent); margin-right: 4px; }
.margin-note.hl { color: var(--ink); }

/* Popup card for terms, sidenotes, sources and cross-refs */
.popup { position: fixed; z-index: 50; max-width: 360px; background: var(--bg-elev); color: var(--ink); border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--ink) 12%, transparent); padding: 10px 14px; font-size: 14.5px; line-height: 1.5; }
.popup .pt { font-variant: small-caps; font-weight: 600; letter-spacing: .03em; margin-bottom: 4px; }
.popup .pm { font: 12px var(--font-ui); color: var(--muted); margin-top: 6px; }
.popup p { margin: 0 0 .5em; }
.popup p:last-child { margin: 0; }

/* Figure caption under the stage explains the visual encoding. */
.stage-caption { font: 12.5px/1.45 var(--font-ui); background: color-mix(in srgb, var(--stage-bg) 88%, transparent); padding: 6px 8px; border-top: 1px solid var(--line); bottom: 0; left: 0; right: 0; }
.stage-caption b { color: var(--ink); font-weight: 600; }
#stage { border-left: 1px solid var(--line); }

/* Going deeper sections */
details.expand { border-left: 1px solid var(--ink); }
details.expand summary::before { content: "⊕ "; }
details.expand[open] summary::before { content: "⊖ "; }
details.expand summary { font-variant: small-caps; letter-spacing: .02em; font-weight: 600; }

/* Phones: the 3D band sits above the text, and the text scrolls under it. */
@media (max-width: 900px) {
  .stage-wrap { z-index: 5; top: 49px; height: 36vh; border-bottom: 1px solid var(--line); background: var(--stage-bg); }
  .layout > main { z-index: 1; }
  .stage-caption { font-size: 11px; padding: 4px 6px; }
}
@media (max-width: 900px) {
  .label3d { font-size: 9.5px; padding: 1px 4px; }
}

/* ── v3: the stage is a dark film frame in both themes, and takes most of the width ── */
.stage-wrap { --ink: #eceae4; --muted: #8d8a83; --line: #2a2c31; --bg-elev: #15171a; --accent: #e8935a; --pass: #6fcf8a; --fail: #ef6f6c; --warn: #e6c15a; --stage-bg: #0b0c0e; color: var(--ink); }
#stage { background: #0b0c0e; border-left: 0; }
.layout { grid-template-columns: minmax(0, 540px) minmax(0, 1fr); column-gap: 30px; max-width: none; }
.layout > .margin { display: none; }
.layout > main { grid-column: 1; padding-left: 32px; }
.stage-wrap { grid-column: 2; }
@media (min-width: 1800px) {
  .layout { grid-template-columns: 220px minmax(0, 600px) minmax(0, 1fr); }
  .layout > .margin { display: block; grid-column: 1; margin-left: 24px; }
  .layout > main { grid-column: 2; padding-left: 0; }
  .stage-wrap { grid-column: 3; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .layout > main { grid-column: 1; grid-row: 2; padding: 0 16px 30vh; }
  .stage-wrap { grid-column: 1; grid-row: 1; }
}
.stage-caption { background: rgba(11, 12, 14, .86); border-top: 1px solid #2a2c31; color: #a9a59c; font-size: 13px; padding: 8px 14px; }
.stage-caption b { color: #eceae4; }
.label3d { background: rgba(21, 23, 26, .85); border-color: #2a2c31; color: #eceae4; }

.stage-overlay, .scene-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.scene-overlay[hidden] { display: none; }
.scene-overlay { font: 500 14px/1.45 "JetBrains Mono", ui-monospace, monospace; color: #eceae4; }
.ov-panel { position: absolute; max-width: min(46%, 420px); background: rgba(13, 14, 17, .82); border: 1px solid #2a2c31; padding: 10px 14px; transition: opacity .45s, transform .45s; }
.ov-panel.off { opacity: 0; transform: translateY(6px); }
.ov-tl { top: 14px; left: 14px; } .ov-tr { top: 14px; right: 14px; } .ov-tc { top: 14px; left: 50%; translate: -50% 0; }
.ov-bl { bottom: 64px; left: 14px; } .ov-br { bottom: 64px; right: 14px; } .ov-bc { bottom: 64px; left: 50%; translate: -50% 0; }
.ov-panel h4 { font: 600 11px Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #8d8a83; margin: 0 0 6px; }
.ov-panel .eq { font-size: 16px; white-space: nowrap; }
.ov-panel .slot { display: inline-block; min-width: 3.2em; text-align: center; border-bottom: 1px solid #4b4945; padding: 0 3px; }
.ov-panel .big { font-size: 26px; font-weight: 500; }
.ov-panel .sub { color: #8d8a83; font-size: 12px; }
.ov-chip { position: absolute; font: 500 13px "JetBrains Mono", monospace; padding: 1px 6px; border-radius: 3px; background: #15171a; border: 1px solid #4b4945; white-space: nowrap; }
.scene-overlay .pass { color: #6fcf8a; } .scene-overlay .fail { color: #ef6f6c; } .scene-overlay .warn { color: #e6c15a; } .scene-overlay .meant { color: #e8935a; } .scene-overlay .muted { color: #8d8a83; }
@media (max-width: 900px) { .scene-overlay { font-size: 11px; } .ov-panel { padding: 5px 8px; max-width: 60%; } .ov-panel .eq { font-size: 12px; } .ov-panel .big { font-size: 17px; } .ov-bl, .ov-br, .ov-bc { bottom: 40px; } }

/* Screenshot mode (?shot=step-id): the stage alone, filling the window. */
.shot-mode .topbar, .shot-mode main, .shot-mode .margin { display: none; }
.shot-mode .stage-wrap { position: fixed; inset: 0; height: auto; top: 0; }

/* Phones: the picture needs the band more than the caption does, so the caption is held to two lines. */
@media (max-width: 900px) {
  .stage-wrap { height: 44vh; }
  .stage-caption { font-size: 11px; line-height: 1.35; padding: 4px 8px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
}

/* Figures can be closed, for readers who only want the text. */
.text-btn { font: 500 13px var(--font-ui); background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap; margin-right: 6px; }
.text-btn:hover { border-color: var(--ink); }
.stage-close { position: absolute; top: 10px; right: 10px; z-index: 6; width: 30px; height: 30px; border-radius: 999px; border: 1px solid #3a3c41; background: rgba(13, 14, 17, .8); color: #a9a59c; font-size: 18px; line-height: 1; cursor: pointer; }
.stage-close:hover { color: #eceae4; border-color: #8d8a83; }
.text-only .stage-wrap { display: none; }
.text-only .layout { grid-template-columns: minmax(0, 660px); justify-content: center; }
.text-only .layout > main { grid-column: 1; grid-row: 1; padding: 0 20px 20vh; }
.text-only .step { opacity: 1; }
@media (min-width: 1180px) {
  .text-only .layout { grid-template-columns: 230px minmax(0, 660px) 230px; column-gap: 36px; }
  .text-only .layout > .margin { display: block; grid-column: 1; margin-left: 0; }
  .text-only .layout > main { grid-column: 2; padding: 0 0 20vh; }
}
.shot-mode .stage-close, .shot-mode .text-btn { display: none; }

/* Link back to the list of all writing. */
.topbar .back { font: 500 13px var(--font-ui); color: var(--muted); text-decoration: none; white-space: nowrap; margin-right: 14px; }
.topbar .back:hover { color: var(--accent); }
.shot-mode .back { display: none; }
/* Before JavaScript runs (or without it), a sidenote reads as a bracketed aside in the text. */
.prose span.sn { color: var(--muted); font-size: .9em; }
.prose span.sn::before { content: " ["; } .prose span.sn::after { content: "] "; }
.byline { font: 500 13.5px var(--font-ui); color: var(--ink); margin: 0 0 4px; }

/* Phones: the top bar must fit the screen. A bar wider than the screen widens the whole page
   and pushes the right side of every figure out of view. */
html, body { overflow-x: clip; }
.topbar > * { flex-shrink: 0; }
.topbar #act-nav { flex: 1 1 0; min-width: 0; }
@media (max-width: 900px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .topbar .brand { display: none; }           /* the title is the page heading just below */
  .topbar .back { margin-right: 2px; }
  .topbar .text-btn { padding: 5px 9px; font-size: 12px; margin-right: 0; }
  .topbar .icon-btn { width: 30px; height: 30px; font-size: 14px; }
  #act-nav a { padding: 4px 8px; font-size: 12px; }
}

/* A figure that can be turned says so, until the reader has tried it. */
.stage-hint { position: absolute; right: 12px; bottom: 72px; font: 500 11px var(--font-ui); letter-spacing: .04em; color: #a9a59c; background: rgba(13, 14, 17, .8); border: 1px solid #2a2c31; border-radius: 999px; padding: 3px 9px; pointer-events: none; opacity: 0; transition: opacity .4s; }
.can-orbit .stage-hint { opacity: 1; }
.can-orbit.orbit-used .stage-hint { opacity: 0; }
.can-orbit canvas { cursor: grab; }
.can-orbit canvas:active { cursor: grabbing; }
.shot-mode .stage-hint { display: none; }
@media (max-width: 900px) { .stage-hint { bottom: 46px; right: 8px; font-size: 10px; } }
