:root {
  --ink: #ebe4d6;
  --muted: #9a9184;
  --paper: #1c1814;
  --panel: #241f1a;
  --line: #3a332c;
  --accent: #d4b87a;
  --warn: #c45c26;
  --blue: #3d8fd1;
  --bg: #100e0c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
header { padding: 0.7rem 1.25rem; flex-shrink: 0; }
footer.colophon { padding: 0.45rem 1.25rem; flex-shrink: 0; max-height: 4.5rem; overflow: auto; }
header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.35rem;
}
h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: 1.55rem;
  margin: 0 0 0.15rem;
}
.lede { margin: 0; max-width: 40rem; color: var(--muted); line-height: 1.35; font-size: 0.9rem; }
.kpi {
  display: flex;
  gap: 1.75rem;
  margin: 0;
  flex-shrink: 0;
  text-align: right;
}
.kpi dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kpi dd { margin: 0.2rem 0 0; font-family: "IBM Plex Mono", monospace; font-size: 1.15rem; color: var(--accent); min-height: 1.2em; }
main {
  display: grid;
  grid-template-columns: minmax(16rem, 19rem) minmax(0, 1fr) minmax(16rem, 20rem);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 0.85rem 1rem 1rem;
  overflow: auto;
  min-height: 0;
}
.log-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 1.1rem 0 0.6rem;
}
.panel > h2:first-child { margin-top: 0; }
label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.55rem 0;
}
select, input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  font: inherit;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.4rem; }
.hint { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-top: 1rem; }
button {
  font: 500 0.9rem "IBM Plex Sans", sans-serif;
  background: var(--accent);
  color: #1a140c;
  border: 0;
  border-radius: 4px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button:disabled { opacity: 0.5; cursor: wait; }
.stage {
  position: relative;
  background: var(--paper);
  min-height: 0;
}
#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.scrub {
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 1.85rem;
  z-index: 2;
  display: grid;
  gap: 0.25rem;
  padding: 0.45rem 0.65rem 0.55rem;
  background: rgba(16, 14, 12, 0.82);
  border: 1px solid var(--line);
  border-radius: 6px;
  backdrop-filter: blur(8px);
}
.scrub[hidden] { display: none; }
.scrub-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.scrub-label em {
  font-style: normal;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  text-transform: none;
  letter-spacing: 0;
}
#scrub {
  width: 100%;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  height: 0.35rem;
}
.metrics {
  position: absolute;
  top: 0.75rem;
  left: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem 0.7rem;
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: rgba(16, 14, 12, 0.82);
  border: 1px solid var(--line);
  border-radius: 6px;
  backdrop-filter: blur(8px);
}
.metrics[hidden] { display: none; }
.metrics dt {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.metrics dd {
  margin: 0.12rem 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--accent);
}
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
}
#log {
  margin: 0;
  white-space: pre-wrap;
  font: 0.72rem/1.4 "IBM Plex Mono", monospace;
  color: #d7ccb8;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.chart {
  width: 100%;
  height: 9.5rem;
  flex-shrink: 0;
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.legend-hint { margin: 0.25rem 0 0.45rem; font-size: 0.7rem; color: var(--muted); flex-shrink: 0; }
.progress {
  flex-shrink: 0;
  height: 1.35rem;
  margin: 0 0 0.45rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.progress[hidden] { display: none; }
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c45c26, #d4b87a);
  transition: width 0.12s linear;
}
#prog-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 0.68rem/1 "IBM Plex Mono", monospace;
  color: var(--ink);
}
.more { flex-shrink: 0; margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted); }
.more summary { cursor: pointer; color: var(--accent); }
.table-wrap.inner { overflow: auto; max-height: 8rem; padding: 0.3rem 0; }
.table-wrap { border-top: 1px solid var(--line); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th, td { text-align: right; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; }
footer { color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--line); }
footer code { color: var(--accent); }
.brand { display: flex; gap: 1rem; align-items: center; min-width: 0; }
.wordmark {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.7rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem 0.4rem;
  line-height: 1;
  flex-shrink: 0;
}
.wordmark span { font-size: 0.72em; vertical-align: super; line-height: 0; }
.colophon h2 { margin-top: 0; }
.colophon p { max-width: 52rem; line-height: 1.5; }
.colophon a { color: var(--accent); }
.rv2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.05rem;
  color: var(--ink);
  margin-top: 1.2rem;
}
.splash {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: radial-gradient(ellipse at 30% 20%, #2a231c 0%, var(--bg) 55%);
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 2rem;
}
.splash.hidden { display: none; }
.splash-inner { max-width: 38rem; width: min(38rem, 100%); }
.mark { display: block; width: 100%; height: auto; margin: 0 0 1.35rem; }
.splash-kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.splash-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.85rem;
  line-height: 1.2;
  margin: 0.4rem 0 1rem;
}
.splash-lede, .splash-note, .splash-cite { color: var(--muted); line-height: 1.5; }
.splash-lede a { color: var(--accent); }
.splash-inner button { margin-top: 1.1rem; padding: 0.7rem 1.2rem; font-size: 1rem; }
.splash-cite { font-size: 0.78rem; margin-top: 1.4rem; }
@media (max-width: 1100px) {
  header { flex-wrap: wrap; align-items: flex-start; }
  .kpi { width: 100%; justify-content: flex-start; text-align: left; }
  main { grid-template-columns: 1fr; min-height: 0; }
  .stage { height: 22rem; min-height: 22rem; }
  .log-panel { border-left: 0; border-top: 1px solid var(--line); }
  h1 { font-size: 1.55rem; }
}
