:root {
  color-scheme: light;
  --page: #fcfbf8;
  --surface: #f3f1eb;
  --ink: #0f0e0b;
  --ink-2: #4d4a43;
  --muted: #78746a;
  --line: #e3dfd5;
  --axis: #c5bfb1;
  --tree: #a7a194;
  --tree-soft: #d8d3c7;
  --accent: #8a6d3b;
  --accent-soft: rgba(188, 169, 138, 0.26);
  --c1: #1d1c19;
  --c2: #b39a6c;
  --c3: #cfcabf;
  --second: #8a6d3b;
  --good: #4d4a43;
  --good-mark: #4d4a43;
  --bad: #8a6d3b;
  --bad-mark: #b39a6c;
  --ring: rgba(15, 14, 11, 0.1);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Spacing scale: every layout margin, padding and gap uses one of these. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #12110d;
    --surface: #1b1a15;
    --ink: #efe5d0;
    --ink-2: #c9c0ad;
    --muted: #8f887a;
    --line: #2c2a23;
    --axis: #48443a;
    --tree: #6f6a5e;
    --tree-soft: #36332b;
    --accent: #bca98a;
    --accent-soft: rgba(188, 169, 138, 0.18);
    --c1: #efe5d0;
    --c2: #bca98a;
    --c3: #6f6a5e;
    --second: #bca98a;
    --good: #c9c0ad;
    --good-mark: #c9c0ad;
    --bad: #d9c49d;
    --bad-mark: #bca98a;
    --ring: rgba(239, 229, 208, 0.1);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #12110d;
  --surface: #1b1a15;
  --ink: #efe5d0;
  --ink-2: #c9c0ad;
  --muted: #8f887a;
  --line: #2c2a23;
  --axis: #48443a;
  --tree: #6f6a5e;
  --tree-soft: #36332b;
  --accent: #bca98a;
  --accent-soft: rgba(188, 169, 138, 0.18);
  --c1: #efe5d0;
  --c2: #bca98a;
  --c3: #6f6a5e;
  --second: #bca98a;
  --good: #c9c0ad;
  --good-mark: #c9c0ad;
  --bad: #d9c49d;
  --bad-mark: #bca98a;
  --ring: rgba(239, 229, 208, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--axis); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
dfn { font-style: normal; font-weight: 600; }
sup { line-height: 0; }

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px max(16px, calc((100vw - 1040px) / 2));
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.mark { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; text-decoration: none; letter-spacing: -0.01em; }
.mark svg { width: 18px; height: 18px; }
.top nav { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.top nav a, .lab { text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.top nav a:hover, .lab:hover { color: var(--ink); }
.lab { border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; }
/* Adjacent header buttons sit --s2 apart instead of the header's 24 px gap. */
.lab + .lab { margin-left: calc(var(--s2) - 24px); }

main { max-width: 960px; margin: 0 auto; padding: 0 var(--s4) var(--s7); }
section { padding-top: var(--s7); }
section + section { border-top: 1px solid var(--line); margin-top: var(--s7); }
h1 { font-size: clamp(32px, 5vw, 46px); line-height: 1.08; letter-spacing: -0.025em; margin: var(--s2) 0 var(--s4); font-weight: 700; }
h2 { font-size: 26px; letter-spacing: -0.015em; line-height: 1.2; margin: 0 0 var(--s4); }
/* Each section folds under its heading; the heading is the toggle. */
h2 .fold { all: unset; display: flex; align-items: baseline; gap: var(--s2); width: 100%; cursor: pointer; }
h2 .fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
h2 .fold::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: auto; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-3px) rotate(45deg); transition: transform 0.15s; }
section.folded h2 .fold::after { transform: translateY(1px) rotate(-45deg); }
section.folded > h2 { margin-bottom: 0; }
section.folded > :not(h2) { display: none; }
h3 { font-size: 17px; line-height: 1.35; margin: var(--s6) 0 var(--s2); }
p { margin: 0 0 var(--s4); }
.lede { font-size: 18px; color: var(--ink-2); }
.note { font-size: 14px; color: var(--muted); line-height: 1.55; }
.hero { padding-top: var(--s7); }

/* Flow: text to text is --s4; text to a block, and block to block, is --s5. */
figure, .table-wrap, details, .construction { margin: var(--s5) 0; }
/* A note that explains the table, chart or figure above it sits close to it. */
:is(.table-wrap, .chart, figure, .tiles):has(+ .note) { margin-bottom: var(--s2); }
:is(.table-wrap, table, .chart, figure, .tiles) + .note { margin-top: var(--s2); }
/* Boxes keep equal space above and below their content. */
:is(details, figure) > :last-child, details p:last-child { margin-bottom: 0; }
p + .chart { margin-top: var(--s5); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: var(--s5) 0; }
.tile { background: var(--page); padding: var(--s4); }
.tile .k { font-size: 13px; color: var(--muted); }
.tile .v { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.tile .s { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; margin-top: var(--s2); }
.tile .s .status { white-space: normal; }
/* Hero: a shared row above one card per wallet profile. */
.duo { display: grid; gap: var(--s3); margin: var(--s5) 0; }
.duo .tiles { margin: 0; }
.tiles.two { grid-template-columns: 1fr 1fr; }
.card .head { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s4); }
.card .head b { font-size: 16px; }
.card .head span { font-size: 13px; color: var(--muted); }
.card .head .who { font-size: 14px; color: var(--ink-2); }
.card .v { font-size: 24px; }
/* The two cards share row tracks, so each figure lines up with its neighbour's
   even when one card's subtitle wraps to more lines. */
.card { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: var(--s4); }
.card .head { margin-bottom: 0; }
/* On wide, tall-enough screens the hero is two columns, text beside compact
   figures, wider than the reading column, and fills the first screen. */
@media (min-width: 900px) and (min-height: 620px) {
  .hero {
    display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    column-gap: var(--s6); align-items: start; align-content: center;
    /* Fill the first screen below the sticky header, so the next section
       starts below the fold. */
    min-height: calc(100svh - 52px); padding-block: var(--s5);
    margin-inline: calc((100% - min(1100px, 100vw - 48px)) / 2);
  }
  .hero > :not(.duo) { grid-column: 1; }
  .hero > .duo { grid-column: 2; grid-row: 1 / span 6; margin: var(--s2) 0 0; gap: var(--s2); }
  .hero h1 { font-size: clamp(30px, 3.2vw, 40px); }
  .hero .lede { font-size: 17px; }
  .hero .tile { padding: var(--s3); }
  .hero .tile .v { font-size: 22px; margin: 2px 0; }
  .hero .tile .v small { font-size: 13px; }
  .hero .tile .s { margin-top: var(--s1); }
  .hero .card { row-gap: var(--s3); }
  .hero .card .v { font-size: 20px; }
  .hero .card .head b { font-size: 15px; }
  .hero .meter { margin-top: 6px; }
}
.chip { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.5; padding: 0 6px; border-radius: 4px; background: var(--ink); color: var(--page); vertical-align: 1px; margin-left: 4px; }
table.profiles td.n { white-space: nowrap; }
.nowrap { white-space: nowrap; }
table.profiles td .src { margin-top: 2px; }
table.profiles td .src .status { font-size: 11.5px; }
table.frontier td { vertical-align: middle; }
table.frontier td.n, table.frontier th.n { padding-left: 10px; }
table.frontier td.n { white-space: nowrap; }
/* Headers wrap so the layout column keeps its width. */
table.frontier th { line-height: 1.3; vertical-align: bottom; }
#table-frontier .row { margin-top: var(--s3); }
#grind-bits { flex-wrap: wrap; }

.meter { position: relative; height: 6px; border-radius: 3px; background: var(--surface); margin-top: 10px; }
.meter .fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--accent); }
.meter i { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 1.5px solid var(--ink); }
.meter-label { position: relative; height: 16px; margin-top: var(--s1); font-size: 11.5px; color: var(--muted); }
.meter-label span { position: absolute; top: 0; white-space: nowrap; }

figcaption { font-size: 14px; margin-bottom: var(--s3); display: flex; flex-direction: column; gap: 2px; }
figure > .table-wrap { margin: 0; }
figcaption span { color: var(--muted); font-size: 13px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text, .tree text { font-family: var(--sans); fill: var(--ink-2); }
.chart .axis line, .chart .axis path { stroke: var(--axis); }
.chart .grid { stroke: var(--line); }
.chart .tick { font-size: 11px; fill: var(--muted); }
.chart .label { font-size: 12.5px; fill: var(--ink); }
.chart .value, .chart .label { paint-order: stroke; stroke: var(--page); stroke-width: 4px; stroke-linejoin: round; }
.chart .value { font-size: 12px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hl { fill: var(--accent); }
.chart .base { fill: var(--tree); }
.chart .budget { stroke: var(--ink); stroke-dasharray: 4 3; }
.chart .reference { stroke: var(--ink-2); stroke-dasharray: 1 3; stroke-linecap: round; }
.chart .label-bg { fill: var(--page); }
.chart .on .label, .chart .keydot:hover .label { text-decoration: underline; }
.chart [data-key], .chart [data-key] * { cursor: pointer; }
.chart .hit[data-key].on { fill: var(--accent-soft); }
.chart .hit[data-key]:focus { outline: none; fill: var(--accent-soft); }
/* Details a pressed key opens under its chart. */
.key-detail { margin-top: var(--s2); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--ink-2); }
.key-detail p { margin: var(--s1) 0 0; }
.key-detail b { color: var(--ink); font-weight: 600; }
.kd-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.kd-close { border: 0; background: none; color: var(--ink-2); font-size: 18px; line-height: 1; padding: 0 4px; cursor: pointer; }
.legend-key { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.legend-key.on { text-decoration: underline; }

details { border: 1px solid var(--line); border-radius: 8px; padding: var(--s3) var(--s4); }
details > summary { cursor: pointer; font-size: 14px; color: var(--ink-2); }
details[open] > summary { margin-bottom: var(--s3); }
details[open] > summary + * { margin-top: 0; }
/* Back-to-back boxes read as one group. */
details:has(+ details) { margin-bottom: var(--s2); }
details + details { margin-top: var(--s2); }
details p { font-size: 14px; color: var(--ink-2); }

table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 550; color: var(--muted); font-size: 13px; }
td.n, th.n { text-align: right; }
tr.sel td { background: var(--accent-soft); }
tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
.table-wrap { overflow-x: auto; }
th button { all: unset; cursor: pointer; }
th button:hover { color: var(--ink); }
th button[aria-sort]::after { content: " ↓"; }

.construction { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: var(--s5); align-items: start; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; font-size: 14px; }
.steps li { counter-increment: s; padding: var(--s2) var(--s3) var(--s2) 40px; border-radius: 8px; position: relative; cursor: default; color: var(--ink-2); }
.steps li strong { color: var(--ink); display: block; }
.steps li::before { content: counter(s); position: absolute; left: var(--s3); top: var(--s2); width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--axis); font-size: 12px; display: grid; place-items: center; color: var(--ink-2); }
.steps li.on { background: var(--accent-soft); }
.steps li.on::before { border-color: var(--accent); color: var(--accent); }
.tree-figure { margin: 0; }
.tree svg { width: 100%; height: auto; display: block; }
.tree .edge { stroke: var(--tree); stroke-width: 0.8; fill: none; }
.tree .edge.soft { stroke: var(--tree-soft); }
.tree .path { stroke: var(--ink); stroke-width: 1.6; fill: none; }
.tree .layer-fill { fill: transparent; }
.tree .top-fill { fill: var(--surface); }
.tree .chain { stroke: var(--tree); stroke-width: 1.1; }
.tree .chain.used { stroke: var(--ink); }
.tree .t-label { font-size: 11.5px; fill: var(--muted); }
.tree .t-strong { font-size: 12px; fill: var(--ink); font-weight: 600; }
.tree .brace { stroke: var(--axis); fill: none; }
.tree [data-part] { cursor: default; }
.tree [data-part]:focus { outline: none; }
.tree .zone { fill: transparent; }
.tree .zone.on, .tree [data-part]:focus .zone { fill: var(--accent-soft); }
.tree .on .path, .tree .on .chain.used { stroke: var(--accent); }
.tree-caption { font-size: 14px; color: var(--ink-2); min-height: 3em; margin: var(--s3) 0 0; text-align: left; }
.tree.small { margin-top: var(--s4); }


/* Each change: labelled rows of text, then its widget one block below. */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s4); margin: 0 0 var(--s5); }
.change-title { font-size: 17px; line-height: 1.35; display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0 var(--s3); }
.change-title .num { width: 26px; height: 26px; font-size: 13px; transform: none; }
/* Row labels read as labels, so the change's own name is the only title. */
.facts dt { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding-top: 3px; }
.facts dd { margin: 0; }
.facts dd p { margin-bottom: var(--s2); }
.facts dd p:last-child { margin-bottom: 0; }
.change .note { margin: var(--s2) 0 0; }
/* Same look as a figure caption. */
.widget-cap { font-size: 14px; margin: 0 0 var(--s3); display: flex; flex-direction: column; gap: 2px; }
.widget-cap span { color: var(--muted); font-size: 13px; }

.limits { list-style: none; padding: 0; margin: 0 0 var(--s4); display: grid; gap: var(--s2); }
.limits li { position: relative; padding-left: 34px; }
.limits .num { position: absolute; left: 0; top: 2px; }
.num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--page); font-size: 12px; display: inline-grid; place-items: center; font-weight: 600; transform: translateY(-1px); }
ul.plain { padding-left: 18px; margin: 0 0 var(--s4); }
ul.plain li { margin-bottom: var(--s2); }

.row button {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--page);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; line-height: 1.5;
}
.row button:hover { border-color: var(--axis); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
.status svg { width: 13px; height: 13px; flex: none; }
.status.ok { color: var(--good); }
.status.miss { color: var(--bad); }
.status.na { color: var(--muted); }
.src { font-size: 11.5px; color: var(--muted); display: block; }
.muted { color: var(--muted); }
td.verdict { white-space: nowrap; }
tr.group td { font-weight: 600; color: var(--ink); padding-top: 14px; }
table.alts td { vertical-align: middle; }
table.alts td.n, table.alts th.n { white-space: nowrap; padding-left: 10px; }
table.alts td .src { font-size: 11.5px; }
table.alts td.miss { color: var(--bad); font-weight: 600; background: color-mix(in srgb, var(--bad-mark) 14%, transparent); }
table.alts td.miss svg { width: 12px; height: 12px; vertical-align: -1px; margin-right: 4px; }
table.alts td sup { color: var(--muted); margin-left: 1px; }

.digits-head { display: flex; justify-content: space-between; gap: var(--s2); font-size: 13px; align-items: center; font-variant-numeric: tabular-nums; }
.digits { display: flex; gap: 1.5px; height: 72px; margin: var(--s2) 0 var(--s3); }
.digits button { flex: 1; min-width: 0; position: relative; padding: 0; border: 0; border-radius: 2px 2px 0 0; background: var(--tree-soft); cursor: pointer; }
.digits button i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 2px 2px 0 0; transition: height 0.2s; }
.digits button i.up { background: var(--bad-mark); }
.digits button i.own { background: var(--tree); }
.digits button[aria-pressed="true"] { outline: 1.5px solid var(--ink); outline-offset: 1px; z-index: 1; }
.digits button:focus-visible { outline: 2px solid var(--accent); }
.digits button.refused { animation: refuse 0.35s; }
@keyframes refuse { 20%, 60% { transform: translateX(-2px); } 40%, 80% { transform: translateX(2px); } }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.row .ghost { color: var(--ink-2); }
.grind { display: grid; grid-template-columns: repeat(64, 1fr); gap: 2px; margin: var(--s2) 0 var(--s3); }
.grind span { aspect-ratio: 1; background: var(--tree-soft); border-radius: 1.5px; }
.grind span.tried { background: var(--axis); }
.grind span.hit { background: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.bits { display: inline-flex; gap: var(--s1); }
.bits i { font-style: normal; font-family: var(--mono); font-size: 12px; width: 20px; height: 22px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-2); }
.bits i.one { color: var(--muted); border-color: var(--axis); }
.bits i.pass { background: var(--accent); border-color: var(--accent); color: var(--page); }

.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 280px;
  background: var(--ink); color: var(--page); font-size: 12.5px; line-height: 1.45;
  padding: 7px 10px; border-radius: 6px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.tip b { font-weight: 600; }
.tip.wide { max-width: min(360px, calc(100vw - 16px)); }

/* Footnote markers: a small badge that shows its note on hover or focus and
   pins it open on a press. */
.fn {
  appearance: none; font: inherit; font-size: 11px; font-weight: 600; line-height: 1;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent);
  min-width: 16px; padding: 2px 4px; margin-left: 1px; border-radius: 8px; cursor: pointer;
  vertical-align: 1px; transition: background 0.12s, color 0.12s;
}
.fn:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.fn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fn.pinned { background: var(--accent); color: var(--page); }

footer { border-top: 1px solid var(--line); padding: var(--s5) var(--s4) var(--s7); text-align: center; font-size: 13px; color: var(--muted); }

@media (max-width: 760px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile .v { font-size: 24px; }
  .construction { grid-template-columns: 1fr; }
  .top { gap: 14px; }
  .lab { display: none; }
}
@media (max-width: 560px) {
  .tiles.two { grid-template-columns: 1fr; }
  table.frontier { font-size: 12.5px; }
  table.frontier th:nth-child(5), table.frontier td:nth-child(5), table.frontier th:nth-child(6), table.frontier td:nth-child(6) { display: none; }
  table.alts { font-size: 12.5px; }
  table.alts td:first-child .src { display: none; }
  table.alts td, table.alts th { padding-right: 4px; }
  table.alts td.n, table.alts th.n { padding-left: 4px; }
  #table-nist table { font-size: 12.5px; }
  #table-nist td, #table-nist th { padding-right: 6px; }
  td.verdict, td.verdict .status { white-space: normal; }
  table.alts td.miss svg { display: none; }
  .grind { grid-template-columns: repeat(32, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .digits button i { transition: none; }
  .digits button.refused { animation: none; outline-color: var(--bad); }
}

.legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: 13px; color: var(--ink-2); margin-top: var(--s2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend i.ring { width: 8px; height: 8px; border-radius: 50%; border: 2px solid; background: none; }
.legend b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 2px; }
.tree svg.route .path { stroke: var(--accent); }
