/* IP 检测站：深色玻璃仪表盘 + 浅色模式；移动端优先 */
* { box-sizing: border-box; }

:root,
[data-theme="dark"] {
  --bg: #0a0f1c;
  --bg2: #0d1526;
  --card: rgba(255, 255, 255, 0.045);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #e6edf7;
  --muted: #8fa0b8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --chip: rgba(255, 255, 255, 0.06);
  --input-bg: rgba(255, 255, 255, 0.06);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --bg: #eef2f7;
  --bg2: #ffffff;
  --card: #ffffff;
  --card-border: #dfe6ef;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --good: #059669;
  --warn: #b45309;
  --bad: #dc2626;
  --chip: #f1f5f9;
  --input-bg: #f8fafc;
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(56, 189, 248, 0.12), transparent 60%),
    radial-gradient(700px 420px at -10% 10%, rgba(99, 102, 241, 0.1), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

[data-theme="light"] body {
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h2 { font-size: 17px; margin: 0 0 10px; letter-spacing: 0.02em; }
h3 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.count { color: var(--muted); font-size: 13px; font-weight: 400; }

/* ---- 顶栏 ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 14px 6px;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 0.04em; }
.theme-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--chip);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

/* 导航：移动端两排 5+5 网格，不横滑；桌面单行 */
.nav { max-width: 860px; margin: 0 auto; padding: 0 10px 10px; }
.nav-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.nav-row + .nav-row { margin-top: 6px; }
.nav a {
  display: block;
  text-align: center;
  padding: 7px 2px;
  border-radius: 9px;
  background: var(--chip);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}
.nav a:hover { background: var(--accent-soft); text-decoration: none; }

/* ---- 内容 ---- */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 12px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
section { scroll-margin-top: 120px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* 检测入口 */
.hero-ip { text-align: center; padding: 6px 0 12px; }
.hero-label { color: var(--muted); font-size: 13px; }
.hero-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.02em;
  word-break: break-all;
}
.hero-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.check-form { display: flex; gap: 8px; }
.check-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.check-form input:focus { border-color: var(--accent); }
button {
  padding: 11px 18px;
  border-radius: 11px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
button:disabled { opacity: 0.55; cursor: default; }
button.danger { background: transparent; border: 1px solid var(--bad); color: var(--bad); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-row button { padding: 8px 14px; font-size: 14px; }

/* 评分 */
.score-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.score-ring {
  --size: 132px;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--c, var(--muted)) calc(var(--p, 0) * 1%), var(--chip) 0);
  position: relative;
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--bg2);
}
.score-num, .score-grade { position: relative; z-index: 1; }
.score-num span { font-size: 34px; font-weight: 800; line-height: 1; }
.score-grade { font-size: 13px; color: var(--muted); margin-top: 4px; }
.breakdown { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 220px; }
.breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--card-border);
  font-size: 14px;
}
.breakdown li:last-child { border-bottom: none; }
.breakdown .delta { font-weight: 700; white-space: nowrap; }
.breakdown .delta.neg { color: var(--bad); }
.breakdown .delta.zero { color: var(--good); }
.breakdown .detail { display: block; color: var(--muted); font-size: 12px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--card-border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td:first-child { color: var(--muted); white-space: nowrap; }

/* 列表 */
.dnsbl-list, .leak-list, .neighbor-list, .scenario-list, .apps-list, .history-list {
  list-style: none; margin: 0; padding: 0;
}
.dnsbl-list li, .neighbor-list li, .apps-list li, .history-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--card-border);
  font-size: 14px;
}
.dnsbl-list li:last-child, .neighbor-list li:last-child,
.apps-list li:last-child, .history-list li:last-child { border-bottom: none; }
.tag {
  flex: none;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--chip);
  white-space: nowrap;
}
.tag.good { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.tag.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.tag.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.tag.muted { color: var(--muted); }
.sub { display: block; color: var(--muted); font-size: 12px; }

/* 场景 */
.scenario-list li { padding: 10px 0; border-bottom: 1px dashed var(--card-border); }
.scenario-list li:last-child { border-bottom: none; }
.scenario-list .head { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.scenario-list p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* 测速 */
.speed-list { margin: 12px 0 0; }
.speed-list > div {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--card-border);
}
.speed-list dt { color: var(--muted); }
.speed-list dd { margin: 0; font-weight: 700; }
.cf-card {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 14px;
}
.cf-card p { margin: 0; }

/* ASN 结果 */
.asn-result { font-size: 14px; }
.asn-result dl { margin: 10px 0 0; }
.asn-result dl > div {
  display: flex; gap: 10px; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px dashed var(--card-border);
}
.asn-result dt { color: var(--muted); flex: none; }
.asn-result dd { margin: 0; text-align: right; word-break: break-all; }

/* 应用 */
.apps-list .app-name { font-weight: 600; }
.apps-list .probe { flex: none; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--chip); white-space: nowrap; }
.apps-list .probe.ok { color: var(--good); }
.apps-list .probe.fail { color: var(--bad); }
.apps-list .probe.wait { color: var(--muted); }

/* 历史 */
.history-list .h-ip { font-weight: 600; word-break: break-all; }
.history-list .h-meta { color: var(--muted); font-size: 12px; }
.history-list .del {
  flex: none; padding: 4px 10px; font-size: 12px;
  background: transparent; border: 1px solid var(--card-border); color: var(--muted);
}
.history-list li { cursor: default; }
.history-list .h-main { cursor: pointer; }

/* 工具目录 */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.tools-grid a {
  display: block;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--chip);
  color: var(--text);
  font-size: 14px;
  text-align: center;
}
.tools-grid a:hover { background: var(--accent-soft); text-decoration: none; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 18px 0 28px;
}

/* ---- 桌面 ---- */
@media (min-width: 720px) {
  .nav { padding-bottom: 12px; }
  .nav-row { display: flex; gap: 4px; }
  .nav-row + .nav-row { margin-top: 0; }
  .nav a { padding: 7px 12px; }
  .tools-grid { grid-template-columns: repeat(5, 1fr); }
  .hero-value { font-size: 36px; }
}
