:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6573;
  --line: #dfe3ea;
  --accent: #2457d6;
  --accent-text: #ffffff;
  --ok: #1b7f4b;
  --ok-bg: #e5f5ec;
  --warn: #9a6200;
  --warn-bg: #fff4dc;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --info: #2457d6;
  --info-bg: #e8eefc;
  --code-bg: #f0f2f5;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --text: #e8eaee;
    --muted: #9aa3b2;
    --line: #2c313a;
    --accent: #6d95ff;
    --accent-text: #0b0d12;
    --ok: #5fd39a;
    --ok-bg: #12291e;
    --warn: #f0b350;
    --warn-bg: #2d2412;
    --bad: #ff8a80;
    --bad-bg: #321715;
    --info: #8eaaff;
    --info-bg: #17203a;
    --code-bg: #0d0f13;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 1.5rem; margin: 8px 0 12px; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
h3 { font-size: 1rem; margin: 16px 0 6px; }
h4 { font-size: .95rem; margin: 12px 0 4px; }
a { color: var(--accent); }
code, pre, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: .85rem; margin: -4px 0 4px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.lang a { text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; }
.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--surface);
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted);
  font-weight: 500; min-height: 40px; display: inline-flex; align-items: center;
}
.tabs a.on { background: var(--info-bg); color: var(--accent); }
.foot { text-align: center; padding: 16px; color: var(--muted); font-size: .85rem; }

.hero { padding: 24px 0 8px; }
.lead { font-size: 1.05rem; color: var(--muted); }
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 16px 0; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.panel { margin: 14px 0; }
.panel h2 { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { margin: 0 0 8px; }
.card h3 { margin-top: 0; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }
.link-card { text-decoration: none; color: inherit; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 380px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-height: 44px;
}
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; min-height: 40px; }
label.check input, .opt input { width: 20px; height: 20px; min-height: 0; flex: 0 0 auto; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: .9rem; font-weight: 500; margin-bottom: 6px; }
.seg { display: flex; flex-direction: column; gap: 8px; }
.seg.compact { flex-direction: row; flex-wrap: wrap; }
.opt {
  flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); font-weight: 400; cursor: pointer;
}
.opt:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }
.opt span { display: flex; flex-direction: column; }
.opt small { color: var(--muted); }
details { border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--surface); }
details[open] { padding-bottom: 12px; }
details > summary { cursor: pointer; padding: 12px 0; font-weight: 600; min-height: 44px; }
details > label, details > p, details > div, details > fieldset { margin-top: 10px; }
.panel details { margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.big { width: 100%; min-height: 52px; font-size: 1.05rem; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn.danger, .link.danger { color: var(--bad); }
.btn.busy { opacity: .6; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 4px; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.alert { padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--info-bg); color: var(--info); }
.verdict { font-weight: 600; padding: 10px 12px; border-radius: 8px; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.verdict.info { background: var(--info-bg); color: var(--info); }

.tag {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--code-bg); color: var(--muted); vertical-align: middle;
}
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info { background: var(--info-bg); color: var(--info); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.info { background: var(--info); }

.findings { list-style: none; padding: 0; margin: 0; }
.findings li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.findings li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: minmax(90px, 35%) 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 6px 0; }
.chips li { background: var(--code-bg); border-radius: 999px; padding: 4px 10px; font-size: .85rem; }
.chips li.ok { background: var(--ok-bg); color: var(--ok); }
.plain { list-style: none; padding: 0; margin: 6px 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li > a { display: block; padding: 10px 0; text-decoration: none; color: inherit; }
.list li.split { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.list li.split > a { flex: 1; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; display: block; overflow-x: auto; }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; }
.hops { margin: 4px 0 8px; padding-left: 24px; font-size: .85rem; }
pre.code, p.code {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-all;
}
pre.code.tall { max-height: 60vh; }
.qr { width: 180px; height: 180px; background: #fff; border-radius: 8px; padding: 4px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.qr-grid figure { margin: 0; text-align: center; }
.qr-grid .qr { width: 100%; height: auto; }
.qr-grid figcaption { font-size: .8rem; overflow-wrap: anywhere; }
.probe { border-top: 1px solid var(--line); padding: 12px 0; }
.proxy { border-top: 1px solid var(--line); padding: 8px 0; }
.progress { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--info-bg); border-radius: 8px; color: var(--info); }
.spinner {
  width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }
