/* =========================================================
   Statechains · Mercury · Spark — editorial paper theme
   ========================================================= */

:root {
  --paper:        #f4ede0;     /* warm cream — slightly warmer than off-white */
  --paper-tint:   #ebe1ce;     /* aside / pull-quote backdrop */
  --paper-deep:   #ddd0b0;     /* table-row alt */
  --ink:          #1a1612;     /* warm near-black */
  --ink-2:        #4a443a;     /* secondary text */
  --ink-3:        #88806e;     /* muted / labels */
  --hair:         #c7baa0;     /* hairlines */
  --hair-soft:    #dcd0b3;     /* lighter rules */
  --hair-strong:  #a89878;     /* emphasised rules */
  --accent:       #a64900;     /* refined Bitcoin orange — sienna */
  --accent-2:     #d4791f;     /* warmer secondary */
  --accent-bg:    #f7e8cf;     /* tinted backdrop for accent regions */
  --ember:        #6b1e0a;     /* warning / loss */
  --ember-bg:     #f3d6c6;
  --moss:         #2d3f1f;     /* "good" tone — deep olive, no neon green */
  --moss-bg:      #d8dec5;

  --display:      "Fraunces", "Playfair Display", Georgia, serif;
  --body:         "Inter", -apple-system, "Segoe UI", sans-serif;
  --mono:         "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --maxw-prose:   720px;
  --maxw:         1080px;
  --gutter:       32px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "ss01", "cv01", "tnum" off;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }
a:hover { color: var(--ember); }
a:focus-visible,
button:focus-visible,
[role="switch"]:focus-visible,
[role="tab"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection { background: var(--accent); color: var(--paper); }

img, svg { max-width: 100%; display: block; }

/* ---------- Type ---------- */
h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  margin: 0 0 0.5em;
}
h1 {
  font-size: clamp(40px, 5.5vw, 68px);
  line-height: 1.02;
  font-weight: 700;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
h2 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.12;
  font-weight: 600;
  margin-top: 0;
}
h3 {
  font-size: 21px;
  line-height: 1.25;
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 30, "SOFT" 80;
  color: var(--ink);
  margin-bottom: 0.25em;
}
h4 {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 0.5em;
}

p {
  font-size: 17px;
  margin: 0 0 1em;
  color: var(--ink);
  max-width: var(--maxw-prose);
}
p.muted, .muted { color: var(--ink-2); }

em, i { font-style: italic; }
strong, b { font-weight: 600; color: var(--ink); }

code, .mono {
  font-family: var(--mono);
  font-size: 0.9em;
  font-feature-settings: "tnum", "ss01";
}
code.inline {
  background: var(--paper-tint);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--hair-soft);
  font-size: 0.85em;
  color: var(--ink);
}

.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- Layout primitives ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: var(--maxw-prose); margin: 0 auto; padding: 0 var(--gutter); }

section { padding: 96px 0 64px; }
section + section { border-top: 1px solid var(--hair-soft); }

.kicker {
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.kicker::before {
  content: "";
  width: 28px; height: 1px;
  background: currentColor;
  display: inline-block;
}

/* ---------- Top nav (minimal, paper) ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244, 237, 224, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair-soft);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; align-items: baseline; gap: 32px;
}
.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  font-style: italic;
  color: var(--ink);
}
.brand .ord { color: var(--accent); margin-right: 4px; }
.nav-links { margin-left: auto; display: flex; gap: 22px; flex-wrap: wrap; }
.nav-links a {
  font-size: 13px;
  color: var(--ink-2);
  border-bottom: 0;
  padding: 4px 0;
  font-feature-settings: "tnum";
  position: relative;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active {
  color: var(--ink);
}
.nav-links a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -16px;
  height: 1px; background: var(--accent);
}
@media (max-width: 640px) {
  .nav-inner {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 0;
    padding: 12px 24px;
  }
  .brand {
    width: 100%;
    font-size: 16px;
    line-height: 1.1;
    white-space: nowrap;
  }
  .nav-links {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(4, max-content);
    gap: 8px 18px;
  }
  .nav-links a.active::after {
    bottom: -5px;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 120px 0 56px;
}
.hero h1 {
  margin-top: 0.1em;
  margin-bottom: 0.4em;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "SOFT" 100;
}
.hero .lede {
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink);
  max-width: 640px;
  margin-bottom: 24px;
}
.hero .lede::first-letter {
  font-family: var(--display);
  float: left;
  font-size: 64px;
  line-height: 0.92;
  padding: 6px 10px 0 0;
  font-weight: 700;
  color: var(--accent);
}
.hero .byline {
  font-family: var(--body);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  border-top: 1px solid var(--hair);
  padding-top: 16px;
  margin-top: 24px;
  max-width: 640px;
}
.hero .byline span b { color: var(--ink); font-weight: 500; }
@media (max-width: 640px) {
  :root { --gutter: 24px; }
  section { padding: 64px 0 48px; }
  .hero { padding: 92px 0 48px; }
  .hero .lede {
    font-size: 19px;
    line-height: 1.48;
  }
  .hero .byline {
    gap: 10px 16px;
  }
}

/* Hero anchor figure */
.hero-figure {
  margin-top: 56px;
  border-top: 1px solid var(--hair);
  padding-top: 32px;
}
.three-up {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}
.three-up > div {
  padding: 22px 28px;
  border-left: 1px solid var(--hair-soft);
}
.three-up > div:first-child { border-left: 0; padding-left: 0; }
.three-up > div:last-child { padding-right: 0; }
.three-up h4 { color: var(--accent); }
.three-up p { font-size: 14.5px; line-height: 1.55; margin: 4px 0 0; max-width: none; }
@media (max-width: 720px) {
  .three-up { grid-template-columns: 1fr; }
  .three-up > div { border-left: 0; border-top: 1px solid var(--hair-soft); padding: 16px 0; }
  .three-up > div:first-child { border-top: 0; }
}

/* ---------- Section structure ---------- */
.section-head {
  border-bottom: 1px solid var(--hair);
  padding-bottom: 28px;
  margin-bottom: 36px;
}
.section-head .meta {
  display: flex; gap: 22px; flex-wrap: wrap;
  font-family: var(--body); font-size: 13px;
  color: var(--ink-3); margin-top: 12px;
}
.section-head .meta b { color: var(--ink-2); font-weight: 500; }

/* Lede paragraphs */
.lede-p {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.005em;
  margin-bottom: 1.2em;
}

/* Dropcap on first paragraph */
.dropcap::first-letter {
  font-family: var(--display);
  float: left;
  font-size: 56px;
  line-height: 0.9;
  padding: 6px 10px 0 0;
  font-weight: 700;
  color: var(--accent);
  font-variation-settings: "opsz" 144;
}

/* Margin notes layout */
.with-margin {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 48px;
  align-items: start;
  max-width: var(--maxw);
}
.with-margin > .body { max-width: var(--maxw-prose); }
.with-margin .aside {
  font-family: var(--body);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 16px;
  margin-top: 6px;
}
.with-margin .aside .num {
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  color: var(--accent);
  font-size: 22px;
  display: block;
  line-height: 1;
  margin-bottom: 6px;
}
@media (max-width: 880px) {
  .with-margin { grid-template-columns: 1fr; }
  .with-margin .aside { border-left: 0; border-top: 1px solid var(--hair); padding: 14px 0 0; }
}

/* Pull quote */
blockquote, .pull {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.35;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 22px;
  margin: 28px 0;
  max-width: 620px;
}
.pull cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

/* ---------- Footnotes / inline data ---------- */
.fn {
  font-feature-settings: "sups";
  font-size: 0.7em;
  vertical-align: super;
  color: var(--accent);
  font-weight: 600;
  margin-left: 1px;
  text-decoration: none;
  border-bottom: 0;
}
.fn:hover { color: var(--ember); }

/* Data callout — inline, not a card */
.callout {
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  border-left: 2px solid var(--accent);
  padding: 8px 0 8px 18px;
  margin: 22px 0;
  max-width: var(--maxw-prose);
}
.callout.warn { border-color: var(--ember); }
.callout.warn b { color: var(--ember); }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  margin: 8px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.table th, .table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hair-soft);
  vertical-align: top;
}
.table thead th {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: transparent;
  border-bottom: 1px solid var(--hair);
}
.table td { color: var(--ink-2); }
.table td.col-1 { color: var(--ink); font-weight: 500; }
.table tr:last-child td { border-bottom: 0; }
.table .pos { color: var(--moss); }
.table .neg { color: var(--ember); }
.table .neut { color: var(--accent); }
@media (max-width: 720px) {
  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .table th,
  .table td {
    white-space: normal;
    min-width: 150px;
  }
  .table th:first-child,
  .table td:first-child {
    min-width: 190px;
  }
}

/* ---------- Diagrams (lightweight, no card chrome) ---------- */
.figure {
  margin: 36px 0;
  max-width: var(--maxw);
}
.figure-head {
  display: flex; gap: 16px; align-items: baseline;
  border-bottom: 1px solid var(--hair);
  padding-bottom: 8px;
  margin-bottom: 18px;
}
.figure-head .label {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.figure-head h3 {
  margin: 0;
  font-size: 18px;
  font-style: normal;
  font-weight: 500;
  color: var(--ink);
  font-variation-settings: "opsz" 30, "SOFT" 30;
}
.figure-head .hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
}
.figure-caption {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 10px;
  max-width: var(--maxw-prose);
  line-height: 1.55;
  font-style: italic;
  font-family: var(--display);
}
@media (max-width: 560px) {
  .figure-head {
    display: block;
  }
  .figure-head .label,
  .figure-head .hint {
    display: block;
  }
  .figure-head h3 {
    margin-top: 6px;
  }
  .figure-head .hint {
    margin-left: 0;
    margin-top: 6px;
    white-space: normal;
  }
}

/* SVG defaults */
.figure svg { width: 100%; height: auto; }
.svg-text { font-family: var(--body); font-size: 12px; fill: var(--ink); }
.svg-text-mono { font-family: var(--mono); font-size: 11.5px; fill: var(--ink); }
.svg-text-muted { font-family: var(--body); font-size: 11px; fill: var(--ink-3); }
.svg-text-accent { font-family: var(--body); font-size: 12px; fill: var(--accent); font-weight: 600; }
.svg-rule { stroke: var(--hair-strong); stroke-width: 1; fill: none; }
.svg-rule-soft { stroke: var(--hair); stroke-width: 1; fill: none; stroke-dasharray: 3 3; }
.svg-node { fill: var(--paper); stroke: var(--ink); stroke-width: 1; }
.svg-node-accent { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 1.4; }
.svg-node-ember { fill: var(--ember-bg); stroke: var(--ember); stroke-width: 1.4; }
.svg-node-moss { fill: var(--moss-bg); stroke: var(--moss); stroke-width: 1.4; }
.svg-arrow { stroke: var(--ink); stroke-width: 1.2; fill: none; }
.svg-arrow-accent { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.svg-arrow-soft { stroke: var(--hair-strong); stroke-width: 1; fill: none; }
.svg-arrow-danger { stroke: var(--ember); stroke-width: 1.2; fill: none; stroke-dasharray: 4 3; }

/* ---------- Pass-the-parcel (statechain) interactive ---------- */
.parcel {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 880px) { .parcel { grid-template-columns: 1fr; } }

.parcel-stage {
  background: var(--paper-tint);
  border: 1px solid var(--hair);
  padding: 22px;
  position: relative;
  min-height: 280px;
  overflow-x: auto;
}
.parcel-row {
  display: flex; gap: 12px; align-items: flex-end;
  border-bottom: 1px solid var(--hair-soft);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.parcel-clock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.parcel-clock b { color: var(--ink); font-weight: 500; }
.parcel-owners {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  min-width: 560px;
}
.parcel-owner {
  border: 1px solid var(--hair);
  padding: 12px 10px;
  text-align: center;
  background: var(--paper);
  position: relative;
  transition: background .2s, border-color .2s;
}
.parcel-owner.holder {
  background: var(--accent-bg);
  border-color: var(--accent);
}
.parcel-owner.holder::before {
  content: "holds";
  position: absolute;
  top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--paper);
  font-family: var(--body); font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.parcel-owner .name {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
}
.parcel-owner .lock {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}
.parcel-owner.expired {
  opacity: 0.45;
  background: var(--paper);
}
.parcel-owner.expired .lock { color: var(--ember); }

.parcel-bars {
  margin: 12px 0;
  min-width: 560px;
}
.parcel-bar {
  display: grid;
  grid-template-columns: 70px 1fr 130px;
  gap: 12px; align-items: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  padding: 5px 0;
}
.parcel-bar .name { color: var(--ink); font-family: var(--display); font-style: italic; font-size: 13px; }
.parcel-bar .track {
  height: 14px;
  background: var(--paper-deep);
  position: relative;
}
.parcel-bar .track-fill {
  height: 100%;
  background: var(--accent);
  transition: width .25s ease;
}
.parcel-bar.expired .track-fill { background: var(--ember); }
.parcel-bar.holder .track-fill { background: var(--accent); }
.parcel-bar.attacker .track-fill { background: var(--ember); }

.parcel-controls {
  position: sticky; top: 80px;
}
.parcel-controls h4 {
  letter-spacing: 0.14em;
  margin-bottom: 12px;
}
.btn {
  display: block;
  width: 100%;
  padding: 9px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--hair-strong);
  background: var(--paper);
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  letter-spacing: 0;
  font-weight: 500;
  transition: all .15s;
}
.btn:hover {
  border-color: var(--ink);
  background: var(--accent);
  color: var(--paper);
}
.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--paper);
}
.btn.primary:hover { background: var(--ember); border-color: var(--ember); }
.btn.danger {
  border-color: var(--ember);
  color: var(--ember);
}
.btn.danger:hover { background: var(--ember); color: var(--paper); }
.btn.ghost {
  border-color: var(--hair);
  color: var(--ink-2);
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--paper); border-color: var(--hair); color: var(--ink-2); }

.parcel-log {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  border-top: 1px solid var(--hair);
  padding-top: 12px;
  max-height: 180px;
  overflow-y: auto;
}
.parcel-log .entry { padding: 3px 0; border-bottom: 1px dotted var(--hair-soft); }
.parcel-log .entry:last-child { border-bottom: 0; }
.parcel-log .entry.bad { color: var(--ember); }
.parcel-log .entry.good { color: var(--moss); }
.parcel-log .ts { color: var(--ink-3); margin-right: 6px; }

/* ---------- Mercury inspector (side-by-side) ---------- */
.inspector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--hair);
  margin-top: 12px;
}
@media (max-width: 720px) { .inspector { grid-template-columns: 1fr; } }
.inspector-pane {
  padding: 22px;
}
.inspector-pane + .inspector-pane {
  border-left: 1px solid var(--hair);
}
@media (max-width: 720px) {
  .inspector-pane + .inspector-pane { border-left: 0; border-top: 1px solid var(--hair); }
}
.inspector-pane.client { background: var(--paper); }
.inspector-pane.server { background: var(--paper-tint); }
.inspector-pane h4 {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  color: var(--ink);
}
.inspector-pane .who {
  font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: 14px; text-transform: none; letter-spacing: 0;
  color: var(--ink-2);
}
.inspector-line {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dotted var(--hair-soft);
  font-family: var(--mono);
  font-size: 12px;
}
.inspector-line .key { color: var(--ink-3); }
.inspector-line .val { color: var(--ink); word-break: break-all; }
.inspector-line.blinded .val {
  color: var(--ink-3);
  letter-spacing: -0.5px;
}
.inspector-line.hidden .val::before {
  content: "—— hidden ——";
  color: var(--ink-3);
  font-style: italic;
}

.inspector-controls {
  display: flex; gap: 10px; margin-top: 18px;
  align-items: center; flex-wrap: wrap;
  border-top: 1px solid var(--hair);
  padding-top: 16px;
}
@media (max-width: 560px) {
  .inspector-controls {
    align-items: flex-start;
  }
  .signature-counter {
    width: 100%;
    margin-left: 0 !important;
  }
}
.inspector-controls .switch {
  position: relative; width: 38px; height: 20px;
  background: var(--paper-deep);
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  cursor: pointer;
}
.inspector-controls .switch::after {
  content: "";
  position: absolute; top: 1px; left: 1px;
  width: 16px; height: 16px;
  background: var(--ink);
  border-radius: 50%;
  transition: transform .2s;
}
.inspector-controls .switch.on { background: var(--accent-bg); border-color: var(--accent); }
.inspector-controls .switch.on::after { background: var(--accent); transform: translateX(18px); }
.inspector-controls .switch-label {
  font-family: var(--body);
  font-size: 13px; color: var(--ink-2);
}

.signature-counter {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-family: var(--display); font-style: italic;
  color: var(--accent);
}
.signature-counter .num { font-size: 22px; font-weight: 600; }

/* ---------- Spark coin picker ---------- */
.picker {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  margin-top: 12px;
  align-items: start;
}
@media (max-width: 880px) { .picker { grid-template-columns: 1fr; } }

.picker-leaves {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 720px) { .picker-leaves { grid-template-columns: repeat(2, 1fr); } }
.leaf {
  border: 1px solid var(--hair);
  padding: 14px 12px;
  cursor: pointer;
  background: var(--paper);
  text-align: left;
  font-family: inherit;
  position: relative;
  transition: all .15s;
}
.leaf:hover { border-color: var(--ink); }
.leaf.selected { background: var(--accent-bg); border-color: var(--accent); }
.leaf.selected::after {
  content: "✓";
  position: absolute; top: 8px; right: 10px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}
.leaf.below-floor {
  border-style: dashed;
  border-color: var(--hair-strong);
  background: var(--paper-tint);
}
.leaf .amount {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.leaf .meta {
  font-family: var(--body);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}
.leaf.below-floor .meta { color: var(--ember); }

.picker-summary {
  position: sticky; top: 80px;
  background: var(--paper-tint);
  border: 1px solid var(--hair);
  padding: 22px;
}
.picker-target {
  font-family: var(--display);
  font-style: italic;
  color: var(--ink-2);
  font-size: 14px;
  margin-bottom: 4px;
}
.picker-amt {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  font-feature-settings: "tnum";
}
.picker-amt .sub { font-size: 14px; color: var(--ink-3); margin-left: 6px; font-weight: 400; }
.picker-row {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dotted var(--hair-soft);
  font-size: 13px;
  font-family: var(--mono);
  color: var(--ink-2);
}
.picker-row .v { color: var(--ink); }
.picker-row.over .v { color: var(--ember); }
.picker-row.exact .v { color: var(--moss); font-weight: 600; }
.picker-status {
  margin-top: 14px;
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}
.picker-status.ok { color: var(--moss); }
.picker-status.over { color: var(--ember); }

/* ---------- Failure scrubber ---------- */
.scrubber {
  margin-top: 12px;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  padding: 22px 0;
}
.scrubber-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--hair-soft);
  margin-bottom: 22px;
}
.scrubber-tab {
  padding: 10px 18px 12px;
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.scrubber-tab:hover { color: var(--ink); }
.scrubber-tab.active { color: var(--ink); border-bottom-color: var(--accent); }

.scrubber-track {
  position: relative;
  height: 60px;
  margin: 14px 0 8px;
}
.scrubber-track .axis {
  position: absolute; left: 0; right: 0; top: 30px;
  height: 1px; background: var(--hair-strong);
}
.scrubber-track .tick {
  position: absolute; top: 26px;
  width: 1px; height: 9px;
  background: var(--hair-strong);
}
.scrubber-track .tick-label {
  position: absolute; top: 38px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  transform: translateX(-50%);
}
.scrubber-track .event {
  position: absolute; top: 8px;
  width: 12px; height: 12px;
  border: 2px solid var(--ink);
  background: var(--paper);
  border-radius: 50%;
  cursor: pointer;
  transform: translateX(-50%);
  transition: all .15s;
}
.scrubber-track .event.hot { background: var(--ember); border-color: var(--ember); }
.scrubber-track .event.fired { background: var(--ink); }
.scrubber-track .event.fired.hot { background: var(--ember); }
.scrubber-track .event-label {
  position: absolute; top: -16px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  transform: translateX(-50%);
  white-space: nowrap;
}
.scrubber-track .playhead {
  position: absolute; top: 4px; bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  pointer-events: none;
}
.scrubber-track .playhead::after {
  content: "";
  position: absolute; top: 0; left: -5px;
  width: 12px; height: 12px;
  background: var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
}
.scrubber-input {
  width: 100%;
  margin-top: 10px;
  accent-color: var(--accent);
}
.scrubber-state {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--hair-soft);
}
@media (max-width: 720px) { .scrubber-state { grid-template-columns: 1fr; } }
.scrubber-state .col h4 { color: var(--ink-3); }
.scrubber-state .col .v {
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.scrubber-state .col.loss .v { color: var(--ember); }
.scrubber-state .col p { font-size: 13px; color: var(--ink-2); margin: 4px 0 0; }

.scrubber-narrative {
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  margin-top: 22px;
  border-left: 2px solid var(--accent);
  padding-left: 18px;
  max-width: var(--maxw-prose);
}

/* ---------- Tabs (used in Mercury & Spark prose flows) ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--hair);
  margin-bottom: 18px;
}
.tab {
  padding: 8px 16px;
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .25s; }
@keyframes fade {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tab-panel ol, .tab-panel ul {
  font-size: 14.5px;
  color: var(--ink-2);
  padding-left: 20px;
  max-width: var(--maxw-prose);
  margin: 6px 0;
}
.tab-panel li { margin: 6px 0; }

/* ---------- Pre / formula blocks ---------- */
.formula {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--paper-tint);
  border-left: 2px solid var(--accent);
  padding: 14px 18px;
  margin: 18px 0;
  white-space: pre-wrap;
  color: var(--ink);
  max-width: var(--maxw-prose);
  line-height: 1.7;
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--hair);
  padding: 36px 0 60px;
  margin-top: 24px;
}
footer .wrap {
  display: flex; gap: 24px; flex-wrap: wrap;
  align-items: baseline; justify-content: space-between;
}
footer p { font-size: 13px; color: var(--ink-3); margin: 0; }
footer .colophon {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-2);
}
footer .links { display: flex; gap: 18px; font-size: 13px; }
footer .links a { color: var(--ink-2); border-bottom: 0; }
footer .links a:hover { color: var(--ink); }

/* ---------- Misc ---------- */
.scroll-rule {
  position: fixed; top: 0; left: 0; height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 60;
  transition: width .1s linear;
}
hr.soft { border: 0; border-top: 1px solid var(--hair-soft); margin: 22px 0; max-width: var(--maxw-prose); }
hr.rule { border: 0; border-top: 1px solid var(--hair); margin: 36px 0; }

/* Pretty number animation */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.flicker { animation: flicker 0.5s ease; }

/* ---------- Key-update walkthrough (Figure 4) ---------- */
.walk { margin-top: 12px; }
.walk-stage {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border: 1px solid var(--hair);
  background: var(--paper);
}
@media (max-width: 880px) { .walk-stage { grid-template-columns: 1fr; } }
.walk-lane {
  padding: 22px 20px 24px;
  border-left: 1px solid var(--hair-soft);
  min-height: 320px;
  position: relative;
}
.walk-lane:first-child { border-left: 0; }
@media (max-width: 880px) {
  .walk-lane { border-left: 0; border-top: 1px solid var(--hair-soft); min-height: 0; }
  .walk-lane:first-child { border-top: 0; }
}
.walk-lane h4 {
  letter-spacing: 0.14em;
  margin-bottom: 4px;
}
.walk-lane h4 .who {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-2);
  margin-left: 6px;
}
.walk-lane.active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.walk-items {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.walk-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  border-bottom: 1px dotted var(--hair-soft);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.25s, transform 0.25s, color 0.25s;
}
.walk-item:last-child { border-bottom: 0; }
.walk-item.visible { opacity: 1; transform: translateY(0); }
.walk-item.fresh {
  color: var(--accent);
  background: var(--accent-bg);
  border-radius: 3px;
  padding: 5px 8px;
  margin: 0 -8px;
}
.walk-item.fresh .key { color: var(--accent); }
.walk-item.deleted {
  color: var(--ember);
  text-decoration: line-through;
  text-decoration-color: var(--ember);
  background: var(--ember-bg);
  border-radius: 3px;
  padding: 5px 8px;
  margin: 0 -8px;
}
.walk-item .key {
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.walk-item .val { word-break: break-all; }
.walk-item .note {
  font-family: var(--body);
  font-size: 11px;
  font-style: italic;
  color: var(--ink-3);
  display: block;
  margin-top: 2px;
}

.walk-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--hair-soft);
  margin-top: -1px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  flex-wrap: wrap;
}
.walk-flow .flow-tag {
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.walk-flow .flow-msg {
  font-family: var(--mono);
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 3px 9px;
  color: var(--accent);
}
.walk-flow .flow-arrow {
  font-family: var(--mono);
  color: var(--accent);
}
.walk-flow .flow-none {
  color: var(--ink-3);
  font-style: italic;
  font-family: var(--display);
  font-size: 13px;
}

.walk-step-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  flex-wrap: wrap;
}
.walk-step-bar .btn {
  width: auto;
  margin: 0;
  padding: 8px 16px;
  font-size: 13px;
}
.walk-counter {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  margin-left: auto;
}
.walk-progress {
  flex: 1;
  height: 2px;
  background: var(--hair-soft);
  position: relative;
  margin: 0 12px;
  max-width: 280px;
}
.walk-progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent);
  transition: width 0.25s;
}

.walk-explainer {
  border-top: 1px solid var(--hair);
  padding-top: 18px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 880px) {
  .walk-explainer { grid-template-columns: 1fr; }
}
.walk-explainer h3 {
  font-family: var(--display);
  font-size: 22px;
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.walk-explainer h3 .step-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-right: 10px;
  letter-spacing: 0.06em;
  font-style: normal;
}
.walk-explainer p {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.6;
  max-width: none;
}
.walk-formula {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper-tint);
  border-left: 2px solid var(--accent);
  padding: 14px 16px;
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.7;
}
.walk-formula .label {
  font-family: var(--body);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: 8px;
}

/* ---------- Lineage section (IV) ---------- */
.lineage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border: 1px solid var(--hair);
  margin: 24px 0;
}
@media (max-width: 880px) { .lineage-grid { grid-template-columns: 1fr; } }
.lineage-col {
  padding: 24px 22px 26px;
  border-left: 1px solid var(--hair-soft);
}
.lineage-col:first-child { border-left: 0; }
@media (max-width: 880px) {
  .lineage-col { border-left: 0; border-top: 1px solid var(--hair-soft); }
  .lineage-col:first-child { border-top: 0; }
}
.lineage-col header {
  border-bottom: 1px solid var(--hair);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.lineage-col .year {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: 4px;
}
.lineage-col h3 {
  font-family: var(--display);
  font-size: 24px;
  font-style: normal;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
}
.lineage-col .byline {
  font-family: var(--display);
  font-style: italic;
  color: var(--ink-2);
  font-size: 13px;
  margin: 4px 0 0;
}
.lineage-col.original h3,
.lineage-col.original .year { color: var(--ink); }
.lineage-col.mercury .year { color: var(--accent); }
.lineage-col.spark .year { color: var(--accent); }

.lineage-row {
  padding: 12px 0;
  border-bottom: 1px dotted var(--hair-soft);
}
.lineage-row:last-child { border-bottom: 0; }
.lineage-row .dim {
  display: block;
  font-family: var(--body);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.lineage-row .val {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.45;
  display: block;
}
.lineage-row .val code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper-tint);
  padding: 1px 5px;
  border-radius: 2px;
}
.lineage-row .tag {
  display: inline-block;
  font-family: var(--body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  margin-top: 6px;
  border: 1px solid;
}
.tag.changed     { color: var(--ink-2); background: var(--paper-tint); border-color: var(--hair-strong); }
.tag.inherited   { color: var(--ink-3); background: transparent;       border-color: var(--hair); }
.tag.improved    { color: var(--moss);  background: var(--moss-bg);    border-color: var(--moss); }
.tag.regressed   { color: var(--ember); background: var(--ember-bg);   border-color: var(--ember); }
.tag.added       { color: var(--accent);background: var(--accent-bg);  border-color: var(--accent); }
.tag.dropped     { color: var(--ember); background: var(--ember-bg);   border-color: var(--ember); }
.tag.workaround  { color: var(--ink-2); background: var(--paper-tint); border-color: var(--hair-strong); }
.tag.required    { color: var(--ink-3); background: transparent;       border-color: var(--hair); }

/* ---------- Ark section ---------- */
.ark-clocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--hair);
  margin: 34px auto 0;
  max-width: var(--maxw);
}
@media (max-width: 760px) { .ark-clocks { grid-template-columns: 1fr; } }
.ark-clock {
  padding: 26px 28px 28px;
  background: var(--paper);
}
.ark-clock + .ark-clock {
  border-left: 1px solid var(--hair);
  background: var(--paper-tint);
}
@media (max-width: 760px) {
  .ark-clock + .ark-clock {
    border-left: 0;
    border-top: 1px solid var(--hair);
  }
}
.ark-clock .clock-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}
.ark-clock h3 {
  font-family: var(--display);
  font-size: 28px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.ark-clock p {
  font-size: 15px;
  line-height: 1.58;
  color: var(--ink);
  max-width: none;
  margin-bottom: 14px;
}
.ark-clock .clock-risk {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
  border-top: 1px dotted var(--hair);
  padding-top: 10px;
}

.ark-bundle {
  border: 1px solid var(--hair);
  background: var(--paper);
  margin: 24px 0;
}
.ark-bundle-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  padding: 15px 20px;
  border-bottom: 1px dotted var(--hair-soft);
}
.ark-bundle-row:last-child { border-bottom: 0; }
.ark-bundle-row .key {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.ark-bundle-row .val {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
}
@media (max-width: 620px) {
  .ark-bundle-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.ark-payment {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--hair);
  background: var(--paper);
  margin: 24px 0;
}
@media (max-width: 920px) { .ark-payment { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .ark-payment { grid-template-columns: 1fr; } }
.ark-lane {
  padding: 22px 20px 24px;
  border-left: 1px solid var(--hair-soft);
  min-height: 210px;
}
.ark-lane:first-child { border-left: 0; }
@media (max-width: 920px) {
  .ark-lane { border-top: 1px solid var(--hair-soft); }
  .ark-lane:nth-child(-n+2) { border-top: 0; }
  .ark-lane:nth-child(odd) { border-left: 0; }
}
@media (max-width: 560px) {
  .ark-lane {
    border-left: 0;
    border-top: 1px solid var(--hair-soft);
    min-height: 0;
  }
  .ark-lane:first-child { border-top: 0; }
}
.ark-lane .lane-tag {
  font-family: var(--display);
  font-size: 13px;
  font-style: italic;
  color: var(--accent);
  display: block;
  margin-bottom: 12px;
}
.ark-lane h4 {
  color: var(--ink);
  margin-bottom: 8px;
}
.ark-lane p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
  max-width: none;
}

.ark-flow {
  display: grid;
  grid-template-columns: 1fr 34px 1fr 34px 1fr 34px 1fr;
  gap: 0;
  align-items: stretch;
  margin: 24px 0;
  border: 1px solid var(--hair);
  background: var(--paper);
}
.ark-step {
  padding: 22px 20px 24px;
  min-height: 190px;
  position: relative;
}
.ark-step + .ark-step { border-left: 1px solid var(--hair-soft); }
.ark-step.exit {
  background: var(--paper-tint);
  border-left: 1px solid var(--hair);
}
.ark-step .step-id {
  font-family: var(--display);
  font-style: italic;
  font-size: 30px;
  line-height: 1;
  color: var(--accent);
  display: block;
  margin-bottom: 18px;
}
.ark-step h4 {
  color: var(--ink);
  margin-bottom: 8px;
}
.ark-step p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
  max-width: none;
}
.ark-arrow {
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 24px;
  color: var(--accent);
  border-left: 1px solid var(--hair-soft);
  border-right: 1px solid var(--hair-soft);
  background: var(--paper-tint);
}
@media (max-width: 960px) {
  .ark-flow {
    grid-template-columns: 1fr;
  }
  .ark-arrow {
    min-height: 34px;
    border: 0;
    border-top: 1px solid var(--hair-soft);
    border-bottom: 1px solid var(--hair-soft);
    transform: rotate(90deg);
  }
  .ark-step {
    min-height: 0;
  }
  .ark-step.exit {
    border-left: 0;
  }
}

.ark-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--hair);
  margin: 36px auto 0;
  max-width: var(--maxw);
}
@media (max-width: 880px) { .ark-compare { grid-template-columns: 1fr; } }
.ark-profile {
  padding: 24px 24px 26px;
  background: var(--paper);
}
.ark-profile + .ark-profile {
  border-left: 1px solid var(--hair);
  background: var(--paper-tint);
}
@media (max-width: 880px) {
  .ark-profile + .ark-profile { border-left: 0; border-top: 1px solid var(--hair); }
}
.ark-profile header {
  border-bottom: 1px solid var(--hair);
  padding-bottom: 16px;
  margin-bottom: 12px;
}
.ark-profile .profile-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}
.ark-profile h3 {
  font-family: var(--display);
  font-size: 24px;
  font-style: normal;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.ark-profile header p {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0;
  max-width: none;
}
.profile-row {
  padding: 12px 0;
  border-bottom: 1px dotted var(--hair-soft);
}
.profile-row:last-child { border-bottom: 0; }
.profile-row .dim {
  display: block;
  font-family: var(--body);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.profile-row .val {
  display: block;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
}
.source-strip {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-3);
  border-top: 1px solid var(--hair);
  padding-top: 12px;
  margin-top: 18px;
}

/* ---------- Blinding compare (Figure 3b) ---------- */
.blind-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--hair);
  margin: 24px 0;
}
@media (max-width: 880px) { .blind-compare { grid-template-columns: 1fr; } }
.blind-compare-col {
  padding: 24px 22px;
  background: var(--paper);
}
.blind-compare-col + .blind-compare-col {
  border-left: 1px solid var(--hair);
  background: var(--paper-tint);
}
@media (max-width: 880px) {
  .blind-compare-col + .blind-compare-col { border-left: 0; border-top: 1px solid var(--hair); }
}
.blind-compare-col header {
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hair-soft);
}
.blind-compare-col.blind header { color: var(--accent); }
.blind-compare-col h4 {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  margin: 14px 0 6px;
  text-transform: none;
  letter-spacing: 0;
}
.blind-compare-col h4:first-of-type { margin-top: 0; }
.blind-compare-col .code-line {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  padding: 1px 0;
}
.blind-compare-col .code-line.dim { color: var(--ink-3); }
.blind-compare-col .code-line.accent { color: var(--accent); font-weight: 500; }
.blind-compare-col ul.see-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}
.blind-compare-col ul.see-list li {
  font-family: var(--mono);
  font-size: 12px;
  padding: 3px 0;
  color: var(--ink-2);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.blind-compare-col li .glyph {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  width: 14px;
  display: inline-block;
  flex: 0 0 14px;
}
.blind-compare-col li.see .glyph { color: var(--moss); }
.blind-compare-col li.miss .glyph { color: var(--ember); }
.blind-compare-col li.miss { color: var(--ink-2); }

/* ---------- Walkthrough expander (after Figure 3b) ---------- */
.walkthrough-trigger {
  display: flex;
  justify-content: center;
  margin: 28px 0 8px;
}
.walkthrough-btn {
  width: auto;
  margin: 0;
  padding: 12px 22px;
  background: var(--paper-tint);
  border: 1px solid var(--hair-strong);
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.02em;
  font-weight: 500;
  transition: background .2s, color .2s, border-color .2s;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-radius: 0;
}
.walkthrough-btn:hover {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.walkthrough-btn .btn-icon {
  display: inline-block;
  font-size: 11px;
  transition: transform 0.2s;
  width: 10px;
  text-align: center;
  color: var(--accent);
}
.walkthrough-btn:hover .btn-icon { color: var(--paper); }
.walkthrough-btn.open .btn-icon { transform: rotate(90deg); }

.walkthrough-body {
  margin: 24px 0 32px;
  padding: 8px 0 4px 32px;
  border-left: 2px solid var(--accent);
  max-width: var(--maxw-prose);
}
.walkthrough-body > h4 {
  font-family: var(--display);
  font-style: italic;
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  margin: 28px 0 8px;
  text-transform: none;
  letter-spacing: 0;
  font-variation-settings: "opsz" 30, "SOFT" 60;
}
.walkthrough-body > h4:first-child { margin-top: 4px; }
.walkthrough-body > h4 .num {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  margin-right: 12px;
  letter-spacing: 0.1em;
}
.walkthrough-body p {
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--ink);
  max-width: 660px;
  margin: 0 0 12px;
}
.walkthrough-body p em {
  font-style: italic;
  font-family: var(--display);
  color: var(--ink);
  font-weight: 500;
}
.walkthrough-body .pre-formula {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--paper-tint);
  border-left: 2px solid var(--accent);
  padding: 12px 16px;
  margin: 14px 0;
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.7;
  max-width: 580px;
}
.walkthrough-body ul {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  padding-left: 22px;
  max-width: 660px;
  margin: 8px 0 14px;
}
.walkthrough-body ul li {
  margin: 4px 0;
}
.walkthrough-body code.inline {
  background: var(--paper-tint);
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--hair-soft);
  font-size: 0.85em;
}
.walkthrough-body .closing {
  font-family: var(--display);
  font-style: italic;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  border-top: 1px solid var(--hair);
  padding-top: 16px;
  margin-top: 24px;
  max-width: 620px;
}

/* ---------- Spark deep-dive: actor map ---------- */
.actors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--hair);
  margin: 24px 0;
}
@media (max-width: 880px) { .actors { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .actors { grid-template-columns: 1fr; } }
.actor {
  padding: 22px 20px 24px;
  border-left: 1px solid var(--hair-soft);
  background: var(--paper);
  position: relative;
}
.actor:first-child { border-left: 0; }
@media (max-width: 880px) {
  .actor { border-left: 0; border-top: 1px solid var(--hair-soft); }
  .actor:first-child, .actor:nth-child(2) { border-top: 0; }
}
@media (max-width: 880px) and (min-width: 561px) {
  .actor:nth-child(odd) { border-left: 0; }
  .actor:nth-child(even) { border-left: 1px solid var(--hair-soft); }
}
.actor header {
  border-bottom: 1px solid var(--hair-soft);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.actor .actor-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}
.actor h3 {
  font-family: var(--display);
  font-size: 19px;
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.005em;
}
.actor .role {
  font-family: var(--display);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-2);
  margin: 4px 0 0;
}
.actor h4 {
  font-size: 10px;
  letter-spacing: 0.14em;
  margin: 12px 0 4px;
  color: var(--ink-3);
}
.actor h4:first-of-type { margin-top: 0; }
.actor ul {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.actor ul li {
  padding: 3px 0;
  border-bottom: 1px dotted var(--hair-soft);
}
.actor ul li:last-child { border-bottom: 0; }
.actor .holds {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 4px 8px;
  border-radius: 2px;
  display: inline-block;
  margin-top: 6px;
}

/* ---------- Spark deep-dive: tree + timelocks ---------- */
.tree-spec {
  margin: 24px 0;
  border: 1px solid var(--hair);
  background: var(--paper);
  padding: 22px;
}
.tree-spec table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 0;
}
.tree-spec th, .tree-spec td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--hair-soft);
  vertical-align: top;
}
.tree-spec th {
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid var(--hair);
}
.tree-spec td.depth {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  width: 110px;
}
.tree-spec td.tx {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}
.tree-spec td.lock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  width: 130px;
}

/* ---------- Spark deep-dive: incidents log ---------- */
.incidents {
  margin: 24px 0;
  border-left: 2px solid var(--ember);
  padding: 8px 0 8px 24px;
}
.incident {
  display: grid;
  grid-template-columns: 130px 1fr 90px;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dotted var(--hair-soft);
  align-items: baseline;
}
.incident:last-child { border-bottom: 0; }
.incident .date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
}
.incident .what {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}
.incident .what .system {
  font-family: var(--display);
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
  margin-right: 4px;
}
.incident .duration {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ember);
  text-align: right;
  white-space: nowrap;
}

/* ---------- Spark deep-dive: SSP / Lightning sequence ---------- */
.spark-flow {
  margin: 18px 0;
}
.spark-flow svg { background: var(--paper); border: 1px solid var(--hair); }

/* ---------- Spark deep-dive: token UTXO anatomy ---------- */
.token-anatomy {
  margin: 24px 0;
  border: 1px solid var(--hair);
  padding: 22px;
  background: var(--paper);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
@media (max-width: 880px) { .token-anatomy { grid-template-columns: 1fr; } }
.token-anatomy h4 {
  margin-bottom: 6px;
  color: var(--ink-2);
}
.token-anatomy .field {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px dotted var(--hair-soft);
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
}
.token-anatomy .field:last-child { border-bottom: 0; }
.token-anatomy .field .key { color: var(--ink-3); }
.token-anatomy .field .val { color: var(--ink); }
.token-anatomy .field .val.accent { color: var(--accent); }

/* ---------- Step-zero primer (plain-language Spark intro) ---------- */
.primer {
  margin: 24px 0 28px;
  padding: 24px 28px 28px;
  background: var(--paper-tint);
  border: 1px solid var(--hair);
  border-left: 4px solid var(--accent);
}
.primer .primer-intro {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  margin: 0 0 24px;
  max-width: 660px;
}
.primer h4 {
  font-family: var(--display);
  font-style: normal;
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
  margin: 28px 0 8px;
  letter-spacing: -0.005em;
  text-transform: none;
  font-variation-settings: "opsz" 30;
}
.primer h4:first-of-type { margin-top: 0; }
.primer h4 .num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-right: 14px;
  letter-spacing: 0.06em;
}
.primer-visual {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--hair-soft);
  padding: 14px 18px;
  margin: 12px 0 14px;
  white-space: pre;
  overflow-x: auto;
  max-width: 580px;
}
.primer p {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 12px;
  max-width: 660px;
}
.primer p.technical {
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink-3);
  border-top: 1px dashed var(--hair);
  padding-top: 10px;
  margin-top: 14px;
  font-style: italic;
  max-width: 660px;
}
.primer p.technical b {
  font-style: normal;
  color: var(--ink-2);
  font-weight: 500;
}
.primer .bridge {
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  border-top: 1px solid var(--hair);
  padding-top: 18px;
  margin-top: 28px;
  max-width: 620px;
}

/* ---------- Worked example timeline ---------- */
.worked-timeline {
  margin: 24px 0 32px;
  padding: 6px 0 6px 32px;
  border-left: 2px solid var(--accent);
  max-width: var(--maxw-prose);
}
.worked-day {
  position: relative;
  padding: 18px 0 22px;
  border-bottom: 1px dotted var(--hair);
}
.worked-day:last-child { border-bottom: 0; padding-bottom: 4px; }
.worked-day::before {
  content: "";
  position: absolute;
  left: -39px;
  top: 24px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 2px var(--accent);
}
.worked-day.alt::before {
  background: var(--paper);
  box-shadow: 0 0 0 2px var(--ember);
}
.worked-day h4 {
  font-family: var(--display);
  font-style: italic;
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 4px;
  text-transform: none;
  letter-spacing: 0;
  font-variation-settings: "opsz" 30;
}
.worked-day .meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  margin: 0 0 12px;
  letter-spacing: 0.04em;
}
.worked-day p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  margin: 6px 0;
  max-width: none;
}
.worked-day .ledger {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper-tint);
  border-left: 2px solid var(--accent);
  padding: 12px 16px;
  margin: 12px 0;
  white-space: pre;
  color: var(--ink);
  line-height: 1.7;
  overflow-x: auto;
}
.worked-day .invariant {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--moss);
  margin-top: 8px;
}
.worked-day.alt h4 { color: var(--ember); }
.worked-day.alt .ledger { border-left-color: var(--ember); }

/* ---------- Tree-cycle visual (one leaf's exit chain) ---------- */
.tree-cycle {
  margin: 18px 0;
  background: var(--paper);
  border: 1px solid var(--hair);
  padding: 22px;
}
.tree-cycle svg { width: 100%; height: auto; }

/* ---------- Transfer traversal linked to Spark tree ---------- */
.transfer-run {
  border: 1px solid var(--hair);
  background: var(--paper);
}
.transfer-story {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  padding: 20px 22px;
  border-bottom: 1px solid var(--hair);
}
.transfer-story h4,
.transfer-panel h4 {
  color: var(--accent);
  margin-bottom: 6px;
}
.transfer-story p {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
  max-width: 620px;
}
.transfer-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mini-btn {
  border: 1px solid var(--hair-strong);
  background: var(--paper-tint);
  color: var(--ink);
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 10px;
  cursor: pointer;
}
.mini-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.transfer-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--hair);
}
.transfer-step {
  border: 0;
  border-right: 1px solid var(--hair-soft);
  background: transparent;
  min-height: 74px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  color: var(--ink-2);
  font-family: var(--body);
}
.transfer-step:last-child { border-right: 0; }
.transfer-step .num {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.transfer-step .label {
  display: block;
  font-family: var(--display);
  font-size: 15px;
  font-style: italic;
  color: var(--ink);
}
.transfer-step.active {
  background: var(--accent-bg);
  color: var(--ink);
}
.transfer-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
}
.transfer-panel {
  min-height: 220px;
  padding: 20px 22px;
  border-left: 1px solid var(--hair-soft);
}
.transfer-panel:first-child { border-left: 0; }
.transfer-line {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dotted var(--hair-soft);
  font-size: 13px;
  color: var(--ink-2);
}
.transfer-line .k {
  font-family: var(--mono);
  color: var(--ink-3);
}
.transfer-line .v {
  color: var(--ink);
}
.transfer-note {
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  margin: 8px 0 14px;
}
.transfer-bad {
  color: var(--ember);
}
.transfer-good {
  color: var(--moss);
}
@media (max-width: 880px) {
  .transfer-story,
  .transfer-grid {
    grid-template-columns: 1fr;
  }
  .transfer-presets {
    justify-content: flex-start;
  }
  .transfer-steps {
    grid-template-columns: 1fr;
  }
  .transfer-step {
    border-right: 0;
    border-bottom: 1px solid var(--hair-soft);
    min-height: 0;
  }
  .transfer-step:last-child { border-bottom: 0; }
  .transfer-panel {
    border-left: 0;
    border-top: 1px solid var(--hair-soft);
    min-height: 0;
  }
  .transfer-panel:first-child { border-top: 0; }
}

/* Lineage figure caption / legend */
.lineage-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hair-soft);
  font-family: var(--body);
  font-size: 11.5px;
  color: var(--ink-3);
}
.lineage-legend .item { display: inline-flex; align-items: center; gap: 6px; }
.lineage-legend .swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  border: 1px solid;
}
.lineage-legend .swatch.improved { background: var(--moss-bg); border-color: var(--moss); }
.lineage-legend .swatch.regressed { background: var(--ember-bg); border-color: var(--ember); }
.lineage-legend .swatch.added { background: var(--accent-bg); border-color: var(--accent); }
.lineage-legend .swatch.dropped { background: var(--ember-bg); border-color: var(--ember); }
.lineage-legend .swatch.changed { background: var(--paper-tint); border-color: var(--hair-strong); }
.lineage-legend .swatch.inherited { background: transparent; border-color: var(--hair); }

/* ============================================================
   Crowded tree · four-user scenario stepper · Figure 7c
   ============================================================ */
.crowded {
  border: 1px solid var(--hair-soft);
  background: var(--paper-tint);
  padding: 20px;
}
.crowded-steps {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border: 1px solid var(--hair-soft);
  background: var(--paper);
}
.crowded-step {
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--hair-soft);
  padding: 12px 10px 14px;
  text-align: left;
  cursor: pointer;
  font-family: var(--body);
  color: var(--ink-2);
  display: grid;
  gap: 4px;
  min-height: 64px;
  transition: background 120ms ease;
}
.crowded-step:last-child { border-right: 0; }
.crowded-step:hover { background: var(--paper-tint); }
.crowded-step.active {
  background: var(--accent-bg);
  color: var(--ink);
}
.crowded-step .day {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.crowded-step.active .day { color: var(--accent); }
.crowded-step .what {
  font-size: 12.5px;
  line-height: 1.3;
  font-weight: 500;
}

.crowded-narrative {
  margin: 18px 0 18px;
  padding: 16px 20px;
  background: var(--paper);
  border-left: 3px solid var(--accent);
  font-family: var(--display);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  font-style: italic;
}
.crowded-narrative b {
  font-style: normal;
  color: var(--accent);
  font-weight: 600;
}
.crowded-narrative code,
.crowded-inspector .insp-note code {
  font-family: var(--mono);
  font-style: normal;
  font-size: 12px;
  background: var(--paper-tint);
  padding: 1px 5px;
  border: 1px solid var(--hair-soft);
  color: var(--ink);
}
.crowded-inspector .insp-note em {
  font-style: italic;
  color: var(--ink);
}
.crowded-inspector .insp-note b {
  color: var(--accent);
  font-weight: 600;
}
.crowded-narrative .block-tag {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.crowded-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
}
.crowded-tree {
  background: var(--paper);
  border: 1px solid var(--hair-soft);
  padding: 14px;
}
.crowded-tree svg { display: block; width: 100%; height: auto; }
.crowded-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hair-soft);
  font-family: var(--body);
  font-size: 11.5px;
  color: var(--ink-3);
}
.crowded-legend .item { display: inline-flex; align-items: center; gap: 6px; }
.crowded-legend .dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid;
}
.crowded-legend .dot.user-A { background: var(--accent-bg); border-color: var(--accent); }
.crowded-legend .dot.user-B { background: var(--moss-bg);   border-color: var(--moss); }
.crowded-legend .dot.user-C { background: var(--ember-bg);  border-color: var(--ember); }
.crowded-legend .dot.user-D { background: #d6dce6;          border-color: #2c3c5a; }
.crowded-legend .dot.user-S { background: var(--paper-tint); border-color: var(--ink-3); }

/* Slate tone for Dave — fourth user, not in the default palette */
.svg-node-slate { fill: #d6dce6; stroke: #2c3c5a; stroke-width: 1.4; }
.svg-arrow-slate { stroke: #2c3c5a; stroke-width: 1.5; fill: none; }
.svg-text-slate { font-family: var(--body); font-size: 12px; fill: #2c3c5a; font-weight: 600; }

/* Per-owner fills used in JS (avoids inline style for stroke/fill switching) */
.crowded-tree .node-A { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 1.4; }
.crowded-tree .node-B { fill: var(--moss-bg);   stroke: var(--moss);   stroke-width: 1.4; }
.crowded-tree .node-C { fill: var(--ember-bg);  stroke: var(--ember);  stroke-width: 1.4; }
.crowded-tree .node-D { fill: #d6dce6;          stroke: #2c3c5a;       stroke-width: 1.4; }
.crowded-tree .node-S { fill: var(--paper-tint); stroke: var(--ink-3);  stroke-width: 1.2; stroke-dasharray: 4 2; }
.crowded-tree .node-spent { fill: var(--paper); stroke: var(--hair-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.crowded-tree .node-broadcast { fill: var(--moss-bg); stroke: var(--moss); stroke-width: 1.8; }
.crowded-tree .node-waiting { fill: var(--paper-tint); stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 4 3; }
.crowded-tree .node-clickable {
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
}
.crowded-tree .node-clickable:hover { filter: brightness(0.96); }
.crowded-tree .node-clickable:focus { outline: none; }
.crowded-tree .node-selected {
  stroke-width: 2.6;
  filter: drop-shadow(0 0 0 var(--ink));
}
.crowded-tree .badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  fill: var(--ink);
}
.crowded-tree .arrow-active {
  stroke: var(--ink);
  stroke-width: 1.6;
  fill: none;
}
.crowded-tree .arrow-broadcast {
  stroke: var(--moss);
  stroke-width: 2;
  fill: none;
}
.crowded-tree .arrow-spent {
  stroke: var(--hair-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  fill: none;
}
.crowded-tree .lock-tag {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--accent);
}

.crowded-inspector {
  background: var(--paper);
  border: 1px solid var(--hair-soft);
  padding: 18px 18px 20px;
  min-height: 360px;
  font-family: var(--body);
}
.crowded-inspector h4 {
  font-family: var(--display);
  font-size: 18px;
  color: var(--ink);
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.crowded-inspector .kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.crowded-inspector .owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  border: 1px solid;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  margin: 0 0 12px;
}
.crowded-inspector .owner-chip.user-A { background: var(--accent-bg); border-color: var(--accent); color: #6a2c00; }
.crowded-inspector .owner-chip.user-B { background: var(--moss-bg);   border-color: var(--moss);   color: var(--moss); }
.crowded-inspector .owner-chip.user-C { background: var(--ember-bg);  border-color: var(--ember);  color: var(--ember); }
.crowded-inspector .owner-chip.user-D { background: #d6dce6;          border-color: #2c3c5a;       color: #1c2640; }
.crowded-inspector .owner-chip.user-S { background: var(--paper-tint); border-color: var(--ink-3);  color: var(--ink-2); }
.crowded-inspector .owner-chip.none   { background: var(--paper-tint); border-color: var(--hair-strong); color: var(--ink-3); }

.crowded-inspector .field-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--hair-soft);
  font-size: 13px;
  align-items: baseline;
}
.crowded-inspector .field-row:last-child { border-bottom: 0; }
.crowded-inspector .field-row .k {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.crowded-inspector .field-row .v {
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.45;
}
.crowded-inspector .field-row .v code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--paper-tint);
  padding: 1px 5px;
  border: 1px solid var(--hair-soft);
}
.crowded-inspector .field-row .v.warn { color: var(--ember); }
.crowded-inspector .field-row .v.good { color: var(--moss); }

.crowded-inspector .insp-note {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--paper-tint);
  border-left: 2px solid var(--accent);
  font-family: var(--display);
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.crowded-inspector .history {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hair-soft);
}
.crowded-inspector .history h5 {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 0 0 8px;
}
.crowded-inspector .history ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.crowded-inspector .history li { margin: 3px 0; }
.crowded-inspector .history li b { color: var(--ink); font-weight: 600; }

.inspector-empty {
  color: var(--ink-3);
}
.inspector-empty h4 {
  font-family: var(--display);
  font-size: 17px;
  color: var(--ink-2);
  margin: 0 0 6px;
  font-weight: 500;
}
.inspector-empty p {
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0;
}

@media (max-width: 920px) {
  .crowded-steps { grid-template-columns: repeat(2, 1fr); }
  .crowded-step { border-right: 0; border-bottom: 1px solid var(--hair-soft); }
  .crowded-grid { grid-template-columns: 1fr; }
  .crowded-inspector { min-height: 0; }
}

/* =========================================================
   Interactive · four-user Ark sandbox (capstone of §IV)
   ========================================================= */
.ark-sim {
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: var(--paper);
  overflow: hidden;
  font-family: var(--body);
}
.ark-sim .ark-sub {
  font-family: var(--body);
  font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin: 14px 0 7px;
}
.ark-sim .ark-sub:first-child { margin-top: 0; }

/* tour bar */
.ark-tour {
  background: var(--paper-tint);
  border-bottom: 1px solid var(--hair);
  padding: 14px 16px;
}
.ark-tour-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ark-tour-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }
.ark-status { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.ark-tour-body { font-size: 14.5px; line-height: 1.55; color: var(--ink); min-height: 46px; }
.ark-tour-body b { color: var(--ink); font-weight: 600; }
.ark-term { color: var(--accent); font-weight: 600; border-bottom: 1px dotted var(--accent-2); cursor: help; }
.ark-tour-nav { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ark-tour-count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

/* buttons */
.ark-btn {
  font-family: var(--body); font-size: 12.5px; line-height: 1.2;
  border: 1px solid var(--hair-strong); background: var(--paper);
  color: var(--ink); padding: 6px 11px; border-radius: 4px; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.ark-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ark-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ark-btn.primary { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ark-btn.primary:hover:not(:disabled) { background: var(--accent); color: var(--paper); }
.ark-btn.ghost { background: transparent; border-style: dashed; color: var(--ink-2); }
.ark-btn.xs { font-size: 11px; padding: 4px 8px; }

/* grid: controls | stage */
.ark-grid { display: grid; grid-template-columns: 252px 1fr; }
.ark-controls { padding: 16px; border-right: 1px solid var(--hair); background: var(--paper); }
.ark-op { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.ark-op .ark-btn:nth-child(3), .ark-op .ark-btn:nth-child(4) { grid-column: auto; }

/* user cards */
.ark-users { display: flex; flex-direction: column; gap: 8px; }
.ark-user {
  position: relative; border: 1px solid var(--hair-soft); border-radius: 5px;
  padding: 8px 9px 8px 12px; background: var(--paper);
}
.ark-user::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--uc); border-radius: 5px 0 0 5px; }
.ark-uhead { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.ark-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.ark-uname { font-weight: 600; font-size: 13.5px; }
.ark-bal { margin-left: auto; text-align: right; font-family: var(--mono); font-size: 10.5px; line-height: 1.4; }
.ark-lbl { color: var(--ink-3); font-size: 9.5px; }
.ark-chain { color: var(--accent); }
.ark-inark { color: var(--moss); }
.ark-exn { color: var(--ember); }
.ark-uacts { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ark-sel {
  font-family: var(--body); font-size: 11px; background: var(--paper);
  border: 1px solid var(--hair-strong); border-radius: 4px; padding: 4px 5px; cursor: pointer; color: var(--ink);
}

/* asp meter */
.ark-meter { height: 9px; border-radius: 5px; background: var(--paper-deep); overflow: hidden; border: 1px solid var(--hair); margin-bottom: 7px; }
.ark-meter-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s; }
.ark-arow { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--ink-2); margin: 2px 0; }
.ark-arow b { color: var(--ink); }
.ark-arow b.ark-amber { color: var(--accent); }
.ark-arow b.ark-moss { color: var(--moss); }
.ark-note { font-size: 11px; color: var(--ink-3); margin-top: 7px; line-height: 1.4; }

/* toggles */
.ark-toggles { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 11.5px; color: var(--ink-2); }
.ark-toggles label { display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.ark-toggles input { accent-color: var(--accent); }

/* stage */
.ark-stage { padding: 16px; min-width: 0; }
.ark-lane { margin-bottom: 16px; }
.ark-lhead {
  display: flex; align-items: center; gap: 9px; margin-bottom: 8px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
.ark-pill {
  font-family: var(--mono); text-transform: none; letter-spacing: 0; font-size: 10px;
  color: var(--ink-2); background: var(--paper-tint); border: 1px solid var(--hair-soft); border-radius: 20px; padding: 1px 9px;
}
.ark-chainstrip { display: flex; gap: 6px; flex-wrap: wrap; align-items: stretch; }
.ark-block { min-width: 80px; border: 1px solid var(--hair-soft); border-radius: 4px; background: var(--paper); padding: 5px 7px; font-family: var(--mono); }
.ark-bh { font-size: 10px; font-weight: 700; color: var(--ink-3); }
.ark-bt { font-size: 9.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.3; }
.ark-block.round { border-color: var(--accent); background: var(--accent-bg); }
.ark-block.round .ark-bh { color: var(--accent); }
.ark-block.exit { border-color: var(--ember); background: var(--ember-bg); }
.ark-block.exit .ark-bh { color: var(--ember); }
.ark-block.board .ark-bh { color: var(--accent-2); }
.ark-treebox { border: 1px solid var(--hair-soft); border-radius: 5px; background: var(--paper-tint); padding: 8px; margin-bottom: 8px; }
.ark-treebox svg { display: block; }
/* pin SVG label font cross-browser (presentation-attribute var() is unreliable in Safari) */
.ark-sim svg text { font-family: var(--mono); }

/* side-by-side: ownership view | transaction graph */
.ark-views { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 14px; align-items: start; margin-bottom: 16px; }
.ark-view { border: 1px solid var(--hair-soft); border-radius: 5px; background: var(--paper); padding: 10px; min-width: 0; }
.ark-vhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; color: var(--ink-2); }
.ark-vhead .ark-pill { margin-left: auto; }
.ark-view .ark-treebox { background: var(--paper-tint); }
.ark-subhead { font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 10px 0 6px; }
.ark-txwrap { overflow-x: auto; overflow-y: hidden; }
/* keep the graph at natural width and scroll it — overrides the global `svg{max-width:100%}` that would shrink it to illegibility */
.ark-txwrap svg { display: block; max-width: none; }
.ark-txhint { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }
.ark-empty { color: var(--ink-3); font-size: 12.5px; padding: 16px; text-align: center; border: 1px dashed var(--hair); border-radius: 5px; }
.ark-cxnote { font-size: 12px; line-height: 1.5; color: var(--ink-2); margin-top: 8px; }
.ark-cxnote b { color: var(--ink); font-weight: 600; }
.ark-cheatrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ark-btn.cheat { background: var(--ember-bg); border-color: var(--ember); color: var(--ember); font-weight: 600; }
.ark-btn.cheat:hover:not(:disabled) { background: var(--ember); color: var(--paper); }
.ark-cheathint { font-size: 11.5px; color: var(--ink-3); }
.ark-cheatdone { font-size: 12px; line-height: 1.45; color: var(--ember); }

/* mechanism inset */
.ark-mech { border: 1px solid var(--hair); border-left: 3px solid var(--accent); border-radius: 5px; background: var(--accent-bg); padding: 11px 13px; margin-top: 4px; }
.ark-mech.warn { border-left-color: var(--ember); background: var(--ember-bg); }
.ark-mtitle { font-weight: 600; font-size: 12.5px; color: var(--accent); margin-bottom: 5px; }
.ark-mech.warn .ark-mtitle { color: var(--ember); }
.ark-mtxt { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.ark-mtxt b { color: var(--ink); font-weight: 600; }

/* legend */
.ark-legend { display: flex; flex-wrap: wrap; gap: 7px 14px; font-size: 11px; color: var(--ink-2); margin-top: 12px; }
.ark-li { display: flex; align-items: center; gap: 5px; }
.ark-sw { width: 11px; height: 11px; border-radius: 3px; border: 1.4px solid var(--hair); flex: 0 0 auto; }
.ark-li b.ark-moss { color: var(--moss); }
.ark-li b.ark-amber { color: var(--accent); }

/* log */
.ark-logwrap { border-top: 1px solid var(--hair); padding: 12px 16px; background: var(--paper); }
.ark-log { max-height: 150px; overflow-y: auto; }
.ark-loge { font-family: var(--mono); font-size: 11px; padding: 4px 0; border-bottom: 1px solid var(--hair-soft); color: var(--ink-2); display: flex; gap: 8px; }
.ark-loge:last-child { border-bottom: 0; }
.ark-loge.you { color: var(--ink); }
.ark-logh { color: var(--accent); flex: 0 0 auto; }

/* tooltip */
.ark-sim-tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .1s;
  max-width: 270px; background: var(--ink); color: var(--paper);
  font-family: var(--body); font-size: 12px; line-height: 1.4;
  padding: 8px 10px; border-radius: 5px; border: 1px solid var(--accent);
  box-shadow: 0 6px 22px rgba(26,22,18,0.28);
}

@media (max-width: 980px) {
  .ark-views { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .ark-grid { grid-template-columns: 1fr; }
  .ark-controls { border-right: 0; border-bottom: 1px solid var(--hair); }
  .ark-op { grid-template-columns: 1fr 1fr; }
}
