:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --ink: #1b1d1f;
  --muted: #62676c;
  --line: #dcddd8;
  --soft: #eeefea;
  --accent: #4f7d00;
  --accent-soft: #eaf2dc;
  --accent-ink: #ffffff;
  --code: #f0f0ec;
  --warn: #9a5b00;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111213;
  --panel: #191b1c;
  --ink: #e9eae6;
  --muted: #9ea3a6;
  --line: #2e3133;
  --soft: #202325;
  --accent: #76b900;
  --accent-soft: #1f2a12;
  --accent-ink: #111;
  --code: #1d2022;
  --warn: #e0a24a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.62 var(--sans); }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code, pre { font-family: var(--mono); font-size: 0.86em; }
:not(pre) > code { background: var(--code); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--code); padding: 14px 16px; border-radius: 8px; overflow-x: auto; line-height: 1.5; }
q { quotes: "“" "”"; font-style: italic; }

.top { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 16px 0 10px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.navbtn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 16px; cursor: pointer; }
.navbtn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.mark { width: 14px; height: 14px; border-radius: 3px; background: var(--accent); box-shadow: 4px 4px 0 var(--line); }
.pills { list-style: none; display: flex; gap: 4px; margin: 0 auto; padding: 0; min-width: 0; overflow: hidden; }
.pills li { display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: 600 11.5px var(--sans); white-space: nowrap; }
.pills b { width: 17px; height: 17px; border-radius: 50%; display: inline-grid; place-items: center; font: 600 10px var(--mono); border: 1px solid var(--line); }
.pills li[data-on] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.pills li[data-on] b { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.theme { margin-left: auto; flex: none; font: 600 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.pills + .theme { margin-left: 0; }
.theme::before { content: "◐ "; }
.theme .t-dark, [data-theme="dark"] .theme .t-light { display: none; }
[data-theme="dark"] .theme .t-dark { display: inline; }

.layout { display: grid; grid-template-columns: 56px minmax(0, 1fr); }
aside { position: sticky; top: 52px; align-self: start; height: calc(100vh - 52px); overflow-y: auto; border-right: 1px solid var(--line); scrollbar-width: none; }
.rail { list-style: none; margin: 0; padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rail a { display: grid; place-items: center; width: 34px; height: 30px; border-radius: 7px; font: 600 13px var(--mono); color: var(--muted); text-decoration: none; }
.rail a:hover { background: var(--soft); color: var(--ink); }
.rail a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.stage-tick { font: 600 9.5px var(--mono); letter-spacing: 0.1em; color: var(--muted); opacity: 0.7; margin-top: 8px; }
.drawer { position: fixed; z-index: 30; top: 52px; left: 0; bottom: 0; width: min(88vw, 330px); overflow-y: auto; padding: 6px 16px 24px; background: var(--panel); border-right: 1px solid var(--line); box-shadow: 12px 0 40px #0003; }
.toc p { margin: 18px 0 4px; font: 600 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: flex; gap: 10px; padding: 5px 8px; border-radius: 6px; font-size: 14px; line-height: 1.35; text-decoration: none; color: var(--muted); }
.toc a span { font: 12px/1.6 var(--mono); min-width: 16px; }
.toc a:hover { background: var(--soft); color: var(--ink); }
.toc a[aria-current] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

main { min-width: 0; padding: 0 24px 80px; }
main > article, main > .pager { margin-left: max(0px, calc((100% - 760px) / 2 - 180px)); }
.kicker { margin: 0; font: 600 12px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.08; letter-spacing: -0.025em; margin: 8px 0 10px; }
.index-main { padding-top: 30px; }
.sub { font-size: 19px; color: var(--muted); max-width: 760px; margin: 0 0 22px; }
article, .how, .stage { max-width: 760px; }
article h2, .how h2, .stage h2 { font-size: 25px; letter-spacing: -0.015em; margin: 44px 0 10px; }
article h3 { font-size: 19px; margin: 30px 0 8px; }
article blockquote { margin: 18px 0; padding: 4px 18px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 0 8px 8px 0; }
article table, .fit-map { border-collapse: collapse; width: 100%; font-size: 14px; margin: 16px 0; }
article table { display: block; overflow-x: auto; }
article th, article td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
article th { font-size: 12px; font-family: var(--mono); letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; margin: 16px 0; }
.fit-map caption { text-align: left; font-size: 13px; color: var(--muted); padding-bottom: 8px; }
.fit-map td { text-align: center; font-family: var(--mono); font-size: 12.5px; }
.fit-map td[data-level="0"] { color: var(--muted); }
.fit-map td[data-level="2"] { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.fit-map td[data-level="3"] { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.fit-map td[data-level="4"] { background: color-mix(in srgb, var(--accent) 44%, transparent); }
[data-theme="dark"] .fit-map td[data-level="2"] { background: color-mix(in srgb, var(--accent) 10%, transparent); }
[data-theme="dark"] .fit-map td[data-level="3"] { background: color-mix(in srgb, var(--accent) 20%, transparent); }
[data-theme="dark"] .fit-map td[data-level="4"] { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.gpu-ladder th, .gpu-ladder td { padding: 6px 6px; }
.gpu-ladder td { font-size: 12px; }
.gpu-ladder td.txt { text-align: left; font-family: var(--sans); font-size: 12.5px; }
.gpu-ladder thead th { text-align: center; vertical-align: bottom; }
.gpu-ladder tbody th[scope="row"] { white-space: nowrap; color: var(--ink); font: 600 13px var(--sans); letter-spacing: 0; }
.gpu-ladder tr.group th { text-align: left; background: var(--panel); color: var(--accent); }
.gpu-ladder tbody + tbody tr.group th { border-top: 2px solid var(--muted); }
.lead-note { max-width: 760px; margin: 0 0 18px; color: var(--muted); }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

.path { margin: 0 0 14px; }
.path ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.path li { position: relative; padding: 8px 9px 9px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font: 12px/1.35 var(--mono); min-width: 0; }
.path li b { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); text-align: center; font-size: 10.5px; line-height: 16px; }
.path li strong { display: block; margin-top: 4px; color: var(--ink); font: 600 13px/1.25 var(--sans); }
.path li span { display: block; margin-top: 2px; }
.path li[data-on] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.path li[data-on] b { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.path p { margin: 8px 2px 0; font-size: 14.5px; color: var(--muted); }
.path p:empty { display: none; }

.hero { margin: 0 0 30px; }
.fig { display: block; width: 100%; border: 0; border-radius: 14px; background: transparent; }
.fig-open { display: inline-block; margin-top: 6px; font: 12px var(--mono); color: var(--muted); }

/* The one-screen chapter view: title row, then figure flanked by two panels. */
.screen { display: flex; flex-direction: column; height: calc(100vh - 52px); min-height: 600px; padding: 12px 0 14px; }
.titlebar { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 14px; padding: 0 0 10px; }
.titlebar .kicker { flex-basis: 100%; }
.titlebar h1 { font-size: clamp(22px, 2.1vw, 30px); margin: 2px 0 0; }
.titlebar .gist { flex-basis: 100%; margin: 4px 0 0; font-size: clamp(17px, 1.5vw, 21px); font-weight: 600; letter-spacing: -0.01em; color: var(--accent); line-height: 1.3; }
.try button strong { display: block; font-weight: 600; }
.try button em { display: block; font-style: normal; color: var(--muted); margin-top: 2px; }
.try button[aria-pressed="true"] em { color: var(--ink); }
details.drill { margin-top: 36px; border-top: 1px solid var(--line); }
details.drill > summary { cursor: pointer; list-style: none; }
details.drill > summary::-webkit-details-marker { display: none; }
details.drill > summary h2 { display: inline-block; margin: 18px 0 8px; }
details.drill > summary h2::after { content: " ▸"; color: var(--muted); font-size: 0.7em; }
details.drill[open] > summary h2::after { content: " ▾"; }
.path-inline { display: none; }
.cockpit { flex: 1; min-height: 0; display: grid; gap: 14px; grid-template-columns: 270px minmax(0, 1fr) 330px; grid-template-areas: "see fig do"; }
.see { grid-area: see; }
.do { grid-area: do; }
.stagecell { grid-area: fig; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.stagecell .fig { flex: 1; min-height: 0; height: 100%; }
.figbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.figbar .fig-open { margin-top: 0; }
.speed { display: flex; align-items: center; gap: 4px; font: 600 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.speed span { margin-right: 4px; }
.speed button { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 600 12px var(--mono); cursor: pointer; }
.speed button:hover { border-color: var(--accent); }
.speed button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.panel { min-height: 0; overflow-y: auto; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 14.5px; line-height: 1.5; scrollbar-width: thin; }
.ph { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 600 11.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }
.ph b { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 11px; }
.ph.sm { margin-top: 16px; color: var(--muted); }
.panel .ph:not(:first-child) { margin-top: 18px; }
.cap { margin: 0 0 10px; font-size: 14.5px; line-height: 1.5; }
.detail { margin-top: 8px; font-size: 13px; color: var(--muted); }
.detail summary { cursor: pointer; font: 600 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.detail p { margin: 6px 0 0; }
.zoom { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; }
.see ul { margin: 0; padding-left: 18px; }
.see li { margin: 3px 0; }
.keys { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.keys li { display: flex; gap: 8px; align-items: baseline; margin: 0 !important; }
.sw { flex: none; width: 16px; height: 9px; border-radius: 2px; border: 1.5px solid var(--ink); transform: translateY(1px); }
.sw[data-mark="lit"] { border: 0; height: 2px; background: var(--accent); transform: translateY(-3px); }
.sw[data-mark="green"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 45%, transparent); }
.sw[data-mark="flat"] { border-color: var(--muted); background: var(--soft); }
.sw[data-mark="dim"] { border-color: var(--line); }
.sw[data-mark="dotted"] { border: 0; height: 0; border-top: 2px dotted var(--muted); transform: translateY(-3px); }
.do { display: flex; flex-direction: column; }
.try { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.try button { width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 14px/1.42 var(--sans); cursor: pointer; }
.try button:hover { border-color: var(--accent); }
.try button b { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font: 600 11px var(--mono); }
.try button[data-done] b { background: var(--soft); }
.try button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.try button[aria-pressed="true"] b { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.try button[data-next]:not([aria-pressed="true"]) b { border-color: var(--accent); color: var(--accent); }
.hint { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.intro p { margin: 0 0 8px; }
.intro ol { margin: 0; padding-left: 20px; }
.readon { display: flex; flex-wrap: wrap; gap: 6px; }
.readon a { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; text-decoration: none; color: var(--muted); }
.readon a:hover { color: var(--ink); border-color: var(--accent); }
article h2 { scroll-margin-top: 70px; }

@media (max-width: 1399px) {
  .cockpit { grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "fig see" "fig do"; gap: 12px 14px; }
  .see { max-height: 38vh; }
  .see .ph.sm, .see .ph.sm + ul { display: none; }
}
@media (max-width: 1180px) { .pills li { font-size: 0; gap: 0; padding: 3px; } .pills b { font-size: 10px; } }

.lab { margin: 28px 0; padding: 18px 20px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.lab-tag { margin: 0; font: 600 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.lab .cmd { margin-top: 10px; }
.cmd { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.cmd code { font-size: 14px; padding: 6px 10px; }
.cmd a { font: 13px var(--mono); }
.lab-note { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.lab details { margin-top: 12px; }
.lab summary { cursor: pointer; font-size: 14px; color: var(--muted); }
.lab pre { font-size: 12.5px; margin: 8px 0 0; max-height: 420px; }
.lab pre.out { background: var(--bg); border: 1px solid var(--line); }

.laiv { max-width: 100%; }
.pg { margin: 22px 0; }

.pager { display: flex; justify-content: space-between; gap: 16px; max-width: 760px; margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; text-decoration: none; font-weight: 600; max-width: 48%; }
.pager a[rel="next"] { text-align: right; margin-left: auto; }
.pager span { font: 12px var(--mono); color: var(--muted); font-weight: 400; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.stage { max-width: none; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; }
.card:hover { border-color: var(--accent); color: inherit; }
.card span { font: 12px var(--mono); color: var(--muted); }
.card strong { line-height: 1.3; }
.card em { font-style: normal; font-size: 14px; color: var(--muted); line-height: 1.45; }

@media (max-width: 999px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  aside, .pills { display: none; }
  main { padding: 0 16px 60px; }
  main > article, main > .pager { margin-left: 0; }
  .screen { height: auto; min-height: 0; padding-top: 18px; }
  .titlebar h1 { font-size: clamp(26px, 6vw, 34px); }
  .path-inline { display: block; }
  .cockpit { display: flex; flex-direction: column; }
  .stagecell { order: 1; }
  .do { order: 2; }
  .see { order: 3; max-height: none; }
  .see .ph.sm, .see .ph.sm + ul { display: block; }
  .panel { overflow: visible; }
  .stagecell .fig { flex: none; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .path ol { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .path li span { display: none; }
}

.now { margin: 0 0 10px; padding: 10px 12px 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent); }
.now > span { display: flex; align-items: center; gap: 6px; font: 600 10.5px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.now > span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: nowpulse 1.6s ease-in-out infinite; }
.now p { margin: 4px 0 0; font-size: 16.5px; line-height: 1.42; font-weight: 500; color: var(--ink); min-height: 2.8em; }
.now p.fresh { animation: nowfresh 600ms ease-out; }
@keyframes nowpulse { 50% { opacity: 0.25; } }
@keyframes nowfresh { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
.now .changed { display: grid; gap: 3px; margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--bg); font: 12.5px/1.45 var(--mono); }
.now .changed span { display: flex; flex-wrap: wrap; gap: 0 8px; }
.now .changed i { font-style: normal; color: var(--muted); }
.now .changed b { color: var(--ink); }
.now .changed em { font-style: normal; color: var(--accent); font-weight: 600; }
.now .changed.fresh { animation: nowfresh 900ms ease-out; }
.now .nums { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); font: 12px/1.5 var(--mono); color: var(--muted); }
.now .nums b { display: block; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.now .nums output { display: block; min-height: 1.5em; color: var(--ink); }
.about { margin-top: 16px; padding-top: 4px; }
.about .ph.sm { margin-top: 0; }
.about .cap { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .now > span::before, .now p.fresh, .now .changed.fresh { animation: none; } }
@media (max-width: 999px) { .see { order: 2; } .do { order: 3; } }
.startbtn { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 650; text-decoration: none; line-height: 1.3; }
.startbtn span { font: 600 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.startbtn:hover { color: var(--accent-ink); filter: brightness(1.06); }
.startlink { display: block; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.screen + .index-main { padding-top: 18px; border-top: 1px solid var(--line); }

/* Top-bar tool link */
.toollink { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; flex: none; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 600 12.5px var(--sans); text-decoration: none; white-space: nowrap; }
.toollink:hover { border-color: var(--accent); color: var(--ink); }
.toollink[aria-current] { background: var(--accent-soft); border-color: var(--accent); }
.toollink b { font-weight: 600; }
.pills ~ .toollink { margin-left: 0; }
.toollink + .theme { margin-left: 0; }
@media (max-width: 1180px) { .toollink { padding: 6px 9px; } .toollink b { display: none; } }
@media (max-width: 999px) { .pills ~ .toollink { margin-left: auto; } }

/* Can it run? */
:root { --bad: #a8402f; --run-tint: #e3efcf; --spill-tint: #f6e6c4; --no-tint: #f1e4e0; }
:root[data-theme="dark"] { --bad: #e58b7e; --run-tint: #243617; --spill-tint: #3a2e14; --no-tint: #2b1f1e; }
.tool { max-width: 1560px; margin: 0 auto; padding: 12px 0 0; }
.canrun .titlebar { padding-bottom: 12px; }
.strip h2 { margin: 0 0 8px; font: 600 12px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.strip ul { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 1700px) { .strip ul { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (max-width: 700px) { .strip ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.strip li { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; line-height: 1.35; min-width: 0; }
.strip b { font-size: 14px; overflow-wrap: anywhere; }
.strip .mk, .strip .mk { overflow-wrap: anywhere; }
.strip .mk span { white-space: nowrap; }
.strip .sz { color: var(--muted); font: 11.5px var(--mono); }
.strip .mk { overflow-wrap: anywhere; }
.strip .mk span { white-space: nowrap; }
.strip .sz { color: var(--accent); font-weight: 600; margin-top: auto; }
.bar { position: relative; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 10px; }
.bar fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; align-items: center; gap: 8px; }
.bar legend, .bar .lbl { float: left; padding: 0; font: 600 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 5px 10px; font: 600 12.5px var(--mono); color: var(--muted); border-left: 1px solid var(--line); }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span, .pick > summary:focus-visible, .mhead button:focus-visible, .corner button:focus-visible, .mach .x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.pick { position: relative; }
.pick > summary { list-style: none; cursor: pointer; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent-soft); font: 600 13px var(--sans); }
.pick > summary::-webkit-details-marker { display: none; }
.pick > summary::after { content: " ▾"; color: var(--muted); }
.pick > summary b { font: 600 12px var(--mono); color: var(--accent); margin-left: 4px; }
.menu { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; width: min(760px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px #0003; columns: 2 260px; column-gap: 20px; }
.menu .hint { column-span: all; margin: 0 0 8px; }
.menu fieldset { display: block; break-inside: avoid; margin: 0 0 12px; }
.menu legend { float: none; display: block; width: 100%; margin-bottom: 4px; color: var(--accent); }
.menu label { display: flex; align-items: baseline; gap: 7px; padding: 2px 0; font-size: 13.5px; cursor: pointer; }
.menu label.off { opacity: 0.45; cursor: not-allowed; }
.menu input { accent-color: var(--accent); }
.menu small { margin-left: auto; color: var(--muted); font: 11.5px var(--mono); white-space: nowrap; }
.menu .dcsw { column-span: all; padding-top: 8px; border-top: 1px solid var(--line); }
.cr-sysctl { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--warn); background: var(--spill-tint); font-size: 13.5px; }
.cr-sysctl code { user-select: all; }
.matrix-wrap { max-height: 78vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); scrollbar-width: thin; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; line-height: 1.3; }
.matrix th, .matrix td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--panel); }
.matrix thead th { position: sticky; top: 0; z-index: 3; vertical-align: bottom; text-align: left; padding: 8px 10px; background: var(--panel); border-bottom: 2px solid var(--line); min-width: 118px; font-weight: 600; }
.matrix thead th.corner { left: 0; z-index: 5; min-width: 230px; max-width: 280px; padding: 0; }
.matrix tbody th.mhead { position: sticky; left: 0; z-index: 2; text-align: left; font-weight: 400; min-width: 230px; max-width: 280px; box-shadow: 1px 0 0 var(--line); }
.corner button, .mhead button { display: block; width: 100%; text-align: left; border: 0; background: none; color: inherit; font: inherit; padding: 8px 10px; cursor: pointer; }
.corner button { font: 600 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.corner button:hover, .mhead button:hover { color: var(--accent); }
.mhead .nm { display: block; font-weight: 700; font-size: 13.5px; overflow-wrap: anywhere; }
.mhead .meta { display: block; color: var(--muted); font-size: 12px; }
.mhead .sz { font: 600 12px var(--mono); }
.mhead .lic { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); font: 10.5px var(--mono); color: var(--muted); vertical-align: 1px; }
.mach .h { display: block; overflow-wrap: anywhere; padding-right: 14px; }
.mach .s { display: block; margin-top: 2px; color: var(--muted); font: 11.5px var(--mono); font-weight: 400; }
.mach .x { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; }
.mach .x:hover { background: var(--soft); color: var(--ink); }
.matrix thead th.mach { position: sticky; }
.matrix td.v { padding: 7px 10px; vertical-align: top; }
.matrix td.v b { display: block; font: 700 12.5px var(--sans); }
.matrix td.v i { display: block; font: normal 13px var(--mono); color: var(--ink); }
.matrix td.run { background: var(--run-tint); }
.matrix td.run b { color: var(--accent); }
.matrix td.spill { background: var(--spill-tint); }
.matrix td.spill b { color: var(--warn); }
.matrix td.no { background: var(--no-tint); }
.matrix td.no b { color: var(--bad); }
.matrix td.no i { color: var(--muted); }
.matrix tbody tr:last-child th, .matrix tbody tr:last-child td { border-bottom: 0; }
.cr-foot { margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); }
.cr-foot span { display: inline-block; margin-right: 14px; }
.cr-empty { padding: 28px; text-align: center; color: var(--muted); }
.how-est { margin-top: 20px; max-width: 820px; border-top: 1px solid var(--line); font-size: 14.5px; }
.how-est summary { cursor: pointer; padding: 12px 0 4px; font: 600 12px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.how-est ul { margin: 4px 0 10px; padding-left: 20px; }
.how-est p { margin: 8px 0; }
.how-est .src { color: var(--muted); font-size: 13px; }
@media (max-width: 999px) {
  .matrix-wrap { max-height: 75vh; }
  .matrix thead th.corner, .matrix tbody th.mhead { min-width: 148px; max-width: 148px; }
  .matrix thead th { min-width: 108px; }
  .mhead .meta, .mhead .lic { display: none; }
  .mhead .nm { font-size: 12.5px; }
  .menu { position: fixed; left: 8px; right: 8px; top: 64px; width: auto; }
}

/* Landing: chapter list beside the course map */
.do .startbtn { margin-bottom: 4px; }
.do .ph.sm { margin: 14px 0 4px; }
.chlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; }
.chlist a { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; font-size: 13.5px; line-height: 1.3; text-decoration: none; color: var(--ink); }
.chlist a b { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font: 600 11px var(--mono); }
.chlist a:hover, .chlist a:focus-visible, .chlist a[data-hot] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.chlist a:hover b, .chlist a:focus-visible b, .chlist a[data-hot] b { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.now .changed[hidden] { display: none; }
