:root {
  color-scheme: dark;
  --bg: #0b101b;
  --surface: #111a29;
  --line: #273449;
  --text: #f1f6fc;
  --muted: #a4b1c5;
  --cyan: #64dfed;
  --violet: #b7a2ff;
  --amber: #f5c477;
  --phase: var(--cyan);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 1rem; line-height: 1.5; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--cyan); outline-offset: 5px; }
.shell { max-width: 1024px; margin: 0 auto; padding: 0 32px; }
.topbar { min-height: 94px; display: flex; gap: 24px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-size: 1.2rem; font-weight: 650; letter-spacing: -.035em; }
.brand svg { width: 30px; height: 30px; color: var(--cyan); flex-shrink: 0; }
.header-note { color: var(--muted); font-size: .875rem; }
main { max-width: 832px; margin: 0 auto; }
.intro { text-align: center; padding: 38px 0 25px; }
.eyebrow { margin: 0 0 9px; color: var(--cyan); font-size: .75rem; font-weight: 650; letter-spacing: .17em; }
h1 { margin: 0 0 8px; font-size: clamp(1.65rem, 3.6vw, 2.25rem); line-height: 1.22; letter-spacing: -.045em; font-weight: 650; }
.intro > p:last-child { margin: 0; color: var(--muted); font-size: 1rem; }
.test-panel { position: relative; border: 1px solid var(--line); border-radius: 20px; background: radial-gradient(ellipse at 50% 43%, #122537 0%, transparent 62%), var(--surface); padding: 22px 28px 16px; }
.panel-top { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: .8125rem; }
.phase-badge { border: 1px solid #354256; border-radius: 7px; padding: 5px 10px; color: #d1ddeb; }
.duration-note { color: var(--muted); text-align: right; }
.gauge { width: min(100%, 360px); aspect-ratio: 360 / 280; min-height: 17.5rem; position: relative; margin: 6px auto -13px; }
.gauge-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gauge-ticks { stroke: #30435a; stroke-width: 7; stroke-dasharray: .24 2.26; }
.gauge-track { stroke: #273a50; stroke-width: 8; stroke-linecap: round; }
.gauge-fill { stroke: var(--phase); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .2s linear, stroke .3s; }
.gauge-reading { position: absolute; inset: 26% 8% 18%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-label { font-size: .75rem; letter-spacing: .13em; font-weight: 600; color: var(--muted); }
.gauge-value { font-size: clamp(3rem, 8vw, 4.5rem); font-weight: 550; letter-spacing: -.06em; line-height: 1.3; font-variant-numeric: tabular-nums; }
.gauge-value.compact { font-size: clamp(2.3rem, 7vw, 3.65rem); }
.gauge-unit { font-size: .9375rem; color: var(--muted); }
.gauge-caption { position: absolute; bottom: 9%; left: 0; width: 100%; text-align: center; font-size: .8125rem; color: var(--muted); }
.test-controls { text-align: center; }
.start-button { min-height: 54px; width: 228px; max-width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 10px; background: var(--cyan); color: #08222b; font-size: 1.0625rem; font-weight: 700; cursor: pointer; transition: background .2s, transform .2s; }
.start-button:hover { background: #8eecf5; }
.start-button:active { transform: translateY(1px); }
.start-button svg { width: 20px; height: 20px; }
.start-button.running { background: #233448; color: var(--text); outline: 1px solid #486079; }
.start-button.running:hover { background: #304257; }
.start-button:disabled { cursor: not-allowed; opacity: .6; }
.data-note { margin: 12px 0 0; font-size: .8125rem; color: var(--muted); }
.progress-area { max-width: 438px; margin: 25px auto 0; }
.progress-track { height: 3px; background: #29384c; border-radius: 5px; overflow: hidden; }
.progress-track > span { display: block; width: 0; height: 100%; background: var(--cyan); transition: width .2s linear; }
.steps { display: flex; flex-wrap: wrap; list-style: none; justify-content: space-between; padding: 0; margin: 12px 0 0; gap: 12px; font-size: .875rem; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 7px; }
.steps li span { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border: 1px solid #3a4b61; border-radius: 50%; font-size: .75rem; }
.steps li.active { color: var(--text); }
.steps li.active span { border-color: var(--cyan); color: var(--cyan); }
.steps li.done span { background: var(--cyan); border-color: var(--cyan); color: #08222b; }
.status-message { text-align: center; font-size: .875rem; color: var(--muted); margin: 18px auto 0; max-width: 600px; min-height: 21px; }
.status-message.error { color: #ffb7a6; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,10rem),1fr)); gap: 12px; margin-top: 14px; }
.metric { border: 1px solid var(--line); background: #101927; border-radius: 12px; padding: 17px 18px 16px; min-width: 0; transition: border-color .2s; }
.metric.active { border-color: var(--phase); }
.metric h2 { display: flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 500; margin: 0 0 9px; color: #d0d9e7; }
.metric h2 svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--cyan); }
#metric-upload h2 svg { color: var(--violet); }
#metric-ping h2 svg, #metric-jitter h2 svg { color: var(--amber); }
.metric p { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin: 0; line-height: 1.2; }
.metric strong { font-size: 1.9rem; font-weight: 550; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.metric p > span { font-size: .75rem; color: var(--muted); }
.metric-hint { color: var(--muted); font-size: .75rem; display: block; margin-top: 8px; }
.server-row { display: flex; align-items: center; gap: 11px; padding: 22px 4px; color: var(--muted); }
.server-row > svg { width: 22px; height: 22px; flex-shrink: 0; }
.server-row > div { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.server-row span { font-size: .8125rem; }
.server-row strong { font-size: .875rem; font-weight: 500; color: #d0d9e7; overflow-wrap: anywhere; }
.server-row .result-time { margin-left: auto; text-align: right; }
.about { border-top: 1px solid var(--line); }
.about summary { cursor: pointer; font-size: .875rem; color: #c7d2e2; padding: 17px 0; width: fit-content; }
.about > div { color: var(--muted); font-size: 1rem; padding-bottom: 10px; }
.about p { margin: 0 0 13px; }
.about strong { color: #d7e1ee; font-weight: 600; }
.noscript { border: 1px solid #a07f48; padding: 15px; border-radius: 10px; }
footer { display: flex; justify-content: space-between; gap: 20px; font-size: .75rem; color: var(--muted); padding: 22px 0 30px; margin-top: 12px; border-top: 1px solid var(--line); }
footer a { text-decoration-color: #5f738b; text-underline-offset: 3px; }
@media (max-width: 600px) {
  .shell { padding: 0 18px; }
  .topbar { min-height: 73px; }
  .header-note { display: none; }
  .intro { padding: 25px 0 20px; }
  .intro > p:last-child { font-size: 1rem; max-width: 30ch; margin: 0 auto; }
  .test-panel { padding: 16px 16px 15px; border-radius: 15px; }
  .panel-top { font-size: .75rem; align-items: flex-start; }
  .phase-badge { padding: 4px 8px; }
  .duration-note { padding-top: 5px; }
  .gauge { max-width: 315px; margin-top: 2px; }
  .gauge-value { font-size: 3.75rem; }
  .gauge-value.compact { font-size: 3rem; }
  .gauge-label { letter-spacing: .1em; }
  .data-note { max-width: 29ch; margin-left: auto; margin-right: auto; }
  .progress-area { margin-top: 21px; }
  .steps { font-size: .875rem; gap: 5px; }
  .steps li { gap: 5px; }
  .status-message { font-size: .875rem; margin-top: 15px; }
  .metrics { grid-template-columns: repeat(auto-fit,minmax(min(100%,7.5rem),1fr)); gap: 10px; margin-top: 10px; }
  .metric { padding: 15px; }
  .metric strong { font-size: 1.9rem; }
  .server-row { padding: 20px 0; }
  .server-row > div { display: block; }
  .server-row > div span, .server-row > div strong { display: block; }
  .server-row .result-time { max-width: 110px; font-size: .75rem; }
  footer { font-size: .75rem; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
@media (max-width: 350px) {
  .shell { padding: 0 12px; }
  .test-panel { padding: 13px 12px; }
  .duration-note { max-width: 12ch; padding: 0; }
  .gauge-value { font-size: 3.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
