/* Agent Harness course: shared stylesheet.
   World: a CI pipeline. Lessons are stages on a rail; incidents read as a failed run next to the
   harness run; finishing a lesson's "Done when" list passes the stage and earns its badge.
   Light is the default; dark applies only when the reader picks it (data-theme="dark"). */

:root {
  --bg: #fbf8f2;
  --surface: #f4eee2;
  --surface-2: #ebe2d0;
  --ink: #2a2318;
  --ink-2: #4f4434;
  --ink-3: #6f6249;
  --line: #e6dcc8;
  --line-strong: #cbbb9a;
  --accent: #8a5a12;
  --accent-ink: #ffffff;
  --accent-soft: #f6e8c8;
  --pass: #2f7a3d;
  --pass-soft: #e8f3e6;
  --fail: #a3321f;
  --fail-soft: #fbebe6;
  --warn: #8a4f00;
  --warn-soft: #fbf0d9;
  --code-bg: #f1eadb;
  --wood-1: #3b2f21;
  --wood-2: #231b12;
  --brass-1: #f7da86;
  --brass-2: #c4902a;
  --tape: #ff7a1a;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 22px -10px rgba(60, 40, 10, .22);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 44rem;
  --wide: 1040px;
  --radius: 12px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15110c;
  --surface: #1f1912;
  --surface-2: #2a2218;
  --ink: #f1e8d8;
  --ink-2: #d4c6ad;
  --ink-3: #ab9b7e;
  --line: #33291d;
  --line-strong: #4b3d2b;
  --accent: #e9c26b;
  --accent-ink: #1a140c;
  --accent-soft: #3a2c14;
  --pass: #7fd18f;
  --pass-soft: #16281a;
  --fail: #ff8d7a;
  --fail-soft: #2e1712;
  --warn: #f2b85a;
  --warn-soft: #2c2110;
  --code-bg: #231c13;
  --wood-1: #2a2117;
  --wood-2: #120e09;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px -10px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
}

/* ---------- Layout: a wide stage, prose kept at a readable measure ---------- */
main { max-width: calc(var(--wide) + 48px); margin: 0 auto; padding: 40px 24px 96px; }
main > * { max-width: var(--measure); margin-left: 0; margin-right: auto; }
main > .incident, main > .table-wrap, main > .diagram, main > .exercise, main > figure.code,
main > details.deeper, main > .modes, main > .split, main > .lesson-head, main > .wide,
main > .cols, main > .toc, main > nav.lesson-nav { max-width: var(--wide); }
body.ref main > * { max-width: var(--wide); }

/* ---------- Type ---------- */
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
h1, h2 { font-family: var(--serif); }
h1 { font-size: clamp(2.1rem, 1.5rem + 2vw, 2.9rem); font-weight: 700; margin: .15em 0 .35em; }
h2 { font-size: 1.6rem; font-weight: 700; margin: 2.4em 0 .7em; }
h3 { font-size: 1.15rem; font-weight: 680; margin: 1.8em 0 .5em; }
p, ul, ol { margin-top: 0; margin-bottom: 1em; }
li { margin: .3em 0; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 650; }
small, .small { font-size: .88em; color: var(--ink-3); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
dfn { font-style: normal; font-weight: 650; border-bottom: 1px dashed var(--line-strong); }
.lede { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); }
.kicker { font-size: .85rem; font-weight: 600; color: var(--ink-3); }
.kicker a { color: inherit; }

/* ---------- Code ---------- */
code, kbd, pre { font-family: var(--mono); font-size: .86em; }
:not(pre) > code { background: var(--code-bg); padding: .1em .38em; border-radius: 6px; overflow-wrap: anywhere; }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 .35em; background: var(--bg); }
pre { background: var(--code-bg); padding: 14px 16px; border-radius: 10px; overflow-x: auto; line-height: 1.55; margin: 0 0 1.2em; tab-size: 2; }
figure.code { margin: 0 0 1.4em; }
figure.code figcaption { font: 600 .78rem/1.4 var(--mono); color: var(--ink-3); margin-bottom: 6px; }
figure.code pre { margin: 0; }
pre .hl { background: var(--accent-soft); display: inline-block; width: 100%; }
pre .dim { color: var(--ink-3); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin-bottom: 1.6em; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; line-height: 1.5; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-weight: 650; color: var(--ink-2); background: var(--surface); }
table.tools td:first-child { font-weight: 650; white-space: nowrap; }

/* ---------- Cabinet: the course map as a shelf of plaques (built by course.js) ---------- */
.cabinet {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 20px 0;
  background: linear-gradient(var(--wood-1), var(--wood-2));
  border-bottom: 6px solid #8a6a3e;
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .5);
  font-size: .85rem; color: #e9d8b4;
}
.cabinet .brand { font: 700 1.05rem/1 var(--serif); color: var(--brass-1); text-decoration: none; white-space: nowrap; padding-bottom: 10px; }
.shelf { display: flex; align-items: flex-end; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 16px 2px 10px; }
.shelf::-webkit-scrollbar { display: none; }
.shelf a {
  position: relative; flex: 0 0 auto;
  display: grid; place-items: center;
  width: 38px; height: 44px; border-radius: 6px;
  font: 700 .78rem/1 var(--sans); text-decoration: none;
  color: #9c8664; border: 2px dashed #6b5a40;
  transition: transform .15s ease-out;
}
.shelf a:hover { transform: translateY(-2px); color: var(--brass-1); }
.shelf a.passed { border: 0; color: #3a2a08; background: linear-gradient(145deg, var(--brass-1), var(--brass-2) 62%, var(--brass-1)); box-shadow: 0 3px 8px rgba(0, 0, 0, .45); }
.shelf a.passed svg { width: 20px; height: 20px; }
.shelf a.current { border-style: solid; border-color: var(--brass-1); color: var(--brass-1); }
.shelf a.passed.current { outline: 2px solid var(--brass-1); outline-offset: 3px; }
.shelf a.flag::after {
  content: ""; position: absolute; top: -15px; left: 50%; width: 14px; height: 18px; margin-left: -7px;
  background: var(--tape); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
}
.cabinet .meter { white-space: nowrap; color: #e9d8b4; font-weight: 600; padding-bottom: 10px; text-decoration: none; }
.cabinet .meter:hover { text-decoration: underline; }
.cabinet .meter b { color: var(--brass-1); }
.theme-toggle {
  font: 600 .78rem/1 var(--sans); color: #e9d8b4; background: transparent;
  border: 1px solid #6b5a40; border-radius: 999px; padding: 7px 12px; cursor: pointer; margin-bottom: 10px;
}
.theme-toggle:hover { color: var(--brass-1); border-color: var(--brass-1); }

/* ---------- Lesson head ---------- */
.lesson-head { margin-bottom: 1.8em; }
.lesson-head .stage { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 650; color: var(--accent); }
.lesson-head h1 { margin-left: 0; max-width: 24ch; }
.lesson-head .lede { max-width: 62ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
}
.chip.badge-chip { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chip.badge-chip.earned { color: var(--pass); background: var(--pass-soft); }

/* ---------- Panels (notes, sources, recall, done) ---------- */
.note, .source, .ask, .recall, .done, .tldr {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 1.4em; font-size: .97rem;
}
.note > :last-child, .source > :last-child, .ask > :last-child, .recall > :last-child, .done > :last-child, .tldr > :last-child { margin-bottom: 0; }
.label { display: block; font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-bottom: .45em; }
.source .label { color: var(--accent); }
.recall { background: var(--warn-soft); border-color: transparent; }
.recall .label { color: var(--warn); }
.tldr { background: var(--accent-soft); border-color: transparent; }
.tldr .label { color: var(--accent); }
.tldr ul { margin: 0; padding-left: 1.1em; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split > * { margin: 0; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }

/* ---------- Incident: a failed run next to the harness run ---------- */
.incident {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 1.8em; font-size: .96rem;
}
.incident > div { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 18px 16px; box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.incident h4 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 -18px 14px; padding: 12px 18px;
  font-size: .9rem; font-weight: 700; letter-spacing: 0;
  border-bottom: 1px solid var(--line);
}
.incident h4::before {
  content: ""; flex: 0 0 20px; height: 20px; border-radius: 50%;
  background-repeat: no-repeat; background-position: center; background-size: 12px;
}
.incident .happened h4 { background: var(--fail-soft); color: var(--fail); }
.incident .happened h4::before { background-color: var(--fail); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3L3 9' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.incident .harness h4 { background: var(--pass-soft); color: var(--pass); }
.incident .harness h4::before { background-color: var(--pass); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.5l2.3 2.3L9.5 3.8' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.incident p:last-child, .incident pre:last-child { margin-bottom: 0; }
.incident pre { font-size: .8rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.incident .who { color: var(--ink-3); font-size: .82rem; margin-top: .8em; }
@media (max-width: 760px) { .incident { grid-template-columns: 1fr; } }

/* ---------- Version badge ---------- */
.ver {
  display: inline-block; font: 650 .7rem/1.6 var(--sans); color: var(--warn); background: var(--warn-soft);
  border-radius: 999px; padding: 0 .6em; vertical-align: .1em; white-space: nowrap;
}
.ver.unverified { color: var(--fail); background: var(--fail-soft); }

/* ---------- Interactive diagram (D2 SVG + stepper) ---------- */
.diagram { margin: 0 0 1.8em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow); overflow: hidden; }
.diagram .canvas { padding: 18px 18px 6px; overflow-x: auto; }
.diagram svg { display: block; width: 100%; max-width: 900px; height: auto; min-width: 560px; margin: 0 auto; }
.diagram svg .fill-N1 { fill: var(--ink); }
.diagram svg .fill-N2 { fill: var(--ink-3); }
.diagram svg .fill-N7 { fill: var(--bg); }
.diagram svg .fill-B6 { fill: var(--surface); }
.diagram svg .stroke-B1, .diagram svg .stroke-B2 { stroke: var(--line-strong); }
.diagram svg .fill-B1, .diagram svg .fill-B2 { fill: var(--ink-3); }
.diagram svg g { transition: opacity .25s ease-out; }
.diagram svg g.on > g.shape > rect { stroke: var(--accent); stroke-width: 3; fill: var(--accent-soft); }
.diagram svg .on path { stroke: var(--accent); }
.diagram svg .on .fill-B1, .diagram svg .on .fill-B2, .diagram svg .on polygon { fill: var(--accent); }
.diagram.stepping svg g[class*=" s"]:not(.on), .diagram.stepping svg g[class^="s"]:not(.on) { opacity: .28; }
.diagram .bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface);
}
.diagram .caption { flex: 1; min-width: 220px; font-size: .95rem; color: var(--ink-2); }
.diagram .caption b { color: var(--ink); }
.diagram .dots { display: flex; gap: 6px; }
.diagram .dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.diagram .dots span.on { background: var(--accent); }

/* ---------- Mode strip ---------- */
.modes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0 0 1.6em; }
.modes > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); font-size: .85rem; color: var(--ink-2); }
.modes > div b { display: block; font: 650 .9rem/1.3 var(--mono); color: var(--ink); margin-bottom: 4px; }
.modes > div.you { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modes > div.you::after { content: "Default on v2.1.283+"; display: block; margin-top: 6px; font-size: .75rem; font-weight: 700; color: var(--accent); }
.modes-scale { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 600; color: var(--ink-3); margin: -1em 0 1.8em; max-width: var(--wide); }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: 650 .85rem/1 var(--sans); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--ink-3); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:focus-visible, .quiz button.opt:focus-visible, .shelf a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Quiz ---------- */
.quiz { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 1.2em; background: var(--bg); font-size: .97rem; }
.recall .quiz { margin-top: .8em; }
.quiz .q { font-weight: 650; margin: 0 0 .8em; }
.quiz .opts { display: grid; gap: 8px; }
.quiz button.opt {
  display: flex; align-items: center; gap: 12px;
  font: inherit; text-align: left; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 14px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.quiz button.opt .key {
  flex: 0 0 24px; height: 24px; display: grid; place-items: center;
  font: 700 .75rem/1 var(--sans); color: var(--ink-3); border: 1px solid var(--line-strong); border-radius: 6px;
}
.quiz button.opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.quiz button.opt:disabled { cursor: default; }
.quiz button.opt.right { border-color: var(--pass); background: var(--pass-soft); }
.quiz button.opt.right .key { background: var(--pass); border-color: var(--pass); color: #fff; }
.quiz button.opt.wrong { border-color: var(--fail); background: var(--fail-soft); }
.quiz button.opt.wrong .key { background: var(--fail); border-color: var(--fail); color: #fff; }
.quiz .why { display: none; margin: .9em 0 0; color: var(--ink-2); font-size: .93rem; }
.quiz.answered .why { display: block; }
.quiz .retry { display: none; margin-top: .8em; }
.quiz.answered.missed .retry { display: inline-flex; }
.score { font-size: .9rem; font-weight: 650; color: var(--ink-2); }
.score .streak { color: var(--warn); }

/* ---------- Exercise: pipeline steps ---------- */
.exercise { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px 8px; margin: 0 0 1.6em; background: var(--bg); box-shadow: var(--shadow); }
.exercise > .label { color: var(--pass); font-size: .85rem; }
.exercise ol { list-style: none; counter-reset: step; padding: 0; margin: 1em 0; }
.exercise ol > li { counter-increment: step; position: relative; padding: 0 0 18px 44px; margin: 0; }
.exercise ol > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 700 .8rem/1 var(--sans); color: var(--accent); background: var(--accent-soft);
}
.exercise ol > li::after { content: ""; position: absolute; left: 13px; top: 32px; bottom: 4px; width: 2px; background: var(--line); }
.exercise ol > li:last-child::after { display: none; }
.exercise pre { margin: .6em 0; }
.exercise .tools-note { font-size: .9rem; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- Checklist and badge award ---------- */
ul.check { list-style: none; padding-left: 0; margin: 0; }
ul.check li { display: flex; gap: .7em; align-items: flex-start; padding: 4px 0; }
ul.check input { appearance: none; flex: 0 0 20px; height: 20px; margin-top: .2em; border: 2px solid var(--line-strong); border-radius: 6px; background: var(--bg); cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s; }
ul.check input:checked { background: var(--pass); border-color: var(--pass); }
ul.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
ul.check input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.award {
  display: none; grid-template-columns: auto 1fr; gap: 20px; align-items: center;
  margin-top: 18px; padding: 20px 22px; border-radius: 14px;
  background: linear-gradient(var(--wood-1), var(--wood-2)); color: #e9d8b4;
  box-shadow: inset 0 0 0 3px #8a6a3e, var(--shadow);
}
.done.complete .award { display: grid; }
.award .plaque {
  width: 92px; height: 108px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brass-1), var(--brass-2) 62%, var(--brass-1));
  box-shadow: 0 6px 14px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .35);
  color: #3a2a08;
}
.award .plaque svg { width: 54px; height: 54px; }
.award .kick { font: 700 .72rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--brass-1); }
.award h3 { margin: .3em 0 .2em; font: 700 1.5rem/1.2 var(--serif); color: #fff3d6; }
.award p { margin: 0 0 .3em; font-size: .92rem; color: #e9d8b4; }
.award .built { color: #fff3d6; }
.award .btn { margin-top: .6em; background: var(--brass-1); border-color: var(--brass-1); color: #3a2a08; }
.done.complete .award .plaque { animation: stamp .6s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes stamp { from { transform: scale(1.8) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .done.complete .award .plaque { animation: none; } .diagram svg g, .shelf a { transition: none; } }

/* ---------- Going deeper ---------- */
details.deeper { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1.4em; background: var(--bg); font-size: .96rem; }
details.deeper > summary { list-style: none; cursor: pointer; padding: 12px 18px; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: 10px; }
details.deeper > summary::-webkit-details-marker { display: none; }
details.deeper > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
details.deeper[open] > summary::before { transform: rotate(45deg); }
details.deeper > :not(summary) { margin-left: 18px; margin-right: 18px; }
details.deeper > :last-child { margin-bottom: 16px; }

/* ---------- Lesson nav, course index ---------- */
nav.lesson-nav { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--line); font-size: .95rem; font-weight: 600; }
.toc { list-style: none; padding: 0; }
.toc li { display: grid; grid-template-columns: 3em 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 10px; background: var(--bg); }
.toc .n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line-strong); font: 700 .8rem/1 var(--sans); color: var(--ink-3); }
.toc li.passed .n { background: var(--pass); border-color: var(--pass); color: #fff; }
.toc .t a { font-weight: 680; text-decoration: none; color: var(--ink); }
.toc .t a:hover { color: var(--accent); }
.toc .t small { display: block; }
.toc .st { font-size: .8rem; font-weight: 650; color: var(--pass); white-space: nowrap; }

/* ---------- Reference sheets ---------- */
body.ref { font-size: 16px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }
.cols > * { min-width: 0; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  main { padding-top: 28px; }
  .cabinet { gap: 10px; padding: 8px 12px 0; }
  .cabinet .meter { display: none; }
}


/* ---------- Illustrated diagrams (hand-built SVG, themed by these classes) ---------- */
.diagram svg .track { fill: none; stroke: var(--line); stroke-width: 18; }
.diagram svg .ring-node { fill: var(--bg); stroke: var(--line-strong); stroke-width: 2.5; }
.diagram svg .ico { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.diagram svg .lbl { font: 700 17px var(--sans); fill: var(--ink); text-anchor: middle; }
.diagram svg .sub { font: 14px var(--sans); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .hub { font: 700 20px var(--serif); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .hubsub { font: 14px var(--sans); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .arc { fill: none; stroke: var(--ink-3); stroke-width: 2.5; }
.diagram svg .head { fill: var(--ink-3); }
.diagram svg .num { font: 800 15px var(--sans); fill: var(--accent); text-anchor: middle; }
.diagram svg .deny { font: 700 13px var(--sans); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .st.on .ring-node { stroke: var(--accent); stroke-width: 4; fill: var(--accent-soft); }
.diagram svg .st.on .ico { stroke: var(--accent); }
.diagram svg .st.on .arc { stroke: var(--accent); stroke-width: 4; }
.diagram svg .st.on .lbl { fill: var(--accent); }
.diagram.stepping svg .st:not(.on) { opacity: .25; }
.diagram svg .st { transition: opacity .25s ease-out; }

/* ---------- Context tray demo ---------- */
.tray { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow); overflow: hidden; margin: 0 0 1.8em; }
.tray .head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.tray .head strong { font-family: var(--serif); font-size: 1.05rem; }
.tray .fill { flex: 1; display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--ink-3); }
.tray .fill span { flex: 1; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.tray .fill i { display: block; height: 100%; width: 0; background: var(--pass); border-radius: inherit; transition: width .4s ease-out, background .3s; }
.tray .fill i.hot { background: var(--fail); }
.tray .stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 16px 18px; min-height: 220px; align-content: start; }
.tray .card { border-radius: 10px; padding: 10px 12px; font-size: .85rem; border: 1px solid var(--line); background: var(--surface); line-height: 1.35; }
.tray .card b { display: block; font-weight: 650; color: var(--ink); }
.tray .card span { color: var(--ink-3); font-size: .78rem; }
.tray .card.pin { background: var(--accent-soft); border-color: var(--accent); }
.tray .card.pin b::before { content: "\1F4CC  "; }
.tray .card.sys { background: var(--surface-2); }
.tray .card.chat { background: var(--bg); }
.tray .card.file { background: var(--bg); border-style: dashed; }
.tray .card.rule { background: var(--warn-soft); border-color: var(--warn); }
.tray .card.hand { background: var(--pass-soft); border-color: var(--pass); }
.tray .card.hand b::before { content: "\1F4C4  "; }
.tray .stack.forked { animation: forked 1.2s ease-out; }
@keyframes forked { 0% { box-shadow: inset 0 0 0 0 var(--accent); } 30% { box-shadow: inset 0 0 0 3px var(--accent); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
.tray .card.sum { background: var(--surface-2); border-color: var(--line-strong); grid-column: span 2; }
.tray .card.pop { animation: pop .35s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes pop { from { transform: translateY(8px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.tray .controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.tray .say { flex-basis: 100%; margin: 0 0 4px; font-size: .95rem; color: var(--ink-2); min-height: 3em; }
.tray .say b { color: var(--ink); }
.tray.styles .prompt { margin: 0; padding: 14px 18px 0; font-family: var(--mono); font-size: .88rem; color: var(--ink-2); }
.tray.styles .prompt span { color: var(--accent); font-weight: 700; margin-right: 6px; }
.tray.styles .reply { padding: 12px 18px 16px; min-height: 190px; font-size: .93rem; }
.tray.styles .reply > p { margin: 0 0 .6em; }
.tray.styles .insight { border-top: 1px dashed var(--line-strong); border-bottom: 1px dashed var(--line-strong); padding: 8px 0; margin: 0 0 .6em; font-size: .9rem; }
.tray.styles .insight b:first-child { color: var(--accent); }
.tray.styles .insight p { margin: .3em 0 0; }
.tray .legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 0 18px 14px; font-size: .78rem; color: var(--ink-3); }
.tray .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; border: 1px solid var(--line-strong); }
@media (prefers-reduced-motion: reduce) { .tray .card.pop { animation: none; } .tray .fill i { transition: none; } }

/* ---------- Previous / next as cards ---------- */
nav.lesson-nav a { flex: 1 1 220px; display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
nav.lesson-nav a small { display: block; font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
nav.lesson-nav a.next { text-align: right; border-color: var(--accent); }
nav.lesson-nav a:hover { border-color: var(--accent); }
.toc .n svg { width: 18px; height: 18px; }
.toc li.passed .n { background: linear-gradient(145deg, var(--brass-1), var(--brass-2) 62%, var(--brass-1)); border: 0; color: #3a2a08; }


/* ---------- Lesson-specific diagram classes (scoped to .diagram svg) ---------- */
/* l0002 */
/* Lesson 2 diagrams (l0002-which-file, l0002-index). Extends the illustrated-diagram classes in course.css. */
.diagram svg .fname { font: 600 14px var(--mono); fill: var(--ink); }
.diagram svg .fname.dim { font-weight: 500; fill: var(--ink-3); }
.diagram svg .fname.sec { font-size: 13px; fill: var(--ink-2); }
.diagram svg .fname.link { font-size: 13px; fill: var(--accent); }
.diagram svg .doc { stroke-width: 1.5; }
.diagram svg .doc.read { fill: var(--pass-soft); stroke: var(--pass); }
.diagram svg .doc.skip { fill: none; stroke: var(--line-strong); stroke-dasharray: 5 4; }
.diagram svg .mark { font: 800 16px var(--sans); text-anchor: middle; }
.diagram svg .mark.ok { fill: var(--pass); }
.diagram svg .mark.no { fill: var(--fail); }
.diagram svg .strike { stroke: var(--fail); stroke-width: 2; }
.diagram svg .note { font: 600 12.5px var(--sans); fill: var(--ink-3); }
.diagram svg .note.strong { font-size: 14px; fill: var(--accent); }
.diagram svg .verdict { font: 700 14.5px var(--sans); fill: var(--ink); text-anchor: middle; }
.diagram svg .rule { stroke: var(--line); stroke-width: 1.5; }
.diagram svg .bar { fill: var(--line-strong); opacity: .55; }
/* l0003 */
/* Lesson 3 diagrams: the wall, the 1-3-1 card, and the "bad path" colouring.
   Scoped to .diagram svg; tokens come from course.css so both themes follow. */
.diagram svg .l3-wall { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l3-brick { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l3-card { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l3-row { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
.diagram svg .l3-key { font: 800 12px var(--mono); letter-spacing: .06em; fill: var(--ink-3); }
.diagram svg .l3-txt { font: 15px var(--sans); fill: var(--ink); }
.diagram svg .l3-dim { font: 14px var(--sans); fill: var(--ink-3); }
.diagram svg .l3-cost { font-weight: 700; fill: var(--fail); }
.diagram svg .l3-wait { font: italic 600 15px var(--serif); fill: var(--ink-2); }
.diagram svg .l3-badge { fill: var(--accent); }
.diagram svg .l3-badgetxt { font: 800 12px var(--sans); letter-spacing: .05em; fill: var(--accent-ink); text-anchor: middle; }
.diagram svg .l3-tag { font: 800 13px var(--sans); letter-spacing: .04em; text-anchor: start; }
.diagram svg .l3-a { fill: var(--fail); }
.diagram svg .l3-b { fill: var(--pass); }
.diagram svg .l3-lead { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-dasharray: 3 4; }
.diagram svg .l3-dot { fill: var(--line-strong); }
/* the quiet path is dashed, and turns red rather than gold when it is the current step */
.diagram svg .st.bad .arc { stroke-dasharray: 7 6; }
.diagram svg .st.bad.on .ring-node { stroke: var(--fail); fill: var(--fail-soft); }
.diagram svg .st.bad.on .ico, .diagram svg .st.bad.on path.arc { stroke: var(--fail); }
.diagram svg .st.bad.on .lbl { fill: var(--fail); }
/* the card lights up part by part */
.diagram svg .st.on .l3-card { stroke: var(--accent); }
.diagram svg .st.on .l3-row { stroke: var(--accent); fill: var(--accent-soft); }
.diagram svg .st.on .l3-wall { stroke: var(--fail); }
.diagram svg .st.on path.l3-brick { stroke: var(--fail); }
.diagram svg .st.on path.l3-lead { stroke: var(--accent); }
.diagram svg .st.on .l3-dot { fill: var(--accent); }
/* l0004 */
/* Lesson 4 only: classes for the l0004-* diagrams. Colours come from course.css tokens, so both themes work. */
.diagram svg .panel { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram svg .mono { font: 14px var(--mono); fill: var(--ink-2); }
.diagram svg .mono.strong { font-weight: 700; fill: var(--ink); }
.diagram svg .l4-mid { text-anchor: middle; }
.diagram svg .l4-left { text-anchor: start; }
.diagram svg .bubble { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .blob { fill: var(--fail-soft); stroke: var(--fail); stroke-width: 2; }
.diagram svg .tile { fill: var(--bg); stroke: var(--fail); stroke-width: 1; opacity: .7; }
.diagram svg .bad { font: 700 14px var(--sans); fill: var(--fail); text-anchor: middle; }
.diagram svg .good { font: 700 14px var(--sans); fill: var(--pass); text-anchor: middle; }
.diagram svg .rail { fill: none; stroke: var(--line-strong); stroke-width: 3; }
.diagram svg .dot { fill: var(--ink-2); stroke: var(--surface); stroke-width: 3; }
.diagram svg .dot.plan { fill: var(--accent); }
.diagram svg .chip { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .chip.pass { fill: var(--pass-soft); stroke: var(--pass); }
.diagram svg .chiptxt { font: 600 13px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .paper { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .tag { fill: var(--surface-2); stroke: none; }
.diagram svg .pen { fill: none; stroke: var(--fail); stroke-width: 2.5; stroke-linecap: round; }
.diagram svg .pentext { font: italic 600 15px var(--sans); fill: var(--fail); }
.diagram svg .stamp { fill: var(--pass-soft); stroke: var(--pass); stroke-width: 3; }
.diagram svg .stamptxt { font: 800 22px var(--sans); letter-spacing: .12em; fill: var(--pass); text-anchor: middle; }
.diagram svg .stampsub { font: 600 13px var(--sans); fill: var(--pass); text-anchor: middle; }
.diagram svg .st.on .chip { stroke: var(--accent); }
.diagram svg .st.on .chip.pass { stroke: var(--pass); }

/* l0005 */
/* l0005 */
/* Lesson 5 diagrams (l0005-paste-vs-skill, l0005-checkpoint). Scoped to .diagram svg; colours are course.css tokens,
   so both themes follow. Reuses .paper, .mono, .fname, .doc, .mark, .note, .chip, .ring-node, .arc, .num from course.css. */
.diagram svg .l5-left { text-anchor: start; }
.diagram svg .l5-tag { font: 800 13px var(--sans); letter-spacing: .06em; text-anchor: start; }
.diagram svg .l5-bad { fill: var(--fail); }
.diagram svg .l5-good { fill: var(--pass); }
.diagram svg .l5-badtxt { fill: var(--fail); font-weight: 700; }
.diagram svg .l5-bubble { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l5-bubble.wrong { fill: var(--fail-soft); stroke: var(--fail); }
.diagram svg .l5-paste { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 6 5; }
.diagram svg .l5-repo { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l5-wire { fill: none; stroke: var(--line); stroke-width: 3; }
.diagram svg .l5-glbl { font: 700 14px var(--sans); fill: var(--ink); text-anchor: middle; }
.diagram svg .l5-rej { fill: var(--fail-soft); stroke: var(--fail); stroke-width: 1.5; }
.diagram svg .l5-rejtxt { font: 600 13px var(--mono); fill: var(--fail); text-anchor: middle; }
.diagram svg .l5-drop { fill: none; stroke: var(--fail); stroke-width: 2; stroke-dasharray: 4 4; }
.diagram svg .l5-done { fill: var(--pass-soft); stroke: var(--pass); stroke-width: 2.5; }
.diagram svg .st.on .l5-repo { stroke: var(--accent); stroke-width: 2.5; }
.diagram svg .st.on .l5-bubble.wrong, .diagram svg .st.on .l5-rej { stroke-width: 3; }
.diagram svg .st.on .l5-glbl { fill: var(--accent); }
/* l0006 */
/* Lesson 6 diagram classes (l0006-two-windows, l0006-green-wrong-reason).
   Scoped to .diagram svg; colours come from course.css tokens, so both themes follow. */
.diagram svg .l6-win { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l6-winbar { fill: var(--surface-2); stroke: none; }
.diagram svg .l6-wintitle { font: 700 15px var(--sans); fill: var(--ink); }
.diagram svg .l6-winmeta { font: 12.5px var(--sans); fill: var(--ink-3); text-anchor: end; }
.diagram svg .l6-bubble { fill: var(--bg); stroke: var(--line); stroke-width: 1.2; }
.diagram svg .l6-bubble.l6-assume { fill: var(--warn-soft); stroke: var(--warn); }
.diagram svg .l6-txt { font: 14px var(--sans); fill: var(--ink-2); }
.diagram svg .l6-txt.l6-assume { font-weight: 700; fill: var(--warn); }
.diagram svg .l6-faint { font: italic 13px var(--sans); fill: var(--ink-3); }
.diagram svg .l6-stamp-ok { fill: var(--surface); stroke: var(--ink-3); stroke-width: 2.5; stroke-dasharray: 6 4; }
.diagram svg .l6-stamptxt-ok { font: 800 19px var(--sans); letter-spacing: .1em; fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l6-stampsub-ok { font: 600 12px var(--sans); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l6-doc { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l6-docname { font: 700 13px var(--mono); fill: var(--ink); }
.diagram svg .l6-code { font: 13px var(--mono); fill: var(--ink-2); }
.diagram svg .l6-code.l6-strong { font-weight: 700; fill: var(--ink); }
.diagram svg .l6-del { fill: var(--fail); }
.diagram svg .l6-add { fill: var(--pass); }
.diagram svg .l6-ln { font: 12px var(--mono); fill: var(--ink-3); text-anchor: end; }
.diagram svg .l6-hit { fill: none; stroke: var(--fail); stroke-width: 2.5; }
.diagram svg .l6-point { fill: none; stroke: var(--fail); stroke-width: 2; stroke-dasharray: 4 4; }
.diagram svg .l6-row { fill: var(--fail-soft); stroke: var(--fail); stroke-width: 1.5; }
.diagram svg .l6-sev { font: 800 13px var(--sans); letter-spacing: .06em; fill: var(--fail); }
.diagram svg .l6-block { fill: var(--fail); }
.diagram svg .l6-blocktxt { font: 800 13px var(--sans); letter-spacing: .04em; fill: var(--bg); text-anchor: middle; }
.diagram svg .l6-note { font: 14px var(--sans); fill: var(--ink-3); }
.diagram svg .l6-head { font: 700 15px var(--sans); fill: var(--ink); }
.diagram svg .l6-lane { font: 700 14px var(--sans); fill: var(--ink-2); }
.diagram svg .l6-step { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.2; }
.diagram svg .l6-step.l6-stepbad { fill: var(--fail-soft); stroke: var(--fail); }
.diagram svg .l6-steptxt { font: 600 13px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .l6-oversell { font: 800 15px var(--sans); fill: var(--fail); }
.diagram svg .l6-measure { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l6-key { font: 800 11.5px var(--mono); letter-spacing: .04em; fill: var(--ink-3); }
.diagram svg .l6-bad { font: 800 15px var(--sans); fill: var(--fail); }
.diagram svg .l6-ok { font: 800 15px var(--sans); fill: var(--pass); }
.diagram svg .l6-caption { font: italic 600 15px var(--serif); fill: var(--ink-2); }
/* The pointer and flagged line keep their red when lit (course.css turns lit paths accent). */
.diagram svg .st.on path.l6-point { stroke: var(--fail); }
.diagram svg .st.on .l6-doc { stroke: var(--accent); }
/* l0007 */
/* l0007 */
/* Lesson 7 only: classes for the l0007-* diagrams (layers grid, who-each-guard-binds). Colours are course.css tokens, so both themes work. */
.diagram svg .l7-col { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram svg .l7-col.req { fill: none; stroke: var(--line-strong); stroke-dasharray: 6 5; }
.diagram svg .l7-head { font: 700 15px var(--sans); fill: var(--ink); text-anchor: middle; }
.diagram svg .l7-headsub { font: 12.5px var(--mono); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l7-note { font: italic 600 13.5px var(--serif); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l7-note.guard { fill: var(--ink-2); }
.diagram svg .l7-brace { fill: none; stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l7-stop { fill: var(--fail); }
.diagram svg .l7-stoptxt { font: 800 11.5px var(--sans); letter-spacing: .08em; fill: var(--bg); text-anchor: middle; }
.diagram svg .l7-why { font: 700 12.5px var(--sans); fill: var(--fail); text-anchor: middle; }
.diagram svg .l7-thru { fill: var(--bg); stroke: var(--ink-3); stroke-width: 2; }
.diagram svg .l7-passtxt { font: 12px var(--sans); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l7-none { font: 800 18px var(--sans); fill: var(--line-strong); text-anchor: middle; }
.diagram svg .l7-slip .arc { stroke-dasharray: 7 6; }
.diagram svg .l7-slipnote { font: 700 13px var(--sans); fill: var(--warn); text-anchor: end; }
.diagram svg .l7-rail { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 3 5; }
.diagram svg .l7-band { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram svg .l7-bind { fill: var(--pass); stroke: var(--bg); stroke-width: 2; }
.diagram svg .l7-bind.off { fill: var(--bg); stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l7-tick { fill: none; stroke: var(--bg); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.diagram svg .l7-who { font: 600 13px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .st.on .l7-thru { stroke: var(--accent); }
.diagram svg .st.on .l7-passtxt { fill: var(--ink-2); }
.diagram svg .st.on .l7-band { stroke: var(--accent); fill: var(--accent-soft); }
.diagram svg .st.on .l7-col { stroke: var(--accent); }
.diagram svg .st.l7-slip.on .arc { stroke: var(--warn); }

/* l0008 */
/* Lesson 8 diagrams (l0008-memory-vs-docs, l0008-sockets). Scoped to .diagram svg; tokens come from course.css,
   so both themes follow. Reuses .panel, .mono, .chip, .chiptxt, .arc, .head, .lbl, .sub from course.css. */
.diagram svg .l8-lane { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram svg .l8-lane.l8-lane-bad { fill: none; stroke: var(--line-strong); stroke-dasharray: 6 5; }
.diagram svg .l8-lanetitle { font: 800 13px var(--sans); letter-spacing: .08em; }
.diagram svg .l8-lanesub { font: italic 600 14px var(--serif); fill: var(--ink-3); }
.diagram svg .l8-badtxt { fill: var(--fail); }
.diagram svg .l8-goodtxt { fill: var(--pass); }
.diagram svg .l8-code { font: 13px var(--mono); fill: var(--ink-2); white-space: pre; }
.diagram svg .l8-comment { font: italic 12.5px var(--mono); fill: var(--ink-3); }
.diagram svg .l8-mono-sm { font: 600 12px var(--mono); fill: var(--ink-2); }
.diagram svg .l8-big { font: 800 34px var(--sans); }
.diagram svg .l8-fail { fill: var(--fail-soft); stroke: var(--fail); stroke-width: 2; }
.diagram svg .l8-ok { fill: var(--pass-soft); stroke: var(--pass); stroke-width: 2; }
.diagram svg .l8-term { fill: var(--code-bg); stroke: var(--fail); stroke-width: 1.5; }
.diagram svg .l8-termhead { font: 800 11.5px var(--mono); letter-spacing: .06em; fill: var(--ink-3); }
.diagram svg .l8-termtxt { font: 12.5px var(--mono); fill: var(--fail); }
.diagram svg .l8-tool { fill: var(--accent); }
.diagram svg .l8-tooltxt { font: 700 12.5px var(--mono); fill: var(--accent-ink); text-anchor: middle; }
.diagram svg .l8-q { font: 600 13.5px var(--sans); fill: var(--ink-2); }
.diagram svg .l8-quote { font: italic 15px var(--serif); fill: var(--ink); }
.diagram svg .l8-src { font: 12px var(--sans); fill: var(--ink-3); }
.diagram svg .l8-note { font: 13px var(--sans); fill: var(--ink-3); }
.diagram svg .l8-plain { font: 600 14px var(--sans); fill: var(--ink); }
.diagram svg .l8-key { font: 800 11.5px var(--mono); letter-spacing: .05em; fill: var(--ink-3); }
.diagram svg .l8-harness { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l8-row { fill: var(--bg); stroke: var(--line); stroke-width: 1.2; }
.diagram svg .l8-row.l8-new { fill: var(--accent-soft); stroke: var(--accent); }
.diagram svg .l8-row.l8-alt { fill: var(--pass-soft); stroke: var(--pass); }
.diagram svg .l8-socket { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l8-pin { fill: var(--ink-3); }
.diagram svg .l8-plug { fill: var(--ink-2); }
.diagram svg .l8-prong { fill: none; stroke: var(--ink-2); stroke-width: 3; stroke-linecap: round; }
.diagram svg .l8-cable { fill: none; stroke: var(--ink-3); stroke-width: 4; stroke-linecap: round; }
.diagram svg .l8-cable.l8-loose { stroke-dasharray: 2 7; }
.diagram svg .l8-server { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l8-server.l8-cand { stroke-dasharray: 6 5; }
.diagram svg .l8-srvname { font: 700 16px var(--sans); fill: var(--ink); }
.diagram svg .l8-srvsub { font: 13px var(--sans); fill: var(--ink-3); }
.diagram svg .l8-lockbg { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 2; }
.diagram svg .l8-lock { fill: none; stroke: var(--warn); stroke-width: 2; stroke-linejoin: round; }
.diagram svg .l8-badge { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 1.5; }
.diagram svg .l8-badgetxt { font: 700 13.5px var(--sans); fill: var(--warn); text-anchor: middle; }
.diagram svg .l8-stamp { fill: var(--fail-soft); stroke: var(--fail); stroke-width: 2.5; }
.diagram svg .l8-stamptxt { font: 800 15px var(--sans); letter-spacing: .1em; fill: var(--fail); text-anchor: middle; }
.diagram svg .st.on .l8-server { stroke: var(--accent); }
.diagram svg .st.on .l8-cable { stroke: var(--accent); }
.diagram svg .st.on .l8-cable.l8-loose { stroke: var(--ink-3); }
.diagram svg .st.on .l8-server.l8-cand { stroke: var(--fail); }
.diagram svg path.l8-arrbad, .diagram svg .st.on path.l8-arrbad { stroke: var(--fail); stroke-dasharray: 7 6; }
/* l0009 */
/* Lesson 9 diagrams (l0009-odd-code, l0009-docs-drift). Every selector starts with .diagram svg. */
.diagram svg .l9-lane { font: 700 14px var(--sans); fill: var(--ink-2); letter-spacing: .02em; }
.diagram svg .l9-divider { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 6 5; }
.diagram svg .l9-colhead { font: 700 15px var(--sans); fill: var(--ink); }
.diagram svg .l9-card { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l9-card.l9-badcard { fill: var(--fail-soft); stroke: var(--fail); }
.diagram svg .l9-card.l9-doc { fill: var(--pass-soft); stroke: var(--pass); }
.diagram svg .l9-card.l9-empty { fill: none; stroke-dasharray: 6 5; }
.diagram svg .l9-cardhead { font: 700 12.5px var(--mono); fill: var(--ink-3); }
.diagram svg .l9-claim { font: 14px var(--sans); fill: var(--ink); }
.diagram svg .l9-claim.l9-faint { font-style: italic; fill: var(--ink-3); }
.diagram svg .l9-code { font: 13px var(--mono); fill: var(--ink-2); }
.diagram svg .l9-mono { font-family: var(--mono); }
.diagram svg .l9-code.l9-bad { fill: var(--fail); }
.diagram svg .l9-code.l9-comment { font-weight: 700; fill: var(--accent); }
.diagram svg .l9-code.l9-docline { fill: var(--ink); }
.diagram svg .l9-code.l9-addline { fill: var(--pass); }
.diagram svg .l9-hl { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.diagram svg .l9-note { font: italic 13.5px var(--sans); fill: var(--ink-3); }
.diagram svg .l9-small { font: 12.5px var(--sans); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l9-prompt { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; }
.diagram svg .l9-prompttxt { font: 600 13.5px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .l9-verdict { font: 700 14px var(--sans); text-anchor: middle; }
.diagram svg .l9-badtxt { fill: var(--fail); }
.diagram svg .l9-reply { fill: var(--pass-soft); stroke: var(--pass); stroke-width: 1.5; }
.diagram svg .l9-replytxt { font: 700 13.5px var(--sans); fill: var(--pass); }
.diagram svg .l9-replysub { font: 13px var(--sans); fill: var(--ink-2); }
.diagram svg .l9-caption { font: italic 14px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .l9-link { stroke-width: 2.5; }
.diagram svg .l9-link.l9-true { stroke: var(--pass); }
.diagram svg .l9-link.l9-stale { stroke: var(--fail); }
.diagram svg .l9-link.l9-unver { stroke: var(--ink-3); stroke-dasharray: 5 5; }
.diagram svg .l9-tag.l9-true { fill: var(--pass-soft); stroke: var(--pass); stroke-width: 1.5; }
.diagram svg .l9-tag.l9-stale { fill: var(--fail-soft); stroke: var(--fail); stroke-width: 1.5; }
.diagram svg .l9-tag.l9-unver { fill: var(--surface); stroke: var(--ink-3); stroke-width: 1.5; }
.diagram svg .l9-tagtxt { font: 800 12px var(--sans); letter-spacing: .06em; text-anchor: middle; }
.diagram svg .l9-tagtxt.l9-true { fill: var(--pass); }
.diagram svg .l9-tagtxt.l9-stale { fill: var(--fail); }
.diagram svg .l9-tagtxt.l9-unver { fill: var(--ink-3); }
.diagram svg .l9-diff { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l9-difftxt { font: 700 13.5px var(--sans); fill: var(--ink); }
/* l0010 */
/* Lesson 10 diagrams: l0010-evidence-ladder, l0010-honest-history */
.diagram svg .l10-rail { fill: none; stroke: var(--line-strong); stroke-width: 3; }
.diagram svg .l10-railtxt { font: 700 12px var(--sans); letter-spacing: .08em; fill: var(--ink-3); text-anchor: middle; text-transform: uppercase; }
.diagram svg .l10-rung { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l10-rung.l10-claim, .diagram svg .l10-card.l10-claim { stroke-dasharray: 6 4; }
.diagram svg .l10-num { fill: var(--bg); stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l10-numtxt { font: 800 15px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .l10-title { font: 700 15.5px var(--sans); fill: var(--ink); }
.diagram svg .l10-proves { font: 14px var(--sans); fill: var(--pass); }
.diagram svg .l10-cant { font: 14px var(--sans); fill: var(--ink-3); }
.diagram svg .l10-head { font: 700 15px var(--sans); fill: var(--ink); }
.diagram svg .l10-card { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l10-cardname { font: 600 12.5px var(--sans); fill: var(--ink-3); }
.diagram svg .l10-quote { font: italic 600 15px var(--sans); fill: var(--ink); }
.diagram svg .l10-mono { font: 13px var(--mono); fill: var(--ink-2); }
.diagram svg .l10-small { font: 13px var(--sans); fill: var(--ink-3); }
.diagram svg .l10-link { fill: none; stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 3 4; }
.diagram svg .l10-verdict { fill: var(--fail-soft); stroke: var(--fail); stroke-width: 2; }
.diagram svg .l10-verdicttxt { font: 700 14.5px var(--sans); fill: var(--fail); text-anchor: middle; }
.diagram svg .l10-axis { stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l10-tick { stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l10-hour { font: 12px var(--mono); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l10-row { font: 700 15px var(--sans); fill: var(--ink); }
.diagram svg .l10-rowsub { font: 12.5px var(--sans); fill: var(--ink-3); }
.diagram svg .l10-dot { fill: var(--pass); stroke: var(--bg); stroke-width: 2; }
.diagram svg .l10-burst { fill: var(--fail); opacity: .85; }
.diagram svg .l10-burstlbl { font: 700 13.5px var(--sans); fill: var(--fail); }
.diagram svg .l10-lead { fill: none; stroke: var(--fail); stroke-width: 1.5; }
.diagram svg .l10-term { fill: var(--code-bg); stroke: var(--line); stroke-width: 1; }
.diagram svg .l10-badtxt { fill: var(--fail); font-weight: 700; }
.diagram svg .l10-badtxt.l10-plain { font: 600 14px var(--sans); }
.diagram svg .l10-good { font: 600 14px var(--sans); fill: var(--pass); }
.diagram svg .l10-divider { stroke: var(--line); stroke-width: 1.5; }
.diagram svg .l10-sidehead { font: 700 14px var(--sans); fill: var(--ink-2); }
.diagram svg .l10-chain { stroke: var(--line-strong); stroke-width: 3; }
.diagram svg .l10-commit { fill: var(--bg); stroke: var(--ink-3); stroke-width: 2.5; }
.diagram svg .l10-commit.l10-x { fill: var(--fail-soft); stroke: var(--fail); }
.diagram svg .l10-commit.l10-r { fill: var(--pass-soft); stroke: var(--pass); }
.diagram svg .l10-ctxt { font: 800 14px var(--mono); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .l10-ctxt.l10-x { fill: var(--fail); }
.diagram svg .l10-ctxt.l10-r { fill: var(--pass); }
.diagram svg .l10-ghost { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 4 4; }
.diagram svg .l10-ctxt.l10-gtxt { fill: var(--ink-3); }
.diagram svg .l10-strike { stroke: var(--fail); stroke-width: 2.5; stroke-linecap: round; }
.diagram svg .l10-refuse { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 1.5; }
.diagram svg .l10-refusetxt { font: 600 11.5px var(--sans); fill: var(--warn); text-anchor: middle; }
.diagram svg .st.on .l10-rung { stroke: var(--accent); stroke-width: 2.5; fill: var(--accent-soft); }
.diagram svg .st.on .l10-num { stroke: var(--accent); }
.diagram svg .st.on .l10-numtxt { fill: var(--accent); }
.diagram svg .st.on .l10-card.l10-claim { stroke: var(--accent); }
/* l0011 */
/* ---------- Lesson 11: the runbook clock and the swap test ---------- */
.diagram svg .l11-face { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram svg .l11-tick { stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l11-tick.major { stroke: var(--ink-3); stroke-width: 2.5; }
.diagram svg .l11-min { font: 700 13px var(--sans); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l11-seg { fill: var(--bg); stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l11-seglbl { font: 700 16px var(--sans); fill: var(--ink); }
.diagram svg .l11-segmin { font: 13px var(--sans); fill: var(--ink-3); }
.diagram svg .st.on .l11-seg { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3; }
.diagram svg .st.on .l11-seglbl { fill: var(--accent); }
.diagram svg g.l11-hand.st:not(.on) { opacity: 0; }
.diagram svg .l11-handline { stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.diagram svg .l11-hub { fill: var(--accent); }
.diagram svg .l11-time { font: 800 18px var(--mono); fill: var(--accent); text-anchor: middle; }
.diagram svg .l11-term { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l11-termbar { fill: var(--surface-2); }
.diagram svg .l11-termtitle { font: 700 13px var(--mono); fill: var(--ink-2); }
.diagram svg .l11-rail { stroke: var(--line-strong); stroke-width: 2; }
.diagram svg .l11-dot { fill: var(--bg); stroke: var(--ink-3); stroke-width: 2; }
.diagram svg .l11-dot.base { fill: var(--line-strong); stroke: var(--line-strong); }
.diagram svg .l11-commit { font: 12px var(--mono); fill: var(--ink); }
.diagram svg .l11-commit.base { fill: var(--ink-3); }
.diagram svg .st.on .l11-dot { fill: var(--pass); stroke: var(--pass); }
.diagram svg .st.on .l11-commit { font-weight: 700; }
.diagram svg .l11-sep { stroke: var(--line); stroke-width: 1.5; }
.diagram svg .l11-proof { font: 600 13.5px var(--sans); fill: var(--pass); }
.diagram svg .l11-note { font: italic 14px var(--serif); fill: var(--ink-3); text-anchor: middle; }
.diagram svg .l11-quote { font: 600 14px var(--mono); fill: var(--ink-2); text-anchor: middle; }
.diagram svg .l11-card { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l11-cardhead { font: 700 17px var(--serif); fill: var(--ink); }
.diagram svg .l11-colhead { font: 800 12px var(--sans); letter-spacing: .05em; fill: var(--ink-3); text-anchor: middle; text-transform: uppercase; }
.diagram svg .l11-row { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
.diagram svg .l11-q { font: 600 15px var(--sans); fill: var(--ink); }
.diagram svg .l11-pill { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.diagram svg .l11-pill.pass { stroke: var(--pass); }
.diagram svg .l11-pill.partial { stroke: var(--warn); }
.diagram svg .l11-pill.fail { stroke: var(--fail); }
.diagram svg .l11-pill.picked { fill: var(--pass-soft); stroke-width: 2.5; }
.diagram svg .l11-check { fill: none; stroke: var(--pass); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.diagram svg .l11-ev { font: 13px var(--sans); fill: var(--ink-3); text-anchor: end; }
.diagram svg .st.on .l11-row { stroke: var(--accent); fill: var(--accent-soft); }
.diagram svg .st.on .l11-ev { fill: var(--ink); font-weight: 600; }
.diagram svg .l11-loop { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 7 5; }
.diagram svg .l11-fixbox { fill: var(--bg); stroke: var(--accent); stroke-width: 1.5; }
.diagram svg .l11-fix { font: 700 14px var(--sans); fill: var(--accent); text-anchor: middle; }


/* ---------- Copy button on code blocks ---------- */
pre { position: relative; }
pre .copy {
  position: absolute; top: 8px; right: 8px;
  font: 600 .72rem/1 var(--sans); color: var(--ink-2); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 9px; cursor: pointer;
  opacity: .75; transition: opacity .15s;
}
pre:hover .copy, pre .copy:focus-visible { opacity: 1; }
pre .copy:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }


/* ---------- "Harness it" tip ---------- */
.tip { background: var(--pass-soft); border: 1px solid transparent; border-radius: var(--radius); padding: 14px 20px; margin-bottom: 1.4em; font-size: .97rem; }
.tip .label { color: var(--pass); }
.tip > :last-child { margin-bottom: 0; }


/* ---------- "Worth installing" resources ---------- */
.kit { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 1.4em; background: var(--bg); font-size: .95rem; }
.kit .label { color: var(--accent); }
.kit ul { margin: 0 0 .6em; padding-left: 1.1em; }
.kit li { margin: .45em 0; }
.kit > :last-child { margin-bottom: 0; }


/* ---------- Home page start block ---------- */
.start { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin: 0 0 1.8em; }
.start .btn { text-decoration: none; padding: 12px 18px; font-size: 1rem; }
.start .small { flex-basis: 100%; margin: .3em 0 0; }


/* ---------- Spot the problem ---------- */
.spot { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 16px 20px; margin: 0 0 1.4em; box-shadow: var(--shadow); }
.spot .q { font-weight: 600; margin: 0 0 .7em; }
.spot .lines { list-style: none; margin: 0 0 12px; padding: 0; font-family: var(--mono); font-size: .86rem; counter-reset: ln; }
.spot .lines li { counter-increment: ln; position: relative; padding: 6px 10px 6px 3em; border: 1px solid transparent; border-radius: 6px; cursor: pointer; white-space: pre-wrap; line-height: 1.45; }
.spot .lines li::before { content: counter(ln); position: absolute; left: 10px; width: 1.6em; text-align: right; color: var(--ink-3); }
.spot .lines li:hover { background: var(--surface); }
.spot .lines li:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.spot .lines li.picked { background: var(--accent-soft); border-color: var(--accent); }
.spot.checked .lines li { cursor: default; }
.spot .lines li.hit { background: var(--pass-soft); border-color: var(--pass); }
.spot .lines li.miss { background: var(--warn-soft); border-color: var(--warn); }
.spot .lines li.wrong { background: var(--fail-soft, var(--warn-soft)); border-color: var(--fail); }
.spot .lines li .why-line { display: block; font-family: var(--sans); font-size: .84rem; color: var(--ink-2); margin-top: 4px; white-space: normal; }
.spot .lines li.hit .why-line::before { content: "Caught: "; font-weight: 700; color: var(--pass); }
.spot .lines li.miss .why-line::before { content: "Missed: "; font-weight: 700; color: var(--warn); }
.spot .lines li.wrong .why-line::before { content: "Fine as is: "; font-weight: 700; color: var(--fail); }
.spot .result { margin: 10px 0 0; font-size: .95rem; }
.spot .result:empty { display: none; }


/* ---------- Instruction layers (lesson 2) ---------- */
.layers { list-style: none; margin: 0 0 1.6em; padding: 0; max-width: var(--wide); display: grid; gap: 6px; counter-reset: layer; }
.layers li { counter-increment: layer; display: grid; grid-template-columns: 2em 11em 1fr; gap: 4px 14px; align-items: baseline; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.layers li::before { content: counter(layer); grid-row: 1 / span 2; font-family: var(--serif); font-size: 1.4rem; color: var(--accent); }
.layers li b { font-family: var(--serif); }
.layers .where { font-size: .93rem; }
.layers .desc { grid-column: 2 / -1; color: var(--ink-2); font-size: .93rem; }
.layers li:nth-child(1) { background: var(--surface-2); }
.layers li:nth-child(3) { background: var(--accent-soft); border-color: var(--accent); }
@media (max-width: 640px) { .layers li { grid-template-columns: 2em 1fr; } .layers li::before { grid-row: 1 / span 3; } .layers .where, .layers .desc { grid-column: 2; } }


/* ---------- Name prompt (home page) ---------- */
.who { flex-basis: 100%; }
.ask-name { display: grid; gap: 8px; padding: 14px 18px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); margin-bottom: 4px; }
.ask-name label { font-weight: 600; }
.ask-name div { display: flex; gap: 8px; flex-wrap: wrap; }
.ask-name input { flex: 1 1 220px; font: inherit; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--ink); }
.ask-name input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.hello { margin: 0 0 4px; font-size: 1.05rem; }
.ask-name.need { border-color: var(--fail); }
.name-gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(30, 22, 14, .55); backdrop-filter: blur(3px); }
.name-gate .ask-name { width: min(520px, 100%); padding: 22px 24px; box-shadow: var(--shadow); background: var(--bg); }
body.gated { overflow: hidden; }
.ask-name .hint { margin: 0; color: var(--fail); font-weight: 600; font-size: .9rem; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-size: .9rem; color: var(--accent); text-decoration: underline; cursor: pointer; }
.share-out input { width: 100%; font: .85rem var(--mono); padding: 8px; margin-top: 4px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--ink); }

/* ---------- Completion card ---------- */
.completion { max-width: var(--wide); margin-bottom: 2em; }
.cfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.cfields label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.cfields small { font-weight: 400; color: var(--ink-3); }
.cfields input { font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--ink); }
.cfields input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.clocked { padding: 14px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: .95rem; }
.cert { padding: 34px 38px; border-radius: 16px; color: #e9d8b4; background: linear-gradient(160deg, #3a2a1a, #241910); border: 3px solid var(--brass-1); box-shadow: var(--shadow); text-align: center; }
.cert .kick { font: 700 .75rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--brass-1); }
.cert h3 { margin: .4em 0 .1em; font: 700 2.4rem/1.15 var(--serif); color: #fff3d6; }
.cert .cdate { margin: 0 0 1.2em; }
.cplaques { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px 6px; margin: 0 0 1.2em; }
.cplaques span { display: grid; justify-items: center; gap: 4px; color: #f3d27a; }
.cplaques svg { width: 30px; height: 30px; }
.cplaques i { font: 600 .74rem/1.2 var(--sans); font-style: normal; color: #e9d8b4; }
.cert .ccan { font-size: .9rem; max-width: 52rem; margin: 0 auto 1em; }
.cert .ccan b, .cert .clinks { color: #fff3d6; }
.cert .clinks a { color: #f3d27a; word-break: break-all; }
.cert .chonest { font-size: .8rem; color: #bfae8c; margin: 1em auto 0; max-width: 46rem; }
.cbtns { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
@media print {
  body.print-cert main > *:not(.completion), body.print-cert .cfields, body.print-cert .cbtns, body.print-cert .cabinet { display: none !important; }
  body.print-cert .cert { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Print ---------- */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #f7f7f7; --surface-2: #eee; --ink: #000; --ink-2: #333; --ink-3: #555;
    --line: #ccc; --line-strong: #999; --accent: #000; --accent-soft: #f2f2f2; --code-bg: #f4f4f4;
    --pass-soft: #fff; --fail-soft: #fff; --warn-soft: #fff; --shadow: none; color-scheme: light;
  }
  body { font-size: 11pt; }
  main { max-width: none; padding: 0; }
  main > * { max-width: none; }
  .cabinet, .theme-toggle, pre .copy, .quiz .retry, nav.lesson-nav, .btn, .diagram .bar, .tray .controls { display: none !important; }
  .quiz .why { display: block; }
  .diagram.stepping svg g, .diagram.stepping svg .st { opacity: 1 !important; }
  details.deeper > summary { list-style: none; }
  .incident, .exercise, .quiz, figure.code, table, .diagram { break-inside: avoid; }
  a { color: inherit; }
  h2 { break-after: avoid; }
  pre { white-space: pre-wrap; }
}
