/* bryan.speedtest — shared styles for the test page and the history page */
:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --line: #262b33;
  --text: #eef1f5;
  --muted: #8a93a1;
  --dl: #3ee6a8;
  --ul: #8b7bff;
  --ping: #ffb547;
  --danger: #ff5d6c;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; justify-content: center; padding: 32px 16px;
}
main { width: 100%; max-width: 760px; }
header { margin-bottom: 24px; }
h1 { font-size: 26px; margin: 0; letter-spacing: -0.02em; line-height: 1.2; }
h1 span { color: var(--dl); }
.tagline { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.meta div { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; color: var(--muted); }
.meta b { color: var(--text); font-weight: 600; margin-left: 4px; }

.targets { border: 0; margin: -8px 0 16px; padding: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.targets[hidden] { display: none; }
.targets legend { float: left; padding: 0; margin-right: 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.targets label { cursor: pointer; }
.targets input { position: absolute; opacity: 0; pointer-events: none; }
.targets span { display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }
.targets input:checked + span { color: var(--text); border-color: var(--dl); background: rgba(62, 230, 168, 0.08); }
.targets input:focus-visible + span { outline: 2px solid var(--dl); outline-offset: 2px; }
.targets:disabled label { cursor: default; opacity: 0.6; }
.note { color: var(--ping); font-size: 13px; margin: -6px 0 16px; }
.note:empty { display: none; }

.stage {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px 20px; display: flex; flex-direction: column; align-items: center;
}
.gauge { width: 100%; max-width: 380px; aspect-ratio: 1 / 0.72; position: relative; }
.gauge svg { width: 100%; height: 100%; overflow: visible; }
.gauge .track { stroke: var(--line); }
.gauge .bar { transition: stroke-dashoffset 0.15s linear, stroke 0.3s; }
.tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.readout { position: absolute; inset: auto 0 6% 0; text-align: center; }
.readout .value { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.readout .unit { color: var(--muted); font-size: 14px; }
.phase { margin-top: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); min-height: 20px; }

button.go {
  margin-top: 20px; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: #06140f;
  background: var(--dl); padding: 14px 40px; border-radius: 999px;
  transition: transform 0.1s, opacity 0.2s;
}
button.go:hover { transform: translateY(-1px); }
button.go:active { transform: translateY(1px); }
button.go.stop { background: var(--danger); color: #fff; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; display: flex; align-items: center; gap: 6px; }
.card .label i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.card .num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.card .num small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }

canvas.spark { width: 100%; height: 70px; display: block; margin-top: 16px; }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 20px; text-align: center; }

/* ---------- History button (test page) ---------- */
.history-link {
  display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 18px; min-height: 64px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); text-decoration: none; transition: border-color 0.15s, transform 0.1s;
}
.history-link:hover { border-color: var(--dl); }
.history-link:active { transform: translateY(1px); }
.history-link:focus-visible { outline: 2px solid var(--dl); outline-offset: 2px; }
.history-link svg { flex: none; color: var(--dl); }
.history-link .text { flex: 1; min-width: 0; }
.history-link strong { display: block; font-size: 15px; }
.history-link .sub { display: block; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.history-link .chev { color: var(--muted); font-size: 26px; line-height: 1; }

/* ---------- History page ---------- */
.back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: -10px 0 6px;
  color: var(--muted); text-decoration: none; font-size: 14px;
}
.back:hover { color: var(--text); }
.back:focus-visible { outline: 2px solid var(--dl); outline-offset: 2px; border-radius: 6px; }
.section-label { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.summary .cards { margin-top: 12px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 12px; }
.text-btn { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; font-size: 13px; padding: 10px 4px; }
.text-btn:hover { text-decoration: underline; }
.results { display: flex; flex-direction: column; gap: 10px; }
.result { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.result-head { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.result-head time { color: var(--text); font-weight: 600; }
.result-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 0; }
.result-nums dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; display: flex; align-items: center; gap: 6px; }
.result-nums dt i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.result-nums dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-nums dd small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.empty {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px 16px; text-align: center; color: var(--muted); font-size: 14px;
}
.empty a { color: var(--dl); font-weight: 600; }

@media (max-width: 560px) {
  .cards, .result-nums { grid-template-columns: repeat(2, 1fr); }
  .readout .value { font-size: 48px; }
}
