/* Starfleet Insurance — a fictional claims-routing demo.
   Paper/riso print: cream stock, ink navy, one signal red, hard zero-blur offset shadows.
   Legibility still wins every time there's a conflict — this is read from two metres away in a
   bright hall by someone who is also holding a coffee.

   Structure: tokens · type voices · nav · cover · chapter chrome · 01 problem · 02 demo ·
   03 built · 04 result · overlays · responsive. */

@font-face {
  font-family: 'Hull23';
  src: url(fonts/hull23.ttf) format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Base values. These ten are the ones .on-dark re-points, so they are kept here under a
     second, never-overridden name as well — that is what lets a cream card sitting inside a
     dark band restore the light palette (.light-island) without duplicating any hex. */
  --base-paper:   #f3e9d2;
  --base-paper-3: #f7f0de;
  --base-panel:   #fff9ea;
  --base-ink:     #101426;
  --base-body:    #2a2a38;
  --base-body-2:  #4a4a5a;
  --base-muted:   #6b5d44;
  --base-rule:    #d9cba6;
  --base-red:     #d63a24;

  /* ground + ink */
  --paper:   var(--base-paper);
  --paper-2: #efe4c8;
  --paper-3: var(--base-paper-3);
  --panel:   var(--base-panel);
  --ink:     var(--base-ink);
  --body:    var(--base-body);
  --body-2:  var(--base-body-2);
  --muted:   var(--base-muted);
  --rule:    var(--base-rule);
  --bone:    #e9dfc4;
  --console: #0b0f1f;

  /* signals */
  --red:        var(--base-red);
  --red-bright: #e8401c;
  --red-wash:   #fbeee6;
  --on-red:     #f7ead0;
  --green:      #2f8f5b;
  --green-wash: #eaf5ee;
  --green-neon: #3bd66b;
  --blue:       #3a6ea8;
  --orange:     #ff8c3c;
  --violet:     #b07ad6;
  --violet-hi:  #d9b8f0;
  --gold:       #d9a73a;
  /* Text versions of the theme colours. The theme red, blue and green are for borders and fills;
     as small text on cream they measure 3.4-4.4:1, under AA. These pass 4.5:1 on every cream
     surface; .on-dark swaps them for the light versions. Checked by the contrast check. */
  --red-text:   #b02a17;
  --blue-text:  #2d5a8e;
  --green-text: #1d6a41;

  /* on dark */
  --cream-hi: #f4ead0;
  --dim:      #b9b3ac;
  --dim-2:    #8a92a8;
  --link-dark:#9fd0ff;
  --edge-dark:#4d8fd1;

  /* hard offset shadows — zero blur, always. Nothing here is ever soft. */
  --sh-sm: 4px 4px 0;
  --sh-md: 6px 6px 0;
  --sh-lg: 8px 8px 0 rgba(0, 0, 0, .45);

  --lbl-f:      'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --sans:       'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --wordmark-f: 'Hull23', 'Big Shoulders Display', sans-serif;
  --mono:       ui-monospace, Menlo, Consolas, monospace;

  --gutter: 48px;
  --maxw: 1280px;
  --pill-h: 34px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

body { display: flex; flex-direction: column; }

a { color: inherit; text-decoration: none; }
p { margin: 0; }
h2, h3 { margin: 0; font-weight: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ---------- the three typographic voices ----------
   .wordmark  brand and numerals only
   .lbl       headings and buttons
   .tele      eyebrows, file paths, status, metrics, machine output — the instrumented voice */

.wordmark {
  font-family: var(--wordmark-f);
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.lbl {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tele {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- accent triples ----------
   Border colour, wash background and hard shadow always agree. One attribute, not three
   declarations, so a card can never end up red-bordered on a green wash. */

[data-accent] {
  border: 2px solid var(--a-line);
  background: var(--a-wash);
  box-shadow: var(--sh-md) var(--a-line);
}
[data-accent="ink"]   { --a-line: var(--ink);   --a-wash: var(--paper-3); }
[data-accent="red"]   { --a-line: var(--red);   --a-wash: var(--red-wash); }
[data-accent="green"] { --a-line: var(--green); --a-wash: var(--green-wash); }
[data-accent="plain"] { --a-line: var(--ink);   --a-wash: var(--panel); }

/* ---------- dark bands ----------
   Re-point the same variables rather than writing a parallel stylesheet, so every component
   inside a dark section works unchanged. Red becomes orange: red does not read on ink. */

.on-dark {
  --paper: #101426;
  --paper-3: var(--console);
  --panel: var(--console);
  --ink: #f3e9d2;
  --body: var(--cream-hi);
  --body-2: var(--dim-2);
  --muted: var(--dim);
  --red: var(--orange);
  --red-text: var(--orange);
  --blue-text: var(--link-dark);
  --green-text: var(--green-neon);
  --rule: rgba(243, 233, 210, .2);
  --a-line: rgba(243, 233, 210, .35);
  background: #101426;
  color: #f3e9d2;
}

/* A cream object sitting inside a dark band — the claim dossiers are printed cards lying on an
   ink desk, not dark UI. Without this they inherit .on-dark's inversion and render cream text on
   cream stock, which is invisible. Restores from the base tokens, so it cannot drift from :root. */
.light-island {
  --paper: var(--base-paper);
  --paper-3: var(--base-paper-3);
  --panel: var(--base-panel);
  --ink: var(--base-ink);
  --body: var(--base-body);
  --body-2: var(--base-body-2);
  --muted: var(--base-muted);
  --rule: var(--base-rule);
  --red: var(--base-red);
  --red-text: #b02a17;
  --blue-text: #2d5a8e;
  --green-text: #1d6a41;
  --a-line: var(--base-ink);
  color: var(--ink);
}

/* ---------- print grain ----------
   One rule, applied by class. The page-level sepia screen that makes cream read as stock. */

.grain::before,
.cover-grain {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image: radial-gradient(rgba(120, 90, 40, .45) .6px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}

/* The signature divider. A double red rule separates every major band. */
.double-rule { border-bottom: 3px double var(--red); }

/* ============================ NAV ============================ */

/* [hidden] needs stating explicitly: the UA rule that implements it loses to any author
   display declaration, so display:flex alone would keep the bar on the cover. */
.nav[hidden] { display: none; }

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px var(--gutter);
  border-bottom: 3px double var(--red);
  background: var(--paper-2);
  position: relative;
  flex: 0 0 auto;
  z-index: 20;
}

.nav-mark {
  font-size: 20px;
  color: var(--red-text);
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 1.1;
}

.tabs {
  display: flex;
  gap: 26px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.tab {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 14.5px;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0 0 4px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.tab:hover { color: var(--red-text); }
.tab.on { color: var(--red-text); border-bottom-color: var(--red); }
.tab-n { display: none; }          /* the numeral lives in the chapter rail, not the nav */
.tab-s { display: none; }

.nav-right { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }

.nav-link {
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}
.nav-link:hover { color: var(--red-text); border-bottom-color: var(--red); }

.mode-pill {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 12.5px;
  padding: 4px 10px;
  border: 2px solid currentColor;
  white-space: nowrap;
}
/* Pill text sits on the cream nav, so each colour is a darker cousin of its theme colour: the
   theme greens, golds and greys are under 4.5:1 on cream (gold was 1.74:1). */
.mode-live    { color: #1d6a41; }
.mode-loading { color: #2d5a8e; }
.mode-warming { color: #7a5200; }
.mode-error   { color: #b02a17; }
/* Standby is deliberately dim: the proxy answered, but nothing has called the model, so this is
   the absence of a claim rather than a weaker one. */
.mode-standby { color: #4f566a; }
/* Offline is gold rather than green. It is a working state, but it is not a live one, and the
   colour should not let it be mistaken for one at a glance across a booth. */
.mode-offline { color: #7a5200; }
.mode-fallback { color: #7a5200; }

/* ============================ COVER ============================ */

/* The cover sits at the top of the page, as it does in the handoff — not centred in the viewport. */
.landing-view { flex: 1 1 auto; display: flex; align-items: flex-start; justify-content: center; }
.landing-view[hidden] { display: none; }

/* The cover is a fixed-aspect painting, so it scales proportionally rather than reflowing —
   and cover.js maps pointer coordinates with k = 1280 / rect.width, which is only correct while
   that aspect ratio holds. Everything inside is sized in design pixels via --px. */
.cover-stage {
  container-type: inline-size;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(0px, 2vw, 24px);
}

.hero {
  --px: 0.078125cqw;          /* 1 design pixel of the 1280-wide comp */
  position: relative;
  width: 100%;
  aspect-ratio: 1280 / 850;
  overflow: hidden;
  background: var(--paper-2);
  font-family: var(--sans);
}

.sky {
  position: absolute;
  inset: calc(22 * var(--px));
  overflow: hidden;
  background: linear-gradient(180deg, #0d0f2b 0%, #15224d 38%, #1d3f6e 62%, #2a6a8f 78%, #3c8fa6 100%);
}

.stars {
  position: absolute;
  inset: 0;
  opacity: .9;
  background-image:
    radial-gradient(#5fc2ff 2.2px, transparent 3px),
    radial-gradient(#8fd6ff 1.6px, transparent 2.4px),
    radial-gradient(#f4ead0 1.4px, transparent 2.2px);
  background-size: 170px 150px, 110px 130px, 230px 190px;
  background-position: 10px 10px, 60px 80px, 120px 40px;
}

.planet {
  position: absolute;
  top: calc(-60 * var(--px));
  right: calc(70 * var(--px));
  width: calc(230 * var(--px));
  height: calc(230 * var(--px));
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #e9a15a 0%, #c9603a 48%, #5a2a2e 100%);
  box-shadow: inset calc(-18 * var(--px)) calc(-14 * var(--px)) 0 rgba(20, 10, 30, .45),
              0 0 0 calc(4 * var(--px)) var(--ink);
}

.planet-ring {
  position: absolute;
  top: calc(44 * var(--px));
  right: calc(8 * var(--px));
  width: calc(330 * var(--px));
  height: calc(84 * var(--px));
  border: calc(5 * var(--px)) solid var(--cream-hi);
  border-radius: 50%;
  transform: rotate(-14deg);
  box-shadow: 0 0 0 calc(3 * var(--px)) var(--ink), inset 0 0 0 calc(3 * var(--px)) var(--ink);
}

.moon {
  position: absolute;
  top: calc(80 * var(--px));
  left: calc(120 * var(--px));
  width: calc(64 * var(--px));
  height: calc(64 * var(--px));
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9fd6ff 0%, #3d7fc4 60%, #1d3f6e 100%);
  box-shadow: inset calc(-8 * var(--px)) calc(-6 * var(--px)) 0 rgba(10, 20, 50, .5),
              0 0 0 calc(3 * var(--px)) var(--ink);
}

#field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.halftone {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  mix-blend-mode: multiply;
  background-image: radial-gradient(rgba(0, 0, 0, .9) 1px, transparent 1.3px);
  background-size: 4px 4px;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, transparent 55%, rgba(10, 8, 30, .45) 100%);
}

.cover-rule {
  position: absolute;
  inset: calc(22 * var(--px));
  pointer-events: none;
  border: 3px double var(--red);
}

.cover-mat {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 calc(22 * var(--px)) var(--paper-2),
              inset 0 0 0 calc(23 * var(--px)) var(--rule);
}

.cover-grain { opacity: .35; }

/* The handoff hangs this off the corner at top:-6/left:-8, where #hero's overflow:hidden slices
   a flat edge through it. With no nav bar above, that cut lands on the page edge and reads as a
   rendering fault rather than a sticker. Inset far enough that the circle and its 3px ring clear
   the clip entirely. */
.cover-badge {
  position: absolute;
  top: calc(8 * var(--px));
  left: calc(8 * var(--px));
  width: calc(120 * var(--px));
  height: calc(120 * var(--px));
  border-radius: 50%;
  background: var(--red-text);   /* cream on the theme red was 3.92:1 */
  border: calc(4 * var(--px)) solid var(--paper-2);
  box-shadow: 0 0 0 calc(3 * var(--px)) var(--red), calc(4 * var(--px)) calc(6 * var(--px)) 0 rgba(20, 10, 10, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transform: rotate(-12deg);
  z-index: 3;
}
.cover-badge .lbl { color: var(--on-red); font-size: calc(15 * var(--px)); line-height: 1.1; }
.cover-badge span { font-size: calc(11 * var(--px)); letter-spacing: .12em; }

.cover-title {
  position: absolute;
  top: calc(44 * var(--px));
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}
.cover-eyebrow {
  font-size: calc(13 * var(--px));
  color: var(--cream-hi);
  letter-spacing: .2em;
  margin-bottom: calc(8 * var(--px));
  text-shadow: 0 1px 0 var(--ink);
}
.cover-wordmark {
  font-size: calc(72 * var(--px));
  line-height: .95;
  color: var(--red-bright);
  text-shadow: calc(3 * var(--px)) calc(3 * var(--px)) 0 var(--ink);
  -webkit-text-stroke: 1px var(--cream-hi);
}
.cover-tagline {
  font-size: calc(16 * var(--px));
  color: var(--cream-hi);
  margin-top: calc(8 * var(--px));
  text-shadow: 1px 1px 0 var(--ink);
}

/* The blurb card, at the handoff's own measurements. Its top edge sits a little above
   cover.js keepOuts[1], exactly as it does in the handoff — ships may drift across the upper
   strip, which is the supplied behaviour and not a regression. */
.cover-card {
  position: absolute;
  left: 50%;
  bottom: calc(52 * var(--px));
  transform: translateX(-50%);
  width: calc(820 * var(--px));
  padding: calc(24 * var(--px)) calc(40 * var(--px)) calc(26 * var(--px));
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 calc(4 * var(--px)) var(--paper),
              0 0 0 calc(6 * var(--px)) var(--red),
              calc(8 * var(--px)) calc(10 * var(--px)) 0 rgba(16, 20, 38, .55);
  z-index: 3;
}
.cover-card-eyebrow {
  font-size: calc(13 * var(--px));
  color: var(--red-text);
  margin-bottom: calc(10 * var(--px));
}
.cover-card-copy {
  font-size: calc(19 * var(--px));
  color: var(--ink);
  line-height: 1.35;
  max-width: calc(660 * var(--px));
  margin: 0 auto;
}

/* The one addition to the handoff's card. Column, not row: the validation message is a sibling
   of the input and would otherwise sit beside it and shove the field off-centre. The card is
   anchored by its bottom edge, so the message grows the card upward rather than pushing the
   buttons down. */
.cover-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: calc(18 * var(--px));
}
.cover-input {
  width: calc(400 * var(--px));
  font-family: var(--sans);
  font-size: calc(15 * var(--px));
  line-height: 1.3;
  text-align: center;
  padding: calc(10 * var(--px)) calc(14 * var(--px));
  background: var(--panel);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: calc(4 * var(--px)) calc(4 * var(--px)) 0 var(--ink);
  outline: 0;
}
.cover-input::placeholder { color: var(--muted); }
.cover-input:focus { border-color: var(--red); box-shadow: calc(4 * var(--px)) calc(4 * var(--px)) 0 var(--red); }

.cover-cta {
  display: flex;
  gap: calc(14 * var(--px));
  justify-content: center;
  margin-top: calc(16 * var(--px));
  flex-wrap: wrap;
}
.cover-btn {
  font-size: calc(15 * var(--px));
  padding: calc(13 * var(--px)) calc(26 * var(--px));
  border: 3px solid var(--ink);
  box-shadow: calc(4 * var(--px)) calc(4 * var(--px)) 0 var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.cover-btn-primary { background: var(--red-text); color: var(--on-red); padding-left: calc(28 * var(--px)); padding-right: calc(28 * var(--px)); }
.cover-btn:active { transform: translate(2px, 2px); box-shadow: calc(2 * var(--px)) calc(2 * var(--px)) 0 var(--ink); }
.cover-btn[disabled] { opacity: .6; cursor: default; }

.cover-chapters {
  display: flex;
  justify-content: center;
  align-items: center;
  /* Reserved so the card does not change height when app.js fills this row — without it the
     hint below jumps down a line on every load. */
  min-height: calc(21 * var(--px));
  gap: calc(22 * var(--px));
  margin-top: calc(16 * var(--px));
  padding-top: calc(12 * var(--px));
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.cover-chapter {
  font-size: calc(13.5 * var(--px));
  line-height: calc(21 * var(--px));
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.cover-chapter:hover { color: var(--red-text); }

.cover-hint {
  font-size: calc(12 * var(--px));
  color: var(--muted);
  letter-spacing: .14em;
  margin-top: calc(14 * var(--px));
}

.cover-saved {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: calc(8 * var(--px));
  margin-top: calc(10 * var(--px));
}
.cover-saved[hidden] { display: none; }
.cover-saved .tele { font-size: calc(11.5 * var(--px)); color: var(--muted); }
.cover-saved-email { font-size: calc(13 * var(--px)); color: var(--blue); }
.cover-link {
  font-size: calc(13 * var(--px));
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 2px solid var(--rule);
  padding: 0 0 1px;
  cursor: pointer;
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.cover-link:hover { color: var(--red-text); border-bottom-color: var(--red); }

/* Sits inside the card, under the input. */
.landing-error {
  margin-top: calc(8 * var(--px));
  font-family: var(--sans);
  font-weight: 700;
  font-size: calc(13.5 * var(--px));
  color: var(--red-text);        /* the theme red was 3.87:1 on the cream card */
}
.landing-error[hidden] { display: none; }

/* ============================ CHAPTER CHROME ============================ */

.demo-view { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.demo-view[hidden] { display: none; }

.tabpanel {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 56px var(--gutter) 48px;
  background: var(--paper);
  max-width: none;
}
.tabpanel[hidden] { display: none; }

/* Every chapter scrolls — the trading cards made the demo chapter taller than any booth screen,
   so the old page-level overflow:hidden would have clipped the console outright. What survives
   of the booth shell is the part that mattered: the document and reasoning panels scroll
   INTERNALLY (capped below), so the verdict never leaves the screen while a packet is being
   read, and show() walks the console into view when a card is pressed. */
#panel-problem, #panel-built, #panel-result { overflow-y: auto; }
/* :not([hidden]) is load-bearing — an ID selector outranks .tabpanel[hidden], so without it
   this display:flex wins over display:none and the demo chapter can never be hidden again
   once it has been shown. */
#panel-demo:not([hidden]) { display: flex; flex-direction: column; overflow-y: auto; }

.tabpanel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image: radial-gradient(rgba(120, 90, 40, .45) .6px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
  z-index: 0;
}
.tabpanel.on-dark::before { opacity: .22; background-image: radial-gradient(rgba(0, 0, 0, .9) 1px, transparent 1.3px); background-size: 4px 4px; }
.tabpanel > * { position: relative; z-index: 1; }

/* Chapter header: a fixed numeral rail beside the headline. */
.chapter {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
}
.rail { flex: none; width: 120px; }
.rail-n { font-size: 64px; color: var(--red); line-height: 1; }
.rail-l { font-size: 13.5px; color: var(--muted); margin-top: 6px; }

.chapter-body { flex: 1; min-width: 0; }
.chapter-h { font-size: 44px; line-height: 1; color: var(--ink); margin-bottom: 16px; }
.lede-p { font-size: 18px; line-height: 1.5; max-width: 760px; color: var(--body); }
.chapter-note { font-size: 13.5px; color: var(--muted); margin-top: 14px; line-height: 1.5; }

.sub-h { font-size: 22px; color: var(--ink); margin-bottom: 6px; }
.bl-h {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 22px;
  color: var(--ink);
  margin: 36px 0 10px;
}

.note {
  font-size: 15px;
  line-height: 1.55;
  color: var(--body-2);
  max-width: 860px;
}
.note code { font-family: var(--mono); font-size: .92em; color: var(--blue); }
.note strong { color: var(--ink); }

.lede { max-width: var(--maxw); margin: 0 auto 8px; }
.lede h2 {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 44px;
  line-height: 1;
  margin-bottom: 12px;
}
.lede p { font-size: 17.5px; line-height: 1.5; max-width: 760px; color: var(--body); }

.tab-body { max-width: var(--maxw); margin: 0 auto; width: 100%; }

/* Chapter footer: ghost prev, colophon, filled next. */
.chapter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px var(--gutter) 14px;
  border-top: 3px double var(--red);
  background: var(--paper-2);
  flex: 0 0 auto;
}
.foot-btn {
  font-size: 15px;
  color: var(--ink);
  border: 3px solid var(--ink);
  padding: 11px 20px;
  box-shadow: var(--sh-sm) var(--ink);
  background: var(--paper);
  cursor: pointer;
  white-space: nowrap;
}
.foot-btn-primary { background: var(--red-text); color: var(--on-red); }
.foot-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.foot-btn[hidden] { visibility: hidden; display: inline-block; }
.foot-colophon { font-size: 12.5px; color: var(--muted); text-align: center; }

.foot-keys {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  padding: 0 var(--gutter) 16px;
  background: var(--paper-2);
  flex: 0 0 auto;
}
kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--rule);
  padding: 1px 5px;
  background: var(--panel);
  color: var(--ink);
}

/* ============================ 01 · THE PROBLEM ============================ */

.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 40px auto 0;
  max-width: var(--maxw);
}

.card { padding: 22px 26px; }
.card-h { font-size: 13.5px; margin-bottom: 12px; }
.card-h-blue { color: var(--blue); }
.card-h-red  { color: var(--red-text); }

.chev { display: flex; flex-direction: column; gap: 10px; font-size: 16px; line-height: 1.45; color: var(--body); }
.chev li { padding-left: 22px; position: relative; }
.chev li::before {
  content: "\203A";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--blue);
}
.chev-red li::before { color: var(--red); }
.chev strong { color: var(--ink); }

/* "What this is" — the orientation block the page was missing. Sits between the problem
   headline and the cards, so a cold reader learns what the thing is before the detail starts. */
.what-is {
  max-width: var(--maxw);
  margin: 36px auto 0;
  padding: 22px 26px;
}
.what-is-lede { font-size: 17px; line-height: 1.5; color: var(--body); max-width: 760px; }
.what-is-lede + .what-is-points { margin-top: 14px; }
.what-is-points { font-size: 15.5px; }

/* The four-chapter signpost. */
.signpost {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 16px;
  counter-reset: none;
}
.signpost li { border-top: 2px solid var(--ink); padding-top: 10px; }
.signpost .sp-n {
  font-family: var(--wordmark-f);
  font-weight: 400;
  letter-spacing: .06em;
  font-size: 24px;
  color: var(--red);
  line-height: 1;
}
.signpost .sp-t {
  display: block;
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 16px;
  color: var(--ink);
  margin-top: 4px;
  line-height: 1.1;
}
.signpost .sp-d { display: block; font-size: 14px; line-height: 1.45; color: var(--muted); margin-top: 5px; }

.ruled-block {
  max-width: var(--maxw);
  margin: 44px auto 0;
  border-top: 2px solid var(--ink);
  padding-top: 26px;
}

/* the mission-path diagram */
.diagram { width: 100%; height: auto; display: block; margin-top: 20px; }
.diagram .d-h { font-family: var(--lbl-f); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 21px; fill: var(--ink); }
.diagram .d-t { font-family: var(--lbl-f); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 16px; }
.diagram .d-s { font-size: 13px; fill: var(--muted); }
.diagram .d-a { font-family: var(--sans); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 11.5px; fill: var(--blue); }
.diagram .d-c { font-family: var(--sans); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }

.diagram-kv { margin-top: 22px; }

/* ============================ 02 · THE DEMO ============================ */

#panel-demo > * { flex: 0 0 auto; }
#panel-demo .chapter { margin-bottom: 18px; }

.authority {
  border: 2px solid var(--violet);
  background: rgba(176, 122, 214, .12);
  padding: 11px 18px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
  font-size: 15.5px;
  color: var(--ink);
}
.authority strong {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 14.5px;
  color: var(--violet-hi);
}

/* --- claim-beat trading cards --- */

.beats {
  display: grid;
  /* minmax(0, 1fr): a plain 1fr column cannot shrink below its longest word, so a long model value on a
     chip grew one card to ~2200px and pushed the third card off the panel on a tablet. */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 20px auto 0;
  max-width: var(--maxw);
  width: 100%;
}

/* The outer cream mat the dossier is mounted on — a photo mount, so it stays cream even though
   the band behind it is ink. Selected card swaps the mat to orange. */
.beat {
  display: block;
  text-align: left;
  color: inherit;
  border: 3px solid var(--base-paper);
  background: var(--base-paper);
  padding: 7px;
  box-shadow: var(--sh-lg);
  cursor: pointer;
  font-family: var(--sans);
}
.beat.on { border-color: var(--orange); }
.beat:focus-visible { outline: 3px solid var(--link-dark); outline-offset: 2px; }

.beat-inner { border: 2px solid var(--ink); background: linear-gradient(180deg, var(--rule), var(--paper)); display: block; }

.beat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 2px solid var(--ink);
  background: var(--bone);
}
.beat-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd27a, #c8232a 70%);
  border: 2px solid var(--ink);
  flex: none;
}
.beat-name { font-size: 17.5px; color: var(--ink); line-height: 1.05; }
.beat-mark { font-size: 12.5px; color: var(--red-text); line-height: 1.1; text-align: right; flex: none; }

/* 200x150 art letterboxed into a wider card — preserveAspectRatio is left at its default, so
   the dossier's cream stock shows as side panels. That is the handoff's look. */
.beat-art { position: relative; height: 150px; border-bottom: 2px solid var(--ink); overflow: hidden; }
.beat-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.beat-tag {
  position: absolute;
  right: 6px;
  top: 6px;
  writing-mode: vertical-rl;
  font-size: 12.5px;
  /* On its own dark chip: the tag can sit over the cream side of a letterboxed portrait, where
     cream text was invisible (1:1). */
  color: var(--base-paper);
  background: var(--base-ink);
  padding: 4px 2px;
}

.beat-body { padding: 10px 10px 8px; position: relative; }

/* The CLAIMANT tab straddles the edge of the portrait. */
.beat-pill-row { display: flex; justify-content: center; margin-top: -22px; }
.beat-pill {
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 3px 16px;
  font-size: 14.5px;
  letter-spacing: .12em;
  color: var(--ink);
}

.beat-meta { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 6px; }
.beat-desc { font-size: 13.5px; line-height: 1.45; color: var(--ink); margin-top: 6px; min-height: 54px; }

.beat-docs {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ink);
}
.beat-doc { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink); }
.beat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  border: 1px solid var(--ink);
  flex: none;
}
.beat-dot.missing { background: var(--red); }

.beat-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px 10px;
  background: var(--ink);
  border-top: 2px solid var(--ink);
}
.beat-stat { display: flex; align-items: center; gap: 6px; min-width: 0; }
.beat, .beat-inner, .beat-body { min-width: 0; }
.beat-name, .beat-meta, .beat-desc, .beat-doc, .beat-chip { overflow-wrap: anywhere; min-width: 0; }
.beat-stat-k { font-family: var(--lbl-f); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 13.5px; color: var(--base-paper); }
.beat-chip {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 13.5px;
  padding: 2px 7px;
  border: 1px solid var(--base-paper);
  background: var(--muted);
  color: var(--base-paper);
}
.beat-chip.c-blue  { background: var(--blue-text); }
.beat-chip.c-green { background: var(--green-text); }
.beat-chip.c-red   { background: var(--red-text); }

.beats-note { font-size: 11.5px; color: var(--dim-2); margin: 10px auto 0; max-width: var(--maxw); width: 100%; }

/* --- the two-column console --- */

.console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 22px;
  margin: 18px auto 0;
  max-width: var(--maxw);
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}
.col { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; }

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 2px solid var(--a-line, var(--ink));
  background: var(--console);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--dim);
  flex: 0 0 auto;
}
.panel-body { overflow-y: auto; padding: 14px; min-height: 0; flex: 1 1 auto; max-height: 52vh; }

/* submitted documents: loose cream sheets on a dark desk */
.doc {
  padding: 16px 18px;
  background: var(--paper-3);
  color: var(--ink);
  box-shadow: var(--sh-sm) rgba(0, 0, 0, .4);
  transform: rotate(-.6deg);
  margin-bottom: 18px;
}
.doc:nth-child(even) { transform: rotate(.5deg); }
.doc:last-child { margin-bottom: 4px; }
.doc-label {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 11.5px;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 8px;
  margin-bottom: 9px;
}
.doc-text {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .04em;
  font-size: 13px;
  line-height: 1.55;
  color: var(--body);
  white-space: pre-wrap;
}
/* The decisive spans. Ink on ink — a redaction you can select but not read at a glance, which
   is the point: the model found it, the room has to be told where. */
.doc-text mark {
  background: var(--ink);
  color: var(--paper);
  padding: 0 3px;
  box-shadow: 0 0 0 1px var(--ink);
}

/* --- the triage card --- */

.verdict {
  border: 2px solid var(--orange);
  background: var(--console);
  padding: 16px 18px;
  flex: 0 0 auto;
}
.verdict-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 11.5px;
  color: var(--dim);
}
.verdict-value {
  font-family: var(--wordmark-f);
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 42px;
  line-height: 1;
  margin-top: 10px;
  color: var(--cream-hi);
}
.v-siu      { color: var(--orange); }
.v-complex  { color: var(--gold); }
.v-standard { color: var(--link-dark); }
.v-fast     { color: var(--green-neon); }
.v-straight { color: var(--green-neon); }

.lamps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
/* A model value can be one long unbroken token; every model-derived string in the verdict and
   reasoning breaks anywhere rather than running off the card. */
.lamp, .meta-strip span, .verdict-top span, .rationale, .reqdocs li, .field-grid dd, .verdict-value {
  overflow-wrap: anywhere; min-width: 0;
}
.lamp {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 11.5px;
  border: 1px solid var(--rule);
  padding: 4px 8px;
  color: var(--dim);
}
.lamp .k { color: var(--dim-2); }
.lamp.on { border-color: var(--orange); color: var(--cream-hi); }
.lamp.on.neutral { border-color: var(--edge-dark); color: var(--link-dark); }

.meta-strip {
  display: flex;
  gap: 6px 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 11.5px;
  color: var(--dim-2);
}
.meta-strip b { font-weight: 600; color: var(--dim-2); }
.meta-strip span { color: var(--cream-hi); }

/* --- reasoning --- */

.rationale { font-size: 15.5px; line-height: 1.5; color: var(--cream-hi); }
.field-grid {
  display: grid;
  /* minmax(0, …) lets both columns shrink; on a phone the values (SIU_INVESTIGATOR) were clipped. */
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 2px 14px;
  margin: 12px 0 0;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 12.5px;
  line-height: 1.7;
}
.field-grid dt, .field-grid dd { min-width: 0; overflow-wrap: anywhere; }
/* On a narrow phone the long label (RECOMMENDED_ADJUSTER_SKILL) left the value a sliver of a column,
   one letter per line. Stack each label over its value instead. */
@media (max-width: 480px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .field-grid dd { margin-bottom: 8px; }
}
.field-grid dt { color: var(--dim-2); }
.field-grid dd { margin: 0; color: var(--cream-hi); }

.reqdocs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 5px;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 12.5px;
  color: var(--orange);
}
.reqdocs li { padding-left: 16px; position: relative; }
.reqdocs li::before { content: "\203A"; position: absolute; left: 0; }

.panel-body .note {
  color: var(--dim-2);
  font-size: 13px;
  border-left: 2px solid var(--edge-dark);
  padding-left: 10px;
  margin-top: 12px;
  line-height: 1.45;
}
.panel-body .note strong { color: var(--cream-hi); }

/* --- receipts drawer --- */

.receipts { border-top: 1px solid var(--rule); flex: 0 0 auto; }
.receipts > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--orange);
}
.receipts > summary::-webkit-details-marker { display: none; }
.receipts > summary::before { content: "\25B8 "; }
.receipts[open] > summary::before { content: "\25BE "; }
.receipts-body { padding: 0 16px 16px; max-height: 40vh; overflow-y: auto; }

/* ---------- "show the detail" disclosure ----------
   The same idea as the receipts drawer, in the cream chapters: the supporting material stays on
   the page for the people who check, but the default read is short. */

.more { margin-top: 12px; }
.more > summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
  color: var(--blue-text);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "\25B8  "; }
.more[open] > summary::before { content: "\25BE  "; }
.more > summary:hover { color: var(--red-text); border-bottom-color: var(--red); }
.more-body { padding-top: 12px; }
.more-body > * + * { margin-top: 12px; }

.json {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: #0b0f1f;          /* fixed: var(--ink) is cream inside .on-dark, which put light text on cream */
  color: #c9d3e6;
  padding: 12px 14px;
  margin: 0;
  white-space: pre-wrap;        /* long values and the rationale wrap; no sideways scroll */
  overflow-wrap: anywhere;
  border: 1px solid var(--rule);
}
.json .k { color: var(--link-dark); }
.json .s { color: var(--green-neon); }
.json .n { color: var(--gold); }
.json .b { color: var(--orange); }

.kv { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
.kv td { padding: 6px 0; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--body); overflow-wrap: anywhere; }
.kv td:first-child {
  width: 34%;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 11.5px;
  color: var(--muted);
  padding-right: 14px;
}
.kv .pending { color: var(--gold); font-style: italic; }

/* --- keep awake --- */

/* Booth operator strip: the presenter's controls, set apart from the visitor story at the very foot of
   the page, under the chapter footer. Dark, like the console, and titled so nobody mistakes it for part of
   the demo. */
.operator-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  width: 100%;
  border-top: 3px double var(--gold);
  padding: 14px var(--gutter) 18px;
  flex: 0 0 auto;
}
.op-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.op-h { font-size: 15px; color: var(--gold); margin: 0; letter-spacing: .12em; }
.op-sub { font-size: 11.5px; color: var(--dim); }
.ka-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.keepalive {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--pill-h);
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--edge-dark);
  padding: 0 16px;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: 12.5px;
}
.ka-dot { width: 9px; height: 9px; border-radius: 50%; background: #6b6f80; border: 1px solid var(--paper); }
.keepalive[aria-pressed="true"] { border-color: var(--green); }
.keepalive[aria-pressed="true"] .ka-dot { background: var(--green-neon); animation: ka-pulse 2s ease-in-out infinite; }
@keyframes ka-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .keepalive[aria-pressed="true"] .ka-dot { animation: none; }
}
.ka-state { font-size: 11.5px; color: var(--green); }
.ka-state.off { color: var(--dim-2); }
.ka-copy { font-size: 13.5px; line-height: 1.45; color: var(--dim); max-width: 640px; }

/* Offline control. Same shape as KEEP AWAKE — they are one family of presenter switches — but
   gold when armed, matching the pill and the band on the verdict card. */
.offline-btn[aria-pressed="true"] { border-color: var(--gold); }
.offline-btn[aria-pressed="true"] .ka-dot { background: var(--gold); }
.keepalive:disabled { opacity: .4; cursor: not-allowed; }

/* The offline band sits inside the verdict card, above the handling path, because that is where
   someone's eye actually goes. The old cached mode marked itself only in the nav corner and a
   viewer could read canned output without ever noticing. Full-width, gold, and it does not
   scroll away from the answer it qualifies. */
.recorded-band {
  background: var(--gold);
  color: #101426;               /* fixed: var(--ink) is cream inside .on-dark (was 1.82:1 on gold) */
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: 11.5px;
  padding: 6px 14px;
  margin: -1px -1px 0;
}
.verdict.is-recorded { border-color: var(--gold); }

/* The idle panel reuses .pending-state's layout but must not spin — there is nothing in flight. */
.pending-state.idle { min-height: 0; }
.pending-state.idle .pending-text { text-align: left; }

/* --- loading / warming / error --- */

.pending-state { display: flex; gap: 14px; align-items: flex-start; padding: 6px 0; }
.pending-text { font-size: 15px; line-height: 1.5; color: var(--cream-hi); }
.pending-text .dim { color: var(--dim-2); font-size: 13.5px; }
.elapsed { font-family: var(--mono); font-size: 13px; color: var(--gold); }
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--rule);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex: none;
  margin-top: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.err-mark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--red);
  color: var(--red);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.pending-state.error .pending-text { color: var(--cream-hi); }
.retry {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 13.5px;
  margin-top: 10px;
  background: var(--red-text);
  color: var(--on-red);
  border: 2px solid var(--paper);
  padding: 7px 16px;
  cursor: pointer;
}
/* In the dark chapter --red-text is orange, and cream on orange was 1.94:1; dark ink on orange passes. */
.on-dark .retry { color: #101426; }

/* ============================ 03 · HOW IT WAS BUILT ============================ */

/* Centred on the same 1280 frame as the chapter header, then indented by the rail (120) + gap (40), so the
   steps line up under the headline at every width. The single grid column keeps the text at 900 wide. */
.log-col { display: grid; grid-template-columns: minmax(0, 900px); max-width: var(--maxw); margin: 36px auto 0; padding-left: 160px; width: 100%; }

.steps { display: flex; flex-direction: column; }
.step { border-top: 2px solid var(--ink); padding: 22px 0 24px; }
.step:last-child { border-bottom: 2px solid var(--ink); }
.step-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.step-n {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  font-size: 24px;
  color: var(--red);
  flex: none;
}
.step-n::after { content: " \00B7"; }
.step-title {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 24px;
  color: var(--ink);
  flex: 1 1 auto;
  line-height: 1.05;
}
.step-status {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
  border: 1px solid currentColor;
  padding: 2px 8px;
  flex: none;
}
.s-done    { color: var(--green-text); }
.s-pending { color: var(--gold); }
.s-failed  { color: var(--red); }

.step-detail { font-size: 16px; line-height: 1.55; color: var(--body); margin-top: 10px; }
.step-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
}
.step-foot code { font-family: var(--mono); text-transform: none; letter-spacing: 0; color: var(--blue-text); }
.step-foot span { color: var(--muted); text-align: right; }

/* The decision table itself, shown verbatim under step 1. */
.step-more { white-space: break-spaces; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; line-height: 1.5; }

/* bar charts: a bordered div and a label. No chart library, no axes. */
.bars { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; max-width: 760px; }
.bar-row { display: flex; align-items: center; gap: 14px; }
.bar-label {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
  color: var(--muted);
  flex: 0 0 210px;
}
.bar { flex: 1 1 auto; height: 18px; }
.bar-fill { height: 100%; border: 2px solid var(--ink); }
.bar-fill.sm { background: var(--green); }
.bar-fill.lg { background: var(--red); }
.bar-val {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
  color: var(--ink);
  flex: 0 0 120px;
  text-align: right;
}

/* ============================ 04 · THE RESULT ============================ */

#panel-result .chapter { margin-bottom: 30px; }

.r-head { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 0 0 30px; }
.r-claim, .r-counter { padding: 18px 22px; font-size: 15.5px; line-height: 1.5; color: var(--body); }
.r-claim {
  border: 2px solid var(--green);
  background: var(--green-wash);
  box-shadow: var(--sh-md) var(--green);
}
.r-counter {
  border: 2px solid var(--red);
  background: var(--red-wash);
  box-shadow: var(--sh-md) var(--red);
}
.r-stat {
  display: block;
  font-family: var(--wordmark-f);
  font-weight: 400;
  letter-spacing: .06em;
  font-size: 50px;
  line-height: 1;
  margin-bottom: 8px;
}
.r-claim .r-stat { color: var(--green); }
.r-counter .r-stat { color: var(--red); }
.r-stat small { font-size: 21px; color: var(--ink); }

.r-warn {
  border: 2px dashed var(--red);
  background: var(--red-wash);
  padding: 12px 16px;
  margin-bottom: 22px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--body);
}
.r-warn code { font-family: var(--mono); font-size: .9em; color: var(--red); }

.table-scroll { overflow-x: auto; }

.r-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid var(--ink);
  background: var(--panel);
  margin-top: 8px;
}
.r-table th {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
  color: var(--muted);
  text-align: right;
  padding: 10px 14px;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}
.r-table th.r-judge { text-align: left; }
.r-current-h { color: var(--red); }
.r-base-h { color: var(--muted); }

.r-table td { padding: 13px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.r-table tr:last-child td { border-bottom: 0; }
.r-decisive td { background: var(--red-wash); }

.r-judge { width: 42%; }
.r-jlabel {
  display: block;
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 17.5px;
  color: var(--ink);
  line-height: 1.1;
}
.r-jdesc { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.4; margin-top: 3px; }

.r-cell {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 14px;
  text-align: right;
  color: var(--body-2);
  white-space: nowrap;
}
.r-current { font-weight: 700; color: var(--red-text); }
.r-win { color: var(--green-text); }
.r-base { color: var(--muted); }
.r-pending { color: var(--gold); font-style: italic; text-transform: none; letter-spacing: 0; }
/* The frontier column can win a row too (must-escalate), and when it does it gets the same mark. */
.r-base.r-win { color: var(--green-text); font-weight: 700; }
/* A draw is not a loss: red on the v9 column means v9 is behind, so a tie is shown plain. */
.r-current.r-tie { color: var(--body); }

.r-of { color: var(--muted); font-weight: 500; }

.r-denom { margin-top: 16px; border-left: 3px solid var(--orange); padding-left: 14px; }

.r-legend { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.r-leg {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--body-2);
}
.r-leg code {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
  color: var(--red-text);
}


/* release gate: a dashed strip and a stamp set at an angle */
.r-gate {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  border: 2px dashed var(--red);
  padding: 14px 18px;
  margin-top: 30px;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--red);
}
.r-stamp {
  font-family: var(--lbl-f);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 17.5px;
  color: var(--on-red);
  background: var(--red);
  padding: 6px 14px;
  border: 2px solid var(--ink);
  transform: rotate(-3deg);
  flex: none;
}
.r-authority {
  border-left: 3px solid var(--violet);
  padding-left: 14px;
  margin-top: 18px;
}

/* ============================ OVERLAYS ============================ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 38, .72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  z-index: 100;
}
.drawer-backdrop.open { display: flex; }

.drawer {
  width: min(960px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: var(--sh-lg);
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 18px 22px;
  border-bottom: 3px double var(--red);
  background: var(--paper-2);
}
.drawer-head h2 { font-size: 26px; color: var(--ink); line-height: 1; }
.drawer-sub { font-size: 13.5px; line-height: 1.5; color: var(--muted); margin-top: 6px; max-width: 640px; }

.x-btn {
  font-size: 13.5px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 6px 14px;
  cursor: pointer;
  flex: none;
}
.x-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.drawer-list { overflow-y: auto; padding: 6px 0; }
.drawer-row {
  display: grid;
  grid-template-columns: 70px 1fr 170px;
  gap: 14px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 11px 22px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  font-family: var(--sans);
}
.drawer-row:hover { background: var(--panel); }
.drawer-row .id {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: .08em;
  font-size: 13.5px;
  color: var(--red-text);
}
.drawer-row .note { font-size: 14.5px; color: var(--body); max-width: none; }
.drawer-row .relabel-note { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.drawer-row .path {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12.5px;
  color: var(--blue-text);
  text-align: right;
}


/* ============================ RESPONSIVE ============================
   The comps are drawn at 1280. At or above that they render as drawn; below it the gutters
   close up and the grids collapse in the order the content survives best. */

@media (max-width: 1100px) {
  :root { --gutter: 32px; }

  .rail { width: 96px; }
  .rail-n { font-size: 52px; }
  .chapter-h, .lede h2 { font-size: 36px; }

  .log-col { padding-left: 136px; }

  .nav { flex-wrap: wrap; row-gap: 10px; }
  .tabs { order: 3; width: 100%; justify-content: flex-start; flex-wrap: wrap; row-gap: 8px; }

  .console-grid { grid-template-columns: minmax(0, 1fr); }
  /* One column means the console is taller than the viewport, so the booth shell has to let
     go here — a presenter on a small screen needs to reach the verdict at all. */
  #panel-demo { overflow-y: auto; }
  .panel-body { max-height: 46vh; }

  .beats { gap: 16px; }
  .beat-art { height: 120px; }

  .r-head { grid-template-columns: 1fr; }
  .signpost { grid-template-columns: repeat(2, 1fr); }
  .r-judge { width: 34%; }
}

@media (max-width: 720px) {
  :root { --gutter: 20px; }

  .nav { flex-wrap: wrap; gap: 12px; }
  .tabs { order: 3; width: 100%; justify-content: flex-start; gap: 8px 18px; flex-wrap: wrap; padding-bottom: 2px; }

  .tab { font-size: 13px; }

  /* Below this width the cover stops being a scene and becomes a printed page: the sky is a
     banner, and the title and card sit on cream beneath it. app.js unmounts cover.js at the same
     number, so whatever frame it last drew stays as a static illustration. */
  .hero {
    --px: 1px;
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    border: 3px double var(--red);
  }
  .sky { position: relative; inset: 0; height: 200px; flex: none; }
  .cover-rule, .cover-mat, .cover-badge { display: none; }

  /* The title block leaves the dark sky, so it has to leave the light-on-dark palette with it —
     cream on cream is invisible, and the ink text-shadows become smears. */
  .cover-title { position: static; padding: 20px 16px 0; }
  .cover-eyebrow { color: var(--red-text); text-shadow: none; }   /* on cream at phone width: theme red was 3.70:1 */
  .cover-wordmark {
    font-size: clamp(30px, 9.5vw, 54px);
    color: var(--red);
    text-shadow: 2px 2px 0 var(--ink);
    -webkit-text-stroke: 0;
    overflow-wrap: break-word;
  }
  .cover-tagline { color: var(--ink); text-shadow: none; }

  .cover-card {
    position: static;
    transform: none;
    width: auto;
    margin: 16px;
    box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--red), 5px 6px 0 rgba(16, 20, 38, .45);
  }
  .cover-card-copy { font-size: 16px; max-width: none; }
  /* The longest route, STRAIGHT_THROUGH, was clipped at phone width. Scale it to the viewport and
     let it break at the underscore rather than hide the answer. */
  .verdict-value { font-size: clamp(22px, 7vw, 42px); overflow-wrap: anywhere; }
  /* Chapter four at phone width: the comparison column must be on screen without a sideways
     scroll, so the row descriptions go (the labels carry the meaning) and cells tighten. */
  .r-table .r-jdesc { display: none; }
  .r-table td, .r-table th { padding: 10px 6px; letter-spacing: .02em; }
  .r-table .r-cell { font-size: 13px; white-space: normal; }
  .r-table th { white-space: normal; font-size: 11px; }
  .r-table .r-jlabel { font-size: 14px; }
  /* Let the "who did this step" tag drop under the title instead of squeezing it to one word a line. */
  .step-head { flex-wrap: wrap; }
  .cover-input { width: 100%; }
  .cover-cta { flex-direction: column; }
  .cover-btn { width: 100%; }
  .cover-chapters { gap: 12px; }
  /* No cursor to move and no live scene to click once cover.js is unmounted. */
  .cover-hint { display: none; }

  .chapter { flex-direction: column; gap: 10px; }
  .rail { display: flex; align-items: baseline; gap: 12px; width: auto; }
  .rail-l { margin-top: 0; }
  .chapter-h, .lede h2 { font-size: 28px; }
  .lede-p, .lede p { font-size: 16px; }

  .log-col { padding-left: 0; }
  .step-title { font-size: 20px; }

  .two-up { grid-template-columns: 1fr; gap: 20px; }
  .signpost { grid-template-columns: 1fr; gap: 14px; }
  .beats { grid-template-columns: 1fr; }
  .bar-row { flex-wrap: wrap; }
  .bar-label { flex-basis: 100%; }
  .bar-val { flex-basis: auto; }

  .chapter-footer { flex-wrap: wrap; }
  .foot-colophon { order: 3; width: 100%; }

  .drawer-row { grid-template-columns: 60px 1fr; }
  .drawer-row .path { grid-column: 2; text-align: left; }
}

/* The one-line intro above the required-evidence list. Sits with the list, not with the
   identifier note below it, so it does not pick up that note's left rule. */
.reqdocs-h { border-left: 0 !important; padding-left: 0 !important; color: var(--dim) !important; font-size: 13px; }

.r-stamp-ok { background: var(--green); color: var(--panel); }

/* ============================ FICTION AND SCOPE NOTICES ============================
   The fictional-data notice is shown as written, on the cover before "Run the claim" and beside the claim
   cards. It is plain text in a ruled box — never a tooltip, never collapsed. */
.fiction-notice {
  border: 2px dashed var(--red);
  background: var(--panel);
  color: var(--ink);
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  max-width: var(--maxw);
  width: 100%;
  margin: 14px auto 0;
}
.fiction-notice strong { color: var(--red-text); }
.cover-notice {
  font-size: max(12px, calc(15 * var(--px)));
  max-width: calc(660 * var(--px));
  margin: calc(12 * var(--px)) auto 0;
  padding: calc(8 * var(--px)) calc(12 * var(--px));
}
.claims-notice { margin-bottom: 4px; }
.doc-fiction {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 11.5px;
  color: var(--gold);
  margin: 0 0 12px;
}
.siu-note { font-size: 13.5px; line-height: 1.45; color: var(--body); margin: 8px 0 4px; }
.beat-pill-fiction { margin-left: 6px; color: var(--red-text); border-color: var(--red-text); }
.what-is-live { margin-top: 10px; }
.table-steps { list-style: decimal; padding-left: 26px; margin-top: 10px; display: flex; flex-direction: column;
               gap: 8px; font-size: 15.5px; line-height: 1.45; color: var(--body); max-width: 860px; }
.table-steps strong { color: var(--ink); }
.scope-line { margin-top: 12px; font-weight: 600; color: var(--ink); }
.r-scope { font-size: 15px; line-height: 1.45; color: var(--ink); border-left: 3px solid var(--violet);
           padding-left: 14px; margin: 0 0 18px; }
.r-over { margin: -12px 0 24px; }
.format-table td:first-child { width: auto; }
/* The two number columns must never run together ("195 of 1970 of 197" at 320 px): right-aligned, kept on
   one line, with a real gap. Checked by the overflow check's format-table gap test. */
.format-table td.fmt-n { text-align: right; white-space: nowrap; padding-left: 14px; width: 1%; }
.contract-table td:first-child { width: 36%; }
.contract-table code { font-family: var(--mono); text-transform: none; letter-spacing: 0; color: var(--blue-text); }
.contract-values { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }

/* The prepared workflow diagram. Theme variables only, so it reads on light and dark grounds. */
.workflow-fig { margin: 24px auto 8px; max-width: var(--maxw); }
.workflow { width: 100%; height: auto; display: block; }
.wf-tall { display: none; max-width: 420px; margin: 0 auto; }
.wf-box { fill: var(--panel); stroke-width: 2.5; }
.wf-t { font-family: var(--lbl-f); font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
        font-size: 18px; fill: var(--ink); }
.wf-s { font-family: var(--sans); font-size: 14.5px; fill: var(--body); }
.wf-line { stroke: var(--red); stroke-width: 2.5; }
.wf-head { fill: var(--red); }
@media (max-width: 1000px) {
  .wf-wide { display: none; }
  .wf-tall { display: block; }
  .wf-t { font-size: 20px; }
  .wf-s { font-size: 15.5px; }
}
@media (max-width: 720px) {
  .cover-notice { font-size: 15px; max-width: none; padding: 10px 12px; margin-top: 12px; }
  .fiction-notice { font-size: 14.5px; }
}
