/* NetPulse · 网络体检中心 —— 明亮现代风 */

:root {
  --bg: #f5f8ff;
  --card: #ffffff;
  --ink: #14203c;
  --muted: #61708f;
  --faint: #93a1bd;
  --brand: #2e6bff;
  --brand-2: #00c3ff;
  --line: #e5ebf8;
  --ok: #059669;
  --bad: #dc2626;
  --radius: 22px;
  --shadow: 0 12px 40px rgba(30, 66, 135, 0.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(1100px 560px at 85% -12%, #e0ecff 0%, transparent 62%),
    radial-gradient(900px 480px at -15% 24%, #dff8ff 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.6;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

/* 背景装饰光斑 */
.bg-blob {
  position: fixed; border-radius: 50%; filter: blur(70px);
  pointer-events: none; z-index: -1; opacity: 0.55;
}
.bg-blob-1 { width: 380px; height: 380px; top: -120px; right: -100px; background: #bcd7ff; animation: drift 16s ease-in-out infinite alternate; }
.bg-blob-2 { width: 320px; height: 320px; bottom: -110px; left: -90px; background: #b9f0ff; animation: drift 20s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(-36px, 30px) scale(1.08); } }

/* ---------- 顶栏 ---------- */
.site-header {
  max-width: 640px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 6px 16px rgba(46, 107, 255, 0.28); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 17px; letter-spacing: 0.2px; }
.brand-text span { font-size: 12px; color: var(--muted); }

.exit-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; font-size: 12.5px; color: var(--muted);
  box-shadow: 0 4px 14px rgba(30, 66, 135, 0.06);
  max-width: 62%; overflow: hidden; white-space: nowrap;
}
.exit-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15); }
#exitText { overflow: hidden; text-overflow: ellipsis; }
.exit-tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: none; letter-spacing: 0.5px; }
.exit-tag.cn { color: #059669; background: #ecfdf5; border: 1px solid #c9ecd9; }
.exit-tag.proxy { color: #b45309; background: #fffbea; border: 1px solid #f5e3b5; }

/* ---------- 节点切换 ---------- */
.node-picker { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.np-label { font-size: 12.5px; color: var(--faint); font-weight: 600; }
.seg { display: flex; gap: 2px; background: #f0f4fd; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  appearance: none; border: none; cursor: pointer; font-family: inherit;
  background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600; padding: 5px 15px; border-radius: 999px;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.seg button.active { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgba(30, 66, 135, 0.14); }
.seg button:active { transform: scale(0.96); }
.np-resolved { width: 100%; text-align: center; font-size: 11.5px; color: var(--faint); }

/* ---------- 卡片 ---------- */
main { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid rgba(229, 235, 248, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: rise 0.5s ease both;
}
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 阶段指示 ---------- */
.phases {
  list-style: none; display: flex; justify-content: center; gap: 30px; margin-bottom: 6px;
}
.phases li {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--faint); transition: color 0.25s;
}
.phases li i {
  width: 9px; height: 9px; border-radius: 50%; background: #d7e0f2; transition: all 0.25s;
}
.phases li.active { color: var(--brand); font-weight: 600; }
.phases li.active i { background: var(--brand); box-shadow: 0 0 0 4px rgba(46, 107, 255, 0.16); animation: pulse 1.1s ease-in-out infinite; }
.phases li.done { color: var(--muted); }
.phases li.done i { background: var(--ok); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(46, 107, 255, 0.08); } }

/* ---------- 仪表 ---------- */
.gauge-wrap { position: relative; width: min(292px, 76vw); aspect-ratio: 1; margin: 6px auto 0; }
.gauge { position: absolute; inset: 0; width: 100%; height: 100%; }
.gauge-track { fill: none; stroke: #e9effd; stroke-width: 14; stroke-linecap: round; stroke-dasharray: 433.54 9999; }
.gauge-prog {
  fill: none; stroke: url(#gaugeGrad); stroke-width: 14; stroke-linecap: round;
  transition: stroke-dasharray 0.18s ease-out, opacity 0.25s;
  filter: drop-shadow(0 3px 8px rgba(46, 107, 255, 0.30));
}
.gauge-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 1px;
}
.value {
  font-size: clamp(42px, 13vw, 60px); font-weight: 700; letter-spacing: -1px;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.unit { font-size: 15px; color: var(--muted); font-weight: 600; }
.phase-label { margin-top: 7px; font-size: 12.5px; color: var(--faint); min-height: 18px; }

/* ---------- 指标卡 ---------- */
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 12px; }
.chip {
  background: #f8faff; border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 6px 9px; text-align: center; transition: border-color 0.3s, background 0.3s;
}
.chip-label { display: block; font-size: 11px; color: var(--faint); margin-bottom: 2px; white-space: nowrap; }
.chip-value { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.chip.filled { border-color: #d3e2ff; background: #f4f8ff; }
.chip.grade-a { border-color: #b8ecd9; background: #f0fdf7; } .chip.grade-a .chip-value { color: var(--ok); }
.chip.grade-b { border-color: #ddefb8; background: #f9fdef; } .chip.grade-b .chip-value { color: #65a30d; }
.chip.grade-c { border-color: #f5e3b5; background: #fffbea; } .chip.grade-c .chip-value { color: #d97706; }
.chip.grade-d { border-color: #f8d9bb; background: #fff7ee; } .chip.grade-d .chip-value { color: #ea580c; }
.chip.grade-f { border-color: #f6c4c4; background: #fef3f3; } .chip.grade-f .chip-value { color: var(--bad); }

/* ---------- 速率曲线 ---------- */
.chart {
  display: block; width: 100%; height: 118px;
  background: #f8faff; border: 1px solid var(--line); border-radius: 14px;
}

/* ---------- 操作 ---------- */
.save-note {
  margin-top: 12px; font-size: 12.5px; color: #b45309; background: #fffbea;
  border: 1px solid #f5e3b5; border-radius: 10px; padding: 7px 12px; text-align: center;
}
.actions { display: flex; justify-content: center; margin-top: 16px; }
.btn-primary {
  appearance: none; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff; font-size: 16.5px; font-weight: 600; font-family: inherit;
  padding: 14px 52px; border-radius: 999px; letter-spacing: 2px;
  box-shadow: 0 10px 24px rgba(46, 107, 255, 0.32);
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(46, 107, 255, 0.38); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary.stop {
  background: #fff; color: var(--bad); box-shadow: inset 0 0 0 2px #f3caca, 0 6px 16px rgba(220, 38, 38, 0.10);
}

.btn-ghost {
  appearance: none; cursor: pointer; font-family: inherit;
  background: #fff; color: var(--muted); font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px;
  transition: color 0.2s, border-color 0.2s;
}
.btn-ghost:hover { color: var(--brand); border-color: #c4d6ff; }
.btn-ghost.small { font-size: 12px; padding: 4px 12px; }

/* ---------- 体验评估 ---------- */
.verdict { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; opacity: 0; transform: translateY(6px); transition: opacity 0.4s, transform 0.4s; }
.verdict.show { opacity: 1; transform: none; }
.verdict-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.verdict-title { font-size: 13.5px; font-weight: 700; color: var(--muted); letter-spacing: 1px; }
.caps { display: flex; flex-wrap: wrap; gap: 8px; }
.cap {
  font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 5px 13px;
  font-variant-numeric: tabular-nums;
}
.cap.ok { color: var(--ok); background: #effaf4; border: 1px solid #c9ecd9; }
.cap.no { color: #94a3b8; background: #f4f6fa; border: 1px solid #e2e8f0; text-decoration: line-through; text-decoration-color: #cbd5e1; }

/* ---------- 历史 ---------- */
.history h2, .about h2 { font-size: 15px; margin-bottom: 12px; }
.history-head { display: flex; align-items: center; justify-content: space-between; }
#historyList { list-style: none; display: flex; flex-direction: column; gap: 6px; }
#historyList li {
  display: grid; grid-template-columns: 1.35fr 1fr 1fr 0.9fr auto;
  align-items: center; gap: 8px;
  font-size: 13px; padding: 9px 12px; border-radius: 12px;
  background: #f8faff; border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.h-date { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.h-node { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; flex: none; }
.h-node.cn { background: var(--ok); }
.h-dl { color: var(--brand); font-weight: 600; }
.h-ul { color: #0891b2; font-weight: 600; }
.h-ping { color: var(--muted); text-align: right; }
.h-grade { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.h-grade.grade-a { background: #effaf4; color: var(--ok); }
.h-grade.grade-b { background: #f9fdef; color: #65a30d; }
.h-grade.grade-c { background: #fffbea; color: #d97706; }
.h-grade.grade-d { background: #fff7ee; color: #ea580c; }
.h-grade.grade-f { background: #fef3f3; color: var(--bad); }

/* ---------- 说明 ---------- */
.about ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.about li { font-size: 13.5px; color: var(--muted); padding-left: 18px; position: relative; }
.about li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.about strong { color: var(--ink); }

footer { max-width: 640px; margin: 20px auto 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: rgba(20, 32, 60, 0.92); color: #fff; font-size: 13.5px;
  padding: 10px 20px; border-radius: 999px; transition: all 0.3s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  body { padding-left: 12px; padding-right: 12px; }
  .card { padding: 18px 14px; border-radius: 18px; }
  .chips { grid-template-columns: repeat(2, 1fr); }
  .phases { gap: 20px; }
  .btn-primary { padding: 14px 44px; width: min(100%, 300px); }
  .exit-chip { font-size: 11.5px; padding: 5px 10px; }
  .brand-text span { font-size: 11px; }
  #historyList li { grid-template-columns: 1.2fr 1fr 1fr auto auto; font-size: 12px; padding: 8px 10px; }
}

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