:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #16191d;
  --muted: #5b6470;
  --line: #dde1e6;
  --accent: #0a66c2;
  --accent-ink: #ffffff;
  --ok: #1d7f47;
  --ok-bg: #e4f3ea;
  --warn: #9a5800;
  --warn-bg: #fdf1dc;
  --bad: #b8322a;
  --bad-bg: #fce6e4;
  --na: #636b76;
  --na-bg: #eceef1;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1215;
    --surface: #171b20;
    --ink: #e7eaee;
    --muted: #9ba4af;
    --line: #2a3139;
    --accent: #5ea8ff;
    --accent-ink: #0b1220;
    --ok: #57c587;
    --ok-bg: #13281c;
    --warn: #f0b24b;
    --warn-bg: #2d2311;
    --bad: #ff7d72;
    --bad-bg: #351816;
    --na: #9ba4af;
    --na-bg: #232930;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  -webkit-text-size-adjust: 100%;
}
html[lang^="zh"] body { line-height: 1.75; }

a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.85rem; }
.fine p { margin: 0.25rem 0; }
.mono { font-family: var(--mono); font-size: 0.92em; word-break: break-all; }

/* Header */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: 0.01em; }
.langs { display: flex; gap: 4px; flex-wrap: wrap; }
.langs a, .langs span { padding: 4px 10px; border-radius: 999px; font-size: 0.9rem; text-decoration: none; }
.langs a { color: var(--muted); }
.langs a:hover { color: var(--ink); background: var(--bg); }
.langs span { background: var(--bg); color: var(--ink); font-weight: 600; }

/* Hero */
.hero { padding: 40px 0 20px; }
.hero h1 { font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.6rem); }
.lede { font-size: 1.1rem; color: var(--muted); margin: 12px 0 16px; max-width: 46em; }
.jump { display: flex; gap: 16px; flex-wrap: wrap; margin: 0; font-weight: 600; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 0 0 20px;
}
.card > h2 { font-size: 1.35rem; }
.card > .muted { margin: 8px 0 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 1.35rem; }
@media (max-width: 600px) { .card { padding: 18px 16px; } }

/* Buttons */
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
.btn-primary, .btn-secondary {
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: transparent; color: var(--accent); border-color: var(--line); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Status */
.status { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 8px 0; }
.spinner {
  width: 16px; height: 16px; flex: none;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Verdict pills */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.6;
}
.pill-ok { color: var(--ok); background: var(--ok-bg); }
.pill-warn { color: var(--warn); background: var(--warn-bg); }
.pill-bad { color: var(--bad); background: var(--bad-bg); }
.pill-na { color: var(--na); background: var(--na-bg); }

/* Self-check */
.summary { border-radius: 12px; padding: 14px 16px; margin: 4px 0 16px; border-left: 4px solid var(--na); background: var(--na-bg); }
.summary.level-ok { border-color: var(--ok); background: var(--ok-bg); }
.summary.level-warn { border-color: var(--warn); background: var(--warn-bg); }
.summary.level-bad { border-color: var(--bad); background: var(--bad-bg); }
.summary p { margin: 0; }
.summary-head { font-weight: 700; font-size: 1.05rem; }
.summary-who { margin-top: 4px !important; color: var(--ink); }

.checks { list-style: none; margin: 0; padding: 0; }
.check { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.check .pill { justify-self: start; align-self: start; margin-top: 2px; }
.check h3 { font-size: 1rem; }
.check p { margin: 2px 0 0; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 520px) { .check { grid-template-columns: 1fr; gap: 6px; } }

.raw { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.raw summary { cursor: pointer; font-weight: 600; color: var(--accent); }

/* Fact lists */
.facts { margin: 8px 0 0; }
.fact { display: grid; grid-template-columns: 12em 1fr; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.fact:first-child { border-top: 0; }
.fact dt { color: var(--muted); }
.fact dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .fact { grid-template-columns: 1fr; gap: 2px; } }

/* Lookup */
.lookup-form { display: flex; gap: 8px; }
.lookup-form input {
  flex: 1; min-width: 0;
  font: inherit; font-family: var(--mono);
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
}
.lookup-form input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.hint { margin: 8px 0 0; font-size: 0.92rem; }

.history { margin: 16px 0 0; }
.history-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.history-title { font-weight: 600; font-size: 0.92rem; }
.history-list { list-style: none; margin: 8px 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--ink);
  padding: 3px 10px; font-family: var(--mono); font-size: 0.85rem;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--na); }
.chip.level-ok .dot { background: var(--ok); }
.chip.level-warn .dot { background: var(--warn); }
.chip.level-bad .dot { background: var(--bad); }

.result { margin-top: 20px; }
.result-head { border-radius: 12px; padding: 16px; border-left: 4px solid var(--na); background: var(--na-bg); }
.result-head.level-ok { border-color: var(--ok); background: var(--ok-bg); }
.result-head.level-warn { border-color: var(--warn); background: var(--warn-bg); }
.result-head.level-bad { border-color: var(--bad); background: var(--bad-bg); }
.result-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.result-ip { font-size: 1.25rem; font-weight: 700; }
.result-meta { margin: 6px 0 0; }
.result-rep { margin: 2px 0 0; color: var(--muted); }
.result-section { margin-top: 22px; }
.result-section h3 { font-size: 1.05rem; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
.rep { width: 100%; border-collapse: collapse; }
.rep th, .rep td { text-align: left; vertical-align: top; padding: 8px 8px 8px 0; border-top: 1px solid var(--line); }
.rep tr:first-child th, .rep tr:first-child td { border-top: 0; }
.rep th { font-weight: 600; width: 55%; }
.rep th small { display: block; font-weight: 400; color: var(--muted); }
.rep-detail { display: block; color: var(--muted); font-size: 0.88rem; margin-top: 2px; overflow-wrap: anywhere; }

.elsewhere { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }

/* About */
.prose h3 { font-size: 1.05rem; margin-top: 20px; }
.prose p { margin: 8px 0; }
.sources { padding-left: 1.2em; margin: 8px 0; }
.sources li { margin: 3px 0; }

.foot { color: var(--muted); font-size: 0.9rem; padding: 8px 0 40px; }
