/*
 * Clef design system (css/clef.css): fonts, tokens, reset, type, buttons, the shell (header, mobile menu, footer,
 * wallet picker, toasts) and the shared components every page uses (panels, eyebrows, chips, probability
 * rows, the staff divider, code cards, tables, the nil placeholder).
 *
 * Look: the Cloudflare blog. White page, alabaster and concrete bands, flaming orange accents, cream
 * diagram panels with thin amber borders, uppercase orange labels, thin probability bars, the five-line
 * staff with sparkles. Inter (body), Inter Tight (display), JetBrains Mono (numbers, labels, code).
 *
 * CSP: style-src 'self'. No inline styles anywhere: dynamic values go through el.style.setProperty().
 *
 * Every page links this file first, then its own (css/home.css, app.css, board.css, docs.css).
 * The vocabulary, so page css only adds layout:
 *   tokens      --paper --alabaster --concrete --ink --body --muted --faint --line --line-2
 *               --orange (#ff5e1f) --orange-2 (diagram orange) --orange-text (small orange text, AA) --orange-deep --carrot --rust --chardon --cream
 *               --cream-2 --amber (panel border) --sand / --sand-2 (bar track / loser) --staff --spark --plate
 *               --good --bad · fonts --sans --display --mono --math · radii --r-xs..--r-xl · --wrap --gutter
 *               --hdr-h · motion --ease --ease-out · --shadow-1 --shadow-2
 *   layout      .wrap (.wrap-narrow) .sec (.sec-band, .sec-tight) .sec-head (.is-center) .page-head .grid-2 .stack
 *   type        .display/.h1 .h2 .h3 .lede .eyebrow (.eyebrow-mono) .small .tiny .mono .tnum .muted .ink
 *               .accent .up .down .link .arrow-link .kicker
 *   controls    .btn (.btn-primary .btn-ink .btn-ghost .btn-soft · .btn-lg .btn-sm .btn-block) .icon-btn
 *               .soon-tag .field .field-label .input .range (--v) .seg (button[aria-pressed]) .chip (.is-mono)
 *   diagram     .panel (.is-hot .is-plain) .panel-head .panel-label · .probs/.prob (.is-top, --p on .prob-bar > i)
 *               .diagram (.dg-col .dg-label .dg-hub .dg-model .dg-note) + js/ui/wires.js connectors
 *               .staff (.spark .is-b) as a divider · .staff-rule (a five-line rule, full width)
 *   data        .tbl (.num) .tbl-wrap · .code (.code-head .code-title .copy-btn, .tok-*) · math / .mathbox
 *               .logo (--logo-size) .nil (unknown value) .stat (.stat-k .stat-v) .empty
 *   shell       .hdr .nav .coin .pop .menu-item .sheet .ftr .modal .picker-* .toasts/.toast .news (js/shell.js)
 *   motion      .reveal (.is-in, js/shell.js initReveal) · prefers-reduced-motion respected everywhere
 */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/inter-latin.woff2) format('woff2'); }
@font-face { font-family: 'Inter Tight'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/inter-tight-latin.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/jetbrains-mono-b.woff2) format('woff2'); }
@font-face { font-family: 'Inter Fallback'; src: local(Arial); ascent-override: 90.49%; descent-override: 22.56%; line-gap-override: 0%; size-adjust: 107.06%; }

:root {
  color-scheme: light;

  --paper: #ffffff;
  --alabaster: #fbfbfb;
  --concrete: #f3f3f3;
  --haze: #f6f6f7;
  --ink: #151414;
  --text: #262626;
  --body: #3d3d3d;
  --muted: #6d6d6d;
  --faint: #8d8d8d;
  --line: #e4e4e4;
  --line-2: #d4d4d4;

  --orange: #ff5e1f;      /* flaming orange, the accent */
  --orange-2: #ff6633;    /* the diagrams' orange (the model box, fills, strokes) */
  --orange-text: #c93a00; /* orange for small text: 5.1:1 on white, 4.9 on cream, 4.6 on the hot panel (WCAG AA) */
  --orange-hover: #ec4b0d;
  --orange-deep: #d63c01;
  --carrot: #ed6937;
  --rust: #b53b13;        /* option text in the diagrams */
  --chardon: #f8e7dd;
  --cream: #fff8ee;       /* diagram panels */
  --cream-2: #fff0e7;     /* the highlighted panel */
  --amber: #fbb34f;       /* panel borders */
  --amber-soft: #fdd7a3;
  --sand: #f0dbbd;        /* probability bar track */
  --sand-2: #e3c49c;      /* a non-winning share */
  --chip: #fbe7cb;
  --spring: #e8e0db;
  --eclipse: #301e13;
  --staff: #fcc98a;
  --staff-soft: #fde2bd;
  --spark: #fea322;       /* the hero art's sparkles */
  --staff-line: #fcc981;  /* the hero art's staff, next to the orb */
  --plate: #bcd4ff;
  --good: #16794a;
  --bad: #c2321b;

  --sans: 'Inter', 'Inter Fallback', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Inter Tight', 'Inter', 'Inter Fallback', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --math: 'STIX Two Math', 'Cambria Math', 'Latin Modern Math', math;

  --r-xs: 4px;
  --r-sm: 6px;
  --r: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --hdr-h: 64px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-1: 0 1px 2px rgba(21, 20, 20, .05), 0 2px 8px rgba(21, 20, 20, .04);
  --shadow-2: 0 2px 6px rgba(21, 20, 20, .06), 0 16px 40px rgba(21, 20, 20, .10);
}

/* ------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--hdr-h) + 16px); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--body);
  font: 400 16px/1.65 var(--sans); letter-spacing: -.006em;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
main { flex: 1 0 auto; display: block; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled, [aria-disabled='true'] { cursor: not-allowed; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
table { border-collapse: collapse; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--chardon); color: var(--ink); }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------------ utilities */

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: calc(760px + 2 * var(--gutter)); }
.sr-only { position: absolute !important; 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: 200; background: var(--ink); color: #fff; padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; transition: top .2s var(--ease); }
.skip:focus { top: 12px; }
.mono { font-family: var(--mono); letter-spacing: -.01em; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink { color: var(--ink); }
.accent { color: var(--orange); }
.up { color: var(--good); }
.down { color: var(--bad); }
.nowrap { white-space: nowrap; }
.ico { flex: none; }

/* a value that is not known yet: a short soft bar, read as "Not available" (js/ui/dom.js setValue) */
.nil { display: inline-block; width: 2.2em; height: .5em; border-radius: 999px; background: linear-gradient(90deg, var(--concrete), var(--line), var(--concrete)); background-size: 200% 100%; animation: nil-shimmer 1.6s linear infinite; vertical-align: middle; }
@keyframes nil-shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ type */

.display, .h1 { font: 500 clamp(40px, 6.2vw, 78px)/1.02 var(--display); letter-spacing: -.035em; color: var(--ink); text-wrap: balance; }
.h2 { font: 600 clamp(28px, 3.6vw, 42px)/1.12 var(--display); letter-spacing: -.025em; color: var(--ink); text-wrap: balance; }
.h3 { font: 600 20px/1.3 var(--display); letter-spacing: -.015em; color: var(--ink); }
.lede { font-size: clamp(17px, 1.6vw, 19px); line-height: 1.6; color: var(--body); text-wrap: pretty; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 12.5px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--orange-text); }
.eyebrow-mono { font-family: var(--mono); font-weight: 600; letter-spacing: .06em; }
.small { font-size: 14px; line-height: 1.55; }
.tiny { font-size: 12.5px; line-height: 1.5; }
.link { color: var(--orange-deep); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--orange) 40%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color .2s var(--ease); }
.link:hover { text-decoration-color: var(--orange); }
.arrow-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; color: var(--ink); }
.arrow-link .ico { transition: transform .25s var(--ease-out); color: var(--orange); }
.arrow-link:hover .ico { transform: translateX(3px); }

/* ------------------------------------------------------------------ buttons */

.btn {
  --btn-h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 16px; border-radius: var(--r);
  font: 600 14.5px/1 var(--sans); letter-spacing: -.01em; white-space: nowrap;
  border: 1px solid transparent; transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 1px 2px rgba(214, 60, 1, .25); }
.btn-primary:hover { background: var(--orange-hover); }
.btn-primary:disabled { background: #ffb08f; box-shadow: none; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #2d2b2a; }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-soft { background: var(--cream); color: var(--rust); border-color: var(--amber-soft); }
.btn-soft:hover { border-color: var(--amber); color: var(--orange-deep); }
.btn-lg { --btn-h: 52px; padding: 0 24px; font-size: 16px; border-radius: 10px; }
.btn-sm { --btn-h: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn .ico { margin-inline: -2px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r); color: var(--ink); transition: background-color .2s var(--ease), color .2s var(--ease); }
.icon-btn:hover { background: var(--concrete); }

.soon-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--concrete); color: var(--muted); font: 600 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; }

/* ------------------------------------------------------------------ header */

.hdr { position: sticky; top: 0; z-index: 50; height: var(--hdr-h); background: rgba(255, 255, 255, .88); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .25s var(--ease), background-color .25s var(--ease); }
.hdr.is-scrolled { border-bottom-color: var(--line); }
.hdr-in { height: 100%; display: flex; align-items: center; gap: 16px; }
.hdr-left { display: flex; align-items: center; gap: 28px; min-width: 0; flex: 1; }
.hdr-right { display: flex; align-items: center; gap: 8px; flex: none; }

.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; color: var(--ink); }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(21, 20, 20, .08); }
.brand-name { font: 600 15px/1 var(--display); letter-spacing: .34em; margin-right: -.34em; color: var(--ink); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav-link { position: relative; display: inline-flex; align-items: center; height: 34px; padding: 0 10px; border-radius: var(--r-sm); font-size: 14.5px; font-weight: 500; color: var(--muted); transition: color .2s var(--ease), background-color .2s var(--ease); }
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current='page'] { color: var(--ink); }
.nav-link[aria-current='page']::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -15px; height: 2px; border-radius: 2px; background: var(--orange); }

.coin { display: inline-flex; align-items: center; height: 36px; padding: 0 4px 0 12px; border: 1px solid var(--line); border-radius: 999px; gap: 2px; background: var(--paper); }
.coin-sym { font: 600 13px/1 var(--mono); color: var(--ink); margin-right: 4px; }
.coin-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font: 500 13px/1 var(--sans); color: var(--body); transition: background-color .2s var(--ease), color .2s var(--ease); }
.coin-btn:hover { background: var(--concrete); color: var(--ink); }
.coin-btn.is-soon { color: var(--faint); }
.coin-btn.is-soon:hover { background: transparent; color: var(--muted); }
.coin-btn .soon-tag { height: 16px; font-size: 9.5px; }
.coin-sep { width: 1px; height: 16px; background: var(--line); }

.hdr-cta { flex: none; }
.hdr-cta.is-account { font-family: var(--mono); font-weight: 500; font-size: 13.5px; gap: 8px; }
.hdr-cta .net-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(22, 121, 74, .15); }
.hdr-cta.is-wrong .net-dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(194, 50, 27, .15); }
.hdr-menu { display: none; }

@media (min-width: 1081px) and (max-width: 1220px) {
  /* six nav links next to the $CLF group: a little less air so they never crowd the right side */
  .hdr-left { gap: 20px; }
  .nav { gap: 2px; }
  .nav-link { padding: 0 8px; }
  .nav-link[aria-current='page']::after { left: 8px; right: 8px; }
}
@media (max-width: 1080px) {
  /* the $CLF group leaves the header here; the menu (its sheet carries Buy and Copy CA) takes over right away */
  .coin { display: none; }
  .hdr-menu { display: inline-grid; }
}
@media (max-width: 820px) {
  .nav { display: none; }
  .hdr-x { display: none; }
  .hdr-in { gap: 8px; }
}
@media (max-width: 380px) {
  .hdr-cta { padding: 0 12px; font-size: 13.5px; }
  .brand-name { letter-spacing: .26em; margin-right: -.26em; }
}

/* the account popover (connected wallet) */
.pop { position: fixed; z-index: 70; top: var(--pop-top, 64px); right: var(--pop-right, 16px); width: min(280px, calc(100vw - 32px)); padding: 6px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-2); animation: pop-in .18s var(--ease-out); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.pop-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop-addr { font: 500 14px/1.3 var(--mono); color: var(--ink); }
.pop-net { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.pop-net .net-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(22, 121, 74, .15); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: var(--r); font-size: 14.5px; font-weight: 500; color: var(--ink); text-align: left; transition: background-color .15s var(--ease); }
.menu-item:hover { background: var(--haze); }
.menu-item .ico { color: var(--muted); }
.menu-item .menu-aside { margin-left: auto; font: 500 12.5px/1 var(--mono); color: var(--muted); }
.menu-item.is-soon { color: var(--faint); }
.menu-item.is-soon .soon-tag { margin-left: auto; }

/* the mobile menu: a sheet under the header */
.sheet { position: fixed; inset: var(--hdr-h) 0 auto 0; margin: 0; width: 100%; max-width: none; max-height: calc(100dvh - var(--hdr-h)); overflow: auto; padding: 8px var(--gutter) 24px; border: 0; border-bottom: 1px solid var(--line); background: var(--paper); box-shadow: 0 24px 40px rgba(21, 20, 20, .08); }
.sheet::backdrop { background: rgba(21, 20, 20, .18); }
.sheet[open] { animation: sheet-in .28s var(--ease-out); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(-8px); } }
/* the sheet opens non-modally (the header's X stays live), so it draws its own scrim under it; it sits above any
   positioned page content (the diagram panels use z-index 1) and below the header */
.sheet { z-index: 60; }
html.menu-open body::after { content: ''; position: fixed; inset: var(--hdr-h) 0 0 0; z-index: 55; background: rgba(21, 20, 20, .18); animation: scrim-in .28s var(--ease-out); }
@keyframes scrim-in { from { opacity: 0; } }
.sheet-nav { display: grid; }
.sheet-link { display: flex; align-items: center; justify-content: space-between; padding: 16px 2px; border-bottom: 1px solid var(--line); font: 500 20px/1.2 var(--display); letter-spacing: -.01em; color: var(--ink); }
.sheet-link[aria-current='page'] { color: var(--orange-deep); }
.sheet-link .ico { color: var(--faint); }
.sheet-coin { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.sheet-coin .btn { width: 100%; }
.sheet-x { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 15px; color: var(--ink); }

/* ------------------------------------------------------------------ what's new (js/shell.js renderNews) */

/* a slim cream strip in the flow under the sticky header: it scrolls away with the page and never overlays it */
.news { position: relative; z-index: 40; background: var(--cream); border-bottom: 1px solid var(--amber-soft); animation: news-in .35s var(--ease-out); }
@keyframes news-in { from { opacity: 0; } }
.news-in { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; }
.news-link { display: inline-flex; align-items: center; gap: 4px 10px; min-width: 0; padding-block: 8px; font-size: 13.5px; line-height: 1.4; color: var(--rust); }
.news-tag { flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--orange); color: #fff; font: 600 10.5px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.news-text { min-width: 0; color: var(--ink); }
.news-cta { flex: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--orange-deep); }
.news-cta .ico { transition: transform .25s var(--ease-out); }
.news-link:hover .news-cta .ico { transform: translateX(3px); }
.news-link:hover .news-text { text-decoration: underline; text-decoration-color: var(--amber); text-underline-offset: 3px; }
.news-x { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); color: var(--rust); transition: background-color .2s var(--ease); }
.news-x:hover { background: var(--chardon); }
@media (max-width: 560px) {
  .news-in { justify-content: space-between; }
  .news-link { align-items: flex-start; font-size: 13px; }
  .news-cta { display: none; }
}
@media (max-width: 820px), (pointer: coarse) {
  .news-x { width: 44px; height: 44px; margin-right: -10px; }
}

/* ------------------------------------------------------------------ footer */

.ftr { margin-top: auto; background: var(--alabaster); border-top: 1px solid var(--line); }
.ftr-in { padding-block: 44px 36px; display: grid; gap: 28px; }
.ftr-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; }
.ftr-links { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14.5px; }
.ftr-links a { color: var(--body); transition: color .2s var(--ease); display: inline-flex; align-items: center; gap: 6px; }
.ftr-links a:hover { color: var(--ink); }
.ftr-base { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.ftr-camp { font: 600 14px/1.4 var(--sans); color: var(--ink); }
.ftr-chain { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.ftr-chain .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.ftr-src { font-size: 13.5px; color: var(--muted); }
.ftr-src a { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; transition: text-decoration-color .2s var(--ease); }
.ftr-src a:hover { text-decoration-color: var(--orange); }
.ftr-note { flex-basis: 100%; max-width: 760px; font-size: 13px; line-height: 1.6; color: var(--muted); }

/* ------------------------------------------------------------------ dialogs: wallet picker */

.modal { width: min(420px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--r-lg); background: var(--paper); color: var(--body); box-shadow: var(--shadow-2), 0 0 0 1px rgba(21, 20, 20, .06); }
.modal::backdrop { background: rgba(21, 20, 20, .32); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .25s var(--ease-out); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 22px 6px; }
.modal-title { font: 600 20px/1.25 var(--display); letter-spacing: -.015em; color: var(--ink); }
.modal-sub { padding: 0 22px 14px; font-size: 14px; color: var(--muted); }
.modal-body { padding: 0 14px 14px; }
.picker-list { display: grid; gap: 6px; }
.picker-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--paper); text-align: left; font-weight: 500; color: var(--ink); transition: border-color .2s var(--ease), background-color .2s var(--ease); }
.picker-item:hover { border-color: var(--amber); background: var(--cream); }
.picker-ico { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.picker-ico.is-blank { display: grid; place-items: center; background: var(--concrete); color: var(--muted); }
.picker-name { flex: 1; }
.picker-go { color: var(--faint); }
.picker-empty { padding: 14px; border-radius: var(--r-md); background: var(--alabaster); border: 1px dashed var(--line-2); font-size: 14px; color: var(--muted); }
.modal-foot { padding: 12px 22px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------------ toasts */

.toasts { position: fixed; z-index: 90; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-radius: var(--r-md); background: var(--ink); color: #fff; font-size: 14px; line-height: 1.4; box-shadow: var(--shadow-2); animation: toast-in .3s var(--ease-out); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.toast::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #a3a3a3; }
.toast.is-ok::before { background: #4ade80; }
.toast.is-error::before { background: #ff7a59; }
.toast.is-pending::before { background: var(--orange); animation: pulse 1.2s var(--ease) infinite; }
.toast.is-out { opacity: 0; transform: translateY(6px); }
.toast-msg { flex: 1; }
.toast-link { color: #ffb08f; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.toast-x { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); color: #a3a3a3; }
.toast-x:hover { color: #fff; background: rgba(255, 255, 255, .1); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes pulse { 50% { opacity: .35; } }
@media (max-width: 560px) { .toasts { left: 16px; right: 16px; bottom: 16px; width: auto; } }

/* ------------------------------------------------------------------ sections */

.sec { padding-block: clamp(72px, 10vw, 128px); }
.sec-band { background: var(--alabaster); border-block: 1px solid var(--line); }
.sec-head { display: grid; gap: 14px; max-width: 760px; margin-bottom: clamp(32px, 4.5vw, 52px); }
.sec-head.is-center { margin-inline: auto; text-align: center; justify-items: center; }
.sec-head .lede { max-width: 640px; }

/* the staff: five thin lines with a sparkle, as a divider or backdrop */
.staff { position: relative; height: 34px; pointer-events: none; }
.staff::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, var(--staff-soft) 0 1.5px, transparent 1.5px 8px); -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
.staff .spark { position: absolute; width: 54px; height: 36px; color: var(--spark); left: var(--spark-x, 62%); top: 50%; transform: translate(-58%, -50%); }
.staff .spark.is-b { width: 36px; height: 24px; left: var(--spark-x2, 30%); top: calc(50% + 8px); opacity: .9; }
.staff-divider { max-width: var(--wrap); margin-inline: auto; }

/* ------------------------------------------------------------------ panels (the diagram vocabulary) */

.panel { position: relative; background: var(--cream); border: 1.5px solid var(--amber); border-radius: var(--r-md); padding: 20px 22px; }
.panel.is-hot { background: var(--cream-2); border-color: #ef7645; }
.panel.is-plain { background: var(--paper); border-color: #fec675; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; margin-bottom: 12px; }
.panel-label { font: 600 12.5px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--orange-text); }
.panel-label .sub { color: var(--rust); opacity: .7; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px; background: var(--chip); color: var(--rust); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip.is-mono { font: 500 12px/1 var(--mono); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.chip .dot.is-live { animation: pulse 1.6s var(--ease) infinite; }

/* probability rows: label, right-aligned percent, a thin bar beneath (the winner in orange) */
.probs { display: grid; gap: 10px; }
.prob { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; row-gap: 7px; }
.prob-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 15.5px; line-height: 1.25; color: var(--rust); }
.prob-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob-val { font: 500 15px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.prob-bar { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.prob-bar > i { display: block; height: 100%; width: calc(var(--p, 0) * 1%); border-radius: inherit; background: var(--sand-2); transition: width .7s var(--ease-out), background-color .3s var(--ease); }
.prob.is-top .prob-name { color: var(--ink); font-weight: 600; }
.prob.is-top .prob-val { color: var(--orange-text); font-weight: 700; }
.prob.is-top .prob-bar > i { background: var(--orange); }

/* asset logos: circles with a hairline so white tiles keep an edge */
.logo { flex: none; width: var(--logo-size, 20px); height: var(--logo-size, 20px); border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(21, 20, 20, .08); background: var(--paper); }
.logo-letter { display: inline-grid; place-items: center; font: 600 10px/1 var(--mono); color: var(--muted); background: var(--concrete); }

/* ------------------------------------------------------------------ code cards (blog code blocks, github-light) */

.code { position: relative; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--alabaster); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 40px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.code-title { display: inline-flex; align-items: center; gap: 8px; font: 500 12.5px/1 var(--mono); color: var(--muted); min-width: 0; }
.code-title b { color: var(--ink); font-weight: 600; }
.code pre { margin: 0; padding: 16px 18px 18px; overflow-x: auto; font: 400 13px/1.7 var(--mono); color: #24292e; font-variant-ligatures: none; tab-size: 2; }
.code pre code { font: inherit; }
.tok-key { color: #005cc5; }
.tok-str { color: #032f62; }
.tok-num { color: #005cc5; }
.tok-lit { color: #c62f3e; }
.tok-pun { color: #6a737d; }
.tok-com { color: #6a737d; font-style: italic; }
.tok-fn { color: #6f42c1; }
.tok-kw { color: #c62f3e; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-sm); font: 500 12.5px/1 var(--sans); color: var(--muted); transition: background-color .2s var(--ease), color .2s var(--ease); }
.copy-btn:hover { background: var(--concrete); color: var(--ink); }
:not(pre) > code { font: 500 .88em/1 var(--mono); padding: .18em .42em; border-radius: var(--r-xs); background: var(--concrete); color: var(--ink); white-space: nowrap; }

/* ------------------------------------------------------------------ math (MathML) */

math { font-family: var(--math); color: var(--ink); }
math[display='block'] { font-size: 1.22em; margin: 0; overflow-x: auto; overflow-y: hidden; padding-block: 4px; }
.mathbox { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------------ tables */

.tbl { width: 100%; font-size: 14.5px; }
.tbl th { padding: 0 12px 10px; font: 600 11.5px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 12px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.tbl th.num, .tbl td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------------ forms */

.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.input { height: 44px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font: 500 15px/1 var(--mono); transition: border-color .2s var(--ease), box-shadow .2s var(--ease); width: 100%; }
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 94, 31, .16); }

/* a range slider in the diagram style */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(90deg, var(--orange) 0 calc(var(--v, 50) * 1%), var(--sand) calc(var(--v, 50) * 1%)); }
.range::-moz-range-track { height: 4px; border-radius: 999px; background: var(--sand); }
.range::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--orange); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--paper); border: 2px solid var(--orange); box-shadow: 0 1px 4px rgba(214, 60, 1, .25); transition: transform .15s var(--ease); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 2px solid var(--orange); }
.range:active::-webkit-slider-thumb { transform: scale(1.12); }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--concrete); gap: 2px; }
.seg button { height: 30px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--muted); transition: background-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease); }
.seg button[aria-pressed='true'] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ reveal on scroll */

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ page header (interior pages) */

.page-head { padding-block: clamp(40px, 6vw, 72px) clamp(28px, 4vw, 40px); position: relative; overflow: clip; }
.page-head .h1 { font-size: clamp(36px, 5vw, 56px); }
.page-head .lede { margin-top: 14px; max-width: 640px; }
.page-head-staff { position: absolute; right: calc(-1 * var(--gutter)); top: 50%; width: min(520px, 50%); transform: translateY(-50%); opacity: .9; }
@media (max-width: 760px) { .page-head-staff { display: none; } }

/* ------------------------------------------------------------------ layout helpers */

.sec-tight { padding-block: clamp(48px, 7vw, 88px); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 56px); }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: var(--stack-gap, 16px); align-content: start; }
.kicker { font: 500 12px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* a key/value figure: small uppercase key, mono value */
.stat { display: grid; gap: 6px; min-width: 0; }
.stat-k { font: 600 11.5px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat-v { font: 500 20px/1.15 var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: -.02em; }

/* a designed empty state: a quiet five-line staff, one sparkle, a sentence and an action */
.empty { position: relative; display: grid; justify-items: center; gap: 10px; padding: clamp(36px, 6vw, 64px) 20px; text-align: center; }
.empty-title { font: 600 clamp(20px, 2.4vw, 26px)/1.2 var(--display); letter-spacing: -.015em; color: var(--ink); }
.empty-text { max-width: 44ch; color: var(--muted); }
.empty .staff-rule { width: min(420px, 100%); margin-bottom: 8px; }

/* horizontal scroll strips: a fade on the side that has more (js/ui/dom.js scrollFade) */
.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }

/* ------------------------------------------------------------------ the staff, as a rule */

/* five thin lines that fade at both ends; put sparkles (js/ui/icons.js sparkleMark) inside as .spark
   (--staff-at: the line 0..4 it sits on, --staff-x: its left position) */
.staff-rule { position: relative; height: 37px; }
.staff-rule::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(var(--staff-line), var(--staff-line)) 0 0 / 100% 1px no-repeat,
    linear-gradient(var(--staff-line), var(--staff-line)) 0 9px / 100% 1px no-repeat,
    linear-gradient(var(--staff-line), var(--staff-line)) 0 18px / 100% 1px no-repeat,
    linear-gradient(var(--staff-line), var(--staff-line)) 0 27px / 100% 1px no-repeat,
    linear-gradient(var(--staff-line), var(--staff-line)) 0 36px / 100% 1px no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent); mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
}
.staff-rule .spark { position: absolute; top: calc(var(--staff-at, 1) * 9px + .5px); left: var(--staff-x, 60%); width: 42px; height: 28px; color: var(--spark); transform: translate(-58%, -50%); }

/* ------------------------------------------------------------------ the decision diagram */

/*
 * INPUTS -> Decision model -> PARALLEL OUTPUTS, the blog's figure in HTML. Markup:
 *   <div class="diagram" data-wires>
 *     <div class="dg-col dg-in"><p class="dg-label">Inputs</p><div class="panel" data-wire-from>...</div>...</div>
 *     <div class="dg-hub"><div class="dg-model" data-wire-hub>...</div><p class="dg-note">Evaluates all questions</p></div>
 *     <div class="dg-col dg-out"><p class="dg-label">Parallel outputs</p><div class="panel" data-wire-to>...</div>...</div>
 *     <svg class="wires"></svg>
 *   </div>
 * js/ui/wires.js draws the orthogonal connectors while the three columns sit side by side (adds .is-wired);
 * stacked, the columns get CSS arrows between them instead.
 */
.diagram { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: clamp(48px, 6.5vw, 96px); align-items: center; }
.diagram > svg.wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.diagram .wires-g path { stroke: var(--ink); stroke-width: 1.6; }
.diagram > :not(svg) { position: relative; z-index: 1; }
.dg-col { display: grid; gap: 20px; align-content: center; min-width: 0; }
.dg-label { font: 600 13px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--orange-text); margin-bottom: -4px; }
.dg-hub { display: grid; justify-items: center; gap: 14px; text-align: center; }
.dg-model { display: grid; justify-items: center; align-content: center; gap: 10px; width: clamp(148px, 13vw, 176px); aspect-ratio: 1.18; padding: 16px; border-radius: var(--r-md); background: var(--orange); color: #fff; font: 700 clamp(19px, 1.7vw, 22px)/1.08 var(--display); letter-spacing: -.01em; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 10px 30px rgba(255, 94, 31, .22); }
.dg-model .ico { width: 44px; height: 44px; }
.dg-note { max-width: 13ch; font: 600 15.5px/1.3 var(--sans); color: var(--orange-text); text-wrap: balance; }

@media (max-width: 900px) {
  .diagram { grid-template-columns: minmax(0, 1fr); row-gap: 44px; }
  .diagram > svg.wires { display: none; }
  .dg-hub { position: relative; }
  .dg-hub::before, .dg-hub::after { content: ''; position: absolute; left: 50%; width: 1.6px; height: 30px; background: var(--ink); transform: translateX(-50%); }
  .dg-hub::before { top: -37px; }
  .dg-hub::after { bottom: -37px; }
  .dg-model { width: auto; aspect-ratio: auto; grid-auto-flow: column; padding: 14px 22px; gap: 12px; }
  .dg-model .ico { width: 30px; height: 30px; }
  .dg-note { max-width: none; }
}

/* ------------------------------------------------------------------ phones: tap targets and safe areas */

/*
 * Owner rule (2026-10-02): decent phone UI, nothing overlapping, tap targets at least 44 px, safe-area insets.
 * Visual sizes stay; the boxes grow where a finger needs them. The page uses viewport-fit=cover, so the side
 * gutters and the bottom-anchored layers make room for the notch and the home indicator.
 */
.wrap { padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)); }
.toasts { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.sheet { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.ftr-in { padding-bottom: calc(36px + env(safe-area-inset-bottom, 0px)); }
.modal { max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow: auto; overscroll-behavior: contain; }

@media (max-width: 820px), (pointer: coarse) {
  .btn { --btn-h: 44px; }
  .btn-lg { --btn-h: 52px; }
  .icon-btn { width: 44px; height: 44px; }
  .hdr-right { gap: 4px; }
  .hdr-menu { margin-right: -6px; }
  .brand { min-height: 44px; }
  .arrow-link { min-height: 44px; }
  .copy-btn { height: 44px; padding: 0 12px; }
  .code-head { height: 46px; padding-right: 1px; }
  .toast { padding-block: 6px; min-height: 52px; }
  .toast-x { width: 44px; height: 44px; margin-right: -6px; }
  .ftr-links { gap: 0 10px; margin-inline: -6px; }
  .ftr-links a { min-height: 44px; min-width: 44px; padding-inline: 6px; justify-content: center; }
  .ftr-src a { min-height: 44px; }
  .ftr-top .brand { min-height: 44px; }
  .sheet-x { min-height: 44px; margin-top: 10px; }
  .menu-item { min-height: 44px; }
}
@media (max-width: 560px) {
  .toasts { left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .ftr-in { padding-top: 36px; gap: 20px; }
  .ftr-top { gap: 8px 32px; }
  .ftr-base { gap: 8px 24px; }
}
