:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

/* The field is the instrument and it gets the whole width. Only the written
   sections keep a measure, because prose that runs the width of a monitor is
   unreadable and a map that does not is wasted. */
.wrap { max-width: none; margin: 0; padding: 0 28px; }
.prose { max-width: 74ch; margin-left: 0; }

header {
  border-bottom: 1px solid var(--border);
  padding: 34px 0 26px;
  margin-bottom: 28px;
}
h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.02em;
}
header .wrap { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.tagline { margin: 0; color: var(--muted); max-width: 76ch; flex: 1 1 30ch; font-size: 13.5px; }
.tagline em { color: var(--text); font-style: normal; font-weight: 600; }

main {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Stage ───────────────────────────────────────────────────────────────── */

/* Full width, but capped in height: the control strip and the readout have to
   stay on screen with the field, or the thing stops being a station and starts
   being a poster. */
.canvas-holder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 8px;
  max-height: 62vh;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}
canvas { display: block; border-radius: 4px; cursor: crosshair; touch-action: none; }

.hint { color: var(--muted); font-size: 13px; margin: 12px 2px 4px; }
.hint strong { color: var(--text); font-weight: 600; }

.field-note {
  margin: 4px 2px 14px;
  padding: 10px 13px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-size: 13.5px;
}

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ── Panel ───────────────────────────────────────────────────────────────── */

.panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 22px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  margin-top: 14px;
}
/* Section headings inside the strip sit as small vertical dividers rather than
   stacked rules, so the row keeps reading left to right. */
.panel h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin: 0;
  padding: 0 0 0 22px;
  border-left: 1px solid var(--border);
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  writing-mode: horizontal-tb;
  flex: 0 0 auto;
}

.control { margin-bottom: 0; flex: 0 1 190px; min-width: 150px; }
.control label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}
select, input[type=range] { width: 100%; }
.canvas-holder canvas { max-width: 100%; max-height: 58vh; width: auto; height: auto; }
select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13.5px;
}
select:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[type=range] { accent-color: var(--accent); margin: 4px 0 0; }
.range-label { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

.buttons { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 12px; }
button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #05121f; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
.wide-btn { width: 100%; margin-top: 14px; }

.toggles { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.toggles label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.toggles input { accent-color: var(--accent); }

/* ── Metrics ─────────────────────────────────────────────────────────────── */

.metrics { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 380px; }
.metric {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 7px 11px;
  flex: 1 1 92px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.metric.wide { flex: 1 1 100%; }
.metric.wide .metric-value { font-size: 19px; }
.metric-label { font-size: 11px; color: var(--muted); }
.metric-value { font-family: var(--mono); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.metric-value.good { color: var(--good); }
.metric-value.warn { color: var(--warn); }
.metric-value.bad  { color: var(--bad); }
.metric-sub { font-size: 10.5px; color: var(--muted); }
.metric-sub.good { color: var(--good); }
.metric-sub.bad  { color: var(--bad); }

.plan-info { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 10px 0 0; }

/* ── Comparison table ────────────────────────────────────────────────────── */

table.compare { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12px; }
table.compare th {
  text-align: right;
  font-weight: 500;
  color: var(--muted);
  padding: 5px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.compare th:first-child, table.compare td.name { text-align: left; }
table.compare td { padding: 6px 3px; text-align: right; font-family: var(--mono); border-bottom: 1px solid var(--surface-2); white-space: nowrap; font-size: 11px; }
table.compare td.name { font-family: inherit; font-size: 11.5px; white-space: normal; line-height: 1.3; }
table.compare td.best { color: var(--good); font-weight: 600; }
table.compare tr.active td.name { color: var(--accent); font-weight: 600; }

/* ── Prose ───────────────────────────────────────────────────────────────── */

.prose { margin: 46px auto 0; max-width: 74ch; }
.prose h2 { font-size: 19px; margin: 32px 0 10px; letter-spacing: -0.01em; }
.prose h3 { font-size: 15px; margin: 26px 0 8px; color: var(--text); }
.prose p { color: #c9d1d9; }
.prose em { color: var(--text); font-style: italic; }
.prose dt { font-weight: 600; margin-top: 14px; color: var(--accent); }
.prose dd { margin: 4px 0 0; color: #c9d1d9; }

footer {
  margin: 52px auto 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
a { color: var(--accent); }

@media (max-width: 940px) {
  main { grid-template-columns: 1fr; }
  .panel { position: static; }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}


/*  the strip, on a narrow screen  ...........................................
    Below tablet width the row cannot hold its columns, so it falls back to a
    stack. The field still keeps the full width; it is the part you look at. */
@media (max-width: 900px) {
  .panel { flex-direction: column; align-items: stretch; gap: 12px; }
  .panel h2 { border-left: 0; padding: 10px 0 0; border-top: 1px solid var(--border); }
  .control { flex: 1 1 auto; }
  .metrics { flex: 1 1 auto; }
}
