/* Cicadel documentation theme: "chemical light".
   A near-black ground lit by glow-stick green. Light mode keeps the same
   green, deepened for readable contrast. */

@font-face { font-family: Geist; src: url('/fonts/Geist-Variable.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/GeistMono-Variable.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: dark;
  --font-sans: Geist, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* The chemical-light scale. */
  --chem-50: #f2ffe6;
  --chem-200: #d4ff9e;
  --chem-300: #b4ff6b;
  --chem-400: #94ff4a;
  --chem-500: #7dff3a;
  --chem-600: #5ce61c;
  --chem-700: #3fb10a;
  --chem-800: #2a7a06;
  --chem-900: #174507;

  --bg: #050805;
  --bg-raised: #0a0f09;
  --surface: #0e150c;
  --surface-2: #131c10;
  --border: #1d2a19;
  --border-strong: #2d4026;
  --text: #ecf8e6;
  --text-soft: #c4d6bc;
  --muted: #8ea585;
  --accent: var(--chem-500);
  --accent-text: var(--chem-400);
  --accent-ink: #061104;
  --accent-soft: rgba(125, 255, 58, .1);
  --accent-line: rgba(125, 255, 58, .35);
  --glow: 0 0 24px rgba(125, 255, 58, .35), 0 0 2px rgba(125, 255, 58, .9);
  --code-bg: #070c06;
  --code-border: #1a2716;
  --code-text: #e3f2dc;
  --topbar-bg: rgba(5, 8, 5, .78);
  --diagram-box: #0d160b;
  --diagram-hot: #112410;
  --diagram-line: #2b3f24;
  --diagram-text: #ecf8e6;
  --diagram-muted: #93a98b;
  --radius: 10px;
  --radius-lg: 16px;
  --topbar-h: 64px;
  --sidebar-w: 272px;
  --toc-w: 240px;
  --content-pad: 64px;
}
:root.light {
  color-scheme: light;
  --bg: #fbfdf9;
  --bg-raised: #ffffff;
  --surface: #f3f8ef;
  --surface-2: #eaf3e3;
  --border: #e1ebd9;
  --border-strong: #c9dabd;
  --text: #0c1709;
  --text-soft: #2b3b25;
  --muted: #5b6e52;
  --accent: var(--chem-500);
  --accent-text: #2c7d05;
  --accent-ink: #061104;
  --accent-soft: rgba(92, 230, 28, .12);
  --accent-line: rgba(63, 177, 10, .45);
  --glow: 0 0 0 1px rgba(63, 177, 10, .25), 0 6px 20px rgba(92, 230, 28, .25);
  --topbar-bg: rgba(251, 253, 249, .82);
  --diagram-box: #ffffff;
  --diagram-hot: #f1ffe6;
  --diagram-line: #c9dabd;
  --diagram-text: #0c1709;
  --diagram-muted: #5b6e52;
  --accent-diagram: #3fb10a;
}

/* Base */
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 20px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 var(--font-sans); font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, input, select { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--chem-500); color: var(--accent-ink); }
svg { flex: none; }
kbd { font: 500 11px/1 var(--font-mono); padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.skip:focus { top: 12px; }

/* Icons drawn with strokes */
.topbar svg:not(.logo), .sidebar svg, .crumbs svg, .toc svg, .card svg, .copy-code svg, .search-box svg, .menu-toggle svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.topbar svg .fill { fill: currentColor; stroke: none; }

/* Logo: the traced cicada mark, shared from /cicada.svg */
.logo { width: 34px; height: 28px; fill: var(--chem-500); stroke: none; filter: drop-shadow(0 0 3px rgba(125, 255, 58, .6)); }
:root.light .logo { fill: var(--chem-700); filter: none; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); background: var(--topbar-bg); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--border); }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent-line) 30%, var(--accent-line) 70%, transparent); opacity: .6; }
.topbar-inner { height: 100%; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); align-items: center; }
.topbar-start { display: flex; align-items: center; gap: 14px; height: 100%; padding: 0 16px 0 24px; border-right: 1px solid var(--border); }
.topbar-start .version-pill { margin-left: auto; }
.topbar-end { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 20px 0 var(--content-pad); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.brand-name { font-weight: 700; font-size: 19px; letter-spacing: -.04em; }
.version-pill { position: relative; display: inline-flex; }
.version-pill select { appearance: none; -webkit-appearance: none; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-soft); border-radius: 999px; padding: 3px 26px 3px 10px; font: 500 12px/1.6 var(--font-mono); }
.version-pill::after { content: ''; position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.top-nav { display: flex; gap: 4px; margin-left: -10px; }
.top-nav a { color: var(--muted); font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 8px; text-decoration: none; }
.top-nav a:hover { color: var(--text); background: var(--surface); }
.top-nav a[aria-current] { color: var(--text); }
.search-trigger { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; width: 260px; padding: 7px 8px 7px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.search-trigger:hover { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-trigger kbd { margin-left: auto; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: none; color: var(--muted); }
.icon-button:hover { color: var(--text); background: var(--surface); border-color: var(--border); text-decoration: none; }
#theme .icon-sun { display: none; }
:root.light #theme .icon-sun { display: block; }
:root.light #theme .icon-moon { display: none; }
.menu-toggle { display: none; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); place-items: center; }

/* Three-column layout */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; background: var(--bg-raised); border-right: 1px solid var(--border); scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sidebar:hover { scrollbar-color: var(--border-strong) transparent; }
.sidebar-inner { padding: 24px 16px 40px 24px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text-soft); font-size: 12.5px; line-height: 1.5; }
.sidebar-home { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px; color: var(--text-soft); font-size: 14px; font-weight: 500; text-decoration: none !important; }
.sidebar-home:hover, .sidebar-home.is-active { background: var(--surface); color: var(--text); }
.nav-group { margin-top: 14px; }
.nav-group summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 4px 10px; color: var(--text); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; border-radius: 6px; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary svg { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.nav-group[open] summary svg { transform: rotate(90deg); }
.nav-group summary:hover { color: var(--accent-text); }
.nav-group.is-framework summary { color: var(--muted); }
.nav-group ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 10px; border-left: 1px solid var(--border); margin-left: 10px; }
.nav-group li a { position: relative; display: block; padding: 5px 10px; margin-left: -11px; border-left: 1px solid transparent; color: var(--muted); font-size: 14px; line-height: 1.45; text-decoration: none; }
.nav-group li a:hover { color: var(--text); border-left-color: var(--border-strong); }
.nav-group li a[aria-current="page"] { color: var(--text); font-weight: 600; border-left: 2px solid var(--accent); margin-left: -11.5px; }
.nav-group li a[aria-current="page"]::before { content: ''; position: absolute; left: -2px; top: 4px; bottom: 4px; width: 2px; box-shadow: var(--glow); }
.sidebar-foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot a { color: var(--muted); font-size: 13px; padding: 4px 10px; }
.sidebar-foot a:hover { color: var(--text); }
.sidebar-label { margin: 0 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.main { min-width: 0; }
.scrim { display: none; }

/* Article + "On this page" */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); gap: 64px; padding: 40px 32px 96px var(--content-pad); }
.page-grid-wide { grid-template-columns: minmax(0, 1fr); max-width: 980px; }
.doc { width: 100%; max-width: 860px; min-width: 0; }
.page-grid > *, .layout > * { min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 13.5px; color: var(--accent-text); font-weight: 500; }
.crumbs a { color: var(--muted); }
.crumbs svg { width: 14px; height: 14px; color: var(--muted); }
.toc { position: relative; }
.toc-inner { position: sticky; top: calc(var(--topbar-h) + 40px); max-height: calc(100vh - var(--topbar-h) - 60px); overflow-y: auto; scrollbar-width: none; }
.toc-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text); }
.toc nav ul { list-style: none; margin: 0; padding: 0; }
.toc nav ul ul { padding-left: 12px; }
.toc nav a { display: block; padding: 4px 0 4px 12px; border-left: 1px solid var(--border); color: var(--muted); font-size: 13px; line-height: 1.45; text-decoration: none; transition: color .15s, border-color .15s; }
.toc nav a:hover { color: var(--text); }
.toc nav a.is-active { color: var(--accent-text); border-left-color: var(--accent); }
.toc-actions { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.toc-actions a { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 3px 0; }
.toc-actions a:hover { color: var(--text); text-decoration: none; }
.toc-actions svg { width: 15px; height: 15px; }

/* Prose */
.prose { overflow-wrap: break-word; }
.prose h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.12; letter-spacing: -.035em; font-weight: 700; margin: 0 0 16px; }
.prose h1 + p, .prose .crumbs + h1 + p { font-size: 18.5px; line-height: 1.6; color: var(--text-soft); margin-bottom: 28px; }
.prose h2 { font-size: 26px; line-height: 1.25; letter-spacing: -.025em; font-weight: 650; margin: 56px 0 14px; padding-top: 8px; }
.prose h3 { font-size: 19px; line-height: 1.35; letter-spacing: -.015em; font-weight: 600; margin: 36px 0 10px; }
.prose h4 { font-size: 16px; font-weight: 600; margin: 28px 0 8px; }
.prose h2, .prose h3, .prose h4 { position: relative; }
.anchor { position: absolute; left: -1.1em; width: 1em; color: var(--muted); opacity: 0; font-weight: 400; text-decoration: none !important; transition: opacity .15s; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor, .anchor:focus { opacity: 1; color: var(--accent-text); }
.prose p { margin: 0 0 18px; color: var(--text-soft); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 22px; color: var(--text-soft); }
.prose li { margin: 6px 0; padding-left: 4px; }
.prose li::marker { color: var(--muted); }
.prose ol > li::marker { color: var(--accent-text); font: 600 14px var(--font-mono); }
.prose a:not(.anchor):not(.card):not(.pager-card):not(.button) { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: text-decoration-color .15s, color .15s; }
.prose a:not(.anchor):not(.card):not(.pager-card):not(.button):hover { color: var(--accent-text); text-decoration-color: var(--accent); }
.prose hr { border: 0; height: 1px; background: var(--border); margin: 40px 0; }
.prose img { max-width: 100%; border-radius: var(--radius); }

/* Inline code */
.prose :not(pre) > code { font: 500 .86em var(--font-mono); padding: .15em .4em; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); white-space: break-spaces; }
.prose a code { color: inherit; }

/* Code blocks */
.codeblock { margin: 22px 0 26px; border: 1px solid var(--code-border); border-radius: var(--radius-lg); background: var(--code-bg); overflow: hidden; }
:root.light .codeblock { --code-border: #1d2a19; }
.code-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 0 16px; height: 40px; border-bottom: 1px solid var(--code-border); background: linear-gradient(180deg, rgba(125, 255, 58, .05), transparent); }
.code-lang { display: inline-flex; align-items: center; gap: 8px; font: 500 12.5px var(--font-mono); color: #9fb596; }
.code-lang::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--chem-500); box-shadow: 0 0 8px rgba(125, 255, 58, .9); }
.copy-code { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 7px; background: none; color: #9fb596; font: 500 12px var(--font-sans); padding: 5px 8px; }
.copy-code:hover { color: #ecf8e6; border-color: #2d4026; background: #0e150c; }
.copy-code svg { width: 14px; height: 14px; }
.copy-code.is-copied { color: var(--chem-400); }
.codeblock .highlight { margin: 0; }
.codeblock pre:focus-visible { outline-offset: -2px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.codeblock pre { margin: 0; padding: 18px 20px; overflow-x: auto; background: transparent !important; color: var(--code-text); font: 13.5px/1.7 var(--font-mono); font-variant-ligatures: none; tab-size: 4; scrollbar-width: thin; scrollbar-color: #2d4026 transparent; }
.codeblock pre code { font: inherit; }

/* Tables */
.table-wrap { margin: 24px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); scrollbar-width: thin; }
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose tr:last-child td { border-bottom: 0; }
.prose th { background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.prose td { color: var(--text-soft); }

/* Callouts ("Good to know") */
.callout { margin: 24px 0; padding: 14px 18px; border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.callout > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 8px; }
.callout-title { font-weight: 600; color: var(--text) !important; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.callout-title::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.callout-note, .callout-tip { border-left-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), var(--surface) 60%); }
.callout-note .callout-title::before, .callout-tip .callout-title::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.callout-important { border-left-color: #a78bfa; }
.callout-important .callout-title::before { background: #a78bfa; }
.callout-warning, .callout-caution { border-left-color: #ffb547; background: linear-gradient(90deg, rgba(255, 181, 71, .08), var(--surface) 60%); }
.callout-warning .callout-title::before, .callout-caution .callout-title::before { background: #ffb547; }
.callout-quote { border-left-color: var(--accent-line); }

/* Diagrams */
.diagram { margin: 28px 0 32px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: radial-gradient(ellipse at 70% 0%, var(--accent-soft), transparent 60%), var(--bg-raised); }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram figcaption { margin-top: 14px; color: var(--muted); font-size: 13.5px; text-align: center; }
:root.light .diagram { --accent: var(--chem-700); }

/* Prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 64px 0 24px; }
.pager-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); color: var(--text) !important; text-decoration: none !important; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pager-card small { color: var(--muted); font-size: 13px; }
.pager-card span { font-weight: 600; }
.pager-card:hover { border-color: var(--accent-line); box-shadow: var(--glow); transform: translateY(-1px); }
.pager-next { grid-column: 2; text-align: right; }
.page-meta { display: flex; gap: 20px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13.5px; }
.page-meta a { color: var(--muted) !important; text-decoration: none !important; }
.page-meta a:hover { color: var(--text) !important; }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 18px 0 8px; }
.card { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); color: var(--text) !important; font-weight: 500; font-size: 15px; text-decoration: none !important; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card svg { width: 16px; height: 16px; color: var(--muted); transition: color .15s, transform .15s; }
.card:hover { border-color: var(--accent-line); box-shadow: var(--glow); transform: translateY(-1px); }
.card:hover svg { color: var(--accent-text); transform: translate(2px, -2px); }

/* Buttons */
.button { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none !important; transition: box-shadow .15s, transform .15s, background .15s, border-color .15s; }
.button-primary { background: var(--chem-500); color: var(--accent-ink) !important; box-shadow: 0 0 0 1px rgba(125, 255, 58, .6), 0 0 28px rgba(125, 255, 58, .35); }
.button-primary:hover { background: var(--chem-400); box-shadow: 0 0 0 1px rgba(125, 255, 58, .8), 0 0 40px rgba(125, 255, 58, .55); transform: translateY(-1px); }
.button-ghost { border: 1px solid var(--border-strong); color: var(--text) !important; background: var(--surface); }
.button-ghost:hover { border-color: var(--accent-line); }

/* Home */
.home { padding: 0 32px 96px; }
.hero { position: relative; padding: 48px 0 40px; }
/* BIOS frame: double green rule, status bars, titled panels. */
.bios { margin-top: 28px; padding: 0; border: 3px double var(--accent-line); border-radius: 6px; background: linear-gradient(180deg, rgba(125, 255, 58, .03), transparent 40%), var(--bg); box-shadow: 0 0 0 1px rgba(125, 255, 58, .06), 0 0 48px -12px rgba(125, 255, 58, .25); }
.bios-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; padding: 30px 22px 24px; }
.bios-panel { position: relative; min-width: 0; padding: 22px 20px 18px; border: 1px solid var(--accent-line); border-radius: 3px; }
.bios-title { position: absolute; top: -.75em; left: 12px; padding: 0 8px; background: var(--bg); font: 600 11.5px/1.5 var(--font-mono); letter-spacing: .14em; color: var(--accent-text); }
.bios-title::before { content: '┤ '; color: var(--accent-line); }
.bios-title::after { content: ' ├'; color: var(--accent-line); }
.bios .hero-glow { display: none; }
.bios .ascii-scene { margin: 0 auto; }
.bios h1 { margin: 0; }
.bios .hero-lede { margin: 0 0 22px; }
.bios .hero-actions { margin: 0; }
.bios .compare, .bios .terminal { max-width: none; margin: 0; border: 0; padding: 0; background: none; box-shadow: none; }
.bios .terminal-bar { display: none; }
.bios .terminal pre { padding: 2px 0; }
.panel-bench .compare-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.panel-bench .compare-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-bench .compare-label b { display: inline; }
.panel-bench .compare-label small { display: inline; }
.qs-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.qs-col { min-width: 0; }
.qs-col + .qs-col { padding-top: 18px; border-top: 1px dashed var(--accent-line); }
.qs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font: 600 11.5px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.qs-code { margin: 0; overflow-x: auto; color: var(--code-text); font: 13.5px/1.85 var(--font-mono); scrollbar-width: thin; }
:root.light .qs-code { color: var(--text); }
.qs-prompt { white-space: pre-wrap; color: var(--text-soft); }
.panel-system, .panel-readme { display: flex; flex-direction: column; justify-content: center; }
@media (min-width: 1240px) {
  .bios-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-areas: "mark system" "bench readme" "boot boot"; column-gap: 28px; row-gap: 30px; }
  .panel-mark { grid-area: mark; display: grid; place-items: center; }
  .panel-system { grid-area: system; padding-left: 28px; }
  .panel-bench { grid-area: bench; }
  .panel-readme { grid-area: readme; padding-left: 28px; }
  .panel-boot { grid-area: boot; }
  .qs-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
  .qs-col + .qs-col { padding: 0 0 0 24px; margin-left: 24px; border-top: 0; border-left: 1px dashed var(--accent-line); }
  .bios h1 { font-size: clamp(40px, 3.9vw, 72px); }
}
.hero-glow { position: absolute; z-index: -1; top: -80px; left: -120px; width: 720px; height: 460px; background: radial-gradient(ellipse at 40% 40%, rgba(125, 255, 58, .22), transparent 62%); filter: blur(10px); pointer-events: none; }
:root.light .hero-glow { background: radial-gradient(ellipse at 40% 40%, rgba(125, 255, 58, .28), transparent 62%); }
.ascii-scene { position: relative; display: grid; width: min(100%, 540px); margin: 0 0 28px; container-type: inline-size; }
.ascii-scene pre { grid-area: 1 / 1; margin: 0; font: 600 calc(100cqw / (var(--cols, 64) * .6)) / 1.09 var(--font-mono); white-space: pre; letter-spacing: 0; user-select: none; }
.ascii-shell { color: var(--muted); }
.ascii-scene:not(.is-playing) .ascii-shell { display: none; }
.ascii-dust { position: absolute; top: 0; left: 0; z-index: 1; color: var(--muted); opacity: .8; pointer-events: none; }
.ascii-adult { color: var(--chem-500); text-shadow: 0 0 calc(100cqw / 160) rgba(125, 255, 58, .75); }
.js .ascii-scene:not(.is-playing):not(.is-done) .ascii-adult { visibility: hidden; }
.js .ascii-scene:not(.is-playing):not(.is-done) .ascii-shell { display: block; }
.ascii-scene.is-done .ascii-adult { animation: chem-glow 4s ease-in-out infinite; }
/* 3D: the cicada turns toward you while it sheds, then sways slowly. */
.panel-mark { perspective: 900px; }
.ascii-scene { transform-style: preserve-3d; transform: rotateX(8deg) rotateY(-14deg); }
.ascii-scene.is-playing { animation: cicada-turn 3.2s cubic-bezier(.2, .7, .2, 1) both; }
.ascii-scene.is-done { animation: cicada-sway 9s ease-in-out infinite; }
@keyframes cicada-turn { from { transform: rotateX(24deg) rotateY(-38deg) rotateZ(-4deg) scale(.92); } to { transform: rotateX(8deg) rotateY(-14deg); } }
@keyframes cicada-turn-flat { from { transform: rotateX(24deg) rotateY(-30deg) scale(.94); } to { transform: none; } }
@keyframes cicada-sway { 0%, 100% { transform: rotateX(8deg) rotateY(-14deg); } 50% { transform: rotateX(4deg) rotateY(14deg) rotateZ(1deg); } }
@keyframes chem-glow { 50% { text-shadow: 0 0 calc(100cqw / 90) rgba(125, 255, 58, .95); } }
:root.light .ascii-adult { color: var(--chem-700); text-shadow: none; }
.hero h1 { margin: 0; max-width: 980px; font-size: clamp(36px, 5.2vw, 64px); line-height: 1.04; letter-spacing: -.05em; font-weight: 750; }
.glow-text { color: var(--chem-500); text-shadow: 0 0 22px rgba(125, 255, 58, .55), 0 0 2px rgba(125, 255, 58, .9); }
:root.light .glow-text { color: var(--chem-700); text-shadow: 0 0 24px rgba(125, 255, 58, .45); }
.hero-lede { max-width: 620px; margin: 22px 0 30px; font-size: clamp(17px, 2vw, 20px); line-height: 1.55; color: var(--text-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; }
.compare { max-width: 760px; margin: 0 0 32px; padding: 18px 20px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); }
.compare-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 12.5px; }
.legend .sw-d { margin-left: 10px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw-c { background: var(--chem-500); box-shadow: 0 0 8px rgba(125, 255, 58, .7); }
.sw-d { background: var(--border-strong); }
.compare-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.compare-label b { display: block; font-size: 14.5px; font-weight: 600; color: var(--text); }
.compare-label small { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
.compare-bars { display: grid; gap: 6px; }
.bar { display: flex; align-items: center; gap: 10px; height: 18px; }
.bar span { display: block; flex: none; width: calc((100% - 84px) * var(--w, 1)); height: 100%; min-width: 3px; border-radius: 4px; }
.bar em { font: 600 13px var(--font-mono); font-style: normal; white-space: nowrap; }
.bar-c span { background: linear-gradient(90deg, var(--chem-600), var(--chem-400)); box-shadow: 0 0 12px rgba(125, 255, 58, .45); }
.bar-c em { color: var(--accent-text); }
.bar-d span { background: var(--border-strong); }
.bar-d em { color: var(--muted); }
.compare-note { margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.compare-note a { color: var(--accent-text); }
@media (max-width: 700px) { .compare-row { grid-template-columns: minmax(0, 1fr); gap: 8px; } }
.terminal { max-width: 760px; border: 1px solid var(--code-border); border-radius: var(--radius-lg); background: var(--code-bg); overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7), 0 0 0 1px rgba(125, 255, 58, .06); }
:root.light .terminal { box-shadow: 0 30px 60px -30px rgba(23, 69, 7, .45); }
.terminal-bar { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-bottom: 1px solid var(--code-border); }
.terminal-bar span { width: 11px; height: 11px; border-radius: 50%; background: #1f2d1b; }
.terminal-bar em { margin-left: 10px; font: 12px var(--font-mono); font-style: normal; color: #7f9577; }
.terminal pre { margin: 0; padding: 18px 20px; overflow-x: auto; color: #e3f2dc; font: 13.5px/1.85 var(--font-mono); }
.terminal .prompt { color: var(--chem-500); user-select: none; }
.terminal .ok { color: var(--chem-500); text-shadow: 0 0 8px rgba(125, 255, 58, .7); }
.home-section { padding-top: 56px; }
.home-section h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.03em; font-weight: 700; }
.section-lede { margin: 0 0 18px; max-width: 760px; color: var(--muted); font-size: 16.5px; }
.mapping { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-raised); }
.map-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 36px minmax(0, 1.25fr); align-items: center; column-gap: 8px; padding: 13px 20px; border-top: 1px solid var(--border); font-size: 15px; line-height: 1.5; transition: background .15s; }
.map-row:first-child { border-top: 0; }
.map-row > span { min-width: 0; }
.map-concept { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.map-from { color: var(--muted); }
.map-to { color: var(--text); font-weight: 500; }
.map-arrow { color: var(--accent-text); text-align: center; font-size: 16px; }
.map-row code { font: 500 13px var(--font-mono); padding: 2px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); white-space: nowrap; }
.map-to code { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.map-head { padding: 10px 20px; background: var(--surface); }
.map-head span { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.map-row:not(.map-head):hover { background: var(--accent-soft); }
@media (max-width: 700px) {
  .map-head { display: none; }
  .map-row { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "concept concept" "from from" "arrow to"; row-gap: 4px; padding: 14px 16px; }
  .map-concept { grid-area: concept; }
  .map-from { grid-area: from; font-size: 14px; }
  .map-arrow { grid-area: arrow; text-align: left; padding-right: 8px; }
  .map-to { grid-area: to; }
}
.home-foot { padding-top: 40px; }

/* Search */
dialog { width: min(640px, calc(100vw - 32px)); max-height: min(72vh, 640px); margin: 12vh auto auto; padding: 0; background: var(--bg-raised); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(125, 255, 58, .08); overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(2, 4, 2, .7); backdrop-filter: blur(4px); }
.search-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
#search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; color: var(--text); }
#search-input::-webkit-search-cancel-button { display: none; }
#search-close { border: 0; background: none; padding: 0; }
#search-status { margin: 0; padding: 10px 18px; font-size: 13px; color: var(--muted); }
#search-results { list-style: none; margin: 0; padding: 0 8px 10px; overflow-y: auto; }
#search-results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
#search-results a:hover, #search-results a[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
#search-results b { font-weight: 600; }
#search-results small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#search-results mark { background: none; color: var(--accent-text); font-weight: 600; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-raised); }
.footer-inner { padding: 28px 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-inner { align-items: flex-start; }
.footer-brand { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.footer-inner p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.footer-inner p strong { color: var(--text-soft); font-weight: 600; }

.footer-inner nav { margin-left: auto; display: flex; gap: 20px; flex-wrap: wrap; }
.footer-inner nav a { color: var(--muted); font-size: 14px; }
.footer-inner nav a:hover { color: var(--text); }
.brand-small .logo { width: 27px; height: 22px; }
.brand-small .brand-name { font-size: 16px; }

/* 404 */
.not-found { padding: 120px 56px; max-width: 640px; }
.not-found-code { margin: 0 0 12px; font: 600 14px var(--font-mono); color: var(--accent-text); }
.not-found h1 { font-size: 44px; letter-spacing: -.04em; margin: 0 0 12px; }
.not-found p { color: var(--muted); margin: 0 0 28px; }

/* Responsive */
@media (min-width: 1700px) { :root { --sidebar-w: 300px; --toc-w: 260px; --content-pad: 96px; } .doc { max-width: 900px; } }
@media (max-width: 1240px) {
  :root { --content-pad: 48px; }
  .page-grid { grid-template-columns: minmax(0, 1fr); padding: 36px 40px 72px var(--content-pad); }
  .toc { display: none; }
  .doc { justify-self: center; }
  .top-nav { display: none; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 58px; }
  :root { --content-pad: 20px; }
  .layout, .topbar-inner { grid-template-columns: minmax(0, 1fr); }
  .topbar-inner { display: flex; gap: 10px; padding: 0 14px; }
  .topbar-start { border: 0; padding: 0; gap: 10px; }
  .topbar-start .version-pill { margin-left: 0; }
  .topbar-end { flex: 1; padding: 0; justify-content: flex-end; gap: 6px; }
  .footer-inner { padding: 24px 20px; }
  .home { padding: 0 12px 56px; }
  .hero { padding-top: 20px; }
  .bios { margin-top: 8px; }
  .bios-grid { gap: 22px; padding: 22px 12px 14px; }
  .bios-panel { padding: 20px 14px 16px; }
  .ascii-scene pre { font-weight: 700; }
  .ascii-adult, .ascii-scene.is-done .ascii-adult { text-shadow: none; animation: none; }
  .ascii-scene, .ascii-scene.is-done { animation-name: none; transform: none; }
  .ascii-scene.is-playing { animation: cicada-turn-flat 2.4s cubic-bezier(.2, .7, .2, 1) both; }
  .menu-toggle { display: inline-grid; }
  .sidebar { position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; height: 100vh; width: min(320px, 86vw); background: var(--bg); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 30px 0 60px -30px rgba(0, 0, 0, .7); }
  .sidebar.is-open { transform: none; }
  .scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(2, 4, 2, .6); backdrop-filter: blur(2px); }
  .search-trigger { width: auto; margin-left: auto; }
  .search-label, .search-trigger kbd { display: none; }
  .page-grid { padding: 28px 20px 64px; }
  .home { padding: 0 20px 64px; }
  .hero { padding-top: 48px; }
  .anchor { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
  .diagram { padding: 14px; }
  .footer-inner nav { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print {
  .topbar, .sidebar, .toc, .pager, .site-footer, .copy-code { display: none !important; }
  .layout, .page-grid { display: block; padding: 0; }
  body { background: #fff; color: #000; }
}
