:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7686;
  --border: #e4e7ec;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --ok: #16a34a;
  --ok-soft: #e7f6ec;
  --warn: #d97706;
  --warn-soft: #fdf3e2;
  --bad: #dc2626;
  --bad-soft: #fde8e8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218; --card: #171b23; --text: #e6e9ef; --muted: #8b95a5; --border: #262c37;
    --accent: #5b8cff; --accent-soft: #1b2540; --ok: #34c06a; --ok-soft: #13291c;
    --warn: #f0a63a; --warn-soft: #2e2413; --bad: #f05252; --bad-soft: #321718;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1218; --card: #171b23; --text: #e6e9ef; --muted: #8b95a5; --border: #262c37;
  --accent: #5b8cff; --accent-soft: #1b2540; --ok: #34c06a; --ok-soft: #13291c;
  --warn: #f0a63a; --warn-soft: #2e2413; --bad: #f05252; --bad-soft: #321718;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* nav */
.topnav { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--border); }
.topnav .inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 4px; padding: 0 16px; height: 52px; overflow-x: auto; scrollbar-width: none; }
.topnav .brand { font-weight: 700; margin-right: 12px; color: var(--text); white-space: nowrap; }
.topnav .brand span { color: var(--accent); }
.topnav a.nav { padding: 6px 10px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.topnav a.nav:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.topnav a.nav.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topnav .spacer { flex: 1; }
.icon-btn { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 8px; padding: 4px 9px; }

/* layout */
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0 0 4px; font-size: 26px; }
.page-head p { margin: 0; color: var(--muted); }
h2.section { font-size: 20px; margin: 32px 0 6px; }
p.section-desc { color: var(--muted); margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.big-ip { font-size: 28px; font-weight: 700; font-family: var(--mono); word-break: break-all; }

/* key-value list */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; word-break: break-all; }

/* badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-bad { color: var(--bad); }

/* table */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); }
table.data tr:last-child td { border-bottom: none; }

/* misc */
.flag { width: 20px; height: 15px; vertical-align: -2px; border-radius: 2px; object-fit: cover; }
.favicon { width: 18px; height: 18px; vertical-align: -4px; border-radius: 4px; }
.btn { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 8px; padding: 6px 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
input.text { font: inherit; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); min-width: 0; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; }
.skeleton { display: inline-block; min-width: 60px; height: 1em; border-radius: 4px; background: linear-gradient(90deg, var(--border), var(--bg), var(--border)); background-size: 200% 100%; animation: sk 1.2s infinite; vertical-align: middle; }
@keyframes sk { to { background-position: -200% 0; } }
.score { font-size: 40px; font-weight: 800; line-height: 1; }
.meter { position: relative; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--bad), var(--warn), var(--ok)); margin: 12px 0 4px; }
.meter i { position: absolute; top: -4px; width: 4px; height: 16px; background: var(--text); border-radius: 2px; transform: translateX(-2px); }
.lat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lat-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.lat-item .name { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); }
pre.raw { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow: auto; max-height: 420px; font-size: 12px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px; }

/* hide ip */
body.hide-ip .ip { filter: blur(6px); }
