/* styles.css — wolfpeachlabs "inhabited-design" paper/ledger theme
   warm paper ground · ink + ochre seam · diff-green pass · seal-red marker
   Authentic Sans + Departure Mono · hairline-rule cards, near-flat */

@font-face { font-family: "Authentic Sans"; src: url("fonts/AuthenticSans-90.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Authentic Sans"; src: url("fonts/AuthenticSans-130.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Authentic Sans Cond"; src: url("fonts/AuthenticSans-60.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Departure Mono"; src: url("fonts/DepartureMono-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --bg: #f4f1ea;              /* paper */
  --paper-2: #efeae0;
  --paper-3: #e7e1d4;
  --panel: #faf7f0;           /* cards lift a touch off the paper */
  --ink: #1c1a17;
  --ink-soft: #46423b;
  --muted: #6d685e;
  --line: #cdc6b7;
  --line-strong: #bcb4a2;
  --accent: #8a5d18;          /* seam ochre — the single highlight: sampled pick + live trunk */
  --accent-bright: #b8842e;
  --accent-soft: #efe5d0;     /* pale ochre wash */
  --seal: #a8302a;            /* wax-seal red — locked stamp + brief-conditioned marker */
  --brief: #a8302a;           /* brief-conditioned (vs framing-conditioned) */
  --brief-soft: #f0dedd;
  --good: #2f5121;            /* diff-add green — pass / cleared / converged */
  --good-soft: #e2ead9;
  --code-bg: #e7e1d4;         /* light paper code block (no dark terminal) */
  --code-ink: #2b2722;
  --code-accent: #8a5d18;
  --code-cm: #8f897a;
  --radius: 5px;
  --shadow: 0 1px 1px rgba(28,26,23,.03), 0 1px 3px rgba(28,26,23,.05);
  --mono: "Departure Mono", ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  --sans: "Authentic Sans", "Authentic Sans Cond", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1320px; margin: 0 auto; padding: 18px 22px 28px; }

/* ---- masthead -------------------------------------------------------- */
.masthead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.masthead h1 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.masthead .sub { color: var(--muted); font-size: 12.5px; }
.masthead .sub b { color: var(--ink-soft); font-weight: 600; }

/* ---- brief bar ------------------------------------------------------- */
.brief {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin: 12px 0 14px; box-shadow: var(--shadow);
  font-size: 12.5px;
}
.brief .k { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; font-weight: 600; align-self: center; }
.brief .v { color: var(--ink-soft); }
.brief .v b { color: var(--ink); font-weight: 600; }

/* ---- step rail ------------------------------------------------------- */
.rail { display: flex; align-items: stretch; gap: 0; margin-bottom: 14px; }
.rail .step {
  flex: 1; position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 11px 8px; cursor: pointer; min-width: 0;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.rail .step + .step { margin-left: 18px; }
.rail .step::before {                       /* connector arrow */
  content: "›"; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  color: var(--line-strong); font-size: 16px; font-weight: 700;
}
.rail .step:first-child::before { content: ""; }
.rail .step:hover { border-color: var(--line-strong); }
.rail .step.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rail .step.done .num { background: var(--good); color: #fff; border-color: var(--good); }
.rail .step .top { display: flex; align-items: center; gap: 7px; }
.rail .step .num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; font-family: var(--mono);
  font-size: 11px; font-weight: 600; color: var(--ink-soft); background: var(--paper-3); border: 1px solid var(--line);
}
.rail .step .name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .step .cond { margin-top: 5px; font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.rail .step .cond .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.rail .step .cond.brief .dot { background: var(--brief); }
.rail .step .master { margin-left: auto; font-size: 9px; font-weight: 700; letter-spacing: .07em; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 1px 4px; }

.legend-cond { display: flex; gap: 16px; font-size: 11px; color: var(--muted); margin: -6px 0 14px 2px; }
.legend-cond span { display: inline-flex; align-items: center; gap: 6px; }
.legend-cond i { width: 18px; height: 0; border-top: 2px solid var(--accent); display: inline-block; }
.legend-cond i.brief { border-top-style: dashed; border-color: var(--brief); }

/* ---- main grid ------------------------------------------------------- */
.main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 16px; align-items: start; }

.stage-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; position: relative; }
.stage { position: relative; width: 100%; }
.stage svg { display: block; width: 100%; height: auto; }
.stage canvas { position: absolute; left: 0; top: 0; pointer-events: none; }

/* svg element styling */
.cand { cursor: pointer; transition: opacity .35s; }
.cand circle { stroke: var(--bg); stroke-width: 1; transition: r .25s, opacity .35s; }
.cand.dim { opacity: .16; }
.cand.pick circle { stroke: var(--accent); stroke-width: 2.5; }
.grp-label { font-size: 9.5px; fill: var(--muted); font-family: var(--sans); }
.link { fill: none; stroke: var(--line-strong); stroke-width: 1; opacity: .5; transition: opacity .4s, stroke .4s; }
.link.dim { opacity: .07; }
.link.live { stroke: var(--accent); opacity: .8; stroke-width: 1.5; }
.gate rect { fill: var(--paper-2); stroke: var(--line-strong); stroke-width: 1.2; transition: stroke .3s, fill .3s; }
.gate.hot rect { stroke: var(--accent); fill: var(--accent-soft); }
.gate .glabel { font-size: 11px; font-weight: 600; fill: var(--ink-soft); font-family: var(--sans); }
.gate .gsub { font-size: 10px; fill: var(--muted); font-family: var(--mono); }
.gate .badge { font-size: 10px; font-weight: 700; fill: var(--good); font-family: var(--mono); }
.pick-node circle { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.pick-node text { font-family: var(--mono); font-size: 11px; font-weight: 700; fill: #fff; }
.pick-cap { font-size: 11px; font-weight: 600; fill: var(--ink); font-family: var(--sans); }
.axis-note { font-size: 10px; fill: var(--muted); font-family: var(--sans); }

/* tooltip */
.tip {
  position: fixed; z-index: 40; max-width: 300px; pointer-events: none; opacity: 0;
  background: var(--ink); color: var(--bg); border-radius: 6px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.28); transition: opacity .12s; line-height: 1.45;
}
.tip .tlabel { font-weight: 650; margin-bottom: 3px; }
.tip .tgrp { font-family: var(--mono); font-size: 10px; color: var(--accent-bright); text-transform: uppercase; letter-spacing: .05em; }
.tip .treason { color: #cbc3b4; }

/* ---- detail panel ---------------------------------------------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.panel h2 { font-size: 15px; margin: 0 0 2px; letter-spacing: -.01em; }
.panel .pnum { font-family: var(--mono); color: var(--muted); font-size: 11px; }
.cond-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; border-radius: 5px; padding: 2px 8px; margin: 8px 0 2px; }
.cond-badge.framing { background: var(--accent-soft); color: var(--accent); }
.cond-badge.brief { background: var(--brief-soft); color: var(--brief); }
.cond-note { color: var(--ink-soft); font-size: 12.5px; margin: 8px 0 14px; }

/* original-prompt callout (Framing / steps 2–4) */
.prompt-origin { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; margin: 11px 0 4px; }
.po-label { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--code-accent); margin-bottom: 6px; }
.po-text { font-size: 14px; color: var(--ink); line-height: 1.4; font-weight: 500; }
.po-flow { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 8px; }

.sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.sec .lab { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.sec .lab .count { font-family: var(--mono); color: var(--ink-soft); background: var(--paper-3); border-radius: 4px; padding: 1px 6px; font-weight: 600; letter-spacing: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-soft); background: var(--paper-2); border: 1px solid var(--line); border-radius: 20px; padding: 2px 8px 2px 6px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.gate-note { font-size: 12px; color: var(--ink-soft); }
.gate-note .surv { color: var(--good); font-weight: 700; font-family: var(--mono); }

.code {
  font-family: var(--mono); font-size: 11px; background: var(--code-bg); color: var(--code-ink);
  border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; overflow-x: auto; white-space: pre; line-height: 1.5;
}
.code .cm { color: var(--code-cm); }
.seedline { font-family: var(--mono); font-size: 12.5px; margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.seedline .row { display: flex; gap: 8px; align-items: baseline; }
.seedline .key { color: var(--muted); }
.seedline .seed { color: var(--ink); font-weight: 600; }
.seedline .picks { color: var(--accent); font-weight: 700; }

.pickcard { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 9px 11px; margin-top: 9px; background: #faf6ec; }
.pickcard .pidx { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--accent); }
.pickcard .plabel { font-weight: 650; font-size: 13px; margin: 1px 0; }
.pickcard .psub { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.pickcard .pjust { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }

/* also-ran (what was NOT sampled) */
.alsoran-list { display: flex; flex-direction: column; gap: 8px; }
.ar { display: flex; align-items: flex-start; gap: 8px; }
.ar-idx { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--muted); flex: none; min-width: 24px; padding-top: 1px; }
.ar > i { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 4px; opacity: .85; }
.ar-body { min-width: 0; }
.ar-lab { font-size: 12px; color: var(--ink-soft); line-height: 1.35; }
.ar-grp { font-size: 10px; color: var(--muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.ar-note { font-size: 11px; color: var(--muted); margin-top: 9px; font-style: italic; }
/* keep the 3 also-ran dots legible above the fully-dimmed rejects */
.cand.dim.alsoran { opacity: .6; }
.cand.alsoran circle { stroke: var(--muted); stroke-width: 1.8; stroke-dasharray: 2.5 2; }

/* ---- controls -------------------------------------------------------- */
.controls { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--paper-3); border: 1px solid var(--line-strong); border-radius: 5px;
  padding: 8px 14px; cursor: pointer; transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent); color: #fff; }
.dots { display: flex; gap: 7px; margin: 0 4px; }
.dots .d { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); cursor: pointer; transition: background .15s, transform .15s; }
.dots .d.active { background: var(--accent); transform: scale(1.25); }
.dots .d.done { background: var(--good); }
.controls .spacer { flex: 1; }
.controls .hint { font-size: 11.5px; color: var(--muted); }
.controls .hint kbd { font-family: var(--mono); font-size: 10.5px; background: var(--paper-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

/* ---- outcome card ---------------------------------------------------- */
.outcome { text-align: center; padding: 40px 24px; }
.outcome .o-eyebrow { font-size: 11px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-weight: 700; }
.outcome h2 { font-size: 22px; margin: 8px 0 6px; letter-spacing: -.02em; }
.outcome .voice { font-family: var(--mono); color: var(--accent); font-size: 14px; letter-spacing: .04em; margin-bottom: 14px; }
.outcome p { max-width: 620px; margin: 0 auto 18px; color: var(--ink-soft); }
.outcome a.cta { display: inline-block; background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 600; padding: 10px 18px; border-radius: 6px; }
.outcome a.cta:hover { background: var(--accent); }
.outcome .o-chain { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 22px auto 0; max-width: 720px; }
.outcome .o-chain .c { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); background: var(--paper-2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; }
.outcome .o-chain .arr { color: var(--line-strong); }

.reduced-note { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ===== new-phase: rail dot colors for bank / loop kinds ================= */
.rail .step .cond.bank .dot { background: var(--accent); }
.rail .step .cond.loop .dot { background: var(--good); }
.cond-badge.bank { background: var(--accent-soft); color: var(--accent); }
.cond-badge.loop { background: var(--good-soft); color: var(--good); }

/* ===== BANK scene (inspiration bank) =================================== */
.bank-wrap { padding: 14px 16px 18px; }
.bank-head { margin-bottom: 12px; }
.bank-eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--accent); }
.bank-sub { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }
.bank-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
.bank-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }
.bank-card { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); cursor: pointer; opacity: 0; transform: translateY(8px); animation: bankIn .45s ease forwards; animation-delay: var(--d, 0ms); transition: border-color .14s, box-shadow .14s, transform .1s; }
.bank-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(138,93,24,.16); }
.bank-card:active { transform: scale(.99); }
.bank-card.fill { border-style: dashed; border-color: var(--line-strong); }
@keyframes bankIn { to { opacity: 1; transform: none; } }
.bank-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--ink); overflow: hidden; }
.bank-thumb::after { content: "⤢"; position: absolute; bottom: 6px; right: 6px; font-size: 12px; line-height: 1; color: #fff; background: rgba(28,26,23,.62); padding: 3px 5px; border-radius: 5px; opacity: 0; transition: opacity .14s; }
.bank-card:hover .bank-thumb::after { opacity: 1; }
.bank-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bank-card figcaption { padding: 7px 9px 8px; }
.bc-src { font-size: 11.5px; font-weight: 650; color: var(--ink); line-height: 1.25; }
.bc-role { font-size: 10px; font-family: var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.anchor-list { display: flex; flex-direction: column; gap: 9px; }
.anchor .an-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.anchor .an-top b { font-size: 12px; }
.an-role { font-size: 9.5px; font-family: var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.an-move { font-size: 11.5px; color: var(--ink-soft); line-height: 1.4; }

/* ===== LOOP scene (critic bars / ICP radar) — SVG element styling ====== */
.grid-line { stroke: var(--line); stroke-width: 1; }
.target-line { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 5 4; opacity: .65; }
.tick-label { font-size: 10px; fill: var(--muted); font-family: var(--mono); }
.target-label { font-size: 10px; fill: var(--accent); font-family: var(--sans); font-weight: 600; }
.bar-flabel { font-size: 11px; fill: var(--ink-soft); font-family: var(--sans); }
.bar-val { font-size: 14px; font-weight: 700; font-family: var(--mono); }
.radar-ring { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-ring.outer { stroke: var(--line-strong); }
.radar-spoke { stroke: var(--line); stroke-width: 1; }
.radar-flabel { font-size: 11px; fill: var(--ink-soft); font-family: var(--sans); }
.radar-poly { stroke-width: 2; transition: none; }
.gates-title { font-size: 10.5px; font-weight: 700; fill: var(--muted); font-family: var(--sans); letter-spacing: .05em; }
.gate-card { fill: var(--paper-2); stroke: var(--line); stroke-width: 1; }
.gate-name { font-size: 12.5px; fill: var(--ink-soft); font-family: var(--sans); }
.gate-stat { font-size: 12px; font-weight: 700; font-family: var(--mono); }
.thumb-frame { fill: var(--ink); stroke: var(--line-strong); stroke-width: 1; }
.thumb-cap { font-size: 11px; fill: var(--muted); font-family: var(--mono); }
.thumb-badge { font-size: 11px; font-weight: 700; font-family: var(--mono); }
.thumb-zoom { font-size: 15px; fill: var(--accent-bright); font-family: var(--mono); }
.thumb-hint { font-size: 10.5px; fill: var(--accent); font-family: var(--mono); letter-spacing: .02em; }
.thumb-frame, .thumb-img, .thumb-zoom { transition: opacity .12s; }
.thumb-frame:hover, .thumb-img:hover, .thumb-zoom:hover { opacity: .88; }
.cycle-title { font-size: 15px; font-weight: 700; font-family: var(--sans); fill: var(--ink); letter-spacing: -.01em; }
.cycle-title.ok { fill: var(--good); }

/* loop panel: per-cycle rows */
.cyc .scorewrap { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0 8px; }
.sc { font-size: 10.5px; color: var(--ink-soft); background: var(--paper-2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.sc b { font-family: var(--mono); color: var(--ink); margin-left: 2px; }
.sc.ten { border-color: var(--good); background: var(--good-soft); }
.sc.ten b { color: var(--good); }
.gate-pill { font-family: var(--mono); font-size: 9.5px; font-weight: 700; border-radius: 4px; padding: 1px 6px; letter-spacing: .03em; }
.gate-pill.fail { color: var(--brief); background: var(--brief-soft); }
.gate-pill.ok { color: #fff; background: var(--good); }
.cyc-head { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
.cyc-meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; font-family: var(--mono); }
.cyc-meta .ok { color: var(--good); }
.cyc-quote { font-size: 12px; color: var(--ink); font-style: italic; margin-top: 7px; border-left: 2px solid var(--line-strong); padding-left: 9px; line-height: 1.45; }
.cyc.cleared .cyc-quote { border-left-color: var(--good); }
.cyc-rebuild { margin: 7px 0 0; padding-left: 16px; font-size: 11.5px; color: var(--ink-soft); }
.cyc-rebuild li { margin: 2px 0; }

/* collapsible persona summary (designer on step 12, ICP on step 14) */
.persona { border: 1px solid var(--line); border-radius: 6px; margin: 11px 0 4px; background: var(--panel); }
.persona > summary { cursor: pointer; padding: 8px 11px; font-size: 12px; font-weight: 650; color: var(--ink); list-style: none; display: flex; align-items: center; gap: 8px; }
.persona > summary::-webkit-details-marker { display: none; }
.persona > summary::before { content: "▸"; color: var(--muted); font-size: 10px; flex: none; transition: transform .15s; }
.persona[open] > summary::before { transform: rotate(90deg); }
.persona .psrc { font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 400; margin-left: auto; }
.persona-body { padding: 3px 12px 11px; border-top: 1px solid var(--line); }
.prow { display: flex; gap: 10px; padding: 6px 0; font-size: 11.5px; }
.prow + .prow { border-top: 1px dashed var(--line); }
.pk { flex: none; width: 72px; color: var(--muted); font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.pv { color: var(--ink-soft); line-height: 1.42; }

/* lightbox — expandable reference image + borrow/diverge note */
.lightbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(28,26,23,.72); }
.lb-card { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr 1fr; max-width: 940px; width: min(92vw, 940px); max-height: 86vh; background: var(--panel); border-radius: 8px; overflow: hidden; box-shadow: 0 24px 70px rgba(28,26,23,.42); }
.lb-img { background: var(--ink); display: flex; align-items: center; justify-content: center; min-height: 0; }
.lb-img img { width: 100%; height: 100%; max-height: 86vh; object-fit: contain; display: block; }
.lb-info { padding: 24px 26px; overflow-y: auto; }
.lb-verdict { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .07em; padding: 3px 9px; border-radius: 5px; }
.lb-verdict.borrow { background: var(--accent-soft); color: var(--accent); }
.lb-verdict.diverge { background: var(--brief-soft); color: var(--brief); }
.lb-verdict.fill { background: var(--paper-3); color: var(--muted); }
.lb-verdict.pass { background: var(--good-soft); color: var(--good); }
/* iteration switcher inside the enlarged loop view */
.lb-iters { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0 2px; }
.lb-iters:empty { display: none; }
.lb-iter { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); background: var(--paper-2); border: 1px solid var(--line-strong); border-radius: 5px; padding: 3px 10px; cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.lb-iter:hover { border-color: var(--accent); color: var(--accent); }
.lb-iter.done::before { content: "✓ "; color: var(--good); }
.lb-iter.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lb-iter.on.done::before { color: var(--good-soft); }
.lb-src { font-size: 18px; font-weight: 700; margin: 13px 0 3px; letter-spacing: -.01em; }
.lb-role { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-bottom: 15px; }
.lb-detail { font-size: 13.5px; line-height: 1.62; color: var(--ink-soft); }
.lb-close { position: absolute; top: 10px; right: 12px; z-index: 2; width: 30px; height: 30px; border: none; border-radius: 6px; background: rgba(250,247,240,.92); color: var(--ink); font-size: 21px; line-height: 1; cursor: pointer; }
.lb-close:hover { background: var(--panel); }
@media (max-width: 720px) {
  .lb-card { grid-template-columns: 1fr; max-height: 90vh; }
  .lb-img img { max-height: 42vh; }
}

@media (prefers-reduced-motion: reduce) {
  .bank-card { animation: none; opacity: 1; transform: none; }
}

/* ===== COVER / overview ================================================ */
#cover { display: none; }
body.on-cover #cover { display: block; }
body.on-cover .brief,
body.on-cover .legend-cond,
body.on-cover .rail,
body.on-cover .main,
body.on-cover .controls,
body.on-cover .reduced-note { display: none; }

.cover-hero { text-align: center; max-width: 760px; margin: 14px auto 24px; }
.cover-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); font-weight: 700; }
.cover-title { font-size: 29px; line-height: 1.12; letter-spacing: -.02em; margin: 10px 0; }
.cover-lead { font-size: 14px; color: var(--ink-soft); margin: 0 auto 18px; max-width: 650px; line-height: 1.55; }
.cover-lead b { color: var(--ink); }
.cover-begin { font-size: 14px; padding: 11px 20px; }
.cover-flowhint { font-size: 11.5px; color: var(--muted); margin-top: 9px; }

.cover-flow { display: flex; align-items: stretch; justify-content: center; gap: 5px; flex-wrap: wrap; }
.cover-arrow { align-self: center; color: var(--line-strong); font-size: 19px; font-weight: 700; }
.cover-stage { flex: 1 1 178px; max-width: 212px; min-width: 166px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px 15px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s, transform .12s; display: flex; flex-direction: column; }
.cover-stage:hover { border-color: var(--accent); box-shadow: 0 5px 18px rgba(138,93,24,.16); transform: translateY(-2px); }
.cover-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cs-num { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.cs-title { font-size: 13.5px; font-weight: 700; margin: 9px 0 4px; }
.cs-desc { font-size: 11px; color: var(--ink-soft); line-height: 1.42; }

/* shared art frame */
.art { width: 100%; height: 80px; margin-top: 6px; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* prompt */
.art-prompt { flex-direction: column; gap: 6px; padding: 9px 10px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; align-items: stretch; justify-content: center; }
.ap-bar { display: flex; gap: 4px; }
.ap-bar i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.ap-type { font-family: var(--mono); font-size: 9px; color: var(--ink); white-space: nowrap; overflow: hidden; border-right: 2px solid var(--accent); width: 0; animation: typeIn 3.4s steps(26) infinite; }
.ap-line { height: 6px; width: 68%; background: var(--line); border-radius: 3px; }
@keyframes typeIn { 0%{width:0} 50%{width:100%} 90%{width:100%} 100%{width:0} }

/* funnel (frame + brief) */
.af-pool { position: absolute; top: 9px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.af-pool i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); animation: poolFade 2.6s ease-in-out infinite; }
.af-pool i.win { background: var(--accent); animation: none; }
@keyframes poolFade { 0%,12%{opacity:1} 52%,100%{opacity:.16} }
.af-stem { position: absolute; top: 17px; bottom: 19px; left: 50%; width: 1px; background: var(--line-strong); transform: translateX(-.5px); }
.af-drop { position: absolute; left: 50%; top: 7px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--accent); opacity: 0; animation: dropDown 2.6s ease-in-out infinite; }
@keyframes dropDown { 0%,12%{transform:translateY(0); opacity:0} 22%{opacity:1} 58%{transform:translateY(50px); opacity:1} 100%{transform:translateY(50px); opacity:1} }
.af-lock { position: absolute; left: 50%; bottom: 9px; width: 12px; height: 12px; margin-left: -6px; border: 1.5px solid var(--accent); border-radius: 2px; opacity: .25; animation: lockPulse 2.6s ease-in-out infinite; }
@keyframes lockPulse { 0%,52%{opacity:.22; background:transparent} 68%{opacity:1; background:rgba(138,93,24,.22)} 100%{opacity:.55; background:rgba(138,93,24,.12)} }
.art-funnel.brief .af-pool i.win,
.art-funnel.brief .af-drop { background: var(--brief); }
.art-funnel.brief .af-lock { border-color: var(--brief); border-style: dashed; }

/* bank */
.art-bank { gap: 6px; }
.ab-tile { width: 34px; height: 26px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); opacity: 0; animation: tileIn 3s ease-in-out infinite; animation-delay: calc(var(--i) * .35s); }
@keyframes tileIn { 0%{opacity:0; transform:translateY(7px)} 28%,82%{opacity:1; transform:none} 100%{opacity:1} }
.ab-persona { font-family: var(--mono); font-size: 9px; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 2px 5px; opacity: 0; animation: tileIn 3s ease-in-out infinite; animation-delay: 1.25s; }

/* bars (critic) */
.art-bars { align-items: flex-end; gap: 7px; padding-bottom: 13px; }
.art-bars .abr-target { position: absolute; top: 15px; left: 16px; right: 16px; border-top: 1.5px dashed var(--accent); opacity: .55; }
.art-bars i { width: 13px; background: var(--accent); border-radius: 2px 2px 0 0; height: 26%; animation: barRise 2.4s ease-in-out infinite; }
.art-bars i:nth-child(3) { animation-delay: .08s; }
.art-bars i:nth-child(4) { animation-delay: .16s; }
.art-bars i:nth-child(5) { animation-delay: .24s; }
@keyframes barRise { 0%{height:26%} 55%{height:80%} 82%,100%{height:80%} }

/* radar (ICP) */
.art-radar svg { width: 72px; height: 72px; overflow: visible; }
.ar-ring { fill: none; stroke: var(--line-strong); stroke-width: 1.2; }
.ar-fill { fill: rgba(138,93,24,.18); stroke: var(--accent); stroke-width: 1.4; transform-box: fill-box; transform-origin: center; animation: radarFill 2.8s ease-in-out infinite; }
@keyframes radarFill { 0%{transform:scale(.38)} 55%{transform:scale(1)} 100%{transform:scale(.38)} }
.abr-loop { position: absolute; top: 5px; right: 7px; font-size: 12px; color: var(--muted); animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .ap-type { width: 100%; border-right: none; animation: none; }
  .af-pool i { animation: none; opacity: 1; }
  .af-drop { animation: none; opacity: 1; transform: translateY(50px); }
  .af-lock { animation: none; opacity: .8; background: rgba(138,93,24,.14); }
  .ab-tile, .ab-persona { animation: none; opacity: 1; transform: none; }
  .art-bars i { animation: none; height: 80%; }
  .ar-fill { animation: none; transform: scale(1); }
  .abr-loop { animation: none; }
}

@media (max-width: 760px) {
  .cover-arrow { display: none; }
  .cover-stage { flex-basis: 44%; }
}

@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .rail { flex-wrap: wrap; gap: 8px; }
  .rail .step { flex: 1 1 30%; }
  .rail .step + .step { margin-left: 0; }
  .rail .step::before { content: ""; }
  .bank-grid { grid-template-columns: repeat(2, 1fr); }
}
