/* Learn · Accumulators — cinematic explainer with LLaMa
 * =========================================================
 *
 * Two-palette rig: a bright linen "lecture hall" is the ground
 * for most acts; two moments (Act 6 compare and Act 9 variance)
 * flip to a night-stage bottle-green so the drama lands.
 *
 * Palette tokens (referenced everywhere by var()):
 *   --acc-paper       #F4EFE4    linen ground
 *   --acc-paper-2     #EAE3D3    linen tint  (card grounds)
 *   --acc-ink         #1F2A24    bottle-green ink
 *   --acc-ink-2       #4F5A50    softened ink
 *   --acc-ink-3       #8B948B    caption ink
 *   --acc-sage        #7D9080    LLaMa sage
 *   --acc-sage-deep   #4E6355    darker sage for accents
 *   --acc-gold        #C9B87A    podium accent (rare)
 *   --acc-red         #B85450    dead-leg strike
 *   --acc-night       #0B1A14    bottle-green near-black
 *   --acc-night-ink   #E8DFC8    night stage text
 *   --acc-hair        rgba(31, 42, 36, 0.10)
 */

:root {
  --acc-paper:      #F4EFE4;
  --acc-paper-2:    #EAE3D3;
  --acc-ink:        #1F2A24;
  --acc-ink-2:      #4F5A50;
  --acc-ink-3:      #8B948B;
  --acc-sage:       #7D9080;
  --acc-sage-deep:  #4E6355;
  --acc-gold:       #C9B87A;
  --acc-red:        #B85450;
  --acc-night:      #0B1A14;
  --acc-night-ink:  #E8DFC8;
  --acc-hair:       rgba(31, 42, 36, 0.10);
  --acc-hair-strong:rgba(31, 42, 36, 0.22);
}

body.page-learn--acc {
  background: var(--acc-paper);
  color: var(--acc-ink);
  font-family: "IBM Plex Serif", "Playfair Display", Georgia, "Times New Roman", serif;
}

/* ── Persistent lecture-hall ground ────────────────────────
 * Warm linen grain + soft corner vignette; sits behind every
 * act so scrolling reads as one room, not stitched pages. */

.acc-paper {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.acc-paper__grain {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(125, 144, 128, 0.06) 0px, transparent 1px),
    radial-gradient(circle at 84% 62%, rgba(31, 42, 36, 0.05) 0px, transparent 1px);
  background-size: 4px 4px, 5px 5px;
  opacity: 0.7;
  mix-blend-mode: multiply;
}
.acc-paper__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center,
      transparent 55%,
      rgba(31, 42, 36, 0.10) 100%);
}

/* ── Fixed LLaMa lecture HUD (top-right) ──────────────────── */

.acc-system {
  position: fixed;
  top: 88px;
  right: 20px;
  z-index: 40;
  background: rgba(244, 239, 228, 0.92);
  border: 1px solid var(--acc-hair-strong);
  border-radius: 4px;
  padding: 10px 14px;
  min-width: 172px;
  font-family: "IBM Plex Mono", "Fira Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--acc-ink-2);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(31, 42, 36, 0.06);
}
.acc-system__row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.acc-system__row + .acc-system__row {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dotted var(--acc-hair);
}
.acc-system__mono {
  font-weight: 700;
  letter-spacing: 0.10em;
  color: var(--acc-ink);
}
.acc-system__badge {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--acc-sage-deep);
  padding: 2px 6px;
  border: 1px solid var(--acc-sage);
  border-radius: 2px;
}
.acc-system__kv em {
  font-style: normal;
  color: var(--acc-ink-3);
  margin-right: 6px;
}

@media (max-width: 900px) {
  .acc-system { display: none; }   /* HUD is desktop-only chrome */
}

/* ── Scroll-progress bar (top edge) ────────────────────────
 * Piggybacks on pw-cine__progress the shell already animates. */

.pw-cine__progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  z-index: 50;
}
.pw-cine__progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--acc-sage-deep);
  transition: width 60ms linear;
}

/* ── Chapter rail (right edge) ───────────────────────────── */

.pw-cine__rail {
  position: fixed;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pw-cine__rail-dot {
  appearance: none;
  border: 0;
  padding: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--acc-hair-strong);
  cursor: pointer;
  position: relative;
  transition: background 160ms ease, transform 160ms ease;
}
.pw-cine__rail-dot:hover,
.pw-cine__rail-dot:focus-visible {
  background: var(--acc-sage);
  outline: none;
  transform: scale(1.2);
}
.pw-cine__rail-dot.is-active {
  background: var(--acc-sage-deep);
  transform: scale(1.35);
}
.pw-cine__rail-lbl {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--acc-ink-2);
  background: rgba(244, 239, 228, 0.95);
  padding: 3px 7px;
  border-radius: 3px;
  border: 1px solid var(--acc-hair);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.pw-cine__rail-dot:hover .pw-cine__rail-lbl,
.pw-cine__rail-dot:focus-visible .pw-cine__rail-lbl { opacity: 1; }

@media (max-width: 900px) {
  .pw-cine__rail { display: none; }
}

/* ── Acts — each a full-viewport stage ─────────────────────
 * Bright by default; two acts flip to night-stage via a
 * modifier for the two moments that need contrast. */

.acc-cine { position: relative; z-index: 1; }

.acc-cine__act,
.pw-cine__act {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 24px;
  position: relative;
  border-bottom: 1px solid var(--acc-hair);
}

.acc-cine__act--night {
  background: var(--acc-night);
  color: var(--acc-night-ink);
  border-bottom-color: rgba(232, 223, 200, 0.10);
}
.acc-cine__act--night .pw-cine__stage    { color: rgba(232, 223, 200, 0.55); }
.acc-cine__act--night .pw-cine__h        { color: var(--acc-night-ink); }
.acc-cine__act--night .pw-cine__lede,
.acc-cine__act--night .acc-lede          { color: rgba(232, 223, 200, 0.80); }

.pw-cine__inner {
  width: 100%;
  max-width: 780px;
  position: relative;
  z-index: 2;
}
.pw-cine__inner--wide     { max-width: 1100px; }
.pw-cine__inner--centered { text-align: center; }

/* ── Editorial typography ──────────────────────────────────
 * Playfair-family display, IBM Plex Serif body, IBM Plex Mono
 * for coupon + telemetry. Matches Letters + Papers voice. */

.pw-cine__eyebrow {
  margin: 0 0 18px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--acc-sage-deep);
}

.pw-cine__title {
  margin: 0 0 24px;
  font-family: "Playfair Display", "IBM Plex Serif", Georgia, serif;
  font-weight: 800;
  text-wrap: balance;
}
.pw-cine__title-sub {
  display: block;
  font-size: clamp(18px, 2vw, 22px);
  font-style: italic;
  font-weight: 400;
  color: var(--acc-ink-2);
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}
.pw-cine__title-main {
  display: block;
  font-size: clamp(48px, 7vw, 88px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--acc-ink);
}

.pw-cine__stage {
  margin: 0 0 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--acc-sage-deep);
}
.pw-cine__h {
  margin: 0 0 20px;
  font-family: "Playfair Display", "IBM Plex Serif", serif;
  font-weight: 700;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--acc-ink);
  text-wrap: balance;
}
.pw-cine__lede,
.acc-lede {
  margin: 0 0 32px;
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.65;
  color: var(--acc-ink-2);
  max-width: 640px;
}
.acc-lede strong { color: var(--acc-ink); }
.acc-lede em     { color: var(--acc-sage-deep); font-style: italic; }

.pw-cine__scroll-hint {
  margin: 60px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--acc-ink-3);
  opacity: 0.85;
}

/* ── Act 0 · Title instrument (opening stats) ──────────── */

.acc-title-instr {
  margin: 40px auto 0;
  max-width: 520px;
  border: 1px solid var(--acc-hair-strong);
  border-radius: 4px;
  background: var(--acc-paper-2);
  padding: 14px 20px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  text-align: left;
}
.acc-title-instr__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px dotted var(--acc-hair-strong);
}
.acc-title-instr__row:first-child { border-top: 0; }
.acc-title-instr__k {
  color: var(--acc-ink-3);
  letter-spacing: 0.06em;
}
.acc-title-instr__v {
  color: var(--acc-ink);
  font-weight: 600;
}
.acc-title-instr__v--pop {
  color: var(--acc-gold);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  /* Foreshadow the answer: the opener's "63" is the same gold as the
   * Lucky 63 accent in Act 5 and the Lucky 63 histogram in Act 9. */
}

/* ── Close signature (Act 9 outro) ─────────────────────── */

.acc-close {
  margin: 48px auto 0;
  max-width: 640px;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-style: italic;
  font-size: 15px;
  line-height: 1.65;
  color: rgba(232, 223, 200, 0.72);
  text-align: center;
}
.acc-close__sig {
  display: block;
  margin-bottom: 12px;
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 18px;
  color: var(--acc-sage);
  letter-spacing: 0.02em;
}

/* ═════════════════════════════════════════════════════════
 *  Act 6 · Compare (£1 six-fold vs £63 Lucky 63, night stage)
 * ═════════════════════════════════════════════════════════ */

.acc-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  max-width: 1000px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .acc-compare { grid-template-columns: 1fr; }
}

.acc-compare__col {
  padding: 24px 26px;
  background: rgba(232, 223, 200, 0.06);
  border: 1px solid rgba(232, 223, 200, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 16px;
}
.acc-compare__col--luck {
  background: rgba(201, 184, 122, 0.10);
  border-color: rgba(201, 184, 122, 0.35);
}
.acc-compare__head {
  display: grid;
  gap: 4px;
}
.acc-compare__lbl {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232, 223, 200, 0.55);
}
.acc-compare__title {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--acc-night-ink);
}
.acc-compare__col--luck .acc-compare__title { color: var(--acc-gold); }
.acc-compare__outlay {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: rgba(232, 223, 200, 0.65);
}
.acc-compare__outlay strong {
  color: var(--acc-night-ink);
  font-family: "Playfair Display", serif;
  font-size: 20px;
  margin-left: 6px;
}

.acc-mini {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 6px;
}
.acc-mini li {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(232, 223, 200, 0.04);
  border-radius: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: rgba(232, 223, 200, 0.85);
}
.acc-mini li em {
  font-style: normal;
  color: rgba(232, 223, 200, 0.45);
}
.acc-mini li b {
  font-weight: 500;
  font-family: "IBM Plex Serif", serif;
  color: var(--acc-night-ink);
}
.acc-mini li i {
  font-style: normal;
  color: rgba(201, 184, 122, 0.85);
  font-weight: 600;
}

.acc-compare__odds {
  padding-top: 12px;
  border-top: 1px dotted rgba(232, 223, 200, 0.20);
  display: grid;
  gap: 4px;
}
.acc-compare__odds-k {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 223, 200, 0.55);
}
.acc-compare__odds-v {
  font-family: "Playfair Display", serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  color: var(--acc-night-ink);
  font-variant-numeric: tabular-nums;
}
.acc-compare__odds-v--gold { color: var(--acc-gold); }

.acc-compare__row-lite {
  padding: 8px 12px;
  border-radius: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: rgba(232, 223, 200, 0.75);
}
.acc-compare__row-lite b { color: var(--acc-night-ink); font-weight: 700; font-family: "Playfair Display", serif; font-size: 16px; margin-left: 4px; }
.acc-compare__row-lite--warn { background: rgba(184, 84, 80, 0.15); border-left: 3px solid var(--acc-red); }
.acc-compare__row-lite--warn b { color: var(--acc-red); }
.acc-compare__row-lite--ok   { background: rgba(125, 144, 128, 0.15); border-left: 3px solid var(--acc-sage); }
.acc-compare__row-lite--ok b { color: var(--acc-sage); }

/* ═════════════════════════════════════════════════════════
 *  Act 7 · Slow-motion settlement (scoreboard + side panels)
 * ═════════════════════════════════════════════════════════ */

.acc-settle {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr);
  gap: 28px;
  max-width: 1100px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 900px) {
  .acc-settle { grid-template-columns: 1fr; }
}

.acc-settle__stage {
  padding: 12px;
  background: #FDFAF3;
  border: 1px solid var(--acc-hair-strong);
  border-radius: 8px;
}
.acc-settle__board {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 8px;
}
.acc-settle__leg {
  display: grid;
  grid-template-columns: 28px 90px 1fr auto 74px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--acc-hair);
  border-radius: 4px;
  background: var(--acc-paper);
  transition: background 220ms ease, border-color 220ms ease, color 220ms ease;
}
.acc-settle__leg.is-won  { background: rgba(125, 144, 128, 0.14); border-color: var(--acc-sage); }
.acc-settle__leg.is-lost { background: rgba(184, 84, 80, 0.06); border-color: rgba(184, 84, 80, 0.30); color: var(--acc-ink-3); }
.acc-settle__leg.is-lost .acc-settle__horse { text-decoration: line-through; }

.acc-settle__seq {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--acc-ink-3);
  text-align: center;
}
.acc-settle__time {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--acc-ink-2);
  letter-spacing: 0.04em;
}
.acc-settle__horse {
  font-family: "Playfair Display", serif;
  font-size: 16px;
  color: var(--acc-ink);
}
.acc-settle__odds {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--acc-sage-deep);
}
.acc-settle__result {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  text-align: right;
  color: var(--acc-ink-3);
}
.acc-settle__leg.is-won  .acc-settle__result { color: var(--acc-sage-deep); }
.acc-settle__leg.is-lost .acc-settle__result { color: var(--acc-red); }

.acc-settle__panels {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 88px;
}
.acc-settle__panel {
  padding: 18px 20px;
  background: #FDFAF3;
  border: 1px solid var(--acc-hair-strong);
  border-left: 3px solid var(--acc-sage-deep);
  border-radius: 4px;
  display: grid;
  gap: 8px;
}
.acc-settle__panel--luck { border-left-color: var(--acc-gold); }
.acc-settle__panel-lbl {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--acc-ink-3);
}
.acc-settle__panel-val {
  font-family: "Playfair Display", serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--acc-sage-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color 320ms ease;
}
.acc-settle__panel--luck .acc-settle__panel-val { color: #8b7420; }
.acc-settle__panel.is-dead .acc-settle__panel-val { color: var(--acc-red); }
.acc-settle__panel-note {
  font-family: "IBM Plex Serif", serif;
  font-style: italic;
  font-size: 13px;
  color: var(--acc-ink-2);
  min-height: 1.6em;
}

/* ═════════════════════════════════════════════════════════
 *  Act 8 · Catch-outs (numbered tiles)
 * ═════════════════════════════════════════════════════════ */

.acc-catchouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}
@media (max-width: 720px) {
  .acc-catchouts { grid-template-columns: 1fr; }
}
.acc-catchout {
  padding: 22px 24px;
  background: #FDFAF3;
  border: 1px solid var(--acc-hair);
  border-radius: 6px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 6px 18px;
  align-items: baseline;
}
.acc-catchout__num {
  grid-row: span 2;
  font-family: "Playfair Display", serif;
  font-size: 34px;
  font-weight: 700;
  color: var(--acc-sage);
  line-height: 1;
}
.acc-catchout__h {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--acc-ink);
}
.acc-catchout__p {
  margin: 0;
  grid-column: 2;
  font-family: "IBM Plex Serif", serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--acc-ink-2);
}

/* ═════════════════════════════════════════════════════════
 *  Act 9 · Variance (Monte Carlo histograms, night stage)
 * ═════════════════════════════════════════════════════════ */

.acc-variance {
  max-width: 1100px;
  margin: 0 auto;
}
.acc-variance__panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
@media (max-width: 900px) {
  .acc-variance__panes { grid-template-columns: 1fr; }
}
.acc-variance__pane {
  padding: 24px 24px 20px;
  background: rgba(232, 223, 200, 0.06);
  border: 1px solid rgba(232, 223, 200, 0.16);
  border-radius: 8px;
}
.acc-variance__head { margin-bottom: 18px; }
.acc-variance__lbl {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232, 223, 200, 0.55);
}
.acc-variance__ttl {
  margin: 4px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--acc-night-ink);
  line-height: 1.2;
}

.acc-hist {
  padding: 12px 6px 4px;
  background: rgba(232, 223, 200, 0.04);
  border-radius: 4px;
}
.acc-hist__svg { width: 100%; height: 180px; display: block; }
/* Horizontal baseline at the foot of the histogram. */
.acc-hist__zero { stroke: rgba(232, 223, 200, 0.20); stroke-width: 1; }
/* Vertical dashed line at the £0 P/L boundary — the reader's
 * eye should rest on this to sort losing weeks from winning ones. */
.acc-hist__breakeven {
  stroke: var(--acc-gold);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  opacity: 0.75;
}
/* Axis labels straddle the break-even line at 25 % — the "Loss"
 * label sits in the loss zone (left 25 %), "Profit" in the win
 * zone (right 75 %). */
.acc-hist__axis {
  display: grid;
  grid-template-columns: 25% 1fr;
  padding: 4px 4px 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 223, 200, 0.55);
}
.acc-hist__axis span:first-child  { text-align: left;  color: rgba(184, 84, 80, 0.75); }
.acc-hist__axis span:last-child   { text-align: right; color: rgba(232, 223, 200, 0.65); }
.acc-hist__bar {
  fill: var(--acc-sage);
  transition: opacity 200ms ease;
}
.acc-hist__bar--luck { fill: var(--acc-gold); }
/* Losing-week bars in either series render in a muted red tint —
 * the eye reads them as "these Saturdays cost you money" without
 * a legend. */
.acc-hist__bar--loss {
  fill: var(--acc-red);
  fill-opacity: 0.55;
}
.acc-hist__bar--luck.acc-hist__bar--loss {
  fill: var(--acc-red);
  fill-opacity: 0.55;
}

.acc-variance__stats {
  list-style: none;
  margin: 16px 0 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.acc-variance__stats li {
  padding: 10px 12px;
  background: rgba(232, 223, 200, 0.06);
  border-radius: 4px;
  display: grid;
  gap: 4px;
}
.acc-variance__stats em {
  font-style: normal;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(232, 223, 200, 0.55);
}
.acc-variance__stats b {
  font-family: "Playfair Display", serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--acc-night-ink);
  font-variant-numeric: tabular-nums;
}

.acc-variance__meta {
  margin: 22px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.10em;
  color: rgba(232, 223, 200, 0.55);
  text-align: center;
}
.acc-variance__meta-sep { margin: 0 8px; opacity: 0.5; }

/* ═════════════════════════════════════════════════════════
 *  Reusable primitives (used across multiple acts)
 * ═════════════════════════════════════════════════════════ */

/* Horse card — a coupon row rendered as a floating card.
 * Silks left, name + meta middle, odds right. */
.acc-horse {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--acc-paper-2);
  border: 1px solid var(--acc-hair-strong);
  border-radius: 6px;
  padding: 12px 18px;
  box-shadow: 0 2px 10px rgba(31, 42, 36, 0.05);
}
.acc-horse__silk {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--s1, var(--acc-sage)) 50%, var(--s2, var(--acc-paper)) 50%);
  border: 2px solid var(--acc-paper);
  box-shadow: 0 0 0 1px var(--acc-hair-strong);
}
.acc-horse__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.acc-horse__name {
  font-family: "Playfair Display", "IBM Plex Serif", serif;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--acc-ink);
}
.acc-horse__meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--acc-ink-3);
}
.acc-horse__odds {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
}
.acc-horse__frac {
  font-size: 20px;
  font-weight: 700;
  font-style: normal;
  color: var(--acc-sage-deep);
}
.acc-horse__dec {
  font-size: 11px;
  font-style: normal;
  color: var(--acc-ink-3);
}

/* Stake chip — the little "£1 stake" pill that drops onto cards. */
.acc-stake-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--acc-sage-deep);
  color: var(--acc-paper);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  margin: 18px auto;
}
.acc-stake-chip em {
  font-style: normal;
  opacity: 0.75;
}
.acc-stake-chip strong {
  font-family: "Playfair Display", serif;
  font-size: 18px;
  font-weight: 700;
}

/* Calculator tape — Plex Mono running total */
.acc-tape {
  margin: 20px auto 0;
  max-width: 520px;
  padding: 18px 22px;
  background: #FDFAF3;
  border: 1px solid var(--acc-hair-strong);
  border-left: 3px solid var(--acc-sage-deep);
  border-radius: 4px;
  font-family: "IBM Plex Mono", monospace;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: var(--acc-ink);
}
.acc-tape--tall { padding: 22px 26px; gap: 10px; }
.acc-tape__title {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc-ink-3);
}
.acc-tape__line { font-size: 14px; }
.acc-tape__line em { font-style: normal; color: var(--acc-sage-deep); }
.acc-tape__seq {
  font-size: 15px;
  color: var(--acc-ink-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.acc-tape__eq   { color: var(--acc-ink-3); font-size: 13px; }
.acc-tape__out {
  font-family: "Playfair Display", serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--acc-sage-deep);
  font-variant-numeric: tabular-nums;
}
.acc-tape__out--big { font-size: 42px; }

.acc-caption {
  margin: 24px auto 0;
  max-width: 520px;
  font-family: "IBM Plex Serif", serif;
  font-style: italic;
  font-size: 15px;
  color: var(--acc-ink-2);
  line-height: 1.6;
  text-align: left;
}

/* ═════════════════════════════════════════════════════════
 *  Act 1 · Single (single horse card + stake + tape)
 * ═════════════════════════════════════════════════════════ */

.acc-single {
  max-width: 620px;
  margin: 0 auto;
  padding: 32px 28px;
  border: 1px solid var(--acc-hair);
  border-radius: 8px;
  background: rgba(255,255,255,0.35);
  text-align: center;
}
.acc-single .acc-horse { max-width: 460px; margin: 0 auto; }

/* ═════════════════════════════════════════════════════════
 *  Act 2 · Multiplier (wrong-math + domino + right-math)
 * ═════════════════════════════════════════════════════════ */

.acc-multiplier {
  max-width: 780px;
  margin: 0 auto;
  display: grid;
  gap: 28px;
}
.acc-mult__op { color: var(--acc-ink-3); }

.acc-mult__stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}
.acc-horse--m { max-width: 260px; }
.acc-mult__flow {
  position: relative;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.acc-mult__coin {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 16px;
  background: var(--acc-sage-deep);
  color: var(--acc-paper);
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  transform: translateX(0);
}
.acc-mult__coin strong {
  font-family: "Playfair Display", serif;
  font-size: 22px;
  line-height: 1;
}
.acc-mult__coin em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.10em;
  opacity: 0.85;
}

/* Two-row contrast card — the intuitive additive answer sits
 * directly above the multiplicative one so the operator swap
 * (+ vs ×) and the payoff (£9 vs £24) both land in a single
 * glance. Replaces the previous strike-through-plus-result pair
 * that read as a design bug more than a lesson. */
.acc-mult__contrast {
  padding: 22px 24px;
  border: 1px solid var(--acc-hair-strong);
  border-radius: 8px;
  background: rgba(232, 223, 200, 0.35);
  display: grid;
  gap: 12px;
}
.acc-mult__crow {
  display: grid;
  grid-template-columns: auto auto 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 6px;
  font-family: "IBM Plex Mono", monospace;
}
.acc-mult__crow--wrong {
  background: rgba(184, 84, 80, 0.06);
  border: 1px solid rgba(184, 84, 80, 0.30);
}
.acc-mult__crow--right {
  background: rgba(125, 144, 128, 0.09);
  border: 1px solid var(--acc-sage);
}
.acc-mult__chip {
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--acc-paper);
  line-height: 1;
}
.acc-mult__chip--wrong { background: var(--acc-red); }
.acc-mult__chip--right { background: var(--acc-sage-deep); }
.acc-mult__crow-lbl {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--acc-ink-2);
}
.acc-mult__crow--wrong .acc-mult__crow-lbl { color: var(--acc-red); }
.acc-mult__crow--right .acc-mult__crow-lbl { color: var(--acc-sage-deep); }
.acc-mult__crow-eq {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 18px;
  color: var(--acc-ink);
}
.acc-mult__crow-eq em { font-style: normal; font-weight: 700; }
.acc-mult__crow-arrow {
  color: var(--acc-ink-3);
  font-size: 16px;
  text-align: center;
}
.acc-mult__crow-pay {
  font-size: 13px;
  color: var(--acc-ink-2);
  text-align: right;
}
.acc-mult__crow-pay strong {
  font-family: "Playfair Display", serif;
  font-size: 24px;
  color: var(--acc-ink);
  font-variant-numeric: tabular-nums;
  margin-right: 3px;
}
.acc-mult__crow--wrong .acc-mult__crow-pay strong { color: var(--acc-red); }
.acc-mult__crow--right .acc-mult__crow-pay strong { color: var(--acc-sage-deep); }
.acc-mult__contrast-foot {
  margin: 4px 0 0;
  padding-top: 6px;
  font-family: "IBM Plex Serif", serif;
  font-style: italic;
  font-size: 14px;
  color: var(--acc-ink-2);
  text-align: center;
}
@media (max-width: 640px) {
  .acc-mult__crow {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "chip label"
      "eq   eq"
      "pay  pay";
    gap: 6px 12px;
  }
  .acc-mult__crow > .acc-mult__chip       { grid-area: chip; }
  .acc-mult__crow > .acc-mult__crow-lbl   { grid-area: label; align-self: center; }
  .acc-mult__crow > .acc-mult__crow-eq    { grid-area: eq; margin-top: 6px; }
  .acc-mult__crow > .acc-mult__crow-arrow { display: none; }
  .acc-mult__crow > .acc-mult__crow-pay   { grid-area: pay; text-align: left; }
}

/* ═════════════════════════════════════════════════════════
 *  Act 3 · Six-timer (coupon strip + big total)
 * ═════════════════════════════════════════════════════════ */

.acc-sixtimer {
  max-width: 780px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

.acc-coupon {
  list-style: none;
  margin: 0; padding: 0;
  border: 1px solid var(--acc-hair-strong);
  border-radius: 8px;
  background: #FDFAF3;
  box-shadow: 0 4px 22px rgba(31, 42, 36, 0.06);
  overflow: hidden;
}
.acc-coupon__row {
  display: grid;
  grid-template-columns: 32px 32px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px dashed var(--acc-hair);
  transform-origin: left center;
}
.acc-coupon__row:first-child { border-top: 0; }
.acc-coupon__seq {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--acc-ink-3);
  text-align: center;
}
.acc-coupon__silk {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--s1) 50%, var(--s2) 50%);
  border: 1.5px solid var(--acc-paper);
  box-shadow: 0 0 0 1px var(--acc-hair-strong);
}
.acc-coupon__name {
  font-family: "Playfair Display", serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--acc-ink);
}
.acc-coupon__meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--acc-ink-3);
  letter-spacing: 0.04em;
}
.acc-coupon__odds {
  font-family: "IBM Plex Mono", monospace;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
}
.acc-coupon__odds em { font-style: normal; font-size: 14px; font-weight: 700; color: var(--acc-sage-deep); }
.acc-coupon__odds b  { font-weight: 400; font-size: 10.5px; color: var(--acc-ink-3); }

.acc-coupon__foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}
.acc-coupon__warn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: rgba(184, 84, 80, 0.06);
  border: 1px solid var(--acc-red);
  border-radius: 4px;
}
.acc-coupon__warn-glyph {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--acc-red);
  color: var(--acc-paper);
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.acc-coupon__warn-txt {
  font-family: "IBM Plex Serif", serif;
  font-size: 14px;
  color: var(--acc-ink);
  line-height: 1.5;
}
.acc-coupon__warn-txt strong { color: var(--acc-red); }

@media (max-width: 720px) {
  .acc-coupon__row { grid-template-columns: 28px 28px 1fr auto; }
  .acc-coupon__meta { grid-column: 3 / span 1; font-size: 10.5px; }
  .acc-coupon__foot { grid-template-columns: 1fr; }
}

/* ═════════════════════════════════════════════════════════
 *  Act 4 · Combinations grid (6×6 SVG + tallies)
 * ═════════════════════════════════════════════════════════ */

.acc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) {
  .acc-grid { grid-template-columns: 1fr; }
}

.acc-grid__stage {
  padding: 18px 20px;
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--acc-hair);
  border-radius: 8px;
  min-height: 420px;
}
.acc-grid__svg { width: 100%; height: auto; display: block; }
.acc-grid__k-lbl {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  fill: var(--acc-ink-3);
  letter-spacing: 0.10em;
}
.acc-grid__cell {
  transition: fill 320ms ease, stroke 320ms ease;
}
.acc-grid__cell.is-lit[data-k="2"] { fill: rgba(125, 144, 128, 0.22); stroke: var(--acc-sage); }
.acc-grid__cell.is-lit[data-k="3"] { fill: rgba(201, 184, 122, 0.22); stroke: var(--acc-gold); }
.acc-grid__cell.is-lit[data-k="4"] { fill: rgba(78, 99, 85, 0.22);    stroke: var(--acc-sage-deep); }
.acc-grid__cell.is-lit[data-k="5"] { fill: rgba(31, 42, 36, 0.16);    stroke: var(--acc-ink); }
.acc-grid__cell.is-lit[data-k="6"] { fill: rgba(201, 184, 122, 0.55); stroke: var(--acc-gold); }

.acc-grid__tallies {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.acc-grid__list {
  list-style: none;
  margin: 0; padding: 0;
  border: 1px solid var(--acc-hair);
  border-radius: 6px;
  overflow: hidden;
  background: #FDFAF3;
}
.acc-grid__row {
  display: grid;
  grid-template-columns: 90px auto 1fr;
  align-items: baseline;
  padding: 12px 16px;
  border-top: 1px dashed var(--acc-hair);
  transition: background 220ms ease;
}
.acc-grid__row:first-child { border-top: 0; }
.acc-grid__row.is-lit { background: rgba(125, 144, 128, 0.10); }
.acc-grid__k {
  font-family: "Playfair Display", serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--acc-ink);
}
.acc-grid__c {
  font-family: "IBM Plex Mono", monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--acc-sage-deep);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}
.acc-grid__form {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--acc-ink-3);
  text-align: right;
  padding-left: 12px;
}

.acc-grid__total {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  background: var(--acc-sage-deep);
  color: var(--acc-paper);
  border-radius: 6px;
}
.acc-grid__total-lbl {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.10em;
  opacity: 0.85;
}
.acc-grid__total-num {
  font-family: "Playfair Display", serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}
.acc-grid__total-num em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.acc-grid__total-hint {
  font-family: "IBM Plex Serif", serif;
  font-style: italic;
  font-size: 13px;
  opacity: 0.88;
}
.acc-grid__total-hint b { color: var(--acc-gold); font-weight: 700; }

/* ═════════════════════════════════════════════════════════
 *  Act 5 · Family tree (stacked bar list)
 * ═════════════════════════════════════════════════════════ */

.acc-family {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}
.acc-family__intro p {
  margin: 0;
  font-family: "IBM Plex Serif", serif;
  font-size: 15px;
  color: var(--acc-ink-2);
  line-height: 1.6;
  max-width: 720px;
}
.acc-family__list {
  list-style: none;
  margin: 0; padding: 0;
  border: 1px solid var(--acc-hair);
  border-radius: 8px;
  overflow: hidden;
  background: #FDFAF3;
}
.acc-family__row {
  display: grid;
  grid-template-columns: 140px 100px 1fr 80px;
  grid-template-rows: auto auto;
  column-gap: 16px;
  padding: 14px 20px;
  border-top: 1px dashed var(--acc-hair);
  align-items: center;
}
.acc-family__row:first-child { border-top: 0; }
.acc-family__row--star { background: rgba(201, 184, 122, 0.10); }
.acc-family__name {
  font-family: "Playfair Display", serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--acc-ink);
}
.acc-family__name--lucky { color: var(--acc-sage-deep); }
.acc-family__row--star .acc-family__name { color: var(--acc-ink); }
.acc-family__meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--acc-ink-3);
  letter-spacing: 0.06em;
}
.acc-family__bar {
  height: 8px;
  background: var(--acc-hair);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.acc-family__bar em {
  display: block;
  height: 100%;
  width: var(--pct);
  background: var(--acc-sage);
  border-radius: 999px;
  transform-origin: left center;
  transform: scaleX(0);
}
.acc-family__row--star .acc-family__bar em { background: var(--acc-gold); }
.acc-family__lines {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--acc-ink-2);
}
.acc-family__lines em {
  font-style: normal;
  font-size: 20px;
  font-weight: 700;
  color: var(--acc-ink);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}
.acc-family__mix {
  grid-column: 1 / -1;
  padding-top: 4px;
  font-family: "IBM Plex Serif", serif;
  font-style: italic;
  font-size: 13px;
  color: var(--acc-ink-3);
}
.acc-family__mix b { font-style: normal; color: var(--acc-sage-deep); font-weight: 700; }

.acc-family__answer {
  margin: 4px 0 0;
  padding: 20px 22px;
  background: var(--acc-sage-deep);
  color: var(--acc-paper);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.acc-family__answer-k {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.88;
}
.acc-family__answer-v {
  font-family: "Playfair Display", serif;
  font-size: 24px;
  font-weight: 700;
}
.acc-family__answer-v strong { color: var(--acc-gold); }

@media (max-width: 720px) {
  .acc-family__row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    row-gap: 6px;
  }
  .acc-family__meta { text-align: right; }
  .acc-family__bar { grid-column: 1 / -1; }
  .acc-family__lines { grid-column: 1 / -1; text-align: left; }
}

/* ── Variance punchline (Act 9 night stage) ────────────────
 * A single-sentence landing after the two histograms. This is
 * the essay's thesis, so it earns oversized display weight and
 * gold ink against the bottle-green ground. */

.acc-variance__punch {
  margin: 26px auto 0;
  max-width: 780px;
  padding: 22px 28px 0;
  border-top: 1px solid rgba(232, 223, 200, 0.16);
  color: var(--acc-night-ink);
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 3.4vw, 32px);
  font-weight: 700;
  font-style: italic;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-align: center;
  text-wrap: balance;
}
.acc-variance__punch::first-letter {
  color: var(--acc-gold);
}

/* ── Wrap-up card ──────────────────────────────────────────
 * Not a chapter — a receipt. Deliberately grounded on the
 * lecture-hall linen so it reads as "class is over" rather
 * than "another act." Sage rule, bottle-green ink, gold ticks. */

.acc-wrapup {
  padding: 96px 24px 128px;
  background: var(--acc-paper);
  border-top: 1px solid var(--acc-hair);
}
.acc-wrapup .pw-cine__inner {
  max-width: 720px;
  margin: 0 auto;
}
.acc-wrapup__eyebrow {
  margin: 0 0 12px;
  color: var(--acc-sage-deep);
  font-family: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.acc-wrapup__h {
  margin: 0 0 32px;
  color: var(--acc-ink);
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.acc-wrapup__list {
  list-style: none;
  margin: 0 0 40px;
  padding: 0;
  display: grid;
  gap: 14px;
}
.acc-wrapup__list li {
  position: relative;
  padding: 12px 16px 12px 44px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--acc-hair);
  border-radius: 6px;
  color: var(--acc-ink);
  font-size: 17px;
  line-height: 1.4;
}
.acc-wrapup__list li::before {
  content: "✓";
  position: absolute;
  left: 16px;
  top: 12px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--acc-gold);
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.acc-wrapup__next {
  margin: 0;
  padding-top: 24px;
  border-top: 1px solid var(--acc-hair);
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.acc-wrapup__next-lbl {
  color: var(--acc-sage-deep);
  font-family: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.acc-wrapup__next-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--acc-sage);
  border-radius: 999px;
  color: var(--acc-sage-deep);
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.75;
  cursor: default;
}

@media (max-width: 560px) {
  .acc-wrapup { padding: 64px 20px 96px; }
  .acc-wrapup__list li { font-size: 15px; padding-left: 40px; }
}

/* Reduced motion — the shell short-circuits animations, but
 * the paper vignette + grain should also stop pulsing. */
@media (prefers-reduced-motion: reduce) {
  .acc-paper__grain,
  .acc-paper__vignette {
    animation: none;
  }
}
