:root {
  --paper: #f3efe5;
  --paper-deep: #e7dfcf;
  --panel: #fffdf7;
  --ink: #181a18;
  --ink-soft: #5b5d57;
  --line: #b9b1a1;
  --line-dark: #777368;
  --coral: #d84f3d;
  --coral-dark: #9e3025;
  --coral-wash: #f7d6ce;
  --emerald: #16785c;
  --emerald-dark: #0e4939;
  --emerald-wash: #cfe9df;
  --cobalt: #2857b8;
  --cobalt-wash: #dbe4f7;
  --amber: #c68213;
  --amber-wash: #f5e3b9;
  --serif: Iowan Old Style, Palatino Linotype, Book Antiqua, Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow: 7px 7px 0 rgba(24, 26, 24, 0.14);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 1px 1px, rgba(24, 26, 24, 0.09) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr);
  align-items: center;
  min-height: 76px;
  padding: 10px clamp(18px, 3vw, 48px);
  border-top: 5px solid var(--coral);
  border-bottom: 1px solid var(--ink);
  background: rgba(243, 239, 229, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  width: max-content;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 26px;
  font-style: italic;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 13px; letter-spacing: 0.16em; }
.brand small { margin-top: 2px; color: var(--ink-soft); font-family: var(--mono); font-size: 8px; letter-spacing: 0.08em; }

.topbar-status {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.mode-pill {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line-dark);
  border-radius: 99px;
  background: var(--panel);
  text-transform: uppercase;
}

.mode-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); }
.mode-pill.live i { background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-wash); animation: breathe 1.8s ease-in-out infinite; }
.mission-code { color: var(--ink-soft); }
.topbar-actions { display: flex; gap: 8px; justify-content: flex-end; }

.button,
.icon-button,
.play-button {
  cursor: pointer;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-weight: 700;
}

.button { min-height: 40px; padding: 9px 14px; font-size: 12px; letter-spacing: 0.025em; }
.button:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(24, 26, 24, 0.2); }
.button:active { transform: translate(0, 0); box-shadow: none; }
.button:disabled { cursor: not-allowed; opacity: 0.42; transform: none; box-shadow: none; }
.button-quiet { border-color: var(--line-dark); background: var(--panel); }
.button-ink { color: #fff; background: var(--ink); }
.button-coral { color: #fff; border-color: var(--coral-dark); background: var(--coral); }

.state-banner {
  padding: 8px 24px;
  border-bottom: 1px solid var(--ink);
  background: var(--amber-wash);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
}
.state-banner.error { color: #fff; background: var(--coral-dark); }
.state-banner.success { color: #fff; background: var(--emerald-dark); }

main {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
  width: min(1540px, calc(100% - clamp(28px, 5vw, 80px)));
  margin: 0 auto;
  padding: 54px 0 72px;
}

.mission-intro {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 60px;
  align-items: end;
  padding: 0 0 28px;
}

.kicker,
.section-index {
  margin: 0 0 10px;
  color: var(--coral-dark);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mission-copy h1,
.section-heading h2,
.stage-header h2,
.receipt-heading h2,
.trace-section h2,
.drawer-head h2,
dialog h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.mission-copy h1 { max-width: 900px; font-size: clamp(54px, 6vw, 96px); line-height: 0.88; }
.mission-objective { max-width: 780px; margin: 24px 0 0; color: var(--ink-soft); font-family: var(--serif); font-size: clamp(18px, 2vw, 25px); line-height: 1.35; }

.phase-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.phase-line strong { text-transform: uppercase; letter-spacing: 0.08em; }
.phase-line > span:last-child { color: var(--ink-soft); }
.phase-beacon { width: 10px; height: 10px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px var(--coral-wash); }
.phase-beacon.success { background: var(--emerald); box-shadow: 0 0 0 5px var(--emerald-wash); }
.phase-beacon.approval { background: var(--amber); box-shadow: 0 0 0 5px var(--amber-wash); }

.replay-deck {
  border: 1px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.replay-heading,
.replay-controls { display: flex; align-items: center; }
.replay-heading { justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.replay-heading label { display: flex; gap: 7px; align-items: center; color: var(--ink-soft); }
.replay-heading select { border: 0; background: transparent; color: var(--ink); font-family: var(--mono); font-size: 10px; font-weight: 700; }
.replay-controls { gap: 7px; padding: 13px 14px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; background: var(--panel); font-size: 18px; }
.icon-button:hover { background: var(--paper-deep); }
.icon-button:disabled { cursor: not-allowed; opacity: 0.35; }
.play-button { flex: 1; height: 40px; color: #fff; background: var(--ink); font-size: 12px; }
.play-button span { margin-right: 6px; font-size: 10px; }
.replay-progress { height: 5px; border-top: 1px solid var(--ink); background: var(--paper-deep); }
.replay-progress span { display: block; width: 0; height: 100%; background: var(--coral); transition: width 500ms cubic-bezier(.2,.8,.2,1); }
.shortcut-hint { margin: 0; padding: 8px 14px; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; text-align: right; }

.causal-stage {
  position: relative;
  grid-column: 1 / span 8;
  min-height: 565px;
  overflow: hidden;
  padding: 26px;
  border: 1px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stage-grid {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(24,26,24,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,26,24,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, #000 15%, transparent 86%);
  pointer-events: none;
}

.stage-header,
.receipt-heading,
.section-heading {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.stage-header h2,
.receipt-heading h2,
.section-heading h2,
.trace-section h2 { font-size: clamp(32px, 3vw, 48px); line-height: 1; }
.stage-status { padding: 6px 9px; border: 1px solid var(--coral-dark); color: var(--coral-dark); background: var(--coral-wash); font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; }
.stage-status.success { border-color: var(--emerald); color: var(--emerald-dark); background: var(--emerald-wash); }
.stage-status.approval { border-color: var(--amber); color: #744803; background: var(--amber-wash); }

.lineage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 355px;
  margin-top: 32px;
}

.belief {
  position: relative;
  z-index: 2;
  min-height: 250px;
  padding: 22px;
  border: 1px solid var(--ink);
  background: var(--panel);
  transition: transform 500ms cubic-bezier(.2,.8,.2,1), opacity 500ms ease, background 500ms ease;
}

.belief-stale { transform: rotate(-1.2deg); box-shadow: 6px 6px 0 var(--coral-wash); }
.belief-grounded { transform: rotate(1.1deg); box-shadow: 6px 6px 0 var(--emerald-wash); }
.belief-owner { margin: 0 0 22px; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; }
.belief-state { display: inline-block; padding: 4px 7px; color: var(--coral-dark); border: 1px solid var(--coral); background: var(--coral-wash); font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: 0.08em; }
.belief-grounded .belief-state { color: var(--emerald-dark); border-color: var(--emerald); background: var(--emerald-wash); }
.belief blockquote { margin: 18px 0 28px; font-family: var(--serif); font-size: clamp(20px, 2vw, 30px); line-height: 1.15; }
.belief .evidence-link { position: absolute; right: 20px; bottom: 18px; left: 20px; padding: 9px 0 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink-soft); cursor: pointer; font-family: var(--mono); font-size: 9px; text-align: left; }
.evidence-link span { float: right; color: var(--ink); }
.belief.superseded { opacity: 0.66; background: repeating-linear-gradient(-45deg, var(--panel), var(--panel) 8px, var(--coral-wash) 8px, var(--coral-wash) 10px); transform: rotate(-1.2deg) scale(.96); }
.belief.superseded blockquote { text-decoration: line-through; text-decoration-color: var(--coral); text-decoration-thickness: 2px; }
.belief.activated { background: var(--emerald-wash); transform: rotate(0) scale(1.02); }

.lineage-transfer { position: relative; z-index: 3; text-align: center; }
.lineage-transfer svg { width: 100%; overflow: visible; }
.transfer-track,
.transfer-pulse { fill: none; stroke-width: 2; }
.transfer-track { stroke: var(--line-dark); stroke-dasharray: 4 6; }
.transfer-pulse { stroke: var(--coral); stroke-dasharray: 35 265; stroke-dashoffset: 0; animation: transfer 2.1s linear infinite; }
.transfer-node { fill: var(--panel); stroke: var(--ink); stroke-width: 2; }
.transfer-label { display: block; margin-top: -20px; color: var(--coral-dark); font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: 0.06em; }
.lineage.resolved .transfer-pulse { stroke: var(--emerald); stroke-dasharray: 300 0; animation: none; }
.lineage.resolved .transfer-node-end { fill: var(--emerald); }
.lineage.resolved .transfer-label { color: var(--emerald-dark); }

.correction-gate {
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin: 4px -26px -26px;
  padding: 17px 26px;
  border-top: 1px solid var(--ink);
  background: var(--amber-wash);
}
.correction-gate[hidden] { display: none; }
.correction-gate > div { display: flex; gap: 12px; align-items: center; }
.correction-gate p { margin: 0; font-size: 12px; line-height: 1.35; }
.correction-gate p span { color: var(--ink-soft); }
.gate-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; background: var(--coral); font-family: var(--serif); font-size: 20px; font-style: italic; }

.receipt-panel {
  grid-column: 9 / -1;
  display: flex;
  flex-direction: column;
  min-height: 565px;
  padding: 26px;
  border: 1px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
}
.receipt-panel .section-index { color: #eaa194; }
.receipt-heading h2 { max-width: 220px; }
.receipt-seal { display: grid; place-items: center; width: 82px; height: 82px; border: 1px solid var(--line); border-radius: 50%; transform: rotate(8deg); }
.receipt-seal span { margin-bottom: -16px; font-family: var(--serif); font-size: 36px; font-style: italic; }
.receipt-seal small { font-family: var(--mono); font-size: 8px; letter-spacing: 0.09em; }
.receipt-seal.complete { color: #fff; border: 2px solid #91d6be; background: var(--emerald-dark); box-shadow: inset 0 0 0 5px var(--ink); animation: stamp 600ms cubic-bezier(.2,1.8,.4,1); }
.receipt-summary { min-height: 72px; margin: 38px 0 28px; color: #d7d3ca; font-family: var(--serif); font-size: 20px; line-height: 1.35; }
.receipt-grid { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-top: 1px solid #545650; border-left: 1px solid #545650; }
.receipt-grid div { padding: 16px 14px; border-right: 1px solid #545650; border-bottom: 1px solid #545650; }
.receipt-grid dt { color: #aaa9a3; font-family: var(--mono); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; }
.receipt-grid dd { margin: 7px 0 0; font-family: var(--mono); font-size: 13px; font-weight: 700; }
.receipt-grid dd.yes { color: #91d6be; }
.receipt-grid dd.no { color: #f29c8e; }
.outcome-shift { display: grid; grid-template-columns: 1fr auto 1fr; gap: 9px; align-items: center; margin-top: auto; padding-top: 28px; font-family: var(--mono); font-size: 8px; letter-spacing: 0.04em; }
.outcome-shift > span:not(.outcome-arrow) { padding: 9px; border: 1px solid #545650; }
.outcome-shift i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--amber); }
.outcome-before.failed i { background: var(--coral); }
.outcome-after.passed { color: #b3e7d5; border-color: var(--emerald) !important; }
.outcome-after.passed i { background: #91d6be; }
.outcome-arrow { color: #999; }

.agents-section,
.trace-section { grid-column: 1 / -1; margin-top: 50px; }
.section-heading { align-items: end; padding-bottom: 22px; border-bottom: 1px solid var(--ink); }
.section-heading > p { max-width: 440px; margin: 0; color: var(--ink-soft); font-family: var(--serif); font-size: 17px; }
.agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.agent-card { position: relative; min-height: 330px; padding: 22px; border: 1px solid var(--ink); background: var(--panel); transition: transform 450ms cubic-bezier(.2,.8,.2,1), box-shadow 450ms ease; }
.agent-card:nth-child(1) { border-top: 5px solid var(--cobalt); }
.agent-card:nth-child(2) { border-top: 5px solid var(--coral); }
.agent-card:nth-child(3) { border-top: 5px solid var(--emerald); }
.agent-card.is-new { animation: card-arrive 550ms cubic-bezier(.2,.9,.3,1); }
.agent-card.verified { background: var(--emerald-wash); box-shadow: 5px 5px 0 rgba(22,120,92,.3); }
.agent-card.superseded { background: var(--coral-wash); }
.agent-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.agent-index { color: var(--ink-soft); font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.agent-status { display: inline-flex; gap: 5px; align-items: center; padding: 4px 7px; border: 1px solid var(--line); font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.agent-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.agent-card.verified .agent-status::before { background: var(--emerald); }
.agent-card.superseded .agent-status::before { background: var(--coral); }
.agent-card h3 { margin: 30px 0 2px; font-family: var(--serif); font-size: 36px; font-weight: 500; line-height: 1; }
.agent-role { margin: 0; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: 0.07em; }
.agent-belief { margin: 28px 0 0; padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.agent-belief span { color: var(--ink-soft); font-family: var(--mono); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.agent-belief p { margin: 7px 0 0; font-family: var(--serif); font-size: 18px; line-height: 1.3; }
.agent-card.superseded .agent-belief p { text-decoration: line-through; text-decoration-color: var(--coral); }
.agent-evidence { position: absolute; right: 22px; bottom: 20px; left: 22px; display: flex; justify-content: space-between; align-items: center; }
.agent-evidence small { color: var(--ink-soft); font-family: var(--mono); font-size: 8px; }
.agent-evidence button { padding: 5px 0; border: 0; border-bottom: 1px solid var(--ink); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; }

.trace-section { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 60px; }
.section-heading.compact { border-bottom: 0; }
.trace-lede { color: var(--ink-soft); font-family: var(--serif); font-size: 19px; }
.event-rail { position: relative; display: flex; gap: 0; overflow-x: auto; margin: 0; padding: 0 0 18px; list-style: none; scrollbar-color: var(--ink) var(--paper-deep); }
.event-rail::before { content: ""; position: absolute; top: 23px; right: 0; left: 0; height: 1px; background: var(--ink); }
.event-item { position: relative; flex: 0 0 205px; padding: 54px 20px 0 0; }
.event-item::before { content: ""; position: absolute; z-index: 2; top: 17px; left: 0; width: 11px; height: 11px; border: 5px solid var(--paper); border-radius: 50%; background: var(--line-dark); box-shadow: 0 0 0 1px var(--ink); }
.event-item.danger::before { background: var(--coral); }
.event-item.success::before { background: var(--emerald); }
.event-item.approval::before { background: var(--amber); }
.event-item button { width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.event-item time { display: block; color: var(--ink-soft); font-family: var(--mono); font-size: 8px; }
.event-item strong { display: block; margin-top: 7px; font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.event-item p { margin: 8px 0 0; color: var(--ink-soft); font-family: var(--serif); font-size: 15px; line-height: 1.25; }

.footer { display: flex; justify-content: space-between; gap: 20px; padding: 20px clamp(18px, 3vw, 48px); border-top: 1px solid var(--ink); background: var(--paper-deep); font-family: var(--mono); font-size: 8px; letter-spacing: .07em; }
.footer a { color: var(--ink); font-weight: 700; }

.provenance-drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(540px, 94vw);
  overflow-y: auto;
  padding: 30px;
  border-left: 1px solid var(--ink);
  background: var(--panel);
  box-shadow: -18px 0 50px rgba(24,26,24,.2);
  transform: translateX(105%);
  transition: transform 350ms cubic-bezier(.2,.8,.2,1);
}
.provenance-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 24px; border-bottom: 1px solid var(--ink); }
.drawer-head h2 { font-size: 38px; line-height: 1; }
.drawer-context { margin: 24px 0; padding: 15px; border-left: 4px solid var(--cobalt); background: var(--cobalt-wash); font-family: var(--serif); font-size: 18px; }
.evidence-list { display: grid; gap: 10px; }
.evidence-item { padding: 15px; border: 1px solid var(--line); background: var(--paper); }
.evidence-item-head { display: flex; justify-content: space-between; gap: 10px; }
.evidence-kind, .capture-label { font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.evidence-kind { color: var(--cobalt); }
.capture-label { color: var(--ink-soft); }
.evidence-item h3 { margin: 10px 0 5px; font-family: var(--serif); font-size: 19px; font-weight: 500; }
.evidence-item code { display: block; overflow-wrap: anywhere; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; }
.evidence-contexts { margin: 8px 0 0; color: var(--ink-soft); font-size: 10px; }
.fresh-inspection { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--ink); }
.fresh-inspection p { margin: 5px 0 12px; color: var(--ink-soft); font-size: 11px; }
.fresh-result { color: var(--emerald-dark) !important; font-family: var(--mono); }
.drawer-scrim { position: fixed; z-index: 50; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(24,26,24,.43); cursor: default; }

dialog {
  width: min(680px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--panel);
  box-shadow: 12px 12px 0 rgba(24,26,24,.3);
}
dialog::backdrop { background: rgba(24,26,24,.62); backdrop-filter: blur(3px); }
dialog form { position: relative; padding: 36px; }
dialog h2 { font-size: clamp(38px, 5vw, 60px); line-height: .95; }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border: 1px solid var(--ink); background: var(--panel); cursor: pointer; font-size: 22px; }
.dialog-number { position: absolute; top: 0; right: 72px; padding: 7px 12px; color: #fff; background: var(--coral); font-family: var(--mono); font-size: 8px; letter-spacing: .07em; }
.dialog-lede { max-width: 560px; color: var(--ink-soft); font-family: var(--serif); font-size: 18px; }
.approval-diff { display: grid; gap: 8px; margin: 24px 0; }
.approval-diff div { display: grid; grid-template-columns: 80px 1fr; gap: 12px; padding: 13px; border: 1px solid var(--line); }
.approval-diff span { font-family: var(--mono); font-size: 8px; font-weight: 700; }
.approval-diff div:first-child { background: var(--coral-wash); }
.approval-diff div:last-child { background: var(--emerald-wash); }
.approval-diff del, .approval-diff ins { font-family: var(--serif); font-size: 16px; text-decoration-thickness: 2px; }
.approval-diff ins { text-decoration: none; }
.approval-evidence { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 24px; }
.approval-evidence span { padding: 5px 8px; border: 1px solid var(--emerald); color: var(--emerald-dark); background: var(--emerald-wash); font-family: var(--mono); font-size: 8px; }
dialog label { display: grid; gap: 6px; margin-top: 16px; font-size: 11px; font-weight: 700; }
dialog input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-dark); border-radius: 0; background: #fff; }
dialog input[readonly] { color: var(--ink-soft); background: var(--paper-deep); cursor: not-allowed; }
.live-identity { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.confirm-field { padding-top: 16px; border-top: 1px solid var(--ink); }
.confirm-field input { font-family: var(--mono); font-size: 17px; letter-spacing: .1em; text-transform: uppercase; }
.dialog-error { min-height: 20px; margin: 8px 0; color: var(--coral-dark); font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-footnote { margin: 18px 0 0; color: var(--ink-soft); font-family: var(--mono); font-size: 8px; text-align: center; }

.loading-screen {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  background: var(--paper);
  transition: opacity 350ms ease, visibility 350ms ease;
}
.loading-screen.hidden { visibility: hidden; opacity: 0; }
.loading-mark { display: grid; place-items: center; width: 76px; height: 76px; border: 1px solid var(--ink); animation: loading-turn 1.8s cubic-bezier(.2,.8,.2,1) infinite; }
.loading-mark span { font-family: var(--serif); font-size: 48px; font-style: italic; }
.loading-screen p { margin-top: 18px; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.toast { position: fixed; z-index: 90; right: 24px; bottom: 24px; max-width: 390px; padding: 13px 16px; border: 1px solid var(--ink); background: var(--panel); box-shadow: var(--shadow); font-size: 11px; transform: translateY(150%); transition: transform 250ms ease; }
.toast.show { transform: translateY(0); }

@keyframes transfer { to { stroke-dashoffset: -300; } }
@keyframes breathe { 50% { opacity: .4; } }
@keyframes stamp { from { opacity: 0; transform: rotate(20deg) scale(1.8); } }
@keyframes card-arrive { from { opacity: 0; transform: translateY(18px); } }
@keyframes loading-turn { 50% { transform: rotate(45deg) scale(.86); } }

@media (max-width: 1120px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-status { display: none; }
  .mission-intro { grid-template-columns: 1fr; gap: 28px; }
  .replay-deck { width: min(500px, 100%); }
  .causal-stage { grid-column: 1 / -1; }
  .receipt-panel { grid-column: 1 / -1; min-height: 430px; }
  .receipt-summary { max-width: 600px; }
  .agent-grid { grid-template-columns: 1fr 1fr; }
  .agent-card:last-child { grid-column: 1 / -1; }
  .trace-section { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .topbar { min-height: 64px; padding: 8px 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand small, .topbar-actions .button-quiet { display: none; }
  .topbar-actions .button { min-height: 36px; padding: 7px 10px; }
  main { width: calc(100% - 24px); padding: 34px 0 50px; gap: 14px; }
  .mission-copy h1 { font-size: clamp(48px, 16vw, 70px); }
  .mission-objective { font-size: 18px; }
  .phase-line { align-items: flex-start; }
  .phase-line > span:last-child { width: calc(100% - 22px); margin-left: 22px; }
  .replay-controls { padding: 10px; }
  .causal-stage, .receipt-panel { padding: 18px; }
  .stage-header { display: block; }
  .stage-status { display: inline-block; margin-top: 12px; }
  .lineage { grid-template-columns: 1fr; gap: 10px; margin-top: 22px; }
  .lineage-transfer { height: 75px; transform: rotate(90deg); }
  .lineage-transfer svg { width: 120px; }
  .lineage-transfer .transfer-label { display: none; }
  .belief { min-height: 225px; }
  .correction-gate { align-items: stretch; flex-direction: column; margin: 8px -18px -18px; padding: 15px 18px; }
  .receipt-heading h2, .stage-header h2, .section-heading h2, .trace-section h2 { font-size: 36px; }
  .receipt-seal { width: 68px; height: 68px; }
  .receipt-summary { margin-top: 26px; }
  .outcome-shift { grid-template-columns: 1fr; }
  .outcome-arrow { transform: rotate(90deg); text-align: center; }
  .agents-section, .trace-section { margin-top: 38px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 14px; }
  .agent-grid { grid-template-columns: 1fr; }
  .agent-card:last-child { grid-column: auto; }
  .footer { flex-direction: column; }
  .provenance-drawer { padding: 22px 18px; }
  dialog form { padding: 30px 20px 22px; }
  .live-identity { grid-template-columns: 1fr; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
  .approval-diff div { grid-template-columns: 65px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .belief-stale, .belief-grounded { transform: none; }
}
