:root {
  color-scheme: dark;
  --bg: #0b1115;
  --panel: #10191e;
  --line: #27373e;
  --text: #eef5f4;
  --muted: #a1b3b9;
  --mint: #7be7c8;
  --orange: #ffab7e;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; }
h1, h2, p, dl, dd { margin: 0; }

.dashboard {
  max-width: 1560px;
  margin-inline: auto;
  padding: clamp(16px, 3vh, 36px) clamp(16px, 3vw, 48px);
}

.masthead, .history-header, .history-footer, .session, .legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.masthead { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.masthead h1 { display: flex; align-items: center; gap: 13px; font-size: 19px; letter-spacing: .06em; }
.mark { display: flex; align-items: end; gap: 3px; color: var(--mint); }
.mark i { width: 3px; height: 7px; background: currentColor; }
.mark i:nth-child(2) { height: 12px; }
.mark i:nth-child(3) { height: 17px; }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status[data-state="live"] { color: var(--mint); }
.status[data-state="issue"] { color: var(--orange); }
button { border: 1px solid #416c63; border-radius: 5px; min-height: 44px; padding: 0 15px; background: #16302d; color: var(--mint); white-space: nowrap; cursor: pointer; }
button:hover { background: #20443d; }
button:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

.readouts { display: grid; grid-template-columns: 1.15fr 2fr; align-items: end; gap: clamp(18px, 4vw, 58px); padding: clamp(20px, 3.5vh, 46px) 0; }
.readouts h2, .metrics dt { color: var(--muted); font-size: clamp(13px, 1.3vw, 17px); font-weight: 550; letter-spacing: .07em; }
.speed p, .metrics dd { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.speed p { gap: 13px; margin-top: 7px; }
.speed p > span { color: var(--mint); font: 650 clamp(62px, 10vw, 148px)/.88 var(--mono); letter-spacing: -.09em; }
small { color: var(--muted); font: 500 13px var(--mono); }
.speed small { font-size: clamp(13px, 1.9vw, 22px); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 4px; }
.metrics > div { padding: 5px clamp(9px, 2vw, 31px); border-left: 1px solid var(--line); }
.metrics dd { margin-top: 10px; font: 600 clamp(23px, 3.45vw, 53px)/1 var(--mono); letter-spacing: -.065em; }
.metrics dd small { letter-spacing: 0; }

.history { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.history-header { padding: 18px clamp(14px, 2vw, 26px) 10px; }
.history h2 { font-size: clamp(19px, 2vw, 25px); letter-spacing: .04em; }
.history-header p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.legend { justify-content: end; color: var(--muted); font-size: 13px; white-space: nowrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 7px; height: 12px; border-radius: 1px; }
.up { background: var(--mint); }
.down { background: var(--orange); }
.chart { position: relative; height: clamp(225px, 43vh, 500px); margin: 0 clamp(10px, 1.8vw, 24px); }
canvas { display: block; width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 15px 70px 36px 3px; display: grid; place-content: center; gap: 8px; padding: 12px; text-align: center; }
.chart-empty strong { font-size: 21px; }
.chart-empty span { color: var(--muted); font-size: 13px; line-height: 1.6; }
.history-footer { border-top: 1px solid var(--line); padding: 12px clamp(14px, 2vw, 26px); color: var(--muted); font-size: 13px; }
.history-footer strong { margin-left: 5px; color: var(--text); font: 500 13px var(--mono); }

@media (max-width: 700px) {
  .readouts { grid-template-columns: 1fr; gap: 22px; }
  .metrics > div { padding-inline: clamp(6px, 2vw, 13px); }
  .metrics > div:first-child { border-left: 0; padding-left: 0; }
  .metrics dd { gap: 4px; font-size: clamp(18px, 5.2vw, 36px); }
  .metrics dd small { font-size: 11px; }
}

@media (max-width: 450px) {
  .masthead, .session { gap: 8px; }
  .masthead h1 { font-size: 15px; gap: 7px; }
  .status { font-size: 11px; }
  button { padding-inline: 8px; font-size: 12px; }
}
