/* SpeedTest Ultra. Light tokens sit on :root; dark tokens apply for the system preference and for a saved override (html[data-theme]). */

@property --phase { syntax: "<color>"; inherits: true; initial-value: #808a9e; }

:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --raise: #ffffff;
  --line: #e4e9f0;
  --line-2: #d3dae5;
  --text: #0f1729;
  --text-2: #4a5568;
  --text-3: #5f6b7f;
  --track: #e9edf3;
  --down: #0a87b8;
  --up: #7a52e0;
  --lat: #b97300;
  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #d03b3b;
  --brand-a: #0a87b8;
  --brand-b: #7a52e0;
  --gd0: #0b77a3; --gd1: #0a87b8; --gd2: #23a6d5;
  --gu0: #6a43d0; --gu1: #7a52e0; --gu2: #9a7cf0;
  --face-a: #ffffff;
  --face-b: #edf1f7;
  --hl: rgba(255, 255, 255, .8);
  --shadow: 0 1px 2px rgba(15, 23, 41, .05), 0 14px 34px -16px rgba(15, 23, 41, .16);
  --aur: 16%;
  --dot: rgba(15, 23, 41, .08);
  --focus: #0a87b8;
  --tip-bg: #0f1729;
  --tip-fg: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0d13;
    --surface: #10141c;
    --surface-2: #151a24;
    --raise: #232b3a;
    --line: #1f2633;
    --line-2: #2b3443;
    --text: #e8ecf3;
    --text-2: #a9b2c3;
    --text-3: #808a9e;
    --track: #1b2230;
    --down: #12a2c8;
    --up: #8a68ea;
    --lat: #c48616;
    --brand-a: #19b4d8;
    --brand-b: #7d5be6;
    --gd0: #0e8db0; --gd1: #12a2c8; --gd2: #49c6e6;
    --gu0: #6e4fd6; --gu1: #8a68ea; --gu2: #b39cf5;
    --face-a: #1a2130;
    --face-b: #0f131b;
    --hl: rgba(255, 255, 255, .05);
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 18px 40px -18px rgba(0, 0, 0, .7);
    --aur: 24%;
    --dot: rgba(255, 255, 255, .055);
    --focus: #49c6e6;
    --tip-bg: #e8ecf3;
    --tip-fg: #0f1729;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d13;
  --surface: #10141c;
  --surface-2: #151a24;
  --raise: #232b3a;
  --line: #1f2633;
  --line-2: #2b3443;
  --text: #e8ecf3;
  --text-2: #a9b2c3;
  --text-3: #808a9e;
  --track: #1b2230;
  --down: #12a2c8;
  --up: #8a68ea;
  --lat: #c48616;
  --brand-a: #19b4d8;
  --brand-b: #7d5be6;
  --gd0: #0e8db0; --gd1: #12a2c8; --gd2: #49c6e6;
  --gu0: #6e4fd6; --gu1: #8a68ea; --gu2: #b39cf5;
  --face-a: #1a2130;
  --face-b: #0f131b;
  --hl: rgba(255, 255, 255, .05);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 18px 40px -18px rgba(0, 0, 0, .7);
  --aur: 24%;
  --dot: rgba(255, 255, 255, .055);
  --focus: #49c6e6;
  --tip-bg: #e8ecf3;
  --tip-fg: #0f1729;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
html[data-lang="zh"] .en,
html[data-lang="en"] .zh,
html[data-unit="Mbps"] .u-mbs,
html[data-unit="MBps"] .u-mbps { display: none !important; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.wrap { width: 100%; max-width: 1128px; margin: 0 auto; padding-inline: max(24px, env(safe-area-inset-left)) max(24px, env(safe-area-inset-right)); }

/* Background: two slow color fields and a dot grid that fades out below the fold */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora::before, .aurora::after { content: ""; position: absolute; width: 72vmax; height: 72vmax; border-radius: 50%; }
.aurora::before {
  left: -24vmax; top: -40vmax;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--down) var(--aur), transparent), transparent);
  animation: drift-a 28s ease-in-out infinite alternate;
}
.aurora::after {
  right: -26vmax; top: -38vmax;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--up) var(--aur), transparent), transparent);
  animation: drift-b 34s ease-in-out infinite alternate;
}
.dots {
  position: absolute; inset: 0;
  background: radial-gradient(circle, var(--dot) 1px, transparent 1.5px) 0 0 / 22px 22px;
  -webkit-mask: linear-gradient(to bottom, #000, transparent 60%);
  mask: linear-gradient(to bottom, #000, transparent 60%);
}
@keyframes drift-a { to { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes drift-b { to { transform: translate(-7vmax, 8vmax) scale(1.06); } }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
}
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -.015em; white-space: nowrap; border-radius: 10px; }
.logo { display: block; width: 30px; height: 30px; flex: none; }
.brand b, .foot-brand b {
  font-weight: 700;
  background: linear-gradient(90deg, var(--brand-a), var(--brand-b));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.tools { display: flex; align-items: center; gap: 8px; flex: none; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  border: 0; background: none; cursor: pointer;
  padding: 5px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-3);
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.seg button:hover { color: var(--text); }
html[data-unit="Mbps"] .seg [data-set-unit="Mbps"],
html[data-unit="MBps"] .seg [data-set-unit="MBps"] {
  background: var(--raise); color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 0 0 1px var(--line);
}
.icon-btn, .pill-btn {
  height: 36px; min-width: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); cursor: pointer;
  transition: color .2s, border-color .2s;
}
.pill-btn { padding: 0 12px; font-size: 13px; font-weight: 600; }
.pill-btn .i { width: 16px; height: 16px; }
.icon-btn:hover, .pill-btn:hover { color: var(--text); border-color: var(--line-2); }
.theme-btn .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: none; }
}
:root[data-theme="dark"] .theme-btn .sun { display: block; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }

/* Layout */
main { display: grid; gap: 20px; padding-top: 24px; padding-bottom: 8px; }
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 var(--hl), var(--shadow);
}
.hero { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 20px; align-items: stretch; }

/* Gauge card */
.gauge-card {
  --phase: var(--text-3);
  display: flex; flex-direction: column;
  padding: 22px 24px 24px;
  background: radial-gradient(90% 58% at 50% 30%, color-mix(in oklab, var(--phase) 11%, transparent), transparent 72%), var(--surface);
  transition: --phase .5s ease;
}
.gauge-card[data-phase="ping"] { --phase: var(--lat); }
.gauge-card[data-phase="down"] { --phase: var(--down); }
.gauge-card[data-phase="up"] { --phase: var(--up); }
.gauge { position: relative; width: min(100%, 380px); aspect-ratio: 320 / 300; margin: 0 auto; container-type: inline-size; }
.dial { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dial .track { fill: none; stroke: var(--track); stroke-width: 14; stroke-linecap: round; }
.dial .val { fill: none; stroke-width: 14; stroke-linecap: round; transition: opacity .25s; }
.dial .sweep { fill: none; stroke: var(--lat); stroke-width: 14; stroke-linecap: round; stroke-dasharray: 64 577; opacity: 0; transition: opacity .3s; }
.gauge-card[data-phase="ping"] .sweep { opacity: 1; animation: sweep 1.4s linear infinite; }
@keyframes sweep { to { stroke-dashoffset: -641; } }
.dial .tick { stroke: var(--line-2); stroke-width: 1.5; stroke-linecap: round; transition: stroke .25s; }
.dial .tick.major { stroke-width: 2.5; }
.dial .tick.on { stroke: var(--phase); }
.dial .glabel { font: 500 11px/1 var(--font); fill: var(--text-3); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
.dial .labels { transition: opacity .45s; }
.dial .labels.off { opacity: 0; }
.gauge-card[data-phase="ping"] .labels:not(.off) { opacity: .45; }
.dial .head { fill: #fff; stroke: var(--phase); stroke-width: 3; transition: opacity .2s; }
.dial .hide { opacity: 0; }
.s-d0 { stop-color: var(--gd0); } .s-d1 { stop-color: var(--gd1); } .s-d2 { stop-color: var(--gd2); }
.s-u0 { stop-color: var(--gu0); } .s-u1 { stop-color: var(--gu1); } .s-u2 { stop-color: var(--gu2); }

.start {
  position: absolute; left: 50%; top: 53.333%; z-index: 2;
  width: 46%; aspect-ratio: 1; padding: 0;
  translate: -50% -50%;
  border: 0; border-radius: 50%; background: none; cursor: pointer;
  color: var(--text);
  transition: opacity .35s, scale .35s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}
.start:hover { scale: 1.035; }
.start:active { scale: .98; }
.start:focus-visible { outline-offset: 6px; }
.start-glow {
  position: absolute; inset: -9%; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--brand-a), var(--brand-b), var(--brand-a));
  filter: blur(22px); opacity: .32;
  animation: pulse 3.6s ease-in-out infinite;
}
.start-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, #19b4d8, #7d5be6 35%, #19b4d8 55%, #7d5be6 80%, #19b4d8);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  animation: spin 8s linear infinite;
}
.start-face {
  position: absolute; inset: 6px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 28%, var(--face-a), var(--face-b) 78%);
  box-shadow: inset 0 1px 0 var(--hl), inset 0 -14px 28px -14px color-mix(in oklab, var(--brand-b) 40%, transparent);
}
.start-label { font-size: 5.6cqw; font-weight: 650; letter-spacing: .02em; line-height: 1.2; }
.lbl-again, .has-result .lbl-start { display: none; }
.has-result .lbl-again { display: inline; }
@keyframes spin { to { rotate: 360deg; } }
@keyframes pulse { 50% { opacity: .5; scale: 1.06; } }

.readout {
  position: absolute; left: 50%; top: 53.333%;
  translate: -50% -50%;
  display: grid; justify-items: center; gap: 1.2cqw;
  opacity: 0; pointer-events: none; text-align: center;
  transition: opacity .3s;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 9px; border-radius: 999px;
  font-size: max(12px, 3.6cqw); font-weight: 600; line-height: 1.3; color: var(--text);
  background: color-mix(in oklab, var(--phase) 16%, transparent);
}
.chip .i { width: 1.15em; height: 1.15em; color: var(--phase); }
.num { font-size: 15cqw; font-weight: 650; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.unit { font-size: max(12px, 4cqw); font-weight: 500; line-height: 1.2; color: var(--text-3); }
.stop {
  position: absolute; left: 50%; top: 92%;
  translate: -50% -50%;
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility 0s .3s, color .2s, border-color .2s;
}
.stop:hover { color: var(--text); border-color: var(--line-2); }
.stop .i { width: 12px; height: 12px; }
.is-running .start { opacity: 0; scale: .86; visibility: hidden; pointer-events: none; transition: opacity .3s, scale .3s, visibility 0s .3s; }
.is-running .readout { opacity: 1; }
.is-running .stop { opacity: 1; visibility: visible; transition: opacity .3s .15s, visibility 0s, color .2s, border-color .2s; }

/* Progress steps, swapped for the result actions once a test has finished */
.status { display: grid; align-items: center; min-height: 46px; margin-top: 10px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.steps li { --c: var(--lat); display: grid; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-3); }
.steps li[data-step="down"] { --c: var(--down); }
.steps li[data-step="up"] { --c: var(--up); }
.st-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.st-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--line-2); transition: background-color .3s, box-shadow .3s; }
.steps li[data-state="active"] { color: var(--text); }
.steps li[data-state="active"] .st-dot { background: var(--c); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c) 22%, transparent); }
.steps li[data-state="done"] { color: var(--text-2); }
.steps li[data-state="done"] .st-dot { background: var(--c); }
.st-bar { display: block; height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.st-bar b { display: block; height: 100%; border-radius: 2px; background: var(--c); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .15s linear; }
.after { display: none; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.has-result:not(.is-running) .steps { display: none; }
.has-result:not(.is-running) .after { display: flex; }
.usage { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.ghost-btn:hover { color: var(--text); border-color: var(--line-2); }
.ghost-btn .i { width: 16px; height: 16px; }
.ghost-btn.confirm { color: var(--text); border-color: color-mix(in oklab, var(--crit) 55%, var(--line)); }
.ghost-btn.confirm .i { color: var(--crit); }

/* Network and server */
.info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.info-item { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.info-ico { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.info-txt { display: grid; min-width: 0; line-height: 1.4; }
.info-k { font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.info-v { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-s { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.ip { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; transition: filter .25s; }
html:not([data-blur="false"]) .ip { filter: blur(4.5px); -webkit-user-select: none; user-select: none; }
.eye { width: 24px; height: 24px; flex: none; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; }
.eye:hover { color: var(--text); }
.eye .i { width: 15px; height: 15px; }


/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 20px; min-width: 0; }
.tile { --c: var(--down); display: flex; flex-direction: column; min-width: 0; padding: 18px 20px 16px; }
.tile[data-k="up"] { --c: var(--up); }
.tile[data-k="ping"], .tile[data-k="jit"] { --c: var(--lat); }
.tile-h { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t-ico { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; color: var(--c); background: color-mix(in oklab, var(--c) 14%, transparent); }
.t-ico .i { width: 17px; height: 17px; }
.t-k { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-2); }
.t-v { display: flex; align-items: baseline; gap: 6px; min-width: 0; margin-top: 14px; }
.t-num { font-size: 34px; font-weight: 650; letter-spacing: -.025em; line-height: 1.05; white-space: nowrap; }
.tile.live .t-num { color: var(--text-2); font-variant-numeric: tabular-nums; }
.t-u { font-size: 14px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.t-s { margin-top: 4px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.t-chart { position: relative; flex: 1 1 auto; min-height: 56px; margin-top: 14px; border-radius: 6px; touch-action: pan-y; }
.t-chart > svg, .dp > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.t-chart:focus-visible, .dp:focus-visible { outline-offset: 5px; }

/* Chart marks: 2px lines, 10% area, end dot with a surface ring, 2px gaps between bars, hairline grid */
.mk-base { stroke: var(--line-2); stroke-width: 1; }
.mk-grid { stroke: var(--line); stroke-width: 1; }
.mk-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mk-area { fill: var(--c); opacity: .1; }
.mk-dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.mk-x { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 3; }
.mk-bar { fill: var(--c); transition: opacity .15s; }
.hl .mk-bar:not(.on) { opacity: .35; }
.tip {
  position: absolute; left: 0; top: 0; z-index: 6;
  display: grid; gap: 1px; padding: 6px 9px; border-radius: 8px;
  background: var(--tip-bg); color: var(--tip-fg);
  font-size: 12px; line-height: 1.35; white-space: nowrap; font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .4);
  translate: -50% calc(-100% - 10px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .12s, visibility 0s .12s;
}
.tip.on { opacity: 1; visibility: visible; transition: opacity .12s; }
.tip b { font-weight: 650; }
.tip span { opacity: .7; }

/* Insight panels */
.insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.panel { min-width: 0; padding: 22px 24px 24px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; margin-bottom: 14px; }
.sec-h h2, .faq h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.sec-sub { font-size: 13px; color: var(--text-3); }
.q-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.q { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px 12px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.q-ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.q-t { display: grid; min-width: 0; line-height: 1.4; }
.q-name { font-size: 14px; font-weight: 600; }
.q-d { font-size: 12.5px; color: var(--text-3); }
.badge, .grade { --s: var(--text-3); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 7px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: color-mix(in oklab, var(--s) 14%, transparent); }
.badge .i { width: 15px; height: 15px; color: var(--s); }
[data-s="good"] { --s: var(--good); }
[data-s="warn"] { --s: var(--warn); }
[data-s="serious"] { --s: var(--serious); }
[data-s="crit"] { --s: var(--crit); }
.grade { display: flex; align-items: center; gap: 16px; }
.grade-badge { width: 60px; height: 60px; flex: none; display: grid; place-items: center; border-radius: 18px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; background: color-mix(in oklab, var(--s) 13%, var(--surface)); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--s) 50%, transparent); }
.grade-txt { display: grid; gap: 2px; min-width: 0; }
.grade-l { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 650; }
.grade-l .i { width: 17px; height: 17px; color: var(--s); }
.grade-d { font-size: 13px; color: var(--text-3); }

/* Latency dot plot: one row per condition, min to max range with the median dot */
.dp { position: relative; height: 124px; margin-top: 22px; border-radius: 6px; touch-action: pan-y; }
.dp-row { transition: opacity .15s; }
.dp-row[data-k="idle"] { --c: var(--lat); }
.dp-row[data-k="down"] { --c: var(--down); }
.dp-row[data-k="up"] { --c: var(--up); }
.hl .dp-row:not(.on) { opacity: .35; }
.dp-lab, .dp-val { font-size: 12.5px; dominant-baseline: central; }
.dp-lab { font-weight: 500; fill: var(--text-2); }
.dp-val { font-weight: 600; fill: var(--text); text-anchor: end; font-variant-numeric: tabular-nums; }
.dp-rng { stroke: var(--c); stroke-width: 6; stroke-linecap: round; opacity: .35; }
.dp-dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.dp-tk { font-size: 11px; fill: var(--text-3); text-anchor: middle; font-variant-numeric: tabular-nums; }

/* History */
.tbl { overflow-x: auto; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { padding: 0 10px 10px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl th small { font-size: inherit; font-weight: 500; }
.tbl td { padding: 11px 10px; white-space: nowrap; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl :is(th, td):first-child { padding-left: 0; }
.tbl :is(th, td):last-child { padding-right: 0; }
.tbl .n { text-align: right; }
.tbl td.n { font-weight: 600; }
.tbl .c { text-align: center; }
.tbl .dim { color: var(--text-3); }
.gl { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 6px; border-radius: 7px; font-size: 12px; font-weight: 700; background: color-mix(in oklab, var(--s, var(--text-3)) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--s, var(--text-3)) 45%, transparent); }
.hist .empty { margin: 0; padding: 22px 0 8px; text-align: center; font-size: 13.5px; color: var(--text-3); }
.hist.has-rows .empty, .hist:not(.has-rows) .tbl, .hist:not(.has-rows) .ghost-btn { display: none; }

/* FAQ */
.faq { padding: 22px 24px 8px; }
.faq h2 { margin-bottom: 4px; }
.faq details + details { border-top: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; cursor: pointer; list-style: none; font-size: 15px; font-weight: 600; border-radius: 8px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .i { color: var(--text-3); transition: rotate .25s, color .2s; }
.faq summary:hover .i { color: var(--text); }
.faq details[open] summary .i { rotate: 180deg; }
.faq details p { margin: -4px 0 16px; max-width: 72ch; font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* Footer, toast, 404 */
.foot { padding: 28px 0 calc(36px + env(safe-area-inset-bottom)); font-size: 13px; color: var(--text-3); }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.foot-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.foot-brand .logo { width: 22px; height: 22px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--tip-bg); color: var(--tip-fg); font-size: 13.5px; font-weight: 600;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .45);
  translate: -50% 12px; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s, translate .25s, visibility 0s .25s;
}
.toast.on { opacity: 1; translate: -50% 0; visibility: visible; transition: opacity .25s, translate .25s; }
.nf { display: grid; place-items: center; min-height: 100vh; text-align: center; }
.nf-code { margin: 0; font-size: 72px; font-weight: 700; letter-spacing: -.04em; line-height: 1; background: linear-gradient(90deg, var(--brand-a), var(--brand-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nf p { margin: 14px 0 24px; color: var(--text-2); }
.nf .ghost-btn { height: 40px; padding: 0 16px; text-decoration: none; }

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .insights { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  main { gap: 14px; padding-top: 16px; }
  .top-in { height: 56px; }
  .card { border-radius: 20px; }
  .gauge-card { padding: 16px 16px 18px; }
  .info { grid-template-columns: minmax(0, 1fr); }
  .steps { gap: 10px; }
  .tiles { gap: 12px; }
  .tile { padding: 14px 14px 12px; }
  .t-ico { width: 26px; height: 26px; border-radius: 8px; }
  .t-ico .i { width: 15px; height: 15px; }
  .t-k { font-size: 13px; }
  .t-v { gap: 4px; margin-top: 10px; }
  .t-num { font-size: 27px; }
  .t-u, .t-s { font-size: 12px; }
  .t-chart { min-height: 44px; margin-top: 10px; }
  .panel, .faq { padding-inline: 16px; }
  .q { padding: 10px; gap: 10px; }
}
@media (max-width: 480px) {
  .wordmark { display: none; }
  .tools { gap: 6px; }
  .seg button { padding: 5px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .aurora::before, .aurora::after, .start-ring, .start-glow,
  .gauge-card[data-phase="ping"] .sweep { animation: none; }
  .start, .faq summary .i, .st-bar b, .toast, .tip { transition: none; }
}
