:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--bg-app); color: var(--fg1); font-family: var(--font-ui); }
body { overflow: hidden; }
button, input, select { font: inherit; }
button, select, input { min-height: 38px; border: 1px solid var(--border-hair); border-radius: var(--r-sm); background: var(--bg-raised); color: var(--fg1); }
button { padding: 0 14px; cursor: pointer; text-align: left; }
button:hover, select:hover, input:hover { border-color: var(--border-strong); background: var(--bg-raised-hover); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 2px; }
button.selected, button.primary { border-color: var(--teal); color: var(--teal-bright); }
button.primary { background: var(--teal-a10); text-align: center; }
h1, h2, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h2 { margin-top: 5px; font-size: 17px; font-weight: 600; }
.mono, dd, .stage-readout, input { font-family: var(--font-mono); }
.eyebrow { color: var(--fg3); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--border-hair); }
.header-status { display: flex; align-items: center; gap: 14px; color: var(--fg-muted); font-size: 12px; }
.state { padding: 4px 8px; border: 1px solid var(--border-hair); border-radius: var(--r-full); color: var(--fg-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.state.pass { border-color: var(--teal); color: var(--teal-bright); }
.workspace { height: calc(100vh - 76px); display: grid; grid-template-columns: 300px minmax(520px, 1fr) 320px; }
.control-pane, .evidence-pane { min-width: 0; overflow-y: auto; background: var(--bg-app); }
.control-pane { border-right: 1px solid var(--border-hair); }
.evidence-pane { border-left: 1px solid var(--border-hair); }
.control-pane section, .evidence-pane section { padding: 21px 20px; border-bottom: 1px solid var(--border-hair); }
.description, .boundary p:last-child { margin-top: 10px; color: var(--fg-muted); font-size: 12px; line-height: 1.55; }
.button-list { display: grid; gap: 8px; margin-top: 15px; }
.button-list button { display: flex; align-items: center; justify-content: space-between; }
.button-list span { color: var(--fg3); font: 10px var(--font-mono); }
.field { display: grid; gap: 7px; margin-top: 15px; color: var(--fg-muted); font-size: 11px; }
select { width: 100%; padding: 0 10px; }
.vector-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.vector-inputs label { display: grid; gap: 5px; color: var(--fg3); font-size: 10px; }
.vector-inputs input { width: 100%; padding: 0 8px; }
.full { width: 100%; margin-top: 10px; }
.check { display: flex; align-items: center; gap: 9px; min-height: 34px; color: var(--fg-muted); font-size: 12px; }
.check input { min-height: auto; accent-color: var(--teal); }
.stage-pane { position: relative; min-width: 0; overflow: hidden; background: var(--bg-base); }
#world { display: block; width: 100%; height: 100%; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; background: var(--bg-base); color: var(--fg-muted); font: 12px var(--font-mono); }
#loading[hidden] { display: none; }
.stage-readout { position: absolute; z-index: 4; left: 14px; right: 14px; bottom: 12px; display: flex; justify-content: space-between; color: var(--fg3); font-size: 11px; pointer-events: none; }
.metrics, .state-table { margin: 14px 0 0; }
.metrics div, .state-table div { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border-hair); }
.metrics dt, .state-table dt { color: var(--fg-muted); font-size: 12px; }
.metrics dd, .state-table dd { margin: 0; color: var(--fg1); font-size: 12px; text-align: right; }
.character-cards { display: grid; gap: 8px; margin-top: 13px; }
.character-card { padding: 11px 12px; border: 1px solid var(--border-hair); border-radius: var(--r-sm); }
.character-card strong { display: block; font-size: 12px; font-weight: 600; }
.character-card span { display: block; margin-top: 4px; color: var(--fg3); font: 10px var(--font-mono); }
.pipeline-list { margin: 13px 0 0; padding-left: 19px; color: var(--fg-muted); font-size: 11px; line-height: 1.75; }
.boundary { background: var(--bg-raised); }
@media (max-width: 1100px) {
  body { overflow: auto; }
  .workspace { height: auto; grid-template-columns: 270px minmax(480px, 1fr); }
  .evidence-pane { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border-hair); display: grid; grid-template-columns: repeat(4, 1fr); }
  .stage-pane { min-height: 700px; }
}
