/* Evocation workbench. Every theme colour is a token. */
:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: #11141b;
  --raised: #171b24;
  --hover: #1d2230;
  --border: #2c3242;
  --border-soft: #232836;
  --fg: #e6e8ee;
  --muted: #a3abbd;
  --faint: #818ba2;
  --accent: #9aa8ff;
  --accent-fill: #5667e5;
  --accent-text: #ffffff;
  --accent-soft: rgba(139, 156, 255, 0.14);
  --ok: #45d6a1;
  --ok-soft: rgba(52, 211, 153, 0.13);
  --bad: #ff8294;
  --bad-soft: rgba(251, 113, 133, 0.14);
  --warn: #f5c451;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --cyan: #65e2d1;
  --cyan-soft: rgba(94, 234, 212, 0.12);
  --input-bg: #0e1118;
  --shadow: rgba(0, 0, 0, 0.28);
  --web: #8998d8;
  --cv-bg: transparent;
  --cv-text: #e6e8ee;
  --cv-node-text: #0b0d12;
  --cv-link: #505970;
  --cv-cut: #ff8294;
  --cv-msg: #f0f2f7;
  --cv-drop: #ff8294;
  --cv-client: #a3abbd;
  --cv-crashed: #8a94aa;
  --cv-paused: #f5c451;
  --cv-role: #a3abbd;
  --cv-leader: #9aa8ff;
  --cv-candidate: #c9a7ed;
  --cv-follower: #77bfca;
  --cv-coordinator: #adb4ff;
  --cv-resource: #65c982;
  --cv-locker: #65e2d1;
  --cv-sel: #ff8fc1;
  --diverge: #d2a7f4;
  --side-diff: #65e2d1;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--fg);
  background: var(--bg);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fa;
  --panel: #ffffff;
  --raised: #f0f2f8;
  --hover: #e6e9f3;
  --border: #b9c0d2;
  --border-soft: #d7dbe7;
  --fg: #1c2230;
  --muted: #505a70;
  --faint: #626d84;
  --accent: #4051c7;
  --accent-fill: #4658d4;
  --accent-text: #ffffff;
  --accent-soft: rgba(70, 88, 212, 0.12);
  --ok: #087f5b;
  --ok-soft: rgba(8, 127, 91, 0.11);
  --bad: #b4233d;
  --bad-soft: rgba(180, 35, 61, 0.10);
  --warn: #835d00;
  --warn-soft: rgba(131, 93, 0, 0.10);
  --cyan: #08776d;
  --cyan-soft: rgba(8, 119, 109, 0.10);
  --input-bg: #ffffff;
  --shadow: rgba(37, 43, 61, 0.12);
  --web: #5f6daf;
  --cv-text: #1c2230;
  --cv-node-text: #ffffff;
  --cv-link: #9ba4ba;
  --cv-cut: #b4233d;
  --cv-msg: #1c2230;
  --cv-drop: #b4233d;
  --cv-client: #505a70;
  --cv-crashed: #657087;
  --cv-paused: #835d00;
  --cv-role: #657087;
  --cv-leader: #4051c7;
  --cv-candidate: #70468d;
  --cv-follower: #287080;
  --cv-coordinator: #4e4c99;
  --cv-resource: #287235;
  --cv-locker: #08776d;
  --cv-sel: #a51661;
  --diverge: #702f88;
  --side-diff: #08776d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  min-width: 320px;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 27px;
  overflow: hidden;
  background: var(--bg);
  line-height: 1.4;
}
button, input, select { font: inherit; color: inherit; }
button, select, input { border-radius: 7px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }
a { color: var(--accent); text-underline-offset: 2px; }
code, .events, .faults, .nodes, .command-line, .timeline-position, .statusbar { font-family: var(--mono); }
code { overflow-wrap: anywhere; }
h2 { margin: 0 0 7px; font-size: 14px; }
h3 { margin: 10px 0 5px; font-size: 12px; }
p { margin: 7px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
.muted { color: var(--muted); }
.compact { font-size: 12px; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 0 12px; border-bottom: 1px solid var(--border-soft);
  background: var(--panel); white-space: nowrap; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
.topbar::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.brand small { color: var(--faint); font-size: 11px; font-weight: 500; }
.brand-mark { width: 24px; height: 24px; flex: none; object-fit: contain; }
.brand-mark-on-light { display: none; }
:root[data-theme="light"] .brand-mark-on-dark { display: none; }
:root[data-theme="light"] .brand-mark-on-light { display: block; }
.top-controls, .top-actions { display: flex; align-items: center; gap: 7px; }
.top-status { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.top-spacer { flex: 1 1 20px; }
.field {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 7px;
  border: 1px solid var(--border-soft); background: var(--raised);
}
.field > span { color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; }
.field select, .field input { min-width: 72px; height: 29px; padding: 0; border: 0; outline: 0; background: transparent; }
.field select { max-width: 112px; }
.seed-field input { width: 58px; min-width: 58px; font-family: var(--mono); }
.switch-label { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.switch-label input { position: absolute; opacity: 0; }
.switch { width: 28px; height: 16px; padding: 2px; border-radius: 999px; background: var(--border); transition: background 120ms; }
.switch::after { content: ""; display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: transform 120ms; }
.switch-label input:checked + .switch { background: var(--accent-fill); }
.switch-label input:checked + .switch::after { transform: translateX(12px); background: #fff; }
.button, button {
  min-height: 30px; padding: 4px 10px; border: 1px solid var(--border);
  background: var(--raised); color: var(--fg);
}
.button:hover:not(:disabled), button:hover:not(:disabled) { background: var(--hover); }
.button.primary, .play-button { border-color: var(--accent-fill); background: var(--accent-fill); color: var(--accent-text); font-weight: 650; }
.button.primary:hover:not(:disabled), .play-button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #10131b; }
.button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.icon-button { width: 31px; height: 31px; min-height: 31px; padding: 0; display: inline-grid; place-items: center; }
#theme-toggle { font-size: 16px; }

/* App shell */
.workbench { display: grid; grid-template-columns: 300px minmax(450px, 1fr) 380px; min-height: 0; overflow: hidden; }
.pane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.left-pane { border-right: 1px solid var(--border-soft); }
.right-pane { border-left: 1px solid var(--border-soft); }
.pane-tabs { display: flex; flex: none; min-height: 43px; padding: 7px 7px 0; border-bottom: 1px solid var(--border-soft); overflow-x: auto; }
.pane-tab { min-height: 35px; padding: 6px 8px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); white-space: nowrap; }
.pane-tab:hover { color: var(--fg); background: var(--hover); }
.pane-tab.active { color: var(--fg); border-bottom-color: var(--accent); background: transparent; }
.tab-count { margin-left: 3px; padding: 1px 5px; border-radius: 999px; background: var(--raised); color: var(--faint); font-size: 9px; }
.pane-scroll { flex: 1; min-height: 0; overflow: auto; }
.tool-panel { padding: 13px; }
.section-heading { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; }
.section-rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.stacked-label { display: grid; gap: 4px; margin: 9px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.stacked-label input, .stacked-label select, .filter-field input, .row select {
  width: 100%; min-height: 31px; padding: 5px 7px; border: 1px solid var(--border); background: var(--input-bg); color: var(--fg);
}
.full { width: 100%; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.download-link { display: inline-block; margin: 4px 0; }
.empty-touch { margin: 18px 0; padding: 16px; border: 1px dashed var(--border); border-radius: 10px; color: var(--faint); text-align: center; }
.empty-touch.small { margin: 7px 10px; padding: 5px; font-size: 11px; }
#story-panel:not([hidden]) + .empty-touch { display: none; }

/* Center */
.center-pane { position: relative; min-width: 0; min-height: 0; padding: 11px; overflow: hidden; background: var(--bg); }
.center-run { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(180px, 1fr) auto; gap: 10px; }
.card { border: 1px solid var(--border-soft); border-radius: 11px; background: var(--panel); box-shadow: 0 8px 24px var(--shadow); }
.empty-run { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-run h2 { color: var(--fg); font-size: 16px; }
.empty-moon { font-size: 40px; color: var(--accent); opacity: 0.7; }
.verdict-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 10px 12px; }
.verdict-card:has(.violation-text) { border-color: color-mix(in srgb, var(--bad) 43%, var(--border-soft)); background: linear-gradient(90deg, var(--bad-soft), transparent 60%), var(--panel); }
.verdict-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 9px; background: var(--bad-soft); color: var(--bad); font-weight: 800; }
.verdict-copy { min-width: 0; }
.verdict-copy h2 { margin: 0; font-size: 13px; }
.verdict-copy p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.command-line { color: var(--muted); font-size: 10.5px; overflow-wrap: anywhere; }
.command-line code { padding: 2px 5px; border-radius: 4px; background: var(--raised); color: var(--fg); }
.verdict-meta { display: grid; gap: 2px; color: var(--faint); font: 10.5px var(--mono); text-align: right; white-space: nowrap; }
.verdict-meta code { color: var(--fg); }
#run-diverge { grid-column: 1 / -1; margin: 0; }
.violation-text { color: var(--bad); font-weight: 650; }
.diverge-text { color: var(--diverge); font-weight: 600; }

.cluster-card { position: relative; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.card-heading { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px 0; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.cluster-stage { position: relative; flex: 1; min-height: 300px; display: grid; place-items: center; overflow: hidden; isolation: isolate; }
.cluster, .web-texture { position: absolute; inset: 0; width: 100%; height: 100%; }
.cluster { z-index: 2; display: block; }
.web-texture { z-index: 0; pointer-events: none; }
.web-layer { fill: none; stroke: var(--web); stroke-width: 1; vector-effect: non-scaling-stroke; transform-origin: center; }
.web-layer.outer { opacity: 0.035; filter: blur(0.45px); transform: scale(1.12) rotate(4deg); }
.web-layer.inner { opacity: 0.065; transform: scale(0.98) rotate(-2deg); }
.cluster text { fill: var(--cv-text); font: 13px var(--mono); font-weight: 600; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.cluster text.sub { font-size: 10.5px; font-weight: 500; stroke-width: 2.5px; }
.cluster .link { stroke: var(--cv-link); stroke-width: 1.35; opacity: 0.75; }
.cluster .cut { stroke: var(--cv-cut); stroke-width: 2.5; stroke-dasharray: 7 5; }
.cluster .client { fill: var(--cv-client); }
.cluster .node circle { fill: var(--cv-role); stroke: var(--panel); stroke-width: 2; }
.cluster .node text.name { fill: var(--cv-node-text); stroke: transparent; font-weight: 800; }
.cluster .node.paused circle { stroke: var(--cv-paused); stroke-width: 5; }
.cluster .msg { fill: var(--cv-msg); }
.cluster .msg.unfinished { fill: none; stroke: var(--cv-msg); stroke-width: 1.5; }
.cluster .drop { fill: var(--cv-drop); }
.cluster .ring { fill: none; stroke: var(--cv-sel); stroke-width: 3; }
.cluster .selected-link { stroke: var(--cv-sel); stroke-width: 3; opacity: 0.75; }
.cluster .ring, .cluster .selected-link { pointer-events: none; }
.cluster .msg.selected { fill: var(--cv-sel); stroke: none; }
.cluster .node { cursor: pointer; }
.cluster .node[data-role="leader"] circle, .swatch[data-role="leader"] { fill: var(--cv-leader); background: var(--cv-leader); }
.cluster .node[data-role="candidate"] circle, .swatch[data-role="candidate"] { fill: var(--cv-candidate); background: var(--cv-candidate); }
.cluster .node[data-role="follower"] circle, .swatch[data-role="follower"] { fill: var(--cv-follower); background: var(--cv-follower); }
.cluster .node[data-role="coordinator"] circle, .swatch[data-role="coordinator"] { fill: var(--cv-coordinator); background: var(--cv-coordinator); }
.cluster .node[data-role="resource"] circle, .swatch[data-role="resource"] { fill: var(--cv-resource); background: var(--cv-resource); }
.cluster .node[data-role="locker"] circle, .swatch[data-role="locker"] { fill: var(--cv-locker); background: var(--cv-locker); }
.legend { z-index: 3; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 12px; margin: 0; padding: 4px 10px 7px; color: var(--muted); font-size: 10px; }
.legend .item { display: inline-flex; align-items: center; gap: 4px; }
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cv-role); }
.swatch.crashed { background: var(--cv-crashed); }
.swatch.paused { background: transparent; border: 2px solid var(--cv-paused); }
.swatch.msg { width: 6px; height: 6px; background: var(--cv-msg); }
.swatch.drop { background: var(--cv-drop); }
.swatch.cut { width: 13px; height: 0; border-radius: 0; border-top: 2px dashed var(--cv-cut); background: none; }
.hover { z-index: 3; position: absolute; left: 10px; bottom: 7px; max-width: 260px; }
.hover > .muted { display: none; }
.hover .node { box-shadow: 0 4px 14px var(--shadow); }

.tour { margin: 7px 0; padding: 7px 9px; border: 1px solid var(--accent); border-radius: 8px; background: var(--raised); }
.tour-controls { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tour-controls button { min-height: 27px; padding: 3px 7px; }
.tour-controls strong { font-size: 10px; text-align: center; }
.tour p { margin: 5px 0 0; font-size: 11px; }

.timeline-card { padding: 9px 12px 7px; }
.playback-row { display: flex; align-items: center; gap: 6px; }
.play-button { width: auto; padding: 0 10px; }
.timeline-position { margin-left: 6px; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.speed-control { margin-left: auto; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.speed-control select { min-height: 27px; border: 1px solid var(--border); background: var(--raised); }
.violation-button { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.track { position: relative; height: 31px; margin-top: 4px; }
.markers { position: absolute; z-index: 2; left: 8px; right: 8px; top: 0; height: 13px; pointer-events: none; }
.marker { position: absolute; width: 3px; height: 12px; min-height: 0; margin-left: -1px; padding: 0; border: 0; border-radius: 2px; background: var(--warn); pointer-events: auto; }
.marker.violation { width: 4px; height: 14px; background: var(--bad); }
.marker.diverge { width: 4px; background: var(--diverge); }
.marker.side-diff { width: 4px; background: var(--side-diff); }
#scrubber { position: absolute; left: 0; top: 13px; width: 100%; margin: 0; accent-color: var(--accent-fill); }
.timeline-key { display: flex; gap: 12px; color: var(--faint); font-size: 9px; }
.timeline-key span { display: inline-flex; align-items: center; gap: 4px; }
.timeline-key #clock { margin-left: auto; font-family: var(--mono); }
.timeline-key i { width: 7px; height: 7px; border-radius: 2px; background: var(--warn); }
.timeline-key .key-diff { background: var(--side-diff); }
.timeline-key .key-violation { background: var(--bad); }

/* Center drawers */
.center-drawer { position: absolute; z-index: 10; inset: 11px; padding: 12px; overflow: auto; background: color-mix(in srgb, var(--panel) 96%, transparent); backdrop-filter: blur(8px); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border-soft); }
.drawer-close { width: 30px; padding: 0; font-size: 18px; }
.side-events { max-height: 42vh; }
.side-text { color: var(--side-diff); }
.faults { margin: 0; padding-left: 20px; font-size: 11px; }

/* Right pane */
.trace-pane { min-height: 0; flex: 1; display: grid; grid-template-rows: minmax(160px, 1fr) 250px; }
.trace-list { min-height: 0; display: flex; flex-direction: column; }
.filter-field { display: flex; align-items: center; gap: 6px; margin: 7px 9px; padding-left: 8px; border: 1px solid var(--border); border-radius: 7px; color: var(--faint); background: var(--input-bg); }
.filter-field input { min-width: 0; border: 0; outline: 0; background: transparent; }
.events { min-height: 0; flex: 1; list-style: none; margin: 0; padding: 0; overflow: auto; background: var(--panel); font-size: 10.5px; }
.events li { padding: 4px 9px; border-left: 2px solid transparent; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.events li:hover { background: var(--hover); }
.events li.current { border-left-color: var(--accent); background: var(--accent-soft); color: var(--fg); }
.events li.related { box-shadow: inset 3px 0 0 var(--cv-sel); background: color-mix(in srgb, var(--cv-sel) 10%, transparent); }
.events li.violation { border-left-color: var(--bad); background: var(--bad-soft); color: var(--fg); font-weight: 650; }
.events li.diverge { outline: 1px dashed var(--diverge); outline-offset: -2px; }
.events li.side-diff { outline: 1px dashed var(--side-diff); outline-offset: -2px; }
.events .index { display: inline-block; min-width: 37px; color: var(--accent); }
.events .time { margin-right: 6px; color: var(--faint); }
.events li.filter-hidden { display: none; }
.state-panel { min-height: 0; padding: 8px 9px; border-top: 1px solid var(--border-soft); overflow: auto; }
.node-tabs { display: flex; gap: 3px; margin: -2px 0 7px; overflow-x: auto; }
.node-tab { min-height: 27px; padding: 3px 9px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); }
.node-tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.nodes { display: grid; gap: 6px; font-size: 10.5px; }
.node { padding: 7px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--raised); }
.node .name { font-weight: 700; }
.node.down { color: var(--muted); border-style: dashed; }
.node.involved { border-color: var(--cv-sel); box-shadow: 0 0 0 1px var(--cv-sel); }
.node .flag { margin-left: 6px; color: var(--bad); }
.node dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; margin: 5px 0 0; }
.node dt { color: var(--faint); }
.node dd { margin: 0; overflow-wrap: anywhere; }

/* Left-pane content */
.story { margin: 7px 0; padding: 0; list-style: none; }
.story li { margin: 2px 0; }
.story button, .finds button { width: 100%; padding: 6px 7px; text-align: left; white-space: normal; border-color: transparent; background: transparent; color: var(--muted); }
.story button:hover, .story li.current button, .finds button:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); }
.story li.current button { box-shadow: inset 2px 0 var(--accent); }
.edit-faults { margin: 5px 0; padding-left: 18px; font-size: 10px; }
.edit-faults li { margin: 5px 0; padding-bottom: 5px; border-bottom: 1px solid var(--border-soft); }
.edit-faults input, .edit-faults select { max-width: 100%; border: 1px solid var(--border); background: var(--input-bg); }
.table-wrap { overflow-x: auto; }
.farm { width: 100%; border-collapse: collapse; font-size: 10px; }
.farm th, .farm td { padding: 4px 6px 4px 0; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; white-space: nowrap; }
.farm td.invariants { min-width: 120px; white-space: normal; }
.farm td.count { text-align: right; font-variant-numeric: tabular-nums; }
.finds { margin: 5px 0; padding: 0; list-style: none; }
.snapshot { color: var(--warn); }

/* Notices and status */
.error, .notice { position: fixed; z-index: 30; top: 60px; left: 50%; width: min(680px, calc(100vw - 24px)); transform: translateX(-50%); padding: 9px 12px; border-radius: 9px; box-shadow: 0 10px 30px var(--shadow); }
.error { border: 1px solid var(--bad); background: var(--panel); color: var(--bad); }
.notice { border: 1px solid var(--accent); background: var(--panel); }
.notice p, .notice ul { margin: 0 0 6px; }
.statusbar { display: flex; align-items: center; gap: 16px; min-width: 0; padding: 0 11px; border-top: 1px solid var(--border-soft); background: var(--panel); color: var(--faint); font-size: 9.5px; overflow: hidden; white-space: nowrap; }
.status-spacer { flex: 1; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--ok); }
.statusbar a { color: var(--muted); }

/* Two columns: tools at left, details under the center. */
@media (max-width: 1100px) and (min-width: 720px) {
  .topbar { gap: 7px; padding-inline: 9px; }
  .brand small, .top-status { display: none; }
  .field select { max-width: 100px; }
  .secondary-actions .button { width: 32px; padding: 0; }
  .secondary-actions .button-label { display: none; }
  .secondary-actions .button > span[aria-hidden="true"] { font-size: 13px; }
  .workbench { grid-template-columns: 280px minmax(0, 1fr); overflow: auto; align-content: start; }
  .left-pane { grid-row: 1 / span 2; position: sticky; top: 0; height: 100%; max-height: calc(100vh - 79px); }
  .center-pane { min-height: 720px; }
  .right-pane { grid-column: 2; min-height: 430px; border-left: 0; border-top: 1px solid var(--border-soft); }
}

/* One column: normal document scrolling, with the run before the tools. */
@media (max-width: 719px) {
  html, body { height: auto; min-height: 100%; }
  body { display: block; overflow-x: hidden; overflow-y: auto; }
  .topbar {
    position: relative; display: grid; height: auto; min-height: 88px;
    grid-template-columns: 24px minmax(0, 1fr); grid-template-areas: "brand setup" "actions secondary";
    align-content: center; gap: 7px 8px; padding: 7px 8px; overflow: visible;
  }
  .brand { grid-area: brand; display: flex; }
  .brand > span, .brand small { display: none; }
  .top-spacer, .top-status { display: none; }
  .top-controls {
    grid-area: setup; display: grid; min-width: 0; width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 66px 30px; gap: 6px;
  }
  .field { min-width: 0; width: auto; padding: 0 5px; }
  .field > span, .switch-label > span:last-child { display: none; }
  .field select, .field input, .seed-field input { width: 100%; min-width: 0; max-width: none; }
  .switch-label { justify-content: center; }
  .top-actions { grid-area: actions; gap: 6px; }
  .top-actions .button { min-width: 62px; padding-inline: 8px; }
  .secondary-actions { grid-area: secondary; display: flex; justify-self: end; gap: 5px; }
  .secondary-actions .button, .secondary-actions .icon-button { width: 31px; min-width: 31px; padding: 0; }
  .secondary-actions .button-label { display: none; }
  .secondary-actions .button > span[aria-hidden="true"] { font-size: 13px; }
  #theme-toggle { font-size: 16px; }

  .workbench { display: flex; flex-direction: column; overflow: visible; }
  .center-pane { order: 1; height: auto; min-height: 0; padding: 8px; overflow: visible; }
  .left-pane { order: 2; min-height: 0; }
  .right-pane { order: 3; min-height: 760px; }
  .pane { height: auto; border: 0; border-top: 1px solid var(--border-soft); }
  .pane-scroll { overflow: visible; }
  .center-run { height: auto; grid-template-rows: auto 400px auto; gap: 8px; }
  .cluster-stage { min-height: 330px; }
  .empty-run { min-height: 520px; }
  .verdict-card { grid-template-columns: auto minmax(0, 1fr); }
  .verdict-meta { grid-column: 2; text-align: left; }
  .playback-row { flex-wrap: wrap; }
  .timeline-position { order: 6; flex-basis: 100%; margin: 0; }
  .speed-control { margin-left: 0; }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .center-drawer { inset: 8px; }
  .trace-pane { grid-template-rows: 500px 260px; }
  .statusbar { min-height: 25px; gap: 9px; }
  .statusbar > :nth-child(2), .statusbar a { display: none; }
}

/*
 * Halloween touches. Delete this block, plus the logo-web/web-texture symbols
 * in index.html, to remove all seasonal decoration.
 */
.halloween-status { opacity: 0.68; }
.halloween-status::before { content: "☾ summoned from " attr(data-source); }
.empty-moon::before { content: "☾"; }
.empty-run p::after { content: " Nothing is haunting this run."; }
.empty-touch[data-empty-for="story"]::before { content: "☾ "; }
.violation-bat::before { content: "🦇"; }
.cluster .node.crashed circle {
  fill: color-mix(in srgb, var(--panel) 80%, transparent);
  stroke: var(--cv-crashed);
  stroke-width: 2;
  stroke-dasharray: 5 4;
}
.cluster .node.crashed text.name { fill: var(--cv-text); stroke: var(--panel); stroke-width: 3px; }
.cluster .node.crashed text.sub { font-style: italic; }
.node.down .flag::before { content: "👻 "; opacity: 0.7; }
.node .flag { border-radius: 999px; padding: 1px 5px; background: var(--bad-soft); }
.empty-touch::first-letter, .empty-moon { text-shadow: 0 0 14px var(--accent-soft); }
.section-heading::before { content: ""; width: 9px; height: 1px; background: linear-gradient(90deg, transparent, var(--web)); opacity: 0.45; }
.violation-bat { position: absolute; z-index: 5; left: -40px; top: 22%; color: var(--fg); font-size: 24px; opacity: 0; transform: rotate(15deg); pointer-events: none; }
.violation-bat.fly { animation: bat-cross 2.8s ease-in-out 1; }
@keyframes bat-cross {
  0% { left: -40px; top: 28%; opacity: 0; transform: rotate(15deg) scale(0.8); }
  15% { opacity: 0.5; }
  50% { top: 13%; transform: rotate(-7deg) scale(1); }
  85% { opacity: 0.42; }
  100% { left: calc(100% + 30px); top: 32%; opacity: 0; transform: rotate(12deg) scale(0.75); }
}
:root[data-candlelight="true"] {
  --accent: #f3a65a;
  --accent-fill: #b65310;
  --accent-soft: rgba(243, 166, 90, 0.15);
}
@media (prefers-reduced-motion: reduce) {
  .violation-bat.fly { animation: none; }
  .switch::after { transition: none; }
}
