:root {
  color-scheme: dark;
  --bg: #090b0d;
  --surface: #101316;
  --surface-2: #15191d;
  --line: #272d33;
  --line-strong: #3a424a;
  --text: #f4f1e9;
  --muted: #969da4;
  --orange: #ff7136;
  --orange-soft: #2a1710;
  --green: #70e1a1;
  --radius: 10px;
  font-family: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); }
button, input { font: inherit; }
a { color: inherit; }

.topbar {
  height: 68px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 13, .94);
}

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-size: 13px; font-weight: 800; letter-spacing: .13em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: #0a0c0e; background: var(--orange); border-radius: 5px; font: 800 12px/1 "IBM Plex Mono", monospace; }
.phase-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 500 10px/1 "IBM Plex Mono", monospace; letter-spacing: .08em; }
.phase-pill span { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(255, 113, 54, .12); }

main { padding: 54px clamp(20px, 4vw, 64px) 72px; }
.workspace { width: min(1440px, 100%); margin: 0 auto; }
.workspace-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 34px; }
.eyebrow, .panel-kicker { margin: 0 0 10px; color: var(--orange); font: 600 11px/1.2 "IBM Plex Mono", monospace; letter-spacing: .13em; }
h1 { max-width: 850px; margin: 0; font-size: clamp(34px, 5vw, 68px); line-height: .98; letter-spacing: -.055em; }
.lede { max-width: 720px; margin: 22px 0 0; color: #b1b7bc; font-size: 16px; line-height: 1.65; }

.system-state { flex: 0 0 224px; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.system-state .state-light { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #6b7279; }
.system-state.online .state-light { background: var(--green); box-shadow: 0 0 0 5px rgba(112, 225, 161, .1); }
.system-state.offline .state-light { background: #ff5e5e; }
.system-state strong, .system-state small { display: block; }
.system-state strong { font-size: 13px; }
.system-state small { margin-top: 4px; color: var(--muted); font: 400 10px/1.4 "IBM Plex Mono", monospace; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.metric { min-height: 112px; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { color: var(--muted); font: 500 10px/1 "IBM Plex Mono", monospace; letter-spacing: .1em; }
.metric strong { font: 600 clamp(28px, 3vw, 42px)/1 "IBM Plex Mono", monospace; letter-spacing: -.04em; }
.metric.accent { background: var(--orange-soft); }
.metric.accent strong { color: var(--orange); }

.surface-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(340px, .75fr); gap: 18px; }
.panel, .pipeline { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.panel-heading { min-height: 90px; padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.panel-heading.compact { min-height: 78px; }
.panel-heading h2 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -.02em; }
.panel-heading .panel-kicker { margin-bottom: 7px; }
.date-control input { height: 38px; padding: 0 10px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 6px; font: 500 11px "IBM Plex Mono", monospace; color-scheme: dark; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 22px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font: 500 9px/1 "IBM Plex Mono", monospace; letter-spacing: .11em; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .018); }
.matchup { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.team-code { display: grid; place-items: center; width: 34px; height: 28px; border: 1px solid var(--line-strong); border-radius: 4px; font: 600 10px "IBM Plex Mono", monospace; }
.game-state, .data-state { color: var(--muted); font: 500 10px "IBM Plex Mono", monospace; text-transform: uppercase; }
.data-state.ready { color: var(--green); }
.inspect-button { padding: 8px 11px; color: var(--text); background: transparent; border: 1px solid var(--line-strong); border-radius: 5px; cursor: pointer; font: 600 10px "IBM Plex Mono", monospace; }
.inspect-button:hover, .inspect-button:focus-visible { color: #0a0c0e; background: var(--orange); border-color: var(--orange); outline: 0; }
.empty-cell { height: 182px; color: var(--muted); text-align: center; font: 400 11px/1.6 "IBM Plex Mono", monospace; }

.trace-id { color: var(--muted); font: 500 10px "IBM Plex Mono", monospace; }
.trace-empty { min-height: 302px; padding: 38px 28px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.trace-empty p { max-width: 270px; margin: 15px 0 0; font-size: 13px; line-height: 1.6; }
.trace-symbol { margin: 0 auto; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--orange); font: 600 11px "IBM Plex Mono", monospace; }
.trace-list { list-style: none; margin: 0; padding: 6px 22px 12px; }
.trace-list li { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 13px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.trace-list li:last-child { border-bottom: 0; }
.trace-list .step { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--orange); font: 600 9px "IBM Plex Mono", monospace; }
.trace-list strong, .trace-list small { display: block; }
.trace-list strong { font-size: 13px; }
.trace-list small { margin-top: 3px; color: var(--muted); font: 400 10px/1.5 "IBM Plex Mono", monospace; }

.pipeline { margin-top: 18px; }
.pipeline .panel-heading a { color: var(--muted); font: 500 11px "IBM Plex Mono", monospace; text-decoration: none; }
.pipeline .panel-heading a:hover { color: var(--orange); }
.pipeline ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.pipeline li { min-height: 126px; padding: 21px; display: flex; gap: 14px; border-right: 1px solid var(--line); }
.pipeline li:last-child { border-right: 0; }
.pipeline li > span { color: var(--orange); font: 600 10px "IBM Plex Mono", monospace; }
.pipeline strong, .pipeline small { display: block; }
.pipeline strong { font-size: 14px; }
.pipeline small { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.5; }

footer { min-height: 74px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font: 400 10px "IBM Plex Mono", monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 920px) {
  .workspace-heading { align-items: flex-start; flex-direction: column; }
  .system-state { flex-basis: auto; width: 100%; }
  .surface-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .pipeline ol { grid-template-columns: repeat(2, 1fr); }
  .pipeline li:nth-child(2) { border-right: 0; }
  .pipeline li:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .phase-pill { display: none; }
  main { padding-top: 36px; }
  .metric { min-height: 95px; padding: 16px; }
  .panel-heading { align-items: flex-start; }
  th, td { padding: 13px 15px; }
  .pipeline ol { grid-template-columns: 1fr; }
  .pipeline li { border-right: 0; border-bottom: 1px solid var(--line); }
  .pipeline li:last-child { border-bottom: 0; }
  footer { padding-block: 20px; align-items: flex-start; flex-direction: column; }
}

