/* ZERO DAY: dark, restrained, cinematic. No external fonts, so the app shell works offline. */
:root {
  --bg: #0b0c0e;
  --bg-2: #111317;
  --surface: #15171b;
  --line: #262a30;
  --line-2: #343941;
  --ink: #dcd7cd;
  --ink-2: #a8a399;
  --muted: #6f6b64;
  --amber: #c9a35c;
  --amber-dim: #7d6638;
  --steel: #7f95a3;
  --red: #b0544a;
  --green: #8ea37a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", Menlo, "Liberation Mono", monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 600px at 50% 110%, rgba(201,163,92,0.07), transparent 60%),
    radial-gradient(900px 500px at 50% -20%, rgba(127,149,163,0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
/* film grain + vignette */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 49;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
}

#app { position: relative; z-index: 1; }
h1, h2, h3 { font-weight: 400; margin: 0; letter-spacing: 0.01em; }
p { margin: 0 0 0.9em; }
code, pre { font-family: var(--mono); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--amber); outline-offset: 3px; }

.kicker, .section-label, .stat-label, .code, .status, .tag, .move, .speaker, figcaption, .btn {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
}
.kicker { color: var(--muted); margin-bottom: 0.6rem; }
.section-label { color: var(--muted); margin: 0 0 1rem; }
.fineprint { color: var(--muted); font-size: 14px; font-style: italic; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 1.6rem; }

/* buttons */
.btn {
  background: transparent; border: 1px solid var(--line-2); color: var(--ink);
  padding: 12px 22px; cursor: pointer; transition: border-color .2s, background .2s, color .2s;
  border-radius: 0;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { border-color: var(--amber-dim); color: var(--amber); }
.btn.primary:hover { background: rgba(201,163,92,0.08); border-color: var(--amber); }
.btn.ghost { color: var(--ink-2); }
.btn.danger { border-color: #5a2d28; color: var(--red); }
.btn.small { padding: 7px 12px; font-size: 10px; }

/* ---------------------------------------------------------------- title */
.title-screen {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-rows: 1fr auto; position: relative; overflow: hidden;
}
.title-skyline { position: absolute; inset: auto 0 0 0; opacity: 0.55; }
.title-skyline svg { width: 100%; height: auto; display: block; }
.title-block { align-self: center; padding: 8vh 7vw; max-width: 760px; position: relative; animation: rise 1.4s ease both; }
.title {
  font-size: clamp(56px, 11vw, 132px); line-height: 0.95; letter-spacing: 0.08em;
  color: var(--ink); margin-bottom: 2.2rem;
}
.title-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 1.6rem; }

/* ---------------------------------------------------------------- hud */
.hud {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 48px);
  background: linear-gradient(var(--bg) 70%, transparent);
}
.wordmark {
  background: none; border: 0; cursor: pointer; padding: 0;
  font-family: var(--serif); letter-spacing: 0.3em; font-size: 15px; color: var(--ink-2);
}
.hud-stats { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.stat { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: baseline; }
.stat-label { color: var(--muted); }
.stat-value { font-family: var(--mono); font-size: 15px; color: var(--ink); }
.stat-sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-style: italic; }

/* ---------------------------------------------------------------- map */
.map { padding: 0 clamp(8px, 3vw, 40px); }
.skyline { width: 100%; height: auto; display: block; }
.map .skyline { max-height: 42vh; }
.skyline .hit { fill: transparent; }
.skyline .bldg { fill: #121418; stroke: #1d2026; stroke-width: 1; transition: fill .3s; }
.skyline .bldg.nova { fill: #16191e; stroke: #2a2f37; }
.skyline .beacon { fill: var(--red); animation: blink 2.4s steps(1) infinite; }
.skyline .win { fill: var(--amber); opacity: 0.85; }
.skyline .horizon { stroke: #2a2620; stroke-width: 1; }
.skyline .dlabel { fill: var(--muted); font-family: var(--sans); font-size: 11px; letter-spacing: 0.2em; }
.skyline .district { cursor: pointer; outline: none; }
.skyline .district.sealed .bldg { fill: #0e1013; stroke: #16181c; }
.skyline .district.sealed .dlabel { fill: #3d3b37; }
.skyline .district:hover .bldg, .skyline .district:focus .bldg { fill: #191c21; }
.skyline .district.selected .bldg { stroke: #3a3e45; }
.skyline .district.selected .dlabel { fill: var(--amber); }

.dossier { padding: 20px clamp(16px, 5vw, 72px) 80px; max-width: 1280px; margin: 0 auto; animation: rise .6s ease both; }
.dossier-head { border-top: 1px solid var(--line); padding-top: 26px; margin-bottom: 28px; }
.dossier-head h2 { font-size: clamp(30px, 4vw, 44px); }
.epigraph { color: var(--ink-2); font-style: italic; margin-top: .4rem; }
.dossier.sealed .dossier-head h2 { color: var(--muted); }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); padding: 22px 22px 20px;
  display: flex; flex-direction: column; min-height: 260px; position: relative;
}
.card h3 { font-size: 24px; margin: 10px 0 2px; }
.card .subject { color: var(--muted); font-size: 14px; font-family: var(--sans); margin-bottom: 12px; }
.card .hook { color: var(--ink-2); font-size: 16px; flex: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.code { color: var(--muted); }
.status { color: var(--muted); }
.status.open { color: var(--amber); }
.status.cleared { color: var(--ink-2); }
.status.mastered { color: var(--green); }
.status.pending, .status.sealed { color: #4a4741; }
.card.sealed, .card.pending { background: var(--bg-2); }
.card.sealed h3, .card.pending h3 { color: var(--ink-2); }
.card.sealed .hook { color: var(--muted); }
.card.is-boss { border-color: #3a3328; }
.card.is-boss::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 2px; background: var(--amber-dim); }
.card.is-flash { border-style: dashed; }
.card.open { border-color: #3a3328; box-shadow: 0 0 0 1px rgba(201,163,92,0.08), 0 20px 60px -30px rgba(201,163,92,0.25); }
.moves { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.move, .tag { border: 1px solid var(--line-2); padding: 3px 7px; color: var(--ink-2); font-size: 9.5px; }
.tag.boss { border-color: var(--amber-dim); color: var(--amber); }
.tag.flash { border-style: dashed; color: var(--steel); border-color: #3b4650; }
.card-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.card-actions .btn { padding: 9px 14px; font-size: 10px; }

/* ---------------------------------------------------------------- mission run */
.run { max-width: 820px; margin: 0 auto; padding: 28px clamp(18px, 5vw, 40px) 120px; }
.run-head { border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 34px; }
.run-head .btn { margin-bottom: 26px; }
.run-head h2 { font-size: clamp(32px, 5vw, 50px); line-height: 1.1; }
.run.mastery .run-head h2 { color: var(--amber); }
.constraint { border-left: 2px solid var(--amber-dim); padding: 4px 0 4px 16px; color: var(--amber); font-style: italic; margin-bottom: 1.6rem; }

.line { margin: 0 0 1.2rem; }
.line.narr { color: var(--ink-2); font-style: italic; }
.line.spoken { margin-left: 0; padding-left: 18px; border-left: 1px solid var(--line-2); }
.line.spoken .speaker { display: block; color: var(--muted); margin-bottom: 4px; }
.line.spoken.vik { border-left-color: var(--amber-dim); }
.line.spoken.vik .speaker { color: var(--amber); }
.line.spoken.priya { border-left-color: #3b4650; }
.line.spoken.priya .speaker { color: var(--steel); }
.line.spoken .said { font-size: 19px; }
blockquote { margin: 0; }

.artifact { margin: 1.4rem 0; border: 1px solid var(--line); background: #0d0e11; }
.artifact figcaption { padding: 8px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.artifact pre { margin: 0; padding: 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; color: #c9c4b8; }

.choice .prompt { font-size: 22px; line-height: 1.4; margin-bottom: 1rem; }
.choice > .speaker { color: var(--steel); margin-bottom: 6px; }
.opts { list-style: none; padding: 0; margin: 1.4rem 0 0; display: grid; gap: 10px; }
.opt {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 28px 1fr; gap: 6px 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); padding: 15px 16px;
  font-family: var(--serif); font-size: 17px; line-height: 1.5; transition: border-color .2s, background .2s, opacity .3s;
}
.opt:hover:not([disabled]) { border-color: var(--ink-2); background: #181a1f; }
.opt[disabled] { cursor: default; }
.opt-key { font-family: var(--mono); color: var(--muted); font-size: 13px; padding-top: 3px; }
.opt-code { margin: 0; font-size: 13px; white-space: pre-wrap; color: #c9c4b8; }
.verdict { grid-column: 2; font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em; font-size: 10px; }
.opt.dim { opacity: 0.35; }
.opt.picked.good { border-color: #4b5a40; } .opt.picked.good .verdict { color: var(--green); }
.opt.picked.bad { border-color: #5a2d28; } .opt.picked.bad .verdict { color: var(--red); }
.opt.picked.cut { border-color: #5a2d28; background: #1a1313; } .opt.picked.cut .verdict { color: var(--red); }
.opt.model { border-style: dashed; border-color: #4b5a40; opacity: 0.85; } .opt.model .verdict { color: var(--green); }

.reveal { margin-top: 1.8rem; }
.response { font-size: 19px; color: var(--ink); }
.model-answer { border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: 1.2rem; color: var(--ink-2); font-size: 16px; }
.debt-note { font-family: var(--mono); color: var(--red); font-size: 13px; }

.outcome-title { font-size: clamp(30px, 5vw, 44px); margin-bottom: 1.6rem; }
.delta { font-family: var(--mono); font-size: 14px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.6rem; }
.ledger-write { border: 1px solid #5a2d28; padding: 14px 16px; margin-top: 1.2rem; background: #140f0f; }
.ledger-write .section-label { color: var(--red); margin-bottom: .6rem; }
.ledger-write p { font-size: 15px; color: var(--ink-2); margin: 0; }
.ledger-write code, .ledger code { color: var(--red); font-size: 12.5px; }

/* ---------------------------------------------------------------- mission anatomy: phases, lesson, practice */
.phases { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0; margin: 18px 0 0; }
.phases li { font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em; font-size: 10px; color: #4a4741; position: relative; }
.phases li.done { color: var(--muted); }
.phases li.on { color: var(--amber); }
.phases li + li::before { content: ""; position: absolute; left: -12px; top: 50%; width: 6px; height: 1px; background: var(--line-2); }
.move.new { border-color: var(--amber-dim); color: var(--amber); }

.challenge-banner { border: 1px solid #5a2d28; color: var(--red); padding: 10px 14px; font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.16em; font-size: 11px; margin-bottom: 1.6rem; }

.lesson-title { font-size: clamp(26px, 4vw, 34px); margin-bottom: 1.2rem; }
.lesson-p { font-size: 18px; }
.trace { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.trace li { margin-bottom: 0.6rem; color: var(--ink); }
.trace li::marker { font-family: var(--mono); color: var(--amber-dim); }
.takeaway { border-left: 2px solid var(--amber-dim); padding: 6px 0 6px 16px; color: var(--amber); font-style: italic; margin-top: 1.6rem; }
.move-intro { border: 1px solid var(--amber-dim); padding: 16px 18px; margin-bottom: 1.6rem; background: rgba(201,163,92,0.04); }
.move-intro .section-label { color: var(--amber); margin-bottom: .3rem; }
.move-intro .move-name { font-size: 24px; margin-bottom: .4rem; }
.move-intro p:last-child { margin: 0; color: var(--ink-2); }

.practice { border-left: 1px dashed #3b4650; padding-left: clamp(12px, 3vw, 24px); }
.practice .section-label { color: var(--steel); }
.practice-count { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 0 0 .4rem; }
.practice-done { font-size: 20px; color: var(--green); }
.feedback { margin-top: 1.1rem; padding: 10px 14px; font-size: 16px; }
.feedback.hint { border: 1px solid #3b4650; color: var(--steel); }
.feedback.ok { border: 1px solid #4b5a40; color: var(--green); }

.prompt { font-size: 22px; line-height: 1.4; margin-bottom: 1rem; }
.format { font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em; font-size: 10px; color: var(--muted); margin: 0 0 .4rem; }
.field-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.field { background: #0d0e11; border: 1px solid var(--line-2); color: var(--ink); font-family: var(--mono); font-size: 16px; padding: 12px 14px; min-width: 0; flex: 1 1 200px; max-width: 360px; border-radius: 0; }
.field:focus { outline: none; border-color: var(--amber-dim); }
.field.area { max-width: none; width: 100%; font-family: var(--serif); font-size: 17px; line-height: 1.5; resize: vertical; }
.field[disabled] { color: var(--ink-2); }
.unit { font-family: var(--mono); color: var(--muted); }
.verdict-line { font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em; font-size: 11px; }
.verdict-line.good { color: var(--green); } .verdict-line.bad { color: var(--red); }

.bug-code .code-lines { list-style: none; margin: 0; padding: 8px 0; overflow-x: auto; }
.code-line { min-width: 100%; width: max-content; display: grid; grid-template-columns: 34px 1fr; text-align: left; background: none; border: 0; border-left: 2px solid transparent; padding: 3px 12px 3px 6px; cursor: pointer; color: #c9c4b8; font-size: 13.5px; }
.code-line code { white-space: pre; }
.code-line:hover:not([disabled]) { background: #15171b; border-left-color: var(--ink-2); }
.code-line[disabled] { cursor: default; }
.code-line.blank { cursor: default; }
.code-line.good { background: #141a12; border-left-color: var(--green); }
.code-line.bad { background: #1a1313; border-left-color: var(--red); }
.code-line.model { border-left-color: var(--green); border-left-style: dashed; }
.ln { font-family: var(--mono); color: #4a4741; font-size: 12px; padding-top: 1px; }

.order-list { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; gap: 8px; }
.order-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); padding: 12px 14px; font-size: 17px; }
.order-item.good { border-color: #4b5a40; } .order-item.good .verdict { color: var(--green); }
.order-item.bad { border-color: #5a2d28; } .order-item.bad .verdict { color: var(--red); }
.order-ctrl { display: flex; gap: 6px; }
.order-item .verdict { grid-column: auto; }

.rubric { list-style: none; padding: 0; margin: 1rem 0 0; }
.rubric li { padding: 6px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 16px; }
.rubric li.hit .verdict { color: var(--green); } .rubric li.miss .verdict { color: var(--red); }
.recap { border-top: 1px solid var(--line); margin-top: 1.6rem; padding-top: 1.2rem; }
.recap p { color: var(--ink-2); font-size: 17px; }

/* ---------------------------------------------------------------- live code cells */
.cell { margin: 1.2rem 0 0; border: 1px solid var(--line-2); background: #0b0c0f; }
.cell > figcaption { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cell-env { text-transform: none; letter-spacing: 0.04em; font-family: var(--mono); font-size: 11px; }
.editor { display: grid; position: relative; font-family: var(--mono); font-size: 14px; line-height: 1.6; tab-size: 4; }
.editor > .hl, .editor > .src { grid-area: 1 / 1; margin: 0; padding: 14px 16px; border: 0; font: inherit; line-height: inherit; tab-size: 4;
  white-space: pre; overflow: hidden; letter-spacing: normal; }
.editor > .hl { pointer-events: none; color: #c9c4b8; }
.editor > .src { background: transparent; color: transparent; caret-color: var(--amber); resize: none; overflow-x: auto; overflow-y: hidden; outline: none; }
.editor > .src::selection { background: rgba(201,163,92,0.28); color: transparent; }
.editor > .src:focus { box-shadow: inset 2px 0 0 var(--amber-dim); }
.editor.ro > .src { caret-color: transparent; }
.t-k { color: #c9a35c; } .t-b { color: #b8aed0; } .t-s { color: #8ea37a; } .t-n { color: #d39a7a; }
.t-c { color: #5f5c56; font-style: italic; } .t-f { color: #9fb6c4; } .t-d { color: #b8aed0; }
.cell-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--line); }
.cell-hint { color: #4a4741; font-family: var(--sans); font-size: 11px; margin-left: auto; }
.cell-status { color: var(--amber); font-family: var(--mono); font-size: 12px; }
.cell-note { margin: 0; padding: 8px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; font-style: italic; }
.cell-out:empty { display: none; }
.cell-result { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.cell .out { margin: 0; padding: 8px 16px; font-size: 13px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }
.cell .out.tb { color: #e0a79e; background: #150f0f; border-left: 2px solid var(--red); }
.cell-meta { font-family: var(--mono); font-size: 11px; color: #4a4741; margin: 4px 16px 6px; }
.cell-quiet { color: var(--muted); font-style: italic; font-size: 15px; margin: 4px 16px; }
.cell-warn { color: #e0a79e; margin: 8px 16px; font-size: 15px; }
.boot { border-top: 1px solid var(--line); padding: 14px 16px; background: rgba(201,163,92,0.03); }
.boot .line { margin-bottom: 0.6rem; }
.boot-log { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.boot-log li::before { content: "· "; color: var(--amber-dim); }
.found { display: grid; gap: 4px; border-left: 2px solid var(--line-2); padding-left: 14px; color: var(--ink-2); }
.found .section-label { margin: 0; }
.viz { margin: 8px 16px 4px; }
.viz figcaption { color: var(--muted); font-size: 10px; margin-bottom: 6px; }
.viz-body.maps { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.viz canvas { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- beats (full-screen transitions) */
.beats {
  position: fixed; inset: 0; z-index: 100; background: #050506;
  display: grid; place-items: center; padding: 8vw;
  opacity: 0; pointer-events: none; transition: opacity .6s ease;
}
.beats.on { opacity: 1; pointer-events: auto; cursor: pointer; }
.beat-stage { max-width: 760px; width: 100%; }
.beat { animation: beat-in 1.1s ease both; }
.beat-line { font-size: clamp(22px, 3.2vw, 32px); line-height: 1.45; color: var(--ink); font-style: italic; }
.beat-line.spoken { font-style: normal; }
.beat .speaker { color: var(--amber); margin-bottom: 12px; }
.act-card { text-align: center; }
.beat-numeral { font-family: var(--sans); letter-spacing: 0.5em; text-transform: uppercase; font-size: 12px; color: var(--muted); margin-bottom: 1.4rem; }
.beat-title { font-size: clamp(44px, 8vw, 92px); letter-spacing: 0.06em; line-height: 1; }
.beat-sub { margin-top: 1.6rem; color: var(--ink-2); font-style: italic; }
.act-card.closed .beat-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: var(--amber-dim); }
.beat-hint { position: absolute; bottom: calc(28px + var(--safe-b)); left: 0; right: 0; text-align: center; font-family: var(--sans); font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: #3d3b37; }

/* ---------------------------------------------------------------- modal */
#modal { display: none; }
#modal.on { display: block; position: fixed; inset: 0; z-index: 80; }
.modal-scrim { position: absolute; inset: 0; background: rgba(5,5,6,0.82); }
.modal-box {
  position: relative; max-width: 620px; margin: 10vh auto 0; max-height: 80vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2); padding: 32px; animation: rise .35s ease both;
}
.modal-box h2 { font-size: 30px; margin-bottom: 1rem; }
.modal-box .hook { color: var(--ink-2); }
.ledger { list-style: none; padding: 0; margin: 0 0 1.4rem; }
.ledger li { border-top: 1px solid var(--line); padding: 12px 0; }
.ledger li p { margin: 4px 0 0; color: var(--ink-2); font-size: 16px; }
.ledger-stats dt { font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em; font-size: 11px; color: var(--muted); margin-top: 12px; }
.ledger-stats dd { margin: 4px 0 0; color: var(--ink-2); font-size: 16px; }
.movelist { padding-left: 1.2rem; }
.movelist li { margin-bottom: 12px; }
.movelist p { margin: 2px 0 0; color: var(--ink-2); font-size: 16px; }

/* ---------------------------------------------------------------- settings and API key gate */
.setting { margin: 1.4rem 0 0; }
.setting .section-label { display: block; margin-bottom: 0.5rem; }
.setting .fineprint { margin: 0.4rem 0 0; }
.field.wide { width: 100%; max-width: 520px; flex: none; display: block; }
.setting-static { margin: 0; color: var(--ink-2); }
.row.tight { margin-top: 0.7rem; }
.row.cell-pad { margin: 4px 16px 10px; }
.disclosure { border: 1px solid var(--line-2); background: var(--bg-2); padding: 18px 20px 8px; margin: 1.4rem 0; }
.disclosure ul { margin: 0; padding-left: 1.1rem; }
.disclosure li { margin-bottom: 10px; color: var(--ink-2); font-size: 16px; }
.settings a { color: var(--amber); word-break: break-all; }
.keygate { border-top: 1px solid var(--line); border-left: 2px solid var(--amber-dim); padding: 14px 16px; background: rgba(201,163,92,0.05); }
.keygate p { margin: 0 0 6px; color: var(--ink-2); font-size: 16px; }
.keygate .section-label { color: var(--amber); }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ---------------------------------------------------------------- gates and the deploy step */
.gate-notice { border: 1px solid #5a2d28; border-left-width: 2px; padding: 4px 18px 14px; margin: 1.2rem 0; }
.contract { border: 1px solid var(--line-2); background: var(--bg-2); padding: 16px 20px 6px; margin: 1.2rem 0; }
.contract ul { margin: 0; padding-left: 1.1rem; }
.contract li { color: var(--ink-2); font-size: 16px; margin-bottom: 8px; overflow-wrap: anywhere; }
.deploy .trace li { overflow-wrap: anywhere; }
.deploy-live { margin-top: 1.4rem; }
.checks { list-style: none; padding: 0; margin: 0.8rem 0; }
.checks li { display: grid; grid-template-columns: 52px 1fr; gap: 2px 12px; border-top: 1px solid var(--line); padding: 8px 0; align-items: baseline; }
.checks .verdict, .ep-habit .verdict { grid-column: auto; }
.checks li.good .verdict { color: var(--green); }
.checks li.bad .verdict { color: var(--red); }
.check-name { font-size: 16px; }
.check-detail { grid-column: 2; color: var(--ink-2); font-size: 14px; font-family: var(--sans); overflow-wrap: anywhere; }
.live-url a { display: block; color: var(--amber); overflow-wrap: anywhere; }
.ship-briefing { border-top: 1px solid var(--amber-dim); border-bottom: 1px solid var(--amber-dim); padding: 6px 0; margin: 0 0 1.8rem; }
.contract .line { margin: 0.4rem 0 1rem; }
.ship-beat { border: 1px solid var(--amber-dim); background: rgba(201,163,92,0.05); padding: 28px clamp(16px, 5vw, 36px) 12px; margin: 1.4rem 0; scroll-margin-top: 16px; }
.ship-live { font-size: clamp(48px, 10vw, 88px); line-height: 1; letter-spacing: 0.08em; color: var(--amber); margin: 0 0 1.4rem; text-transform: uppercase; }
.ship-beat .line .said { font-size: 21px; }

/* ---------------------------------------------------------------- sound settings */
.sound-settings { border-top: 1px solid var(--line); margin-top: 2.4rem; padding-top: 1.6rem; }
.volume-row { display: flex; gap: 14px; align-items: center; max-width: 520px; }
.volume { flex: 1; min-width: 0; accent-color: var(--amber); height: 32px; }
.volume-readout { font-family: var(--mono); font-size: 13px; color: var(--ink-2); min-width: 4ch; }

/* ---------------------------------------------------------------- epilogue */
.epilogue { padding-bottom: 100px; }
.epilogue > .ep-head, .epilogue > .ep-section { max-width: 820px; margin-left: auto; margin-right: auto; padding-left: clamp(18px, 5vw, 40px); padding-right: clamp(18px, 5vw, 40px); }
.ep-sky { overflow: hidden; max-width: 1280px; margin: 0 auto; }
.ep-sky svg { display: block; width: 100%; }
.ep-head { text-align: center; padding: 34px 0 10px; }
.ep-title { font-size: clamp(34px, 7vw, 68px); line-height: 1.1; margin: 0; }
.rise { opacity: 0; animation: rise 1s ease forwards; }
.ep-section { border-top: 1px solid var(--line); padding-top: 28px; margin-top: 44px; }
.ep-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 20px; }
.ep-figure { display: grid; gap: 4px; }
.ep-value { font-size: 34px; color: var(--amber); }
.ep-movelist { list-style: none; padding: 0; margin: 0; }
.ep-movelist > li { border-top: 1px solid var(--line); padding: 14px 0; }
.ep-habit { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.ep-movelist li.held .verdict { color: var(--green); }
.ep-movelist li.broken .verdict { color: var(--red); }
.ep-entries { list-style: none; padding: 0 0 0 14px; margin: 8px 0 0; border-left: 1px solid var(--line-2); }
.ep-entries li { margin-bottom: 12px; }
.ep-fact { margin: 0; font-family: var(--sans); font-size: 13px; color: var(--muted); }
.ep-line { margin: 2px 0 0; color: var(--ink-2); font-style: italic; }
.ep-last { text-align: left; }
.ep-end { font-size: clamp(40px, 9vw, 84px); letter-spacing: 0.14em; text-align: center; margin: 60px 0 20px; text-transform: uppercase; }
.ep-last > .fineprint { text-align: center; }
.ep-actions { justify-content: center; }
.skyline .bldg.nova.dark { fill: #08090a; stroke: #16181c; }
@media (prefers-reduced-motion: reduce) { .rise { opacity: 1; } }

.noscript { padding: 40px; }

/* ---------------------------------------------------------------- motion */
.fade-in { animation: rise .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes beat-in { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
@keyframes blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: 0.15; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- small screens */
.district-nav { display: none; }
@media (max-width: 640px) {
  body { font-size: 17px; }
  .skyline .dlabel { display: none; }
  .district-nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 10px 4px 0; }
  .dnav { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); padding: 12px 0; font-family: var(--serif); font-size: 15px; letter-spacing: 0.1em; cursor: pointer; }
  .dnav.selected { border-color: var(--amber-dim); color: var(--amber); }
  .dnav.sealed { color: #4a4741; }
  .hud .btn.small { padding: 8px 10px; }
  .editor { font-size: 16px; }          /* iOS Safari zooms into fields under 16px on focus */
  .editor > .hl, .editor > .src { padding: 12px; }
  .cell-hint { display: none; }
  .viz-body.maps { gap: 12px; }
  .order-item { grid-template-columns: 24px 1fr; }
  .order-item .order-ctrl, .order-item .verdict { grid-column: 2; }
  .prompt { font-size: 20px; }
  .hud { padding: 10px 14px; }
  .hud-stats { gap: 12px; }
  .stat-sub { display: none; }
  .skyline .dlabel { font-size: 18px; letter-spacing: 0.05em; }
  .modal-box { margin: 6vh 12px 0; padding: 22px; }
  .choice .prompt { font-size: 20px; }
  .artifact pre { font-size: 12px; }
}
