/* Theme tokens. Dark is the page's built-in default; light follows the OS unless a theme is picked. */
@media (prefers-color-scheme: light) {
:root:not([data-theme]) {
  --bg:#f7f8fa;
  --panel:#ffffff;
  --panel2:#f1f3f6;
  --ink:#1f2328;
  --muted:#57606a;
  --accent:#d1242f;
  --accent2:#0b6b69;
  --ok:#15803d;
  --warn:#b45309;
  --bad:#b91c1c;
  --code-bg:#eef1f4;
  --border:#d8dee4;
  --link:#0b62d6;
  --c-071:#065f2c;
  --c-0d1612:#eef8f0;
  --c-0f1a12:#ecf8ef;
  --c-111:#111;
  --c-15181d:#ffffff;
  --c-1a130d:#fff4ec;
  --c-1a1608:#fff8e1;
  --c-1a1f26:#eef0f3;
  --c-1b1012:#fdeeee;
  --c-1b2027:#e8ebf0;
  --c-1b3763:#dbe8ff;
  --c-1f242c:#ffffff;
  --c-2c528f:#9bbcf0;
  --c-3a1f52:#efe3fb;
  --c-4ade80:#15803d;
  --c-4b1414:#fde2e2;
  --c-6a3bb0:#b797e6;
  --c-7a1d1d:#f2a3a3;
  --c-86efac:#15803d;
  --c-9fe7a4:#166534;
  --c-bbf7d0:#dcfce7;
  --c-bff2c2:#14532d;
  --c-eaf3ff:#1e3a8a;
  --c-f0a93b:#d97706;
  --c-f0d4b8:#7c3f12;
  --c-f6e9ff:#4c1d95;
  --c-f8c261:#fde68a;
  --c-fbd38d:#92400e;
  --c-fde68a:#78350f;
  --c-ff7a59:#0b6b69;
  --c-ff8080:#b91c1c;
  --c-ffd7bf:#084f4d;
  --c-fff:#0f172a;
  --c-0f2415:#e7f8ec;
  --c-1a3826:#dcfce7;
  --c-1f1812:#fff1e8;
  --c-2a2208:#fef3c7;
  --c-2a5a3a:#86c79a;
  --c-2b1013:#fde8e8;
  --c-3a4452:#b6bfcc;
  --c-6b5215:#e0b44c;
  --c-8f1414:#b91c1c;
  --c-d61e1e:#b91c1c;
  --c-d9fbe3:#14532d;
  --c-ffd1d1:#7f1d1d;
  --c-a00055:rgba(15,23,42,.18);
  --c-a2551228912:rgba(11,107,105,.10);
  --c-a2551228915:rgba(11,107,105,.15);
  --on-accent:#fff;
  color-scheme:light;
}
}
:root[data-theme="light"] {
  --bg:#f7f8fa;
  --panel:#ffffff;
  --panel2:#f1f3f6;
  --ink:#1f2328;
  --muted:#57606a;
  --accent:#d1242f;
  --accent2:#0b6b69;
  --ok:#15803d;
  --warn:#b45309;
  --bad:#b91c1c;
  --code-bg:#eef1f4;
  --border:#d8dee4;
  --link:#0b62d6;
  --c-071:#065f2c;
  --c-0d1612:#eef8f0;
  --c-0f1a12:#ecf8ef;
  --c-111:#111;
  --c-15181d:#ffffff;
  --c-1a130d:#fff4ec;
  --c-1a1608:#fff8e1;
  --c-1a1f26:#eef0f3;
  --c-1b1012:#fdeeee;
  --c-1b2027:#e8ebf0;
  --c-1b3763:#dbe8ff;
  --c-1f242c:#ffffff;
  --c-2c528f:#9bbcf0;
  --c-3a1f52:#efe3fb;
  --c-4ade80:#15803d;
  --c-4b1414:#fde2e2;
  --c-6a3bb0:#b797e6;
  --c-7a1d1d:#f2a3a3;
  --c-86efac:#15803d;
  --c-9fe7a4:#166534;
  --c-bbf7d0:#dcfce7;
  --c-bff2c2:#14532d;
  --c-eaf3ff:#1e3a8a;
  --c-f0a93b:#d97706;
  --c-f0d4b8:#7c3f12;
  --c-f6e9ff:#4c1d95;
  --c-f8c261:#fde68a;
  --c-fbd38d:#92400e;
  --c-fde68a:#78350f;
  --c-ff7a59:#0b6b69;
  --c-ff8080:#b91c1c;
  --c-ffd7bf:#084f4d;
  --c-fff:#0f172a;
  --c-0f2415:#e7f8ec;
  --c-1a3826:#dcfce7;
  --c-1f1812:#fff1e8;
  --c-2a2208:#fef3c7;
  --c-2a5a3a:#86c79a;
  --c-2b1013:#fde8e8;
  --c-3a4452:#b6bfcc;
  --c-6b5215:#e0b44c;
  --c-8f1414:#b91c1c;
  --c-d61e1e:#b91c1c;
  --c-d9fbe3:#14532d;
  --c-ffd1d1:#7f1d1d;
  --c-a00055:rgba(15,23,42,.18);
  --c-a2551228912:rgba(11,107,105,.10);
  --c-a2551228915:rgba(11,107,105,.15);
  --on-accent:#fff;
  color-scheme:light;
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="hacker"] {
  --bg:#000000;
  --panel:#020a04;
  --panel2:#041208;
  --ink:#33ff66;
  --muted:#1fa83f;
  --accent:#33ff66;
  --accent2:#66ff99;
  --ok:#33ff66;
  --warn:#99ff66;
  --bad:#ff5555;
  --code-bg:#000000;
  --border:#0f5a26;
  --link:#66ffcc;
  --c-071:#00ff66;
  --c-0d1612:#001a07;
  --c-0f1a12:#001a07;
  --c-111:#000;
  --c-15181d:#000;
  --c-1a130d:#001a07;
  --c-1a1608:#001a07;
  --c-1a1f26:#001a07;
  --c-1b1012:#140404;
  --c-1b2027:#003311;
  --c-1b3763:#002a10;
  --c-1f242c:#001a07;
  --c-2c528f:#00aa44;
  --c-3a1f52:#002a10;
  --c-4ade80:#33ff66;
  --c-4b1414:#002a10;
  --c-6a3bb0:#00aa44;
  --c-7a1d1d:#ff5555;
  --c-86efac:#33ff66;
  --c-9fe7a4:#33ff66;
  --c-bbf7d0:#002a10;
  --c-bff2c2:#66ff99;
  --c-eaf3ff:#33ff66;
  --c-f0a93b:#00aa44;
  --c-f0d4b8:#33ff66;
  --c-f6e9ff:#33ff66;
  --c-f8c261:#002a10;
  --c-fbd38d:#66ff99;
  --c-fde68a:#99ffbb;
  --c-ff7a59:#33ff66;
  --c-ff8080:#ff5555;
  --c-ffd7bf:#66ff99;
  --c-fff:#66ff99;
  --c-0f2415:#003311;
  --c-1a3826:#003311;
  --c-1f1812:#002a10;
  --c-2a2208:#001a07;
  --c-2a5a3a:#33ff66;
  --c-2b1013:#1a0000;
  --c-3a4452:#00aa44;
  --c-6b5215:#00aa44;
  --c-8f1414:#33ff66;
  --c-d61e1e:#003311;
  --c-d9fbe3:#33ff66;
  --c-ffd1d1:#ff5555;
  --c-a00055:rgba(0,255,102,.15);
  --c-a2551228912:rgba(51,255,102,.15);
  --c-a2551228915:rgba(51,255,102,.2);
  --on-accent:#000;
  color-scheme:dark;
}

/* Hacker: IBM VGA 8x16 text-mode font. Its glyphs sit on a 16px pixel grid, so it
   is only crisp at 16px / 32px with whole-pixel line heights - keep sizes on that grid. */
/* Hacker-theme font: IBM VGA 8x16 from The Ultimate Oldschool PC Font Pack by VileR
   (https://int10h.org/oldschool-pc-fonts/), CC BY-SA 4.0 - see assets/FONT-LICENSE.txt. */
@font-face {
  font-family: "IBM VGA 8x16";
  src: url("ibm-vga-8x16.woff") format("woff");
  font-display: swap;
}
:root[data-theme="hacker"], :root[data-theme="hacker"] * {
  font-family: "IBM VGA 8x16", ui-monospace, Menlo, Consolas, monospace !important;
  font-size: 16px !important; line-height: 24px;
  font-weight: 400 !important; font-style: normal !important; font-synthesis: none;
  letter-spacing: 0 !important; text-shadow: none !important; font-kerning: none;
  -webkit-font-smoothing: none; -moz-osx-font-smoothing: unset; text-rendering: optimizeSpeed;
}
:root[data-theme="hacker"] h1.title, :root[data-theme="hacker"] h2,
:root[data-theme="hacker"] .score-big { font-size: 32px !important; line-height: 40px; }
/* Words wrapped inside big headings (acronym tooltips, links) keep the heading's size */
:root[data-theme="hacker"] h1.title *, :root[data-theme="hacker"] h2 *,
:root[data-theme="hacker"] .score-big * { font-size: inherit !important; line-height: inherit; }
:root[data-theme="hacker"] h2::before { content: "> "; color: var(--muted); }
:root[data-theme="hacker"] nav.toc .brand-type, :root[data-theme="hacker"] nav.toc .brand-type * { font-size: 32px !important; line-height: 40px !important; }
/* Whole-pixel spacing so every line of text stays on the 16px pixel grid
   (default em-based margins like 0.83em x 32px = 26.56px knock it off by half a pixel) */
:root[data-theme="hacker"] h2 { margin: 48px 0 24px; }
:root[data-theme="hacker"] h3 { margin: 32px 0 16px; }
:root[data-theme="hacker"] h4 { margin: 24px 0 8px; }
:root[data-theme="hacker"] p, :root[data-theme="hacker"] ul, :root[data-theme="hacker"] ol,
:root[data-theme="hacker"] dl, :root[data-theme="hacker"] blockquote { margin-top: 16px; margin-bottom: 16px; }
:root[data-theme="hacker"] li { margin: 4px 0; }
:root[data-theme="hacker"] td, :root[data-theme="hacker"] th { padding: 8px; }
/* Collapsed borders split 1px in half and shift cell text by 0.5px; use whole-pixel separate borders */
:root[data-theme="hacker"] table { border-collapse: separate; border-spacing: 0;
  border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
:root[data-theme="hacker"] td, :root[data-theme="hacker"] th { border-width: 0 1px 1px 0; }
:root[data-theme="hacker"] b, :root[data-theme="hacker"] strong, :root[data-theme="hacker"] th,
:root[data-theme="hacker"] h1, :root[data-theme="hacker"] h2, :root[data-theme="hacker"] h3, :root[data-theme="hacker"] h4 { color: #b3ffc6; }
:root[data-theme="hacker"] h3 { text-decoration: underline; text-underline-offset: 4px; }
:root[data-theme="hacker"] em, :root[data-theme="hacker"] i { text-decoration: underline; text-underline-offset: 3px; }
:root[data-theme="hacker"] ::selection { background: #33ff66; color: #000; }

/* Theme switcher: a small control in the page's top-right corner (scrolls with the page) */
.theme-bar { position:absolute; z-index:50; top:calc(12px + env(safe-area-inset-top, 0px)); right:max(16px, env(safe-area-inset-right, 0px));
  display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--muted); }
.theme-bar .seg { box-shadow:0 1px 3px rgba(0,0,0,.18); }
@media (max-width:600px) { .theme-bar > span { display:none; } .theme-bar button { padding:5px 9px; } }
.theme-bar .seg { display:inline-flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.theme-bar button { background:var(--panel2); color:var(--ink); border:0; border-right:1px solid var(--border);
  padding:5px 12px; font:inherit; cursor:pointer; }
.theme-bar button:last-child { border-right:0; }
.theme-bar button:hover { background:var(--c-1b2027,#1b2027); }
.theme-bar button[aria-pressed="true"] { background:var(--accent2); color:var(--on-accent,#fff); font-weight:600; }


/* Narrow screens: keep wide tables scrollable inside their box instead of widening the page */
main, .wrap { min-width: 0; }
@media (max-width: 1000px) {
  main { padding: 24px 16px 80px; }
  table { display: block; overflow-x: auto; }
}
@media (max-width: 1000px) {
  code { overflow-wrap: anywhere; }
}
/* Long paths in table cells wrap instead of stretching the table past the page */
td code, td { overflow-wrap: anywhere; }
