:root {
  --bg: #0b1020;
  --bg-2: #11172e;
  --card: rgba(255,255,255,0.04);
  --card-2: rgba(255,255,255,0.06);
  --line: rgba(255,255,255,0.08);
  --text: #e6ecff;
  --text-2: #9aa3bf;
  --muted: #6b7393;
  --brand: #3b82f6;
  --brand-2: #5eead4;
  --danger: #f87171;
  --ok: #34d399;
  --warn: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(59,130,246,0.25), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(94,234,212,0.18), transparent 60%),
    linear-gradient(180deg, #070b1a 0%, #0b1020 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.skip {
  position:absolute; left:-9999px; top:8px; background:#000; color:#fff; padding:8px 12px; border-radius:8px;
}
.skip:focus { left:12px; z-index:1000; }
a { color: var(--brand-2); text-decoration:none; }
a:hover { text-decoration: underline; }

.topbar {
  display:flex; align-items:center; justify-content:space-between;
  padding: 18px 24px; max-width: 900px; margin: 0 auto;
}
.brand { display:flex; align-items:center; gap:10px; }
.brand h1 { font-size: 20px; margin:0; letter-spacing:0.5px; font-weight:700; }
.logo { font-size: 24px; filter: drop-shadow(0 0 10px rgba(94,234,212,0.6)); }
.topnav { display:flex; gap:10px; }

.btn {
  appearance:none; border:0; cursor:pointer; user-select:none;
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight:600;
  transition: transform .12s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(135deg, #3b82f6, #5eead4); color:#06122a; box-shadow: 0 8px 20px rgba(59,130,246,0.35); }
.btn.primary:hover { box-shadow: 0 10px 24px rgba(59,130,246,0.5); }
.btn.ghost { background: var(--card); color: var(--text); border:1px solid var(--line); }
.btn.ghost:hover { background: var(--card-2); }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity:.5; cursor:not-allowed; }

.container { max-width: 900px; margin: 0 auto; padding: 8px 20px 60px; }

.gauge-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items:center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
@media (max-width: 720px) { .gauge-card { grid-template-columns: 1fr; } }

.gauge { position: relative; aspect-ratio: 1/1; width: 100%; max-width: 360px; margin: 0 auto; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 14; }
.ring-fg {
  fill: none; stroke: url(#grad); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 540; stroke-dashoffset: 540;
  transition: stroke-dashoffset .25s ease;
  filter: drop-shadow(0 0 8px rgba(94,234,212,0.45));
}
.gauge-center {
  position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center;
}
.speed-label {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 2px;
  letter-spacing: 1px;
}
.speed { font-size: 56px; font-weight: 800; font-family: var(--mono); letter-spacing: -1px; line-height: 1; }
.unit { font-size: 14px; color: var(--text-2); margin-top: 4px; letter-spacing: 2px; }
.phase {
  margin-top: 14px;
  font-size: 13px;
  padding: 8px 18px;
  letter-spacing: 0.5px;
}
.phase:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.6);
  box-shadow: none;
}

.metrics { list-style:none; padding:0; margin:0; display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metrics li {
  background: var(--card-2); border:1px solid var(--line);
  padding: 14px 16px; border-radius: var(--radius-sm);
  display:flex; flex-direction:column; gap:4px;
}
.metrics .label { font-size: 12px; color: var(--text-2); }
.metrics .value { font-size: 22px; font-weight: 700; font-family: var(--mono); }
.metrics .unit-sm { font-size: 11px; color: var(--muted); margin-left: 2px; }


.result-text {
  margin-top: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 22px;
  box-shadow: var(--shadow);
}
.result-text .rt-line {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
  word-break: break-word;
}
.result-text .rt-label { color: var(--text-2); }
.result-text .rt-value {
  color: var(--brand-2);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 17px;
  margin: 0 2px;
  text-shadow: 0 0 8px rgba(94,234,212,0.25);
}
.result-text .rt-unit { color: var(--muted); font-size: 13px; }
.result-text .rt-sep  { display:inline-block; width: 12px; }
.result-text.is-pending .rt-value { color: var(--muted); }
@media (max-width: 480px) {
  .result-text { padding: 14px 16px; }
  .result-text .rt-line { font-size: 14px; }
  .result-text .rt-value { font-size: 15px; }
}
.steps { margin-top: 22px; }
.steps ol { list-style:none; padding:0; margin:0 0 12px; display:flex; gap:8px; flex-wrap:wrap; }
.step {
  display:flex; align-items:center; gap:8px; padding: 8px 14px;
  background: var(--card); border:1px solid var(--line);
  border-radius: 999px; font-size: 13px; color: var(--text-2);
  transition: color .2s, background .2s, border-color .2s;
}
.step.active { color: var(--text); background: var(--card-2); border-color: rgba(94,234,212,0.5); }
.step.done { color: var(--ok); }
.step .dot { width:8px; height:8px; border-radius:50%; background: var(--muted); }
.step.active .dot { background: var(--brand-2); box-shadow: 0 0 8px var(--brand-2); }
.step.done .dot { background: var(--ok); }

.progress { height:6px; background: var(--card); border-radius:999px; overflow:hidden; border:1px solid var(--line); }
.bar { height:100%; width:0; background: linear-gradient(90deg, #3b82f6, #5eead4); transition: width .25s ease; }

.history { margin-top: 28px; }
.history-head { display:flex; align-items:center; justify-content:space-between; }
.history-head h2 { font-size: 16px; margin:0; }
.history-list { list-style:none; padding:0; margin: 12px 0 0; display:flex; flex-direction:column; gap:8px; }
.history-list li {
  background: var(--card); border:1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px; display:flex; align-items:center; justify-content:space-between;
  font-family: var(--mono); font-size: 13px;
}
.history-list .empty { color: var(--muted); justify-content:center; }
.history-list .time { color: var(--text-2); }
.history-list .dl { color: var(--brand-2); font-weight:700; }
.history-list .ping { color: var(--text-2); }

.tips { margin-top: 28px; background: var(--card); border:1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; }
.tips h2 { font-size: 14px; margin:0 0 10px; color: var(--text-2); font-weight:600; }
.tips ul { margin:0; padding-left: 18px; color: var(--text-2); font-size: 13px; line-height: 1.8; }

.foot { text-align:center; color: var(--muted); font-size: 12px; padding: 20px 0 30px; }
.foot .dotsep { margin: 0 6px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: rgba(0,0,0,0.85); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 13px; box-shadow: 0 10px 20px rgba(0,0,0,0.3);
  animation: toastIn .2s ease;
}
.toast.toast-alert {
  background: rgba(220, 38, 38, 0.94);
  color: #fff;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.35);
}
@keyframes toastIn { from { opacity:0; transform: translate(-50%, 8px);} to { opacity:1; transform: translate(-50%, 0);} }

@media (max-width: 480px) {
  .speed { font-size: 44px; }
  .gauge-card { padding: 20px; }
  .topbar { padding: 14px 16px; }
  .container { padding: 4px 14px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.stats {
  margin-top: 22px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat-item {
  background: var(--card); border:1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px; display:flex; flex-direction:column; gap:4px;
}
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-value { font-size: 20px; font-weight: 700; font-family: var(--mono); }
.stat-unit  { font-size: 11px; color: var(--muted); }
