/* 拉爆基站 · 官网 — mobile first, dark by default, light via prefers-color-scheme. No external assets. */
:root {
  color-scheme: dark;
  --bg: #0a0e15;
  --bg-glow: rgba(56, 189, 248, .10);
  --surface: #131a25;
  --surface-2: #1b2433;
  --line: #253044;
  --ink: #f3f6fb;
  --muted: #8b97aa;
  --faint: #4b5668;
  --subtle: #76829a; /* secondary text that must stay readable (≥4.5:1) */
  --down-1: #38bdf8;
  --down-2: #6366f1;
  --up-1: #c084fc;
  --up-2: #f472b6;
  --accent: #3b82f6;
  --accent-ink: #fff;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --gold: #fbbf24;
  --silver: #cbd5e1;
  --bronze: #f59e6b;
  --shadow: 0 20px 50px -24px rgba(0, 0, 0, .7);
  --radius: 20px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --header-h: 60px;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f3f5f9;
    --bg-glow: rgba(2, 132, 199, .08);
    --surface: #ffffff;
    --surface-2: #eef1f6;
    --line: #e1e6ee;
    --ink: #0f172a;
    --muted: #64748b;
    --faint: #a3adbd;
    --subtle: #6b7587;
    --down-1: #0284c7;
    --down-2: #4f46e5;
    --up-1: #9333ea;
    --up-2: #db2777;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --gold: #d97706;
    --silver: #94a3b8;
    --bronze: #c2410c;
    --shadow: 0 18px 40px -26px rgba(15, 23, 42, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 50% -120px, var(--bg-glow), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 10px; background: var(--accent); color: #fff; text-decoration: none; }
.skip-link:focus { top: 10px; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 18px; }
.num, .stat dd, .readout-value, .result-speed b { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: background-color .2s, border-color .2s, transform .15s, opacity .2s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled, .btn.is-disabled { opacity: .5; cursor: default; filter: none; transform: none; }
.btn.is-disabled { pointer-events: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-soft:hover { border-color: var(--faint); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-large { min-height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) { .site-header { background: var(--bg); } }
.header-inner { height: 100%; display: flex; align-items: center; gap: 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .02em; text-decoration: none; }
.wordmark img { border-radius: 8px; }
.wordmark-sm { font-size: 14px; gap: 8px; }
.header-nav { display: none; margin-left: auto; gap: 4px; }
.header-nav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px; transition: color .2s, background-color .2s; }
.header-nav a:hover { color: var(--ink); background: var(--surface-2); }
.header-inner > .btn { margin-left: auto; }
@media (min-width: 720px) {
  .header-nav { display: flex; }
  .header-inner > .btn { margin-left: 8px; }
}

/* ---------- announcement banner ---------- */
.banner { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface)); border-bottom: 1px solid var(--line); }
.banner-inner { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
.banner-tag { flex: none; padding: 1px 8px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; }
.banner-text { flex: 1; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.banner-text strong { color: var(--ink); margin-right: 8px; font-weight: 600; }
.banner-link { flex: none; color: var(--accent); font-weight: 600; text-decoration: none; }
.banner-link:hover { text-decoration: underline; }
.banner-close { flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin-right: -6px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.banner-close:hover { background: var(--surface-2); color: var(--ink); }
.banner-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---------- hero / speed test ---------- */
.hero { padding: 22px 0 36px; }
.hero-grid { display: grid; gap: 14px; grid-template-areas: "head" "gauge" "panel"; }
.hero-head { grid-area: head; text-align: center; }
.hero-controls { display:flex; flex-direction:column; align-items:center; gap:10px; margin-top:12px; }
.hero-controls .ip-chip, .hero-controls .seg-mode { margin:0; }
.stress-upload-option { display:flex; align-items:center; justify-content:center; gap:9px; min-height:36px; padding:4px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); cursor:pointer; font-size:13px; }
.stress-upload-option small { color:var(--muted); font-size:12px; }
.stress-upload-option input { position:absolute; opacity:0; width:1px; height:1px; }
.upload-switch { width:30px; height:18px; border-radius:20px; background:var(--faint); padding:3px; transition:background .2s; }
.upload-switch::before { content:''; display:block; width:12px; height:12px; background:#fff; border-radius:50%; transition:transform .2s; }
.stress-upload-option input:checked + .upload-switch { background:var(--up-1); }
.stress-upload-option input:checked + .upload-switch::before { transform:translateX(12px); }
.stress-upload-option input:focus-visible + .upload-switch { outline:2px solid var(--accent); outline-offset:3px; }
.stress-upload-option:has(input:disabled) { cursor:default; opacity:.7; }
.speed-tools { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:8px 10px; margin:0 0 12px; color:var(--muted); font-size:12px; }
.speed-tools .btn { flex:none; }
.speed-tool-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-left:auto; }
.live-latency { display:inline-flex; align-items:center; gap:6px; min-height:32px; padding:4px 9px; border:1px solid var(--line); border-radius:10px; background:var(--surface); white-space:nowrap; }
.live-latency::before { content:''; width:6px; height:6px; flex:none; border-radius:50%; background:var(--faint); }
.live-latency b { min-width:49px; color:var(--ink); font-variant-numeric:tabular-nums; font-weight:650; text-align:right; }
.live-latency[data-state=good]::before { background:var(--success); }
.live-latency[data-state=slow]::before { background:var(--warning); }
.live-latency[data-state=timeout]::before { background:var(--danger); }
.monitor-message { padding:10px 12px; margin:0 0 12px; border:1px solid var(--line); border-radius:12px; color:var(--muted); background:var(--surface); font-size:12px; line-height:1.6; }
.floating-body { margin:0; min-width:0; background:var(--surface); }
.floating-panel { padding:16px; }
.floating-panel header, .floating-panel footer { display:flex; align-items:center; gap:10px; justify-content:space-between; }
.floating-panel header strong { font-size:14px; }
.floating-panel button { border:1px solid var(--line); background:var(--surface-2); color:var(--ink); border-radius:8px; padding:5px 9px; font-size:12px; }
.floating-panel #float-status { margin:8px 0 12px; font-size:12px; color:var(--muted); }
.floating-rates { display:flex; gap:24px; margin-bottom:14px; }
.floating-rates > div { flex:1; min-width:0; }
.floating-rates span, .floating-rates b, .floating-rates small { display:block; }
.floating-rates span, .floating-rates small { font-size:12px; }
.floating-rates b { font-size:32px; font-variant-numeric:tabular-nums; }
.floating-rates .c-down { color:var(--down-1); }
.floating-rates .c-up { color:var(--up-1); }
.floating-panel footer { font-size:11px; color:var(--muted); flex-wrap:wrap; }
.floating-panel #float-detail { margin-right:auto; }
.floating-video-source { position:fixed; width:480px; height:260px; left:-10000px; top:0; pointer-events:none; }
.gauge-col { grid-area: gauge; }
.panel-col { grid-area: panel; min-width: 0; }
.hero h1 { font-size: clamp(26px, 7vw, 44px); line-height: 1.2; letter-spacing: -.01em; font-weight: 800; }
.grad-text { background: linear-gradient(90deg, var(--down-1), var(--down-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { margin-top: 8px; color: var(--muted); font-size: 15px; }

.gauge { position: relative; width: min(100%, 340px); aspect-ratio: 1 / 1; margin: 0 auto; }
.gauge canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.gauge-center { position: absolute; inset: 0; display: grid; place-items: center; }
.start-btn {
  position: relative; display: grid; place-items: center;
  width: 39%; aspect-ratio: 1; margin-top: 9%;
  border: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.28), transparent 55%), linear-gradient(140deg, var(--down-1), var(--down-2));
  color: #fff; box-shadow: 0 18px 44px -12px color-mix(in srgb, var(--down-2) 70%, transparent), inset 0 -6px 16px rgba(0,0,0,.18);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, opacity .25s;
  -webkit-tap-highlight-color: transparent;
}
.start-btn::before, .start-btn::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--down-1) 55%, transparent);
  animation: pulse 2.6s cubic-bezier(.2,.6,.3,1) infinite; pointer-events: none;
}
.start-btn::after { animation-delay: 1.3s; }
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.32); opacity: 0; } }
.start-btn:hover { transform: scale(1.035); }
.start-btn:active { transform: scale(.97); }
.start-btn:disabled { cursor: progress; opacity: .7; }
.start-label { font-size: clamp(19px, 5.6vw, 24px); font-weight: 700; letter-spacing: .08em; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.gauge-readout {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-top: 8%; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.readout-phase { font-size: 13px; color: var(--muted); letter-spacing: .1em; }
.readout-value { font-size: clamp(44px, 14vw, 64px); font-weight: 750; line-height: 1.05; letter-spacing: -.02em; }
.readout-unit { font-size: 14px; color: var(--muted); }
.stop-btn {
  position: absolute; bottom: 6%; left: 50%; transform: translateX(-50%);
  min-height: 34px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 13px;
}
.stop-btn:hover { color: var(--ink); border-color: var(--faint); }
.gauge[data-state="running"] .start-btn,
.gauge[data-state="done"] .start-btn,
.gauge[data-state="starting"] .start-btn { opacity: 0; visibility: hidden; transform: scale(.85); }
.gauge[data-state="running"] .gauge-readout,
.gauge[data-state="done"] .gauge-readout { opacity: 1; visibility: visible; }
.gauge[data-state="done"] .stop-btn { display: none; }
.gauge[data-state="starting"] .gauge-readout { opacity: 1; visibility: visible; }
.gauge-note { margin-top: 6px; text-align: center; font-size: 13px; color: var(--muted); }
.gauge-upload { margin-top:6px; color:var(--up-1); font-size:clamp(13px,3.5vw,16px); font-weight:600; font-variant-numeric:tabular-nums; }
.gauge.is-duplex .readout-value { color:var(--down-1); font-size:clamp(38px,11vw,56px); }
.gauge.is-duplex .gauge-readout { padding-top:4%; }
.gauge-legend { display:flex; justify-content:center; gap:16px; font-size:12px; color:var(--muted); margin:0 0 10px; }
.gauge-legend span::before { content:''; display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:5px; vertical-align:middle; }
.gauge-note a { color: var(--accent); text-decoration: none; font-weight: 600; }
.gauge-note a:hover { text-decoration: underline; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.stats.has-upload { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats.has-upload .stat { grid-column: span 2; }
.stats.has-upload .stat:nth-child(-n+2) { grid-column: span 3; }
.result-upload #result-up, #stat-up { color: var(--up-1, var(--accent)); font-variant-numeric: tabular-nums; }
.result-top.has-upload { flex-direction:column; align-items:stretch; gap:12px; }
.result-top.has-upload .result-rates { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.result-top.has-upload .result-speed { flex-wrap:wrap; gap:4px; }
.result-top.has-upload .result-speed b { font-size:clamp(26px,7vw,36px); }
.result-top.has-upload .spark { width:100%; height:48px; }
.chart-head { gap:8px; flex-wrap:wrap; }
.chart-peak { white-space:nowrap; }
.stress-meta { flex-wrap:wrap; line-height:1.5; }
.speed-phases { display:flex; justify-content:center; gap:8px; margin:12px 0 0; padding:0; list-style:none; font-size:12px; color:var(--muted); }
.speed-phases li { border:1px solid var(--line); border-radius:20px; padding:5px 14px; }
.speed-phases li.active { color:var(--accent); border-color:var(--accent); background:var(--surface); font-weight:700; }
.speed-phases li.done { color:var(--down-1); }
.chart-legend { display:flex; gap:16px; margin:0 0 8px 34px; font-size:12px; color:var(--muted); }
.chart-legend span::before { content:''; display:inline-block; width:16px; height:3px; margin-right:6px; vertical-align:middle; border-radius:2px; }
.legend-down::before { background:var(--down-1); }
.legend-up::before { background:var(--up-1, #a78bfa); }
.stat { padding: 10px 10px 9px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.stat dt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stat dt small { font-size: 11px; color: var(--subtle); }
.stat dd { margin: 2px 0 0; font-size: clamp(17px, 5vw, 22px); font-weight: 700; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat:first-child dd { color: var(--down-1); }

.stage {
  display: grid; position: relative;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); overflow: hidden;
}
.stage-view { grid-area: 1 / 1; padding: 18px; opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility .35s; min-width: 0; }
.stage > .stage-view { display:none; }
.stage[data-view="intro"] .view-intro,
.stage[data-view="live"] .view-live,
.stage[data-view="result"] .view-result,
.stage[data-view="error"] .view-error { display:block; opacity: 1; visibility: visible; }
.stage[data-view="live"] .view-live, .stage[data-view="error"] .view-error { display:flex; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 12px; align-items: center; }
.steps strong { display: block; font-size: 15px; font-weight: 600; }
.steps small { display: block; font-size: 13px; color: var(--muted); }
.step-dot { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--surface-2); color: var(--down-1); font-weight: 700; font-size: 14px; }
.stage-hint { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }

.view-live { display: flex; flex-direction: column; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.chart-peak { font-variant-numeric: tabular-nums; }
.chart { flex: 1; width: 100%; min-height: 150px; margin-top: 8px; }

.result-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.result-kicker { font-size: 13px; color: var(--muted); }
.result-speed { display: flex; align-items: baseline; gap: 6px; }
.result-speed b { font-size: clamp(36px, 10vw, 46px); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; background: linear-gradient(90deg, var(--down-1), var(--down-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-speed small { color: var(--muted); font-size: 14px; }
.spark { width: 42%; max-width: 180px; height: 52px; }
.result-rating { margin-top: 8px; font-size: 15px; font-weight: 600; min-height: 1.6em; }
.submit-row { display: flex; gap: 8px; margin-top: 14px; }
.submit-row input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 15px;
}
.submit-row input::placeholder { color: var(--muted); }
.submit-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.submit-msg { min-height: 1.6em; margin-top: 6px; font-size: 13px; color: var(--muted); }
.submit-msg.ok { color: var(--success); }
.submit-msg.err { color: var(--danger); }
.again-btn { width: 100%; margin-top: 4px; }

.view-error { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
.error-icon svg { width: 40px; height: 40px; fill: none; stroke: var(--warning); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.error-text { color: var(--ink); max-width: 30em; overflow-wrap: anywhere; }

@media (min-width: 960px) {
  .hero { padding: 36px 0 48px; }
  .hero-grid { grid-template-columns:minmax(300px,.92fr) minmax(0,1.08fr); grid-template-areas:"head head" "gauge panel"; column-gap:32px; row-gap:26px; align-items:center; }
  .hero-head { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:24px; align-items:center; text-align:left; padding-bottom:24px; border-bottom:1px solid var(--line); }
  .hero h1 { font-size:clamp(30px,3vw,40px); }
  .hero-controls { margin:0; align-items:flex-end; gap:8px; }
  .gauge { width:min(100%,380px); }
  .gauge-col { align-self:center; padding:12px 0; }
  .panel-col { align-self:start; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stage-view { padding: 22px; }
}

/* ---------- sections ---------- */
.section { padding: 36px 0; }
@media (min-width: 960px) { .section { padding: 56px 0; } }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section h2 { font-size: clamp(22px, 5.4vw, 30px); font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.section-sub { margin-top: 4px; color: var(--muted); font-size: 14px; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

/* ---------- segmented controls ---------- */
.lb-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 12px; }
.lb-period-note { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.seg button { min-height: 36px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; transition: background-color .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--surface-2); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg-sm button { padding: 0 12px; font-size: 13px; }
@media (max-width: 420px) { .seg button { padding: 0 11px; } .seg-sm button { padding: 0 9px; } .lb-controls { gap: 8px; } }

/* ---------- leaderboard ---------- */
.lb-card { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow); }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-head { flex-wrap: wrap; align-items: flex-end; }
.seg-board button { min-height: 40px; padding: 0 20px; font-size: 15px; font-weight: 700; }
.seg-board button[aria-selected="true"] { background: linear-gradient(135deg, var(--down-1), var(--down-2)); color: #fff; box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--down-2) 80%, transparent); }
@media (max-width: 520px) { .lb-head { flex-direction: column; align-items: stretch; } .seg-board { display: grid; grid-template-columns: 1fr 1fr; } }
.lb-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.lb-list .lb-row:first-child { border-top: 0; }
.lb-header { display: none; }
.lb-row .col-a, .lb-row .col-b, .lb-row .col-c, .lb-row .col-net { display: none; }
.lb-row.is-me { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rank { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 700; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank.m1, .rank.m2, .rank.m3 { color: #1a1206; }
.rank.m1 { background: linear-gradient(145deg, #fde68a, var(--gold)); }
.rank.m2 { background: linear-gradient(145deg, #f1f5f9, var(--silver)); }
.rank.m3 { background: linear-gradient(145deg, #fed7aa, var(--bronze)); }
.user { min-width: 0; }
.user-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nick { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.badge-app { background: color-mix(in srgb, var(--down-1) 18%, transparent); color: var(--down-1); }
.badge-web { background: color-mix(in srgb, var(--up-1) 18%, transparent); color: var(--up-1); }
.meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; min-width: 0; }
.meta-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.meta-when { flex: none; display: none; }
.meta-text + .meta-when::before { content: "·"; margin-right: 6px; }
.net-ico { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.net-badge { --net: var(--muted); flex: none; display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 650; line-height: 1; color: var(--net); background: color-mix(in srgb, var(--net) 14%, transparent); border: 1px solid color-mix(in srgb, var(--net) 22%, transparent); }
.net-badge .net-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-wifi { --net: var(--down-1); }
.net-cellular { --net: var(--success); }
.net-ethernet { --net: var(--warning); }
.net-vpn { --net: var(--up-1); }
.net-badge.is-empty { --net: var(--faint); }
.main { text-align: right; }
.main b { font-size: 17px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.main small { margin-left: 3px; font-size: 11px; color: var(--muted); }
.lb-row:has(> .sub:not(:empty)) > .rank { grid-row: span 2; }
.lb-row > .sub { grid-column: 2 / -1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.lb-row > .sub:empty { display: none; }
.board-traffic .main b { background: linear-gradient(135deg, var(--down-1), var(--up-1)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.lb-empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.skeleton .bar { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 50%, var(--line)) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton .rank { background: var(--surface-2); }
@media (max-width: 380px) { .main b { font-size: 16px; } }
@media (min-width: 760px) {
  .lb-row { grid-template-columns: 48px minmax(0, 1fr) 118px 92px 84px 76px 138px; gap: 12px; padding: 12px 20px; }
  .lb-header { display: grid; padding-top: 12px; padding-bottom: 12px; font-size: 12px; color: var(--muted); border-top: 0; background: var(--surface-2); }
  .lb-row .col-a, .lb-row .col-b, .lb-row .col-c { display: block; font-size: 14px; color: var(--muted); white-space: nowrap; }
  .lb-row .col-net { display: flex; justify-content: flex-start; min-width: 0; }
  .lb-row .m-only { display: none; }
  .board-traffic .meta-when { display: inline; }
  .lb-row:has(> .sub:not(:empty)) > .rank { grid-row: auto; }
  .lb-list .c-up { color: var(--up-1); }
  .lb-list .c-down { color: var(--down-1); }
  .net-badge { height: 24px; padding: 0 9px; font-size: 12px; }
  .net-ico { width: 14px; height: 14px; }
}
@media (min-width: 760px) and (max-width: 899px) {
  .lb-row { grid-template-columns: 44px minmax(0, 1fr) 110px 84px 76px 120px; }
  .lb-row .col-c { display: none !important; }
}

/* ---------- download ---------- */
.download-card {
  position: relative; overflow: hidden;
  display: grid; gap: 18px; padding: 22px; border-radius: 24px;
  background:
    radial-gradient(600px 240px at 100% 0%, color-mix(in srgb, var(--down-2) 20%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.download-main { display: flex; gap: 16px; align-items: flex-start; }
.app-icon { flex: none; width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--down-2) 80%, transparent); }
.download-main h2 { margin-top: 2px; }
.download-sub { margin-top: 4px; color: var(--muted); font-size: 14px; }
.release-status { margin-top: 8px; font-size: 13px; color: var(--muted); }
.download-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.download-actions .btn-large { flex: 1 1 220px; }
.release-details { border-top: 1px solid var(--line); padding-top: 14px; }
.release-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.release-details details { margin-top: 8px; }
.release-details summary { cursor: pointer; font-size: 14px; color: var(--accent); font-weight: 600; }
.release-notes { margin-top: 8px; white-space: pre-line; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.checksum { margin-top: 10px; display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.checksum code { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; color: var(--ink); background: var(--surface-2); padding: 8px 10px; border-radius: 8px; }
@media (min-width: 860px) {
  .download-card { grid-template-columns: 1fr auto; align-items: center; padding: 32px 36px; }
  .download-actions { justify-content: flex-end; }
  .download-actions .btn-large { flex: none; }
  .release-details { grid-column: 1 / -1; }
}

/* ---------- features ---------- */
.features { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feature { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.feature h3 { margin-top: 12px; font-size: 15px; font-weight: 700; }
.feature p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.f-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; }
.f-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.f-down { background: color-mix(in srgb, var(--down-1) 16%, transparent); color: var(--down-1); }
.f-up { background: color-mix(in srgb, var(--up-1) 16%, transparent); color: var(--up-1); }
.f-ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.f-warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
@media (min-width: 960px) { .features { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } .feature { padding: 22px; } }

/* ---------- faq ---------- */
.faq-list { display: grid; gap: 8px; }
.faq-list details { border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.faq-list summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; font-weight: 600; font-size: 15px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
.faq-list details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq-list details p { padding: 0 16px 14px; color: var(--muted); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.text-link { display: inline-block; margin: -6px 16px 14px; color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
@media (min-width: 960px) {
  .faq-grid { display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: start; }
}

/* ---------- footer ---------- */
.site-footer { margin-top: 20px; padding: 24px 0 calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.footer-inner .wordmark { color: var(--ink); }
.copyright { margin-right: auto; }

/* ---------- popup ---------- */
.popup {
  width: min(92vw, 400px); max-height: min(86vh, 640px); padding: 0; border: 1px solid var(--line); border-radius: 22px;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); overflow: hidden;
}
.popup::backdrop { background: rgba(5, 8, 14, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.popup[open] { animation: pop .28s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.popup-inner { display: flex; flex-direction: column; max-height: inherit; }
.popup-image { width: 100%; max-height: 220px; object-fit: cover; background: var(--surface-2); }
.popup-body { padding: 22px 22px 8px; overflow-y: auto; }
.popup-body h2 { font-size: 19px; font-weight: 700; }
.popup-body p { margin-top: 8px; color: var(--muted); font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.popup-actions { display: flex; gap: 10px; padding: 14px 22px 22px; }
.popup-actions .btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .start-btn::before, .start-btn::after { display: none; }
}
.hero.is-disabled .gauge-col, .hero.is-disabled .stats { display: none; }
.hero.is-disabled .hero-grid { grid-template-areas: "head" "panel"; grid-template-columns: minmax(0, 640px); justify-content: center; }
.hero.is-disabled .hero-head { text-align: center; align-self: auto; }
.hero.is-disabled .stage-view:not(.view-error) { display: none; }

/* ================= V4: account, mode switch, continuous run, board detail, user center ================= */
.header-inner > .account { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.header-inner > .header-download { margin-left: 8px; }
@media (min-width: 720px) { .header-inner > .account { margin-left: 8px; } }
@media (max-width: 460px) { .header-download { display: none !important; } }
.btn-qq { background: linear-gradient(135deg, #12b7f5, #3b82f6); color: #fff; border: 0; }
.btn-qq:hover { filter: brightness(1.08); }
.btn-qq svg { fill: currentColor; stroke: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:disabled { opacity: .5; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.me-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; font-size: 14px; font-weight: 600; max-width: 160px; }
.me-chip:hover { border-color: var(--faint); }
.me-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* avatars: QQ image over a generated initial */
.avatar { --hue: 210; position: relative; flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(140deg, hsl(var(--hue) 70% 58%), hsl(calc(var(--hue) + 40) 70% 46%)); color: #fff; font-weight: 700; font-size: 14px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.has-img .avatar-initial { visibility: hidden; }
.avatar-sm { width: 30px; height: 30px; font-size: 13px; }
.avatar-xl { width: 72px; height: 72px; font-size: 28px; }
.avatar-me { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* mode switch */
.seg-mode { margin-top: 14px; }
.seg-mode button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 18px; font-size: 14px; }
.seg-mode svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.seg-mode button[aria-checked="true"] { background: linear-gradient(135deg, var(--down-1), var(--down-2)); color: #fff; }
.seg-mode button:disabled { cursor: not-allowed; opacity: .6; }
.seg-mode button[aria-checked="true"]:disabled { opacity: 1; }
.step-dot svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stress-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.stress-conn { margin-left: auto; font-variant-numeric: tabular-nums; }
.live-dot { flex: none; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: live 1.6s ease-out infinite; }
@keyframes live { to { box-shadow: 0 0 0 7px transparent; } }

/* leaderboard: me, live, avatars, expandable details */
.lb-row .user { display: flex; align-items: center; gap: 10px; }
.user-text { min-width: 0; flex: 1; }
.lb-item { cursor: pointer; transition: background-color .2s; }
.lb-item:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.lb-row.is-me { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
@property --rank-glow-angle { syntax:"<angle>"; initial-value:0deg; inherits:false; }
.lb-item.rank-located, .podium-card.rank-located { position:relative; background:color-mix(in srgb,var(--accent) 11%,var(--surface)); box-shadow:inset 0 0 0 1px var(--accent); animation:rank-halo 3s ease-out both; }
.rank-located::before { content:""; position:absolute; inset:0; padding:3px; border-radius:inherit; pointer-events:none; background:conic-gradient(from var(--rank-glow-angle),#22d3ee,#3b82f6 65deg,#fff 90deg,#a855f7 125deg,#f472b6 180deg,#38bdf8 245deg,#fff 270deg,#6366f1 310deg,#22d3ee); -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0); -webkit-mask-composite:xor; mask-composite:exclude; animation:rank-orbit 3s linear both; }
.rank-located::after { content:""; position:absolute; inset:4px; border:1px solid #38bdf8; border-radius:inherit; pointer-events:none; animation:rank-locate-ring 1s ease-out 3; }
@keyframes rank-orbit { 0% { --rank-glow-angle:0deg; opacity:0; } 8%,88% { opacity:1; } 100% { --rank-glow-angle:1080deg; opacity:0; } }
@keyframes rank-halo { 0%,100% { box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 30%,transparent); } 12%,45%,75% { box-shadow:inset 0 0 18px #38bdf825,0 0 24px #3b82f640,0 0 40px #a855f725; } 28%,60%,88% { box-shadow:inset 0 0 5px #38bdf815,0 0 10px #3b82f620; } }
@keyframes rank-locate-ring { from { opacity:.8; box-shadow:inset 0 0 0 0 #38bdf830; } to { opacity:0; box-shadow:inset 0 0 0 12px transparent; } }
.rank-location-cursor { position:fixed; z-index:60; display:flex; align-items:center; gap:6px; padding:8px 12px 8px 9px; border:1px solid #93c5fd; border-radius:12px; background:linear-gradient(120deg,#0ea5e9,#3b82f6 55%,#8b5cf6); color:#fff; box-shadow:0 6px 24px #3b82f650,0 0 14px #38bdf830; pointer-events:none; font:700 13px/1.3 var(--font); animation:rank-cursor-life 3s ease-out both; }
.rank-location-cursor::after { content:""; position:absolute; left:16px; bottom:-7px; border-left:7px solid transparent; border-right:7px solid transparent; border-top:7px solid var(--accent); }
.rank-location-cursor.is-below::after { bottom:auto; top:-7px; border-top:0; border-bottom:7px solid var(--accent); }
.rank-location-cursor svg { width:23px; height:23px; fill:#fff; stroke:#fff; stroke-width:1.4; stroke-linejoin:round; animation:rank-cursor-point 1s ease-in-out 3; }
@keyframes rank-cursor-life { 0% { opacity:0; transform:translateY(-7px) scale(.96); } 8%,88% { opacity:1; transform:translateY(0) scale(1); } 100% { opacity:0; transform:translateY(-4px) scale(.98); } }
@keyframes rank-cursor-point { 50% { transform:translate(2px,3px); } }
@media(prefers-reduced-motion:reduce) { .lb-item.rank-located, .podium-card.rank-located, .rank-located::before, .rank-located::after, .rank-location-cursor, .rank-location-cursor svg { animation:none; } }
.badge-me { background: var(--accent); color: #fff; }
.badge-live { gap: 5px; background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.badge-live .live-dot { width: 6px; height: 6px; }
.badge-qq { background: color-mix(in srgb, #12b7f5 18%, transparent); color: #12b7f5; }
.lb-detail { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; padding: 12px; border-radius: 14px; background: var(--surface-2); cursor: default; animation: pop .22s ease; }
.lb-detail[hidden] { display: none; }
.d-cell { display: flex; flex-direction: column; min-width: 0; }
.d-label { font-size: 11px; color: var(--muted); }
.d-value { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.d-cell.c-down .d-value { color: var(--down-1); }
.d-cell.c-up .d-value { color: var(--up-1); }
.d-cell.c-accent .d-value { color: var(--accent); }
@media (min-width: 760px) { .lb-detail { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 4px 0 2px; } }

.my-rank { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20; margin-top: 12px; padding: 12px 14px;
  border-radius: 18px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); box-shadow: var(--shadow); }
.my-rank-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.my-rank-top { display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; align-items:center; gap:10px; }
.my-rank-body strong { font-size: 14px; }
.my-rank-body span { font-size: 12px; color: var(--muted); line-height:1.6; overflow-wrap:anywhere; }
.my-rank-value b { font-size: 18px; font-weight: 800; }
.my-rank-value small { margin-left: 3px; font-size: 11px; color: var(--muted); }
.my-rank.is-prompt { border-color: var(--line); }
body.view-me .my-rank { display: none; }
.rank-challenge { margin-top:10px; padding-top:10px; border-top:1px solid color-mix(in srgb,var(--accent) 20%,var(--line)); }
.rank-challenge-heading { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:3px 12px; color:var(--ink); font-size:12px; line-height:1.6; }
.rank-challenge-gap { display:inline-flex; align-items:baseline; gap:5px; color:var(--accent); font-variant-numeric:tabular-nums; }
.rank-challenge-gap strong { font-size:21px; font-weight:800; line-height:1.25; }
.rank-challenge-gap small { font-size:11px; font-weight:650; }
.rank-challenge-track { height:5px; margin-top:8px; overflow:hidden; border-radius:999px; background:var(--surface-2); }
.rank-challenge-track>span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--down-1),var(--up-1)); transition:width .35s ease; }
@media(max-width:520px) {
  .my-rank { padding:10px 12px; }
  .my-rank-top { grid-template-columns:28px minmax(0,1fr) auto; gap:2px 8px; }
  #my-rank-avatar { width:28px; height:28px; grid-row:1 / 3; }
  .my-rank-body { grid-column:2; }
  .my-rank-body strong { font-size:13px; }
  .my-rank-body span { font-size:11px; }
  #my-rank-value { grid-column:2; grid-row:2; }
  .my-rank-value b { font-size:15px; }
  #my-rank-action { grid-column:3; grid-row:1 / 3; padding-inline:10px; }
  .rank-challenge-gap strong { font-size:19px; }
}

/* toasts, confirm, challenge */
.toasts { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow); animation: pop .25s ease; transition: opacity .4s, transform .4s; }
.toast-ok { background: var(--success); color: #04140d; }
.toast-err { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }
.text-input { width: 100%; min-height: 44px; margin-top: 12px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 15px; }
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.challenge-box { display: grid; place-items: center; min-height: 72px; margin-top: 14px; }

/* user center */
body.view-me main > section:not(#me), body.view-me .banner { display: none; }
.me-view { padding-top: 18px; min-height: calc(100vh - var(--header-h) - 90px); }
.me-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.me-top .btn svg { width: 16px; height: 16px; }
.me-profile { display: flex; gap: 16px; align-items: center; padding: 20px; border-radius: var(--radius); background: radial-gradient(500px 200px at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.me-info { min-width: 0; flex: 1; }
.me-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.me-name { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.me-name-form { display: flex; gap: 8px; align-items: center; }
.me-name-form .text-input { margin-top: 0; min-height: 36px; max-width: 220px; }
.me-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }
.me-sub .badge { margin-right: 4px; }
.me-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.me-stat { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.me-stat-label { font-size: 12px; color: var(--muted); }
.me-stat-value b { font-size: 24px; font-weight: 800; }
.me-stat-value small { margin-left: 3px; font-size: 12px; color: var(--muted); }
.me-stat.c-accent b { background: linear-gradient(135deg, var(--down-1), var(--up-1)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.me-stat.c-down b { color: var(--down-1); }
.me-stat-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-hint { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--ink); font-size: 14px; }
.me-card { margin-top: 12px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.me-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.me-card h3 { font-size: 16px; font-weight: 700; }
.me-runs, .me-devices { list-style: none; margin: 0; padding: 0; }
.me-run, .me-device { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.me-run:first-child, .me-device:first-child { border-top: 0; }
.me-run-main { flex: 1; min-width: 0; }
.me-run-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; min-width: 0; }
.me-run-status { font-size: 12px; color: var(--muted); font-weight: 500; }
.device-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.device-dot.online { background: var(--success); }
.me-empty, .me-loading { padding: 18px 4px; color: var(--muted); font-size: 14px; }
.me-loading { text-align: center; padding: 60px 0; }
.me-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.me-guest { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 44px 22px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.me-guest h3 { font-size: 20px; font-weight: 800; }
.me-guest p { max-width: 30em; color: var(--muted); }
.me-fine { color: var(--subtle); font-size: 12px; }
@media (min-width: 760px) { .me-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .me-view { padding-top: 32px; } }

/* ---------- rate unit toggle (Mbps ⇄ MB/s) ---------- */
.unit-toggle { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; cursor: pointer; user-select: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; transition: background .2s, transform .15s; }
.unit-toggle::after { content: "⇄"; font-size: .85em; opacity: .7; }
.unit-toggle:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.unit-toggle:active { transform: scale(.94); }
.unit-flip { animation: unit-flip .32s cubic-bezier(.2,.8,.3,1); }
@keyframes unit-flip { from { opacity: .2; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.rate-readout .readout-value, .result-speed b { cursor: pointer; }
.stat dt small.unit-toggle { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .unit-flip { animation: none; } }

/* ---------- traffic board rates ---------- */
.lb-row .col-rate { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; }
@media (min-width: 760px) {
  .board-traffic .lb-row { grid-template-columns: 48px minmax(0, 1fr) 118px 150px 150px 64px 128px; }
}
@media (min-width: 760px) and (max-width: 899px) {
  .board-traffic .lb-row { grid-template-columns: 44px minmax(0, 1fr) 104px 132px 132px 112px; }
}
.lb-row > .sub-rates { margin-top: -2px; color: var(--subtle); }
.lb-row:has(> .sub-rates:not(:empty)) > .rank { grid-row: span 3; }
@media (min-width: 760px) { .lb-row:has(> .sub-rates:not(:empty)) > .rank { grid-row: auto; } }

/* Leaderboard pagination: 15 per page, top 50 */
.lb-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0 4px; }
.lb-pager button { min-width: 44px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line, rgba(148,163,184,.25)); background: var(--card, rgba(255,255,255,.04)); color: inherit; font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; transition: background .2s, border-color .2s, transform .15s; }
.lb-pager button:hover:not(:disabled) { border-color: var(--brand, #3b82f6); }
.lb-pager button:active:not(:disabled) { transform: scale(.96); }
.lb-pager button:disabled { opacity: .35; cursor: default; }
.lb-pager .is-active { background: var(--brand, #3b82f6); border-color: var(--brand, #3b82f6); color: #fff; font-weight: 600; }

/* Visitor IP / region chip under the hero subtitle: always occupies its row so it never shifts the layout. */
.ip-chip { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:6px 8px; width:fit-content; max-width:100%; min-height:34px; margin:12px auto 0; padding:6px 12px; border-radius:16px; border:1px solid var(--line); background:var(--surface); font-size:13px; color:var(--muted); }
.ip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good, #22c55e); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good, #22c55e) 22%, transparent); flex: none; }
.ip-chip.is-loading .ip-dot { background: var(--faint); box-shadow: none; animation: ip-pulse 1.2s ease-in-out infinite; }
.ip-chip.is-error .ip-dot { background: var(--faint); box-shadow: none; }
.ip-addr { appearance:none; border:0; background:none; padding:2px 0; margin:0; max-width:calc(100% - 18px); min-width:0; overflow-wrap:anywhere; font:inherit; line-height:1.5; color:var(--ink); font-weight:600; font-variant-numeric:tabular-nums; cursor:pointer; border-radius:6px; }
.ip-addr:disabled, .ip-chip.is-loading .ip-addr { cursor: default; color: var(--muted); font-weight: 500; }
.ip-addr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ip-loc { min-width:0; max-width:100%; overflow-wrap:anywhere; line-height:1.5; }
.ip-loc:empty { display: none; }
@keyframes ip-pulse { 50% { opacity: .35; } }
@media (min-width: 960px) { .ip-chip { margin-left: 0; } }
@media (prefers-reduced-motion: reduce) { .ip-chip.is-loading .ip-dot { animation: none; } }
/* Podium honors: distinct silhouettes and materials, with optional compositor-only motion. */
.rank-rally { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-top:18px; padding:18px 22px; border:1px solid var(--line); border-radius:20px; background:radial-gradient(ellipse at 0 0,color-mix(in srgb,var(--gold) 10%,transparent),transparent 65%),var(--surface); }
.rank-rally-copy { min-width:0; }
.rank-rally-kicker { display:block; margin-bottom:4px; color:var(--muted); font-size:11px; font-weight:650; letter-spacing:1px; }
.rank-rally-copy strong { display:block; color:var(--ink); font-size:19px; line-height:1.5; letter-spacing:.3px; }
.rank-rally-copy p { margin-top:4px; color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.rank-rally-actions { display:flex; flex-direction:column; align-items:center; gap:6px; flex:none; }
.rank-rally-cta { gap:14px; min-height:42px; border-color:#d6a148; background:linear-gradient(120deg,#fff0bc,#edc46f); color:#54390c; box-shadow:0 4px 14px #c58b1d18; }
.rank-rally-cta:hover { filter:brightness(1.05); }
.rank-rally-cta span { font-size:19px; }
.rank-motion-toggle { max-width:152px; min-height:28px; padding:2px 5px; border:0; border-radius:6px; background:transparent; color:var(--muted); font-size:11px; }
.rank-motion-toggle:hover:not(:disabled) { color:var(--ink); background:var(--surface-2); }
.rank-motion-toggle:disabled { cursor:default; }
.lb-podium { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:end; gap:18px; padding:42px 0 22px; }
.lb-podium[data-count="1"] { grid-template-columns:minmax(0,360px); justify-content:center; }
.lb-podium[data-count="2"] { grid-template-columns:repeat(2,minmax(0,1fr)); max-width:740px; margin:auto; }
.podium-card {
  --medal:#d39b69; --medal-ink:#99532f; --medal-soft:#fbefe5;
  position:relative; isolation:isolate; display:flex; flex-direction:column; align-items:center; min-width:0;
  padding:37px 14px 22px; border:1px solid color-mix(in srgb,var(--medal) 55%,var(--line)); border-radius:24px;
  background:radial-gradient(ellipse at 50% 0,color-mix(in srgb,var(--medal) 18%,transparent),transparent 58%),linear-gradient(180deg,var(--medal-soft),var(--surface) 76%);
  color:var(--ink); box-shadow:0 8px 28px color-mix(in srgb,var(--medal) 10%,transparent),inset 0 1px 0 #ffffff50;
  cursor:pointer; text-align:center; transition:transform .2s,box-shadow .2s;
}
.podium-card:hover { box-shadow:0 12px 32px color-mix(in srgb,var(--medal) 20%,transparent); }
.podium-card:focus-visible { outline:3px solid var(--accent); outline-offset:4px; }
.podium-card.place-1 { --medal:#e0b14f; --medal-ink:#93620a; --medal-soft:#fff7df; padding-top:49px; padding-bottom:30px; border-width:2px; box-shadow:0 10px 36px #c9971d1a,inset 0 1px 0 #fff5; }
.podium-card.place-2 { --medal:#a3bdd9; --medal-ink:#496b8e; --medal-soft:#eef5fc; }
.winner-gleam { position:absolute; inset:0; z-index:-1; overflow:hidden; border-radius:inherit; pointer-events:none; }
.winner-gleam::after { content:""; position:absolute; inset:0; background:linear-gradient(115deg,transparent 25%,color-mix(in srgb,var(--medal) 12%,transparent) 42%,#ffffff28 50%,transparent 65%); transform:translateX(-130%); }
.winner-avatar { position:relative; display:inline-flex; margin:8px 0 16px; color:var(--medal); }
.winner-avatar .avatar { position:relative; width:66px; height:66px; border:3px solid var(--medal); box-shadow:0 0 0 4px var(--surface),0 0 0 5px color-mix(in srgb,var(--medal) 45%,transparent); font-size:25px; flex:none; }
.place-1 .winner-avatar .avatar { width:82px; height:82px; font-size:30px; }
.winner-aura { position:absolute; inset:-11px; border-radius:50%; background:conic-gradient(from 40deg,transparent 0deg,var(--medal) 80deg,transparent 160deg,var(--medal) 260deg,transparent 340deg); opacity:.28; }
.place-1 .winner-aura { inset:-14px; opacity:.46; }
.winner-crown { position:absolute; z-index:2; width:64px; height:52px; top:-40px; left:50%; transform:translateX(-50%); filter:drop-shadow(0 3px 3px #38230030); overflow:visible; }
.place-1 .winner-crown { width:82px; height:66px; top:-51px; filter:drop-shadow(0 3px 5px #d5952850); }
.place-3 .winner-crown { width:58px; height:47px; top:-34px; }
.winner-position { position:absolute; z-index:3; left:50%; bottom:-9px; transform:translateX(-50%); min-width:29px; padding:1px 6px; border:2px solid var(--surface); border-radius:9px; color:var(--medal-ink); background:var(--medal-soft); box-shadow:0 2px 6px #00000018; font:800 11px/1.4 var(--mono); }
.place-1 .winner-position { color:#5e3d05; background:linear-gradient(120deg,#ffeeb9,#e5b450); }
.winner-sparks { position:absolute; z-index:2; inset:-16px; pointer-events:none; }
.winner-sparks i { position:absolute; top:24%; left:0; width:8px; height:8px; background:var(--medal); clip-path:polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%); opacity:.75; }
.winner-sparks i:nth-child(2) { left:auto; right:0; top:54%; width:11px; height:11px; }
.winner-sparks i:nth-child(3) { top:84%; left:8%; width:6px; height:6px; }
.winner-title { display:inline-flex; align-items:center; gap:8px; margin:3px 0 1px; color:var(--medal-ink); font-size:16px; font-weight:800; letter-spacing:4px; text-indent:4px; }
.winner-title::before, .winner-title::after { content:""; width:16px; height:1px; background:var(--medal); opacity:.7; }
.place-1 .winner-title { font-size:19px; }
.winner-honor { margin-bottom:12px; color:var(--medal-ink); font-size:10px; letter-spacing:2px; }
.winner-name { display:block; width:100%; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:17px; line-height:1.5; }
.winner-tags { display:flex; flex-wrap:wrap; justify-content:center; gap:4px; margin:6px 0; }
.winner-device { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; color:var(--muted); margin-bottom:8px; }
.podium-card .net-badge { max-width:100%; font-size:11px; min-width:0; }
.podium-card .net-text { overflow:hidden; text-overflow:ellipsis; }
.winner-value { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:center; gap:4px; margin-top:16px; font-variant-numeric:tabular-nums; }
.winner-value b { font-size:28px; line-height:1.15; letter-spacing:-1px; }
.winner-value small { font-size:12px; color:var(--muted); }
.place-1 .winner-value b { font-size:34px; color:var(--medal-ink); }
.winner-caption { font-size:11px; color:var(--muted); margin-top:4px; }
.winner-dialog h2 { font-size:19px; margin-bottom:12px; }
.winner-dialog .lb-detail { display:grid; border:0; padding:12px 0 20px; }
.winner-dialog>.btn { width:100%; }
.lb-header[hidden] { display:none; }
.lb-row .meta { flex-wrap:wrap; gap:4px 7px; }
.lb-row .meta-text { min-width:0; }
/* Only small decorations animate; hidden/offscreen podiums and open details pause them. */
.lb-podium.has-motion .crown-glint { animation:crown-shine 5.6s ease-in-out infinite; }
.lb-podium.has-motion .crown-glint-gem { animation-delay:1.8s; }
.lb-podium.has-motion .place-2 .crown-glint { animation-duration:7s; animation-delay:1s; }
.lb-podium.has-motion .place-3 .crown-glint { animation-duration:8s; animation-delay:2s; }
.lb-podium.has-motion .winner-sparks i { animation:crown-spark 5s ease-in-out infinite; }
.lb-podium.has-motion .winner-sparks i:nth-child(2) { animation-delay:1.4s; }
.lb-podium.has-motion .winner-sparks i:nth-child(3) { animation-delay:2.6s; }
.lb-podium.has-motion .place-1 .winner-gleam::after { transform:none; opacity:0; animation:podium-luster 7s ease-in-out infinite; }
.lb-podium.has-motion:not(.motion-playing) .crown-glint,
.lb-podium.has-motion:not(.motion-playing) .winner-sparks i,
.lb-podium.has-motion:not(.motion-playing) .winner-gleam::after { animation-play-state:paused; }
@keyframes crown-shine { 0%,20%,48%,100% { opacity:.12; } 33% { opacity:1; } 40% { opacity:.45; } }
@keyframes crown-spark { 0%,35%,75%,100% { opacity:.2; } 55% { opacity:.95; } }
@keyframes podium-luster { 0%,30%,85%,100% { opacity:0; } 56% { opacity:.75; } }
@media(prefers-color-scheme:dark) {
  .podium-card { --medal-ink:#edb58f; --medal-soft:#30241e; }
  .podium-card.place-1 { --medal-ink:#f7d789; --medal-soft:#342b19; }
  .podium-card.place-2 { --medal-ink:#c1d7ed; --medal-soft:#212c3c; }
}
@media(max-width:600px) {
  .rank-rally { gap:10px; padding:14px; border-radius:17px; }
  .rank-rally-copy strong { font-size:15px; }
  .rank-rally-kicker { font-size:10px; letter-spacing:.4px; }
  .rank-rally-copy p { font-size:11px; }
  .rank-rally-cta { gap:7px; padding-inline:12px; font-size:12px; }
  .rank-motion-toggle { max-width:102px; font-size:10px; }
  .lb-podium { gap:8px; padding:32px 0 16px; }
  .podium-card { padding:29px 7px 16px; border-radius:17px; }
  .podium-card.place-1 { padding-top:39px; padding-bottom:23px; }
  .winner-avatar .avatar { width:44px; height:44px; font-size:18px; border-width:2px; box-shadow:0 0 0 3px var(--surface),0 0 0 4px color-mix(in srgb,var(--medal) 45%,transparent); }
  .place-1 .winner-avatar .avatar { width:56px; height:56px; font-size:22px; }
  .winner-crown { width:47px; height:38px; top:-30px; }
  .place-1 .winner-crown { width:60px; height:48px; top:-38px; }
  .place-3 .winner-crown { width:43px; height:35px; top:-25px; }
  .winner-avatar { margin:6px 0 14px; }
  .winner-aura { inset:-8px; }
  .place-1 .winner-aura { inset:-10px; }
  .winner-sparks { inset:-12px; }
  .winner-position { min-width:25px; font-size:9px; padding-inline:4px; bottom:-8px; }
  .winner-name { font-size:12px; }
  .winner-title { gap:4px; font-size:13px; letter-spacing:2px; text-indent:2px; }
  .winner-title::before, .winner-title::after { width:9px; }
  .place-1 .winner-title { font-size:15px; }
  .winner-honor { margin-bottom:10px; font-size:9px; letter-spacing:1px; }
  .winner-device { font-size:10px; margin-bottom:7px; }
  .winner-tags { gap:3px; }
  .winner-tags .badge { font-size:9px; padding:1px 4px; }
  .podium-card .net-badge { padding:3px 5px; font-size:9px; }
  .podium-card .net-ico { width:12px; height:12px; }
  .winner-value { gap:2px; margin-top:12px; }
  .winner-value b { font-size:20px; }
  .place-1 .winner-value b { font-size:23px; }
  .winner-value small { font-size:10px; }
  .winner-caption { font-size:10px; }
}
@media(prefers-reduced-motion:reduce) {
  .lb-podium .podium-card { transition:none; }
  .lb-podium.has-motion .crown-glint,
  .lb-podium.has-motion .winner-sparks i, .lb-podium.has-motion .winner-gleam::after { animation:none; }
}

/* Narrow phones: the stat label and its unit pill stack instead of overflowing the card. */
@media (max-width: 520px) {
  .stat dt { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; white-space: normal; }
  .stat dt .unit-toggle { margin-left: -7px; }
}
.unit-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Ranking dialogs have their own column count and a scrollable body at every viewport size. */
.winner-dialog { width: min(calc(100vw - 32px), 560px); max-height: min(88vh, 760px); max-height: min(88dvh, 760px); }
.winner-upload { display:flex; flex-direction:column; align-items:center; gap:4px; width:100%; margin-top:12px; padding-top:12px; border-top:1px solid color-mix(in srgb,var(--medal) 22%,var(--line)); }
.winner-upload-value { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:center; gap:3px; max-width:100%; font-variant-numeric:tabular-nums; }
.winner-upload-value b { font-size:20px; line-height:1.2; }
.winner-upload-value small { font-size:11px; }
.winner-upload-value.is-missing { font-size:12px; color:var(--muted); }
.winner-upload .winner-caption { margin-top:0; }
@media(max-width:600px) { .winner-upload { margin-top:9px; padding-top:9px; } .winner-upload-value b { font-size:16px; } .winner-upload-value small { font-size:9px; } }
.winner-dialog .popup-inner { max-height: inherit; }
.winner-dialog .popup-body { min-height: 0; flex: 1 1 auto; padding: 22px 22px 0; overscroll-behavior: contain; }
.winner-dialog .popup-body h2 { line-height: 1.45; overflow-wrap: anywhere; }
.winner-dialog .lb-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin: 16px 0 0; padding: 16px; border: 1px solid var(--line); }
.winner-dialog .d-label { font-size: 12px; }
.winner-dialog .d-value { font-size: 15px; line-height: 1.5; }
.winner-dialog .popup-actions { flex: none; padding: 18px 22px 22px; }
/* QQ authorization keeps the original tab available across browser switches. */
.qq-flow-dialog { width:min(calc(100vw - 24px),460px); max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px); padding:0; border-radius:26px; overflow:auto; overscroll-behavior:contain; }
.qq-flow-inner { padding:26px; min-width:0; }
.qq-flow-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:20px; }
.qq-flow-eyebrow { color:var(--muted); font-size:12px; font-weight:700; letter-spacing:.06em; }
.qq-flow-symbol { width:42px; height:42px; min-width:1.7em; min-height:1.7em; flex:none; display:grid; place-items:center; border:1px solid color-mix(in srgb,var(--accent) 30%,transparent); border-radius:14px; background:linear-gradient(135deg,color-mix(in srgb,var(--down-1) 15%,var(--surface)),color-mix(in srgb,var(--down-2) 18%,var(--surface))); color:var(--down-1); font-size:25px; }
.qq-flow-dialog h2 { font-size:23px; line-height:1.4; letter-spacing:-.035em; }
.qq-flow-status { margin-top:10px; font-size:14px; line-height:1.8; color:var(--muted); overflow-wrap:anywhere; }
.qq-flow-steps { display:flex; gap:12px; padding:0; margin:22px 0; list-style:none; counter-reset:qq-step; }
.qq-flow-steps li { flex:1; min-width:0; color:var(--muted); font-size:11px; line-height:1.65; }
.qq-flow-steps li::before { counter-increment:qq-step; content:counter(qq-step); display:grid; place-items:center; width:2.3em; height:2.3em; margin-bottom:6px; border:1px solid var(--line); border-radius:50%; background:var(--surface-2); color:var(--ink); font-weight:700; }
.qq-flow-steps li:first-child::before,.qq-flow-dialog[data-status="needs_code"] .qq-flow-steps li:nth-child(2)::before { background:var(--accent); border-color:transparent; color:#fff; }
.qq-flow-open,#qq-flow-continue { width:100%; margin-bottom:20px; min-height:48px; }
.qq-flow-code-form { padding:20px; border:1px solid var(--line); border-radius:18px; background:color-mix(in srgb,var(--surface-2) 45%,var(--surface)); }
.qq-flow-code-form label { display:block; font-size:14px; font-weight:650; line-height:1.7; }
.qq-flow-hint { margin-top:6px; color:var(--muted); font-size:12px; line-height:1.8; }
.qq-flow-code { display:block; height:auto; min-height:2.4em; padding:10px 12px; margin:16px 0 12px; font:600 24px/1.4 var(--mono); font-variant-numeric:tabular-nums; text-align:center; letter-spacing:.17em; background:var(--surface); }
.qq-flow-code::placeholder { font:400 14px/1.4 var(--font); letter-spacing:0; }
.qq-flow-code-form .btn { width:100%; min-height:46px; }
.qq-flow-error { margin:0 0 12px; color:var(--danger); font-size:13px; line-height:1.7; overflow-wrap:anywhere; }
.qq-flow-footer { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:10px 0; }
.qq-flow-expiry { font-size:12px; font-variant-numeric:tabular-nums; color:var(--muted); }
.qq-flow-text-button,.qq-flow-alternate { padding:10px 0; min-height:44px; border:0; background:transparent; color:var(--down-1); font-size:13px; line-height:1.6; }
.qq-flow-alternate { display:block; width:100%; margin:4px 0 12px; padding:12px; border-radius:12px; background:var(--surface-2); text-align:center; }
.qq-flow-text-button:disabled,.qq-flow-alternate:disabled { opacity:.45; cursor:default; }
.qq-flow-cancel { width:100%; }
@media(max-width:360px) { .qq-flow-inner { padding:20px 16px; } .qq-flow-dialog h2 { font-size:21px; } .qq-flow-code-form { padding:16px; } .qq-flow-steps { gap:7px; } .qq-flow-code { letter-spacing:.12em; } }
@media(max-height:580px) { .qq-flow-inner { padding-top:18px; padding-bottom:18px; } .qq-flow-head { margin-bottom:12px; } .qq-flow-steps { margin:14px 0; } .qq-flow-symbol { width:34px; height:34px; } }
@media (max-width: 380px) {
  .winner-dialog .popup-body { padding: 18px 16px 0; }
  .winner-dialog .popup-actions { padding: 16px; }
  .winner-dialog .lb-detail { gap: 12px; padding: 12px; }
}
.lb-item, .podium-card { scroll-margin-top: calc(var(--header-h) + 16px); scroll-margin-bottom: 120px; }
@media (max-height: 480px) { .my-rank { position: static; } }

/* Locality shares the site's blue accent; every entry exposes its own server-derived IP region. */
.location-badge { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; margin: 5px 0 0; padding: 3px 7px; border-radius: 7px; background: color-mix(in srgb,var(--accent) 12%,transparent); color: var(--accent); font-size: 11px; line-height: 1.45; font-weight: 650; vertical-align: middle; }
.location-badge svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.location-badge>span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.location-badge.is-pending { background: var(--surface-2); color: var(--muted); font-weight: 500; }
.network-location { display:flex; flex-wrap:wrap; align-items:center; gap:4px 6px; min-width:0; max-width:100%; margin:5px 0 0; }
.network-location .location-badge { margin:0; }
.isp-badge { --isp-color:var(--accent); display:inline-flex; align-items:center; max-width:100%; padding:3px 7px; border:1px solid color-mix(in srgb,var(--isp-color) 22%,var(--line)); border-radius:7px; background:color-mix(in srgb,var(--isp-color) 9%,var(--surface)); color:var(--isp-color); font-size:11px; font-weight:650; line-height:1.45; overflow-wrap:anywhere; }
.isp-badge[data-operator="telecom"] { --isp-color:var(--down-2); }
.isp-badge[data-operator="mobile"] { --isp-color:var(--down-1); }
.isp-badge[data-operator="unicom"] { --isp-color:var(--danger); }
.isp-badge[data-operator="broadcast"] { --isp-color:var(--success); }
.isp-badge[data-operator="unknown"] { --isp-color:var(--muted); font-weight:500; }
.podium-card .network-location { justify-content:center; margin:3px 0 8px; }
.podium-card .network-location .location-badge { margin:0; }
@media(max-width:600px) { .podium-card .isp-badge { padding:3px 5px; font-size:10px; } }
.podium-card .location-badge { margin: 3px 0 8px; }
.podium-card .location-badge>span { white-space: normal; overflow-wrap: anywhere; }
@media(max-width:600px) { .podium-card .location-badge { padding: 3px 5px; font-size: 10px; } }

.stat dd { min-height:30px; line-height:30px; }
.readout-value { display:flex; align-items:center; min-height:66px; }
.gauge.is-duplex .readout-value { min-height:58px; }
.result-speed b.long-number { font-size:clamp(22px,5vw,32px); }
.result-top.has-upload .result-speed b.long-number { font-size:clamp(20px,5vw,28px); }
.stress-meta { min-height:36px; align-content:center; }
.stage .chart { display:block; width:100%; height:208px; min-height:208px; max-height:208px; flex:0 0 208px; aspect-ratio:auto; }
.chart-scale-note { font-size:11px; line-height:1.5; color:var(--muted); min-height:17px; margin:5px 0 0; }
.chart-scale-note[hidden] { display:block !important; visibility:hidden; }
.readout-value.long-number { font-size:clamp(28px,8vw,42px); }
.gauge.is-duplex .readout-value.long-number { font-size:clamp(28px,8vw,40px); }
.stat dd.long-number { font-size:clamp(14px,4vw,18px); }
.result-top.has-upload .spark { max-width:none; }
@media(min-width:960px){.stage .chart{height:228px;min-height:228px;max-height:228px;flex-basis:228px;}}

/* Transfer spikes and long status messages keep the live panel at a fixed size. */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
.hero-grid, .hero-head, .gauge-col { min-width:0; }
.stage .chart { min-width:0; max-width:100%; contain:size; }
.view-live .chart-head { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; height:20px; min-height:20px; max-height:20px; }
.view-live .chart-head > span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.view-live .chart-legend { height:18px; min-height:18px; max-height:18px; }
.view-live .chart-legend[hidden] { display:flex !important; visibility:hidden; }
.chart-scale-note { height:34px; min-height:34px; max-height:34px; line-height:17px; overflow:hidden; }
.stress-meta { display:grid; grid-template-columns:7px minmax(0,1fr); grid-template-rows:36px 18px; gap:0 8px; height:54px; min-height:54px; max-height:54px; align-items:start; }
.stress-meta .live-dot { margin-top:6px; }
#stress-sync { min-width:0; max-height:36px; overflow:auto; overflow-wrap:anywhere; line-height:18px; }
.stress-conn { grid-column:2; justify-self:end; margin:0; line-height:18px; white-space:nowrap; }
.stat dd { max-width:100%; overflow:hidden; text-overflow:ellipsis; }
@media(max-width:959px) {
  .view-live .chart-head { grid-template-columns:minmax(0,1fr); grid-template-rows:18px 18px; gap:0; height:36px; min-height:36px; max-height:36px; }
  .chart-peak { justify-self:end; max-width:100%; }
  .stress-meta { grid-template-rows:54px 18px; height:72px; min-height:72px; max-height:72px; }
  #stress-sync { max-height:54px; }
}
@media(max-width:520px) {
  .stats, .stats.has-upload { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stats.has-upload .stat, .stats.has-upload .stat:nth-child(-n+2) { grid-column:auto; }
  .stat { min-height:68px; }
  .stat dt { flex-direction:row; align-items:baseline; gap:4px; min-height:18px; white-space:nowrap; }
  .stat dt .unit-toggle { margin-left:0; }
  .stats.has-upload .stat:last-child { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:48px; }
  .stats.has-upload .stat:last-child dd { margin:0; }
  .speed-tools { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:36px 36px; gap:6px; }
  #background-hint { line-height:18px; max-height:36px; overflow:hidden; }
  .speed-tool-actions { margin-left:0; justify-content:flex-end; flex-wrap:nowrap; }
}

/* Unified first-party account sign-in, shared with the native App. */
.mobile-test-controls { display:none; }
@media(max-width:959px) {
  .mobile-test-controls:not([hidden]) { position:fixed; z-index:70; bottom:calc(12px + env(safe-area-inset-bottom)); left:max(12px,env(safe-area-inset-left)); right:max(12px,env(safe-area-inset-right)); display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:66px; padding:10px 12px; border:1px solid color-mix(in srgb,var(--accent) 28%,var(--line)); border-radius:18px; background:color-mix(in srgb,var(--surface) 96%,transparent); box-shadow:0 4px 28px #0003; -webkit-backdrop-filter:blur(16px); backdrop-filter:blur(16px); }
  .mobile-test-copy { display:flex; flex-direction:column; min-width:0; gap:3px; }
  .mobile-test-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; }
  .mobile-test-copy small { color:var(--muted); font-size:11px; line-height:1.4; }
  .mobile-test-controls .stop-btn { position:static; transform:none; display:inline-flex; align-items:center; justify-content:center; flex:none; min-width:112px; min-height:46px; margin:0; padding:10px 16px; border:1px solid color-mix(in srgb,var(--danger) 35%,var(--line)); border-radius:12px; background:color-mix(in srgb,var(--danger) 14%,var(--surface)); color:var(--danger); font-size:14px; font-weight:750; }
  .mobile-test-controls .stop-btn:disabled { opacity:.65; cursor:progress; }
  body.has-mobile-test-controls { padding-bottom:calc(94px + env(safe-area-inset-bottom)); }
  body.has-mobile-test-controls .my-rank { bottom:calc(94px + env(safe-area-inset-bottom)); }
  body.has-mobile-test-controls .toasts { bottom:calc(94px + env(safe-area-inset-bottom)); }
}


/* The test workspace: stable controls, one primary measurement area, separate editors. */
.hero { padding:30px 0 26px; }
.hero-grid { grid-template-areas:"head" "controls" "gauge" "panel"; gap:16px; }
.hero-head { display:flex; flex-direction:column; align-items:flex-start; gap:14px; text-align:left; padding:0 2px; border:0; }
.hero-copy { min-width:0; }
.hero-eyebrow { display:block; margin-bottom:7px; color:var(--accent); font-size:11px; font-weight:750; letter-spacing:1.8px; }
.hero h1 { font-size:clamp(27px,6.7vw,36px); line-height:1.3; letter-spacing:-.5px; }
.hero-sub { margin-top:8px; max-width:52em; font-size:13px; line-height:1.65; }
.hero-network { min-width:0; max-width:100%; }
.network-caption { display:none; font-size:11px; color:var(--muted); margin-bottom:6px; }
.hero-network .ip-chip { justify-content:flex-start; margin:0; padding:0; min-height:26px; border:0; border-radius:0; background:transparent; font-size:12px; gap:5px 8px; }
.hero-network .ip-dot { width:6px; height:6px; }
.hero-network .ip-addr { font-size:12px; }
.test-toolbar { grid-area:controls; display:flex; flex-direction:column; align-items:stretch; gap:12px; padding:12px; border:1px solid var(--line); border-radius:20px; background:var(--surface); }
.test-toolbar .seg-mode { margin:0; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:4px; border:0; background:var(--surface-2); }
.test-toolbar .seg-mode button { justify-content:center; min-height:42px; padding:0 12px; font-size:13px; }
.test-context { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; min-width:0; }
.test-toolbar[data-run-mode=quick] .test-context { grid-template-columns:minmax(0,1fr); }
.context-button { display:flex; align-items:center; gap:8px; min-width:0; min-height:64px; padding:10px; border:1px solid var(--line); border-radius:13px; background:var(--surface); color:var(--ink); text-align:left; transition:border-color .18s,background .18s; }
.context-button:hover { border-color:color-mix(in srgb,var(--accent) 50%,var(--line)); background:var(--surface-2); }
.context-icon { display:grid; place-items:center; flex:none; width:30px; height:30px; border-radius:9px; background:color-mix(in srgb,var(--accent) 9%,transparent); color:var(--accent); }
.context-icon svg, .node-welcome-icon svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.context-copy { display:flex; flex-direction:column; min-width:0; gap:3px; }
.context-copy small { color:var(--muted); font-size:11px; line-height:1.3; }
.context-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; font-weight:650; line-height:1.4; }
.context-chevron { margin-left:auto; color:var(--muted); font-size:22px; flex:none; }
.active-run-summary { flex-basis:100%; margin:0; padding:0 2px; color:var(--muted); font-size:12px; line-height:1.6; overflow-wrap:anywhere; }
.gauge-col { padding:14px 12px 18px; border:1px solid var(--line); border-radius:24px; background:radial-gradient(ellipse at 50% 20%,color-mix(in srgb,var(--down-1) 4%,transparent),transparent 65%),var(--surface); }
.gauge { width:min(100%,310px); }
.gauge-note { margin:0 auto; max-width:30em; font-size:11px; line-height:1.7; }
.speed-phases { margin-top:12px; }
.speed-phases li { font-size:11px; padding:4px 12px; }
.panel-col { min-width:0; }
.stage { box-shadow:0 8px 30px -24px #0005; }
.speed-tools { padding:0 2px; }
.section { padding:32px 0; }
.section-head { margin-bottom:18px; }
.section h2 { font-size:clamp(23px,5vw,28px); }
.section-sub { font-size:13px; line-height:1.7; }
.my-rank { position:relative; bottom:auto; z-index:auto; margin:0 0 16px; padding:13px 16px; background:var(--surface); box-shadow:none; -webkit-backdrop-filter:none; backdrop-filter:none; }
.my-rank.is-prompt { background:var(--surface); }
body.has-mobile-test-controls .my-rank { bottom:auto; }
.rank-rally { margin-top:16px; padding:16px 20px; }
.rank-rally-copy strong { font-size:17px; }
.lb-podium { gap:16px; padding:34px 0 20px; }
.podium-card { padding:29px 14px 18px; }
.podium-card.place-1 { padding-top:39px; padding-bottom:25px; }
.winner-honor { margin-bottom:8px; }
.winner-tags { margin:5px 0; }
.winner-value { margin-top:12px; }
.winner-details-link { display:block; margin-top:12px; font-size:11px; color:var(--muted); }
.podium-card:hover .winner-details-link { color:var(--medal-ink); }
.podium-card > .winner-device, .podium-card > .net-badge { display:none; }
.podium-card .network-location { justify-content:center; margin-top:3px; }
.winner-upload { margin-top:9px; padding-top:9px; }
.download-card { box-shadow:none; }
.features { gap:14px; }
.feature { border-radius:18px; }
.faq-list { align-items:start; }
.site-footer { margin-top:12px; }
.hero.is-disabled .hero-grid { grid-template-areas:"head" "controls" "panel"; grid-template-columns:minmax(0,1fr); }
@media(min-width:760px) {
  .hero-grid { grid-template-columns:minmax(280px,.88fr) minmax(0,1.12fr); grid-template-areas:"head head" "controls controls" "gauge panel"; gap:22px; align-items:start; }
  .hero-head { flex-direction:row; justify-content:space-between; align-items:center; gap:28px; }
  .hero-network { max-width:330px; text-align:right; }
  .network-caption { display:block; }
  .hero-network .ip-chip { justify-content:flex-end; }
  .test-toolbar { flex-direction:row; flex-wrap:wrap; align-items:center; padding:12px; }
  .test-toolbar .seg-mode { flex:0 0 auto; }
  .test-context { flex:1; }
  .context-button { min-height:62px; }
  .gauge-col { align-self:stretch; display:flex; flex-direction:column; justify-content:center; padding:20px 16px; }
  .gauge { width:min(100%,340px); }
  .section { padding:42px 0; }
  .faq-grid { display:block; }
  .faq-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
}
@media(min-width:1100px) { .hero { padding:38px 0 32px; } .hero-grid { column-gap:24px; } .test-toolbar { gap:24px; padding:14px 16px; } .test-toolbar .seg-mode button { min-width:124px; } .context-button { padding:10px 16px; } }
@media(min-width:760px) and (max-width:1099px) { .panel-col .stats:not(.has-upload) { grid-template-columns:repeat(2,minmax(0,1fr)); } #stat-ping { font-size:18px; } }
@media(max-width:600px) {
  .context-icon { display:none; }
  .lb-podium { gap:8px; padding:30px 0 16px; }
  .podium-card { padding:26px 7px 14px; }
  .podium-card.place-1 { padding-top:36px; padding-bottom:21px; }
  .podium-card > .network-location { display:none; }
  .winner-honor { margin-bottom:8px; }
  .winner-details-link { margin-top:10px; font-size:10px; }
  .rank-rally { padding:13px 14px; }
  .rank-rally-copy strong { font-size:14px; }
  .my-rank { padding:11px 12px; }
  .my-rank-body strong { font-size:12px; }
  .feature { padding:16px; }
  .feature p { font-size:12px; line-height:1.8; }
}
@media(max-width:360px) { .context-button { gap:7px; padding:9px; } .context-icon { display:none; } .test-toolbar .seg-mode button { padding:0 7px; } .hero h1 { font-size:25px; } .hero-sub { font-size:12px; } }

/* Consistent node manager and run-settings dialogs. Forms never move the main start control. */
.speed-region-control { display:grid; gap:9px; width:100%; min-width:0; padding-top:12px; border-top:1px solid var(--line); }
.region-switch { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; padding:4px; border-radius:13px; background:var(--surface-2); }
.region-switch button { display:flex; justify-content:center; align-items:center; gap:5px; min-width:0; min-height:38px; padding:7px 5px; border:1px solid transparent; border-radius:10px; color:var(--muted); background:transparent; font:inherit; font-size:13px; font-weight:600; white-space:nowrap; transition:background .16s,color .16s,box-shadow .16s; }
.region-switch button:hover:not(:disabled) { color:var(--accent); background:color-mix(in srgb,var(--accent) 5%,var(--surface)); }
.region-switch button[aria-checked=true] { color:var(--accent); border-color:color-mix(in srgb,var(--accent) 16%,var(--line)); background:var(--surface); box-shadow:0 2px 5px #152d5010; }
.region-switch button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.region-switch button:disabled { cursor:default; opacity:.7; }
.region-switch svg { width:15px; height:15px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.region-note { display:flex; align-items:baseline; justify-content:center; gap:6px; margin:0; color:var(--muted); font-size:11px; line-height:1.6; }
.region-indicator { width:5px; height:5px; flex:none; border-radius:50%; background:var(--accent); opacity:.65; }
#speed-region-note { min-width:0; overflow-wrap:anywhere; }
@media(min-width:760px) { .speed-region-control { grid-template-columns:minmax(320px,1fr) minmax(0,1fr); align-items:center; gap:18px; } .region-note { justify-content:flex-start; } }
@media(max-width:360px) { .region-switch button { font-size:12px; gap:3px; } .region-switch svg { width:13px; height:13px; } }
.settings-dialog { width:min(860px,calc(100vw - 48px)); max-height:min(90vh,820px); max-height:min(90dvh,820px); padding:0; margin:auto; border:1px solid var(--line); border-radius:24px; color:var(--ink); background:var(--surface); box-shadow:0 24px 100px #0005; overflow:hidden; }
.settings-dialog::backdrop { background:#07111d88; -webkit-backdrop-filter:blur(5px); backdrop-filter:blur(5px); }
.settings-shell { display:flex; flex-direction:column; max-height:inherit; min-height:0; }
.settings-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; flex:none; padding:22px 24px 18px; border-bottom:1px solid var(--line); }
.settings-eyebrow { display:block; color:var(--accent); font-size:11px; font-weight:700; letter-spacing:1.5px; margin-bottom:4px; }
.settings-header h2 { font-size:22px; line-height:1.4; }
.settings-header p { color:var(--muted); font-size:12px; line-height:1.6; margin-top:5px; }
.dialog-close { flex:none; display:grid; place-items:center; width:40px; height:40px; padding:0; border:1px solid var(--line); border-radius:12px; background:var(--surface-2); color:var(--muted); font-size:27px; line-height:1; }
.dialog-close:hover { color:var(--ink); }
.settings-body { min-height:0; overflow:auto; overscroll-behavior:contain; padding:22px 24px; }
.settings-footer { flex:none; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 24px; border-top:1px solid var(--line); background:var(--surface); }
.settings-footer p { max-width:260px; font-size:11px; line-height:1.6; color:var(--muted); }
.settings-footer-actions { display:flex; align-items:center; gap:10px; margin-left:auto; }
.settings-footer .btn { min-height:42px; font-size:13px; padding:0 16px; }
.settings-fields { min-width:0; margin:0; padding:0; border:0; }
.settings-fields input:not([type=checkbox]), .settings-fields select { width:100%; min-width:0; min-height:44px; padding:11px 12px; border:1px solid var(--line); border-radius:11px; background:var(--bg); color:var(--ink); font:inherit; font-size:14px; line-height:1.45; }
.settings-fields input::placeholder { color:var(--muted); opacity:.7; }
.settings-fields input:focus-visible, .settings-fields select:focus-visible { outline:2px solid color-mix(in srgb,var(--accent) 70%,transparent); outline-offset:1px; }
.settings-label { display:flex; align-items:center; justify-content:space-between; margin:15px 0 7px; font-size:13px; font-weight:650; }
.settings-label:first-child { margin-top:0; }
.settings-label small { font-size:11px; color:var(--muted); font-weight:400; }
.settings-help { margin-top:12px; color:var(--muted); font-size:12px; line-height:1.7; overflow-wrap:anywhere; }
.settings-section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.settings-section-head h3, .node-editor-heading h3 { font-size:14px; font-weight:700; }
.settings-section-head>span { color:var(--muted); font-size:11px; }
.settings-text-button { padding:6px 0; min-height:36px; border:0; background:none; color:var(--accent); font-size:12px; font-weight:600; text-align:left; }
.danger-text { color:var(--danger); }
.settings-running-note { margin:0; padding:12px 24px; color:var(--muted); font-size:12px; line-height:1.6; background:var(--surface-2); }
.settings-dialog button:disabled { opacity:.55; cursor:default; }
.node-manager-grid { display:grid; grid-template-columns:minmax(220px,.9fr) minmax(0,1.1fr); gap:24px; min-height:370px; }
.node-library { min-width:0; padding-right:24px; border-right:1px solid var(--line); }
.node-library-list { display:grid; gap:8px; max-height:330px; overflow-y:auto; overscroll-behavior:contain; padding:3px; margin:-3px; }
.node-library-row { display:flex; align-items:center; gap:4px; border:1px solid var(--line); border-radius:13px; background:var(--surface); }
.node-library-row.is-selected { border-color:color-mix(in srgb,var(--accent) 65%,var(--line)); background:color-mix(in srgb,var(--accent) 6%,var(--surface)); }
.node-choice { display:flex; align-items:center; flex:1; min-width:0; gap:10px; padding:13px 11px; border:0; border-radius:12px; background:none; color:var(--ink); text-align:left; }
.node-choice-mark { display:grid; place-items:center; flex:none; width:19px; height:19px; border:1px solid var(--line); border-radius:50%; color:#fff; font-size:12px; font-weight:750; }
.is-selected .node-choice-mark { background:var(--accent); border-color:var(--accent); }
.node-choice-copy { min-width:0; display:flex; flex-direction:column; gap:4px; }
.node-choice-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; font-weight:650; }
.node-choice-copy small { color:var(--muted); font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.node-edit { min-width:42px; min-height:42px; margin-right:5px; padding:4px 6px; border:0; border-radius:8px; background:none; color:var(--muted); font-size:11px; }
.node-edit:hover { color:var(--accent); background:var(--surface-2); }
.node-add { display:flex; align-items:center; justify-content:center; gap:7px; width:100%; min-height:44px; margin-top:12px; border:1px dashed color-mix(in srgb,var(--accent) 45%,var(--line)); border-radius:12px; background:color-mix(in srgb,var(--accent) 3%,var(--surface)); color:var(--accent); font-size:13px; font-weight:600; }
.node-add>span { font-size:20px; line-height:1; }
.node-editor { min-width:0; }
.node-welcome { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; height:100%; min-height:260px; padding:20px 10px; text-align:center; }
.node-welcome-icon { display:grid; place-items:center; width:62px; height:62px; border:1px solid color-mix(in srgb,var(--accent) 15%,var(--line)); border-radius:20px; background:color-mix(in srgb,var(--accent) 7%,var(--surface)); color:var(--accent); }
.node-welcome-icon svg { width:32px; height:32px; stroke-width:1.3; }
.node-welcome h3 { font-size:16px; }
.node-welcome p { color:var(--muted); font-size:12px; line-height:1.8; max-width:24em; }
.node-welcome .btn { margin-top:4px; font-size:13px; }
.node-provider-summary { display:grid; gap:9px; width:100%; max-width:320px; padding:12px 14px; border:1px solid var(--line); border-radius:13px; background:var(--surface-2); text-align:left; }
.node-library > .node-provider-summary { margin-top:12px; max-width:none; }
.node-provider-row { display:flex; gap:12px; align-items:baseline; font-size:12px; line-height:1.6; }
.node-provider-label { flex:none; color:var(--accent); font-weight:600; }
.node-provider-names { min-width:0; overflow-wrap:anywhere; color:var(--muted); }
.node-editor-heading { display:flex; align-items:center; gap:8px; margin-bottom:16px; }
.node-editor-heading .danger-text { margin-left:auto; }
.editor-back { display:none; width:34px; min-height:36px; padding:0; border:1px solid var(--line); border-radius:10px; color:var(--ink); background:var(--surface); font-size:25px; }
.node-check-line { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:17px; }
.node-check-line>span { font-size:11px; line-height:1.6; color:var(--muted); }
.node-check-line .btn { min-height:36px; font-size:12px; padding:0 12px; flex:none; }
.node-status { margin-top:12px; padding:10px 12px; border-radius:10px; background:var(--surface-2); color:var(--muted); font-size:12px; line-height:1.7; overflow-wrap:anywhere; }
.node-status[data-state=checking] { color:var(--accent); background:color-mix(in srgb,var(--accent) 8%,var(--surface)); }
.node-status[data-state=success] { color:var(--success); background:color-mix(in srgb,var(--success) 8%,var(--surface)); }
.node-status[data-state=error] { color:var(--danger); background:color-mix(in srgb,var(--danger) 8%,var(--surface)); }
.node-requirements { margin-top:12px; color:var(--muted); font-size:11px; line-height:1.7; }
.node-requirements summary { cursor:pointer; min-height:28px; }
.node-requirements p { padding-top:5px; }
.limits-dialog { width:min(540px,calc(100vw - 48px)); }
.direction-setting { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:14px 16px; border:1px solid var(--line); border-radius:14px; background:var(--surface-2); cursor:pointer; }
.direction-setting>span:first-child { display:flex; flex-direction:column; gap:4px; }
.direction-setting strong { font-size:13px; }
.direction-setting small { font-size:11px; color:var(--muted); }
.direction-switch { position:relative; display:inline-flex; flex:none; align-items:center; }
.direction-switch input { position:absolute; inset:0; z-index:1; margin:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.direction-switch .upload-switch { display:block; width:38px; height:22px; padding:3px; background:var(--faint); border-radius:99px; }
.direction-switch .upload-switch::before { display:block; content:''; width:16px; height:16px; border-radius:50%; background:#fff; transition:transform .18s; }
.direction-switch input:checked + .upload-switch { background:var(--accent); }
.direction-switch input:checked + .upload-switch::before { transform:translateX(16px); }
.direction-switch input:focus-visible + .upload-switch { outline:2px solid var(--accent); outline-offset:3px; }
.settings-section { margin-top:20px; padding-top:20px; border-top:1px solid var(--line); }
.speed-limits { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.speed-limits:has(#limit-up-field[hidden]) { grid-template-columns:minmax(0,1fr); }
.speed-limits>label, .traffic-limit-label { font-size:12px; color:var(--muted); line-height:1.6; }
.option-input { display:flex; align-items:center; margin-top:7px; min-width:0; border:1px solid var(--line); border-radius:11px; background:var(--bg); }
.settings-fields .option-input input { border:0; background:none; }
.option-input small { flex:none; padding-right:12px; color:var(--muted); font-size:11px; }
.settings-fields .option-input select { flex:0 0 75px; width:75px; border:0; background:none; }
.option-input:focus-within { outline:2px solid color-mix(in srgb,var(--accent) 70%,transparent); outline-offset:1px; }
.settings-fields .option-input input:focus-visible, .settings-fields .option-input select:focus-visible { outline:0; }
.limits-preview { margin-top:18px; padding:12px 14px; border:1px solid color-mix(in srgb,var(--accent) 18%,var(--line)); border-radius:12px; color:var(--accent); background:color-mix(in srgb,var(--accent) 5%,var(--surface)); font-size:12px; line-height:1.8; overflow-wrap:anywhere; }
@media(max-width:700px) {
  .settings-dialog { width:calc(100vw - 24px); max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px); border-radius:20px; }
  .settings-header { padding:18px 18px 16px; gap:12px; }
  .settings-header h2 { font-size:20px; }
  .settings-body { padding:18px; }
  .settings-footer { padding:14px 18px max(14px,env(safe-area-inset-bottom)); gap:10px; }
  .node-dialog .settings-footer { flex-direction:column; align-items:stretch; }
  .node-dialog .settings-footer-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; margin:0; }
  .settings-footer p { max-width:none; font-size:11px; }
  .settings-footer .btn { min-width:0; font-size:13px; padding:0 12px; }
  .settings-fields input:not([type=checkbox]), .settings-fields select { font-size:16px; }
  .node-manager-grid { grid-template-columns:minmax(0,1fr); gap:0; min-height:0; }
  .node-library { border:0; padding:0; }
  .node-library-list { max-height:none; }
  .node-dialog:not(.is-editing) .node-editor, .node-dialog.is-editing .node-library { display:none; }
  .editor-back { display:grid; place-items:center; }
  .node-editor-heading { margin-bottom:14px; }
  .node-dialog .settings-header p { max-width:22em; }
  .limits-dialog .settings-footer-actions { gap:8px; }
  .limits-dialog .settings-footer .btn { padding:0 12px; }
  .settings-section { margin-top:18px; padding-top:18px; }
  .speed-limits { gap:10px; }
}
@media(max-width:360px) { .settings-header, .settings-body { padding:16px; } .settings-footer { padding:12px 16px; } .speed-limits { grid-template-columns:minmax(0,1fr); } .limits-dialog .settings-footer { flex-wrap:wrap; } .limits-dialog .settings-footer-actions { flex:1; justify-content:flex-end; } .settings-footer .btn { font-size:12px; padding:0 9px; } }
@media(max-height:500px) { .settings-dialog { max-height:calc(100dvh - 16px); } .settings-header { padding-top:12px; padding-bottom:12px; } .settings-eyebrow, .settings-header p, .settings-footer p { display:none; } .settings-footer { padding-top:10px; padding-bottom:10px; } .node-manager-grid { min-height:0; } }
