:root {
  --paper: #f3f5f2;
  --ink: #17212b;
  --muted: #68737d;
  --line: #ccd2ce;
  --runway: #101417;
  --panel: #ffffff;
  --red: #d7353f;
  --cyan: #168fa8;
  --green: #228963;
  --amber: #c68a18;
  --shadow: 0 12px 32px rgba(23, 33, 43, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.masthead {
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--runway);
  color: #fff;
  border-bottom: 4px solid var(--red);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-family: "Arial Narrow", Impact, sans-serif;
  font-size: 24px;
  font-style: italic;
  border-radius: 4px;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; text-transform: uppercase; }
.brand span { color: #aeb8bf; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }

.live-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #d7ddda;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
.state-dot { width: 9px; height: 9px; background: var(--amber); border-radius: 50%; box-shadow: 0 0 0 4px rgba(198, 138, 24, .16); }
.live-state.online .state-dot { background: #43d19e; box-shadow: 0 0 0 4px rgba(67, 209, 158, .15); }
.live-state.offline .state-dot { background: #ff626b; box-shadow: 0 0 0 4px rgba(255, 98, 107, .15); }

main { width: min(1440px, 100%); margin: 0 auto; padding: clamp(18px, 3vw, 38px); }

.instrument-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(400px, 2fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.latest-reading, .metrics { background: var(--panel); }
.latest-reading { padding: 24px 28px; }
.latest-reading p, .eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
.latest-reading strong {
  display: block;
  color: var(--red);
  font-family: "Arial Narrow", Impact, sans-serif;
  font-size: clamp(54px, 7vw, 92px);
  line-height: .92;
  font-style: italic;
}
.latest-reading time { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; }

.metrics { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics div { padding: 24px 20px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.metrics dt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.metrics dd { margin: 8px 0 0; font: 700 28px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

.tape-section, .distribution, .log-panel { margin-top: 24px; background: var(--panel); border: 1px solid var(--line); }
.section-heading { min-height: 72px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.section-heading.compact { min-height: 64px; }
h1, h2 { margin: 0; font-family: "Arial Narrow", Impact, sans-serif; font-size: 24px; line-height: 1; text-transform: uppercase; }
.section-heading button, .section-heading a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-decoration: none;
  cursor: pointer;
}
.section-heading button:hover, .section-heading a:hover { border-color: var(--ink); }
.section-heading button:focus-visible, .section-heading a:focus-visible { outline: 3px solid rgba(22,143,168,.35); outline-offset: 2px; }

.round-tape {
  min-height: 104px;
  padding: 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: var(--runway);
  scrollbar-color: var(--red) #242b30;
}
.round-chip {
  flex: 0 0 86px;
  min-height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid #364149;
  border-top: 4px solid var(--cyan);
  border-radius: 3px;
  color: #d7f5fb;
  background: #171d21;
  font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.round-chip.mid { border-top-color: #825ad1; color: #ddd1ff; }
.round-chip.high { border-top-color: var(--red); color: #ffb3b8; }

.lower-grid { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(480px, 1.7fr); gap: 24px; }
.bands { padding: 20px; display: grid; gap: 16px; }
.band-row { display: grid; grid-template-columns: 90px 1fr 38px; align-items: center; gap: 12px; font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.band-track { height: 10px; background: #e5e9e6; overflow: hidden; }
.band-fill { height: 100%; background: var(--cyan); transition: width .35s ease; }
.band-row:nth-child(2) .band-fill { background: #6b6fc8; }
.band-row:nth-child(3) .band-fill { background: var(--amber); }
.band-row:nth-child(4) .band-fill { background: var(--red); }

.table-wrap { max-height: 360px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #e3e7e4; }
th { position: sticky; top: 0; background: #f7f8f6; color: var(--muted); font-size: 10px; text-transform: uppercase; }
td:nth-child(2) { font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
footer { padding: 10px 24px 28px; color: var(--muted); text-align: center; font-size: 11px; }

@media (max-width: 820px) {
  .instrument-panel, .lower-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div { border-top: 1px solid var(--line); }
  .latest-reading strong { font-size: 64px; }
}

@media (max-width: 480px) {
  .masthead { align-items: flex-start; }
  .brand span { display: none; }
  main { padding: 14px; }
  .metrics dd { font-size: 22px; }
  .round-chip { flex-basis: 76px; }
  th, td { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
