/* SaveEZ docs in the "Neon Block" look (docs/DESIGN.md): chartreuse fills with black text, black
   2px outlines, hard offset shadows down and to the right, cobalt links and accents, and a
   "cobalt night" dark mode. Layout: three columns (sidebar, reading column, "On this page"),
   collapsing to one column with a drawer menu on phones.

   Token rules: --brand is a FILL and always carries --on-brand (black) text. Never use --brand as
   text on a light surface. --link is the accent for text and lines: cobalt in light, chartreuse in
   dark. --acc-box is the fill behind accent text inside diagrams (chartreuse in light, deep cobalt
   in dark), so accent text never sits on its own colour. */
:root {
  --bg: #f4f6ec;
  --surface: #ffffff;
  --sunken: #eaedde;
  --ink: #0b0b0b;
  --ink-soft: #2b2c30;
  --muted: #565961;
  --line: #d7dbcb;
  --outline: #0b0b0b;
  --brand: #d4ff1f;
  --on-brand: #0b0b0b;
  --brand-soft: #f2ffc4;
  --cobalt: #1f3bff;
  --on-cobalt: #ffffff;
  --link: #1f3bff;
  --link-line: rgb(31 59 255 / 0.35);
  --acc-box: #d4ff1f;
  --acc-box-ink: #0b0b0b;
  --focus: #1f3bff;
  --grow: #067a4e;
  --grow-soft: #def5e9;
  --warn: #8a4f00;
  --warn-soft: #fcefd6;
  --danger: #b42f3d;
  --danger-soft: #fbe6e9;
  --code-bg: #eef0e3;
  --scrim: rgb(11 11 11 / 0.45);

  --shadow-1: 2px 2px 0 var(--outline);
  --shadow-2: 4px 4px 0 var(--outline);
  --shadow-3: 6px 6px 0 var(--outline);

  --font-body: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  /* Dela Gothic One has one weight. Where it cannot load (the copy inside the app, whose security
     headers only allow its own fonts), the heavy system faces below keep the blocky look. */
  --font-display: "Dela Gothic One", "Arial Black", "Segoe UI Black", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --topbar-h: 62px;
  --sidebar-w: 276px;
  --toc-w: 220px;
  --read-w: 46rem;
  --radius: 12px;
  --radius-card: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08104a;
    --surface: #0f1a63;
    --sunken: #0b1557;
    --ink: #f5f8ff;
    --ink-soft: #dbe1f7;
    --muted: #a3acd8;
    --line: #26337e;
    --outline: #000000;
    --brand-soft: #1a2a8f;
    --link: #d4ff1f;
    --link-line: rgb(212 255 31 / 0.4);
    --acc-box: #1a2a8f;
    --acc-box-ink: #d4ff1f;
    --focus: #d4ff1f;
    --grow: #5fdca4;
    --grow-soft: #0d3a3a;
    --warn: #ffc46b;
    --warn-soft: #3a2c25;
    --danger: #ff9aa5;
    --danger-soft: #3d1c3c;
    --code-bg: #0b1557;
    --scrim: rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08104a;
  --surface: #0f1a63;
  --sunken: #0b1557;
  --ink: #f5f8ff;
  --ink-soft: #dbe1f7;
  --muted: #a3acd8;
  --line: #26337e;
  --outline: #000000;
  --brand-soft: #1a2a8f;
  --link: #d4ff1f;
  --link-line: rgb(212 255 31 / 0.4);
  --acc-box: #1a2a8f;
  --acc-box-ink: #d4ff1f;
  --focus: #d4ff1f;
  --grow: #5fdca4;
  --grow-soft: #0d3a3a;
  --warn: #ffc46b;
  --warn-soft: #3a2c25;
  --danger: #ff9aa5;
  --danger-soft: #3d1c3c;
  --code-bg: #0b1557;
  --scrim: rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--bg);
}
::selection { background: var(--brand); color: var(--on-brand); }
a { color: var(--link); font-weight: 600; text-decoration: underline; text-decoration-color: var(--link-line); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }
.skip-link {
  position: absolute; left: 12px; top: -56px; z-index: 100;
  background: var(--brand); color: var(--on-brand); font-weight: 700; padding: 8px 14px;
  border: 2px solid var(--outline); border-radius: 10px; box-shadow: var(--shadow-1); text-decoration: none;
}
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 8px); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--bg);
  border-bottom: 2px solid var(--outline);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font: 400 19px/1 var(--font-display); font-weight: 900; font-synthesis: none; letter-spacing: -0.01em; }
.brand-tag {
  font: 700 12px/1 var(--font-body);
  color: var(--on-brand); background: var(--brand); border: 2px solid var(--outline); border-radius: 8px; padding: 4px 7px;
}
.search-trigger {
  flex: 1 1 auto; max-width: 420px; margin-inline: auto;
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 10px 0 12px;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 12px; box-shadow: var(--shadow-1);
  color: var(--muted); cursor: pointer; text-align: left;
}
.search-trigger:hover { background: var(--brand-soft); color: var(--ink); }
.search-trigger span:not(.kbd) { flex: 1; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbd {
  font: 500 11px/1 var(--font-mono); color: var(--ink-soft);
  border: 1.5px solid var(--outline); border-radius: 5px; padding: 3px 5px; background: var(--bg);
}
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 2px solid transparent; border-radius: 12px; background: none; cursor: pointer; color: var(--ink);
  text-decoration: none;
}
.icon-btn:hover { background: var(--sunken); border-color: var(--outline); }
.icon-btn svg { width: 20px; height: 20px; }
.net-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 12px/1 var(--font-body); color: var(--warn); background: var(--warn-soft);
  border: 1.5px solid currentColor; padding: 5px 9px; border-radius: 999px; white-space: nowrap;
}
.net-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.app-link {
  font: 800 14px/1 var(--font-body); color: var(--on-brand); background: var(--brand);
  padding: 10px 14px; border: 2px solid var(--outline); border-radius: 12px; box-shadow: var(--shadow-2);
  text-decoration: none; white-space: nowrap;
  transition: transform 140ms var(--ease-out);
}
.app-link:hover { background: #c4f000; }
.app-link:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--outline); }
.menu-btn { display: none; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1440px;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 14px 40px max(16px, env(safe-area-inset-left, 0px));
  border-right: 2px solid var(--outline);
}
.nav-group + .nav-group { margin-top: 22px; }
.nav-title { font: 800 13px/1 var(--font-body); color: var(--ink); padding: 0 10px 10px; margin: 0; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.nav-link {
  display: block; padding: 7px 10px; border: 2px solid transparent; border-radius: 10px;
  font-size: 14.5px; font-weight: 500; line-height: 1.35; color: var(--ink-soft); text-decoration: none;
}
.nav-link:hover { background: var(--sunken); color: var(--ink); }
.nav-link[aria-current="page"] {
  background: var(--brand); color: var(--on-brand); font-weight: 800;
  border-color: var(--outline); box-shadow: var(--shadow-1);
}

.content {
  min-width: 0;
  padding-block: 40px 72px;
  padding-left: max(16px, env(safe-area-inset-left, 0px), min(56px, 4vw));
  padding-right: max(16px, env(safe-area-inset-right, 0px), min(56px, 4vw));
}
.toc {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  padding: 40px max(16px, env(safe-area-inset-right, 0px)) 40px 8px;
}
.toc-title { font: 800 13px/1 var(--font-body); color: var(--ink); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a {
  display: block; margin-left: -2px; padding: 5px 0 5px 12px; border-left: 3px solid transparent;
  font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--muted); text-decoration: none;
}
.toc a.lvl-3 { padding-left: 24px; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); font-weight: 700; border-left-color: var(--link); }

/* ---------- Pages and prose ---------- */
.page { max-width: var(--read-w); margin: 0 auto; }
.page[hidden] { display: none !important; }
.crumb {
  display: inline-block; font: 700 13px/1 var(--font-body); color: var(--on-cobalt); background: var(--cobalt);
  border: 2px solid var(--outline); border-radius: 8px; padding: 5px 9px; margin: 0 0 16px;
}
.page h1 {
  font: 400 clamp(32px, 4.6vw, 48px)/0.98 var(--font-display); font-weight: 900; font-synthesis: none;
  letter-spacing: -0.01em; margin: 0 0 16px; text-wrap: balance;
}
.lead { font-size: 18.5px; line-height: 1.6; color: var(--ink-soft); margin: 0 0 28px; max-width: 40rem; }
.page h2 {
  font: 400 26px/1.15 var(--font-display); font-weight: 900; font-synthesis: none; letter-spacing: -0.01em;
  margin: 52px 0 14px; padding-top: 4px; text-wrap: balance;
}
.page h3 { font: 800 19px/1.35 var(--font-body); margin: 32px 0 8px; text-wrap: balance; }
.page h4 { font: 800 15.5px/1.4 var(--font-body); margin: 22px 0 6px; }
.page p, .page li { max-width: 42rem; }
.page p { margin: 0 0 16px; }
.page ul, .page ol { margin: 0 0 18px; padding-left: 1.3em; }
.page li { margin: 5px 0; }
.page li::marker { color: var(--ink); }
.page strong { font-weight: 700; color: var(--ink); }
.page hr { border: 0; border-top: 2px solid var(--outline); margin: 40px 0; }
.heading-anchor { opacity: 0; margin-left: 8px; color: var(--muted); text-decoration: none; font-weight: 400; }
h2:hover .heading-anchor, h3:hover .heading-anchor, .heading-anchor:focus { opacity: 1; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.88em; }
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; overflow-wrap: anywhere; }
pre {
  background: var(--code-bg); border: 2px solid var(--outline); border-radius: var(--radius); box-shadow: var(--shadow-1);
  padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; margin: 0 0 22px;
}

/* Plain-words box: the first thing on every feature page. A chartreuse block, black text. */
.plain {
  background: var(--brand);
  color: var(--on-brand);
  border: 2px solid var(--outline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-3);
  padding: 20px 22px 6px;
  margin: 0 6px 34px 0;
}
.plain-label {
  display: flex; align-items: center; gap: 8px;
  font: 800 14px/1 var(--font-body); color: var(--on-brand);
  margin: 0 0 12px;
}
.plain-label svg { width: 18px; height: 18px; }
.plain p, .plain li { font-size: 17px; line-height: 1.6; color: var(--on-brand); }
.plain strong { color: var(--on-brand); }
.plain a { color: var(--on-brand); text-decoration-color: currentColor; }
.plain code { background: rgb(255 255 255 / 0.6); border-color: var(--outline); color: var(--on-brand); }

/* Callouts */
.note {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px;
  border: 2px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-2);
  padding: 14px 16px; margin: 0 4px 22px 0;
}
.note > :last-child { margin-bottom: 0; }
.note-body > :last-child { margin-bottom: 0; }
.note-icon { width: 20px; height: 20px; margin-top: 3px; color: var(--ink); }
.note.warn { background: var(--warn-soft); }
.note.warn .note-icon { color: var(--warn); }
.note.danger { background: var(--danger-soft); }
.note.danger .note-icon { color: var(--danger); }
.note p { font-size: 15px; margin-bottom: 8px; }
.note strong:first-child { display: block; margin-bottom: 2px; }

/* Status pills (the project's own status words) */
.pill {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: 2px;
  font: 700 11.5px/1 var(--font-body);
  padding: 4px 8px; border: 1.5px solid currentColor; border-radius: 999px; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { color: var(--grow); background: var(--grow-soft); }
.pill.mock { color: var(--warn); background: var(--warn-soft); }
.pill.plan { color: var(--muted); background: var(--sunken); }
.pill.review { color: var(--on-cobalt); background: var(--cobalt); border-color: var(--outline); }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin: -12px 0 24px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 4px 24px 0; border: 2px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-2); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { font-weight: 800; font-size: 13px; color: var(--ink); background: var(--sunken); border-bottom: 2px solid var(--outline); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .mono { font-size: 12.5px; overflow-wrap: anywhere; }
.addr { font-family: var(--font-mono); font-size: 12.5px; font-weight: 400; overflow-wrap: anywhere; word-break: break-all; }

/* Step list (real sequences only) */
.steps { list-style: none; padding: 0; margin: 0 0 24px; counter-reset: step; display: grid; gap: 14px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; margin: 0; max-width: none; }
.steps > li::before {
  content: counter(step);
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand); color: var(--on-brand); border: 2px solid var(--outline); box-shadow: var(--shadow-1);
  font: 800 14px/1 var(--font-body); margin-top: 1px;
}
.steps > li > div > :last-child { margin-bottom: 0; }

/* Two-up cards for small comparisons */
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 0 4px 26px 0; }
.duo > div { border: 2px solid var(--outline); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-2); padding: 16px 18px; min-width: 0; }
.duo h4 { margin-top: 0; }
.duo p, .duo li { font-size: 15px; }
.duo > div > :last-child { margin-bottom: 0; }

/* Landing cards on the intro page */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 0 4px 30px 0; }
.card {
  display: block; border: 2px solid var(--outline); border-radius: var(--radius-card); padding: 16px 16px 14px;
  text-decoration: none; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-2);
  transition: transform 140ms var(--ease-out);
}
.card:hover { background: var(--brand); color: var(--on-brand); }
.card:hover span { color: var(--on-brand); }
.card:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--outline); }
.card b { display: block; font: 800 16.5px/1.3 var(--font-body); margin-bottom: 4px; }
.card span { display: block; font-size: 14px; font-weight: 400; line-height: 1.5; color: var(--muted); }

/* ---------- Diagrams ---------- */
figure.diagram { margin: 8px 4px 30px 0; }
.diagram-frame {
  border: 2px solid var(--outline); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-2);
  padding: 20px 16px; overflow-x: auto;
}
.diagram-frame svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.diagram-frame.wide svg { min-width: 600px; }
figure.diagram figcaption { font-size: 14px; line-height: 1.55; color: var(--muted); margin-top: 12px; max-width: 42rem; }
figure.diagram figcaption b { color: var(--ink); font-weight: 700; }
.d-box { fill: var(--bg); stroke: var(--outline); stroke-width: 2; }
.d-box.accent { fill: var(--acc-box); stroke: var(--outline); stroke-width: 2.5; }
.d-box.soft { fill: var(--sunken); stroke: var(--outline); }
.d-box.warn { fill: var(--warn-soft); stroke: var(--warn); }
.d-box.good { fill: var(--grow-soft); stroke: var(--grow); }
.d-box.bad { fill: var(--danger-soft); stroke: var(--danger); }
.d-zone { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 5; }
.d-zone.accent { stroke: var(--link); }
.d-t { fill: var(--ink); font: 700 13px var(--font-body); }
.d-s { fill: var(--ink-soft); font: 400 11.5px var(--font-body); }
.d-m { fill: var(--muted); font: 400 11px var(--font-mono); }
.d-l { fill: var(--ink-soft); font: 600 11.5px var(--font-body); }
.d-cap { fill: var(--ink); font: 800 11px var(--font-body); }
.d-t.acc { fill: var(--acc-box-ink); }
.d-l.acc { fill: var(--link); }
.d-t.warn, .d-l.warn { fill: var(--warn); }
.d-t.good, .d-l.good { fill: var(--grow); }
.d-t.bad, .d-l.bad { fill: var(--danger); }
.d-e { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; }
.d-e.acc { stroke: var(--link); stroke-width: 2.2; }
.d-e.dash { stroke-dasharray: 4 4; }
.d-e.bad { stroke: var(--danger); }
.d-e.good { stroke: var(--grow); }
.d-head { fill: var(--ink-soft); }
.d-head.acc { fill: var(--link); }
.d-head.bad { fill: var(--danger); }
.d-head.good { fill: var(--grow); }
.d-fill-acc { fill: var(--link); }
.d-fill-good { fill: var(--grow); }
.d-fill-warn { fill: var(--warn); }
.d-fill-bad { fill: var(--danger); }
.d-fill-line { fill: var(--line); }
.d-chip { fill: var(--brand); stroke: var(--outline); stroke-width: 1.5; }
.d-chip-t { fill: var(--on-brand); font: 800 11px var(--font-body); }

/* ---------- Prev / next ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; padding-top: 24px; border-top: 2px solid var(--outline); }
.pager a {
  display: block; border: 2px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-2);
  padding: 14px 16px; text-decoration: none; color: var(--ink); min-width: 0;
  transition: transform 140ms var(--ease-out);
}
.pager a:hover { background: var(--brand); color: var(--on-brand); }
.pager a:hover small, .pager a:hover span { color: var(--on-brand); }
.pager a:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--outline); }
.pager small { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.pager span { font: 800 15.5px/1.35 var(--font-body); color: var(--ink); }
.pager .next { text-align: right; grid-column: 2; }

.site-foot {
  max-width: var(--read-w); margin: 48px auto 0; padding-top: 18px; border-top: 2px solid var(--outline);
  font-size: 13px; line-height: 1.6; color: var(--muted);
}
.site-foot p { margin: 0 0 8px; max-width: none; }

/* ---------- Search dialog ---------- */
.search-scrim {
  position: fixed; inset: 0; z-index: 80; background: var(--scrim);
  display: flex; justify-content: center; align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 10vh) max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
}
.search-panel {
  width: min(600px, 100%); max-height: 70vh; display: flex; flex-direction: column;
  background: var(--surface); border: 2px solid var(--outline); border-radius: var(--radius-card); box-shadow: var(--shadow-3); overflow: hidden;
}
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 2px solid var(--outline); }
.search-field svg { width: 18px; height: 18px; color: var(--ink); flex: none; }
.search-field input {
  flex: 1; min-width: 0; height: 54px; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 500 16px var(--font-body);
}
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results li { margin: 0; }
.search-results a {
  display: block; padding: 9px 12px; border: 2px solid transparent; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 500;
}
.search-results a small { display: block; font-size: 12.5px; color: var(--muted); }
.search-results a span { font-size: 15px; }
.search-results a mark { background: none; color: inherit; font-weight: 800; text-decoration: underline; text-decoration-thickness: 2px; }
.search-results a.sel, .search-results a:hover { background: var(--brand); color: var(--on-brand); border-color: var(--outline); }
.search-results a.sel small, .search-results a:hover small { color: var(--on-brand); }
.search-empty { padding: 18px 14px; color: var(--muted); font-size: 14.5px; }
.search-hint { display: flex; gap: 14px; padding: 9px 14px; border-top: 2px solid var(--outline); font-size: 12px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1239px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 959px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed; z-index: 70; left: 0;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    height: calc(100% - var(--topbar-h) - env(safe-area-inset-top, 0px));
    width: min(320px, 86vw);
    background: var(--bg); border-right: 2px solid var(--outline); box-shadow: var(--shadow-3);
    transform: translateX(-104%); transition: transform 0.22s var(--ease-out), visibility 0s linear 0.22s; visibility: hidden;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform 0.22s var(--ease-out); }
  .nav-scrim { position: fixed; inset: 0; z-index: 65; background: var(--scrim); }
  .content { padding-top: 28px; }
  .brand-tag, .app-link-wide { display: none; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 58px; }
  .search-trigger { max-width: none; }
  .search-trigger span:not(.kbd), .search-trigger .kbd { display: none; }
  .search-trigger { flex: 0 0 40px; width: 40px; padding: 0; justify-content: center; margin-inline: auto 0; box-shadow: none; }
  .net-badge { display: none; }
  .lead { font-size: 17px; }
  .plain { padding: 16px 16px 4px; }
  .plain p, .plain li { font-size: 16px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  th, td { padding: 9px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

[hidden] { display: none !important; }

/* Phones: keep diagram text readable. Diagrams run edge to edge and scroll sideways
   instead of shrinking labels below about 11px. */
.scroll-hint { display: none; font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.diagram-frame.scrolls + .scroll-hint { display: block; }
@media (max-width: 640px) {
  figure.diagram { margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px))); }
  figure.diagram figcaption, .scroll-hint { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .diagram-frame { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; padding: 16px 12px; }
  .diagram-frame svg { min-width: 420px; }
  .diagram-frame.wide svg { min-width: 600px; }
}

/* Very small phones: keep the top bar inside the screen. */
@media (max-width: 420px) {
  .topbar { gap: 8px; }
  .brand-name { display: none; }
  .app-link { padding: 9px 11px; font-size: 13.5px; }
}
