:root {
  color-scheme: dark;
  --bg: #0f1216;
  --bg-glow: #18222e;
  --surface: #141920;
  --panel: #161b22;
  --panel-2: #1c232c;
  --line: #2a333f;
  --line-strong: #3a4654;
  --text: #e6edf3;
  --muted: #a4b0bd;
  --dim: #8b98a5;
  --accent: #2f81f7;
  --accent-soft: rgba(47, 129, 247, .13);
  --action: #1f6feb;
  --action-hover: #1a65d6;
  --action-active: #1557b0;
  --ok: #3fb950;
  --ok-soft: rgba(63, 185, 80, .12);
  --warn: #d29922;
  --warn-soft: rgba(210, 153, 34, .12);
  --warn-border: rgba(210, 153, 34, .3);
  --danger: #ff7b72;
  --danger-soft: rgba(255, 123, 114, .12);
  --danger-border: rgba(255, 123, 114, .35);
  --notice-danger-border: rgba(255, 123, 114, .3);
  --focus-ring: rgba(47, 129, 247, .15);
  --radius: 12px;
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --mono: Consolas, "SFMono-Regular", "Courier New", monospace;
  --field-hover-line: #536273;
  --field-focus-bg: #181f28;
  --accent-text: #8fc2ff;
  --skeleton-bg: #27313c;
  --badge-bg: #252e38;
  --ok-text: #75d17c;
  --warn-text: #e7ba62;
  --danger-text: #ffaaa4;
  --danger-strong-text: #ffb0aa;
  --table-head: #1b222b;
  --table-hover: #1b222b;
  --row-line: #252e38;
  --notice-bg: #1a2028;
  --scroll-thumb: #3b4654;
  --scroll-thumb-hover: #516071;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fa;
  --bg-glow: #e8f1fc;
  --surface: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: #dce4ed;
  --line-strong: #c4d0dc;
  --text: #17212b;
  --muted: #526273;
  --dim: #637487;
  --accent: #0969da;
  --accent-soft: rgba(9, 105, 218, .09);
  --action: #0969da;
  --action-hover: #0757b8;
  --action-active: #064a9c;
  --ok: #1a7f37;
  --ok-soft: rgba(26, 127, 55, .09);
  --warn: #9a6700;
  --warn-soft: rgba(154, 103, 0, .09);
  --warn-border: rgba(154, 103, 0, .24);
  --danger: #cf222e;
  --danger-soft: rgba(207, 34, 46, .08);
  --danger-border: rgba(207, 34, 46, .24);
  --notice-danger-border: rgba(207, 34, 46, .22);
  --focus-ring: rgba(9, 105, 218, .12);
  --field-hover-line: #94a6b8;
  --field-focus-bg: #ffffff;
  --accent-text: #0757b8;
  --skeleton-bg: #e5ebf2;
  --badge-bg: #edf2f7;
  --ok-text: #1a7f37;
  --warn-text: #946200;
  --danger-text: #cf222e;
  --danger-strong-text: #a40e26;
  --table-head: #f5f8fb;
  --table-hover: #f8fafc;
  --row-line: #e7ecf2;
  --notice-bg: #f7f9fc;
  --scroll-thumb: #c3ceda;
  --scroll-thumb-hover: #aebdcc;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  margin: 0;
  caret-color: var(--accent);
}

html { background: var(--bg); }

body {
  min-width: 320px;
  background:
    radial-gradient(1200px 600px at 20% -10%, var(--bg-glow) 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

button, input { font: inherit; }
button { color: inherit; }
h1, h2, p, dl, dd { margin: 0; }

::selection { background: var(--accent); color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; }

.topbar {
  width: min(1260px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  white-space: nowrap;
}
.back:hover { background: var(--panel-2); color: var(--text); }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}
.brand-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--action);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.brand-sub {
  padding-left: 9px;
  border-left: 1px solid var(--line);
  color: var(--dim);
  font-size: 12px;
  font-weight: 400;
}
.readonly {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  font-size: 12px;
}
.readonly i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.theme-toggle {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
}
.theme-icon-moon { display: none; }
:root[data-theme="light"] .theme-icon-sun { display: none; }
:root[data-theme="light"] .theme-icon-moon { display: block; }

main {
  width: min(1260px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.search-area { max-width: 900px; }
.search-area h1 {
  font-size: 24px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -.02em;
}
.search-area > p {
  max-width: 720px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

#searchForm {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.search-field {
  flex: 1;
  min-width: 0;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.search-field:hover { border-color: var(--field-hover-line); }
.search-field:focus-within {
  border-color: var(--accent);
  background: var(--field-focus-bg);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
}
.search-field input::placeholder { color: var(--dim); font-family: var(--font); }
kbd {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--dim);
  font: 11px var(--font);
}
.search-field:focus-within kbd { opacity: 0; }

#searchBtn,
.error-state button {
  height: 46px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--action);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
#searchBtn:hover,
.error-state button:hover { background: var(--action-hover); }
#searchBtn:active,
.error-state button:active { background: var(--action-active); }
#searchBtn:disabled { opacity: .55; cursor: default; }

.search-meta {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: var(--dim);
  font-size: 11.5px;
}
.search-meta button {
  height: 25px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 11px var(--mono);
  cursor: pointer;
}
.search-meta button:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
#history { display: inline-flex; gap: 6px; overflow: hidden; white-space: nowrap; }

.state-intro {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.intro-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px; align-items: start; }
.intro-grid h2 { font-size: 15px; font-weight: 600; }
.intro-grid p { max-width: 580px; margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.intro-grid dl { display: grid; gap: 9px; }
.intro-grid dl div { display: grid; grid-template-columns: 58px 1fr; gap: 12px; }
.intro-grid dt { color: var(--text); font-weight: 600; }
.intro-grid dd { color: var(--dim); font-size: 12.5px; }

.loading {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  margin-top: 32px;
}
.loading aside,
.loading > div {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.skeleton {
  display: block;
  height: 11px;
  margin-bottom: 13px;
  border-radius: 4px;
  background: var(--skeleton-bg);
  animation: pulse 1.5s ease-in-out infinite;
}
.skeleton.title { width: 35%; height: 20px; }
.skeleton.block { height: 86px; margin-top: 18px; }
.skeleton.rule { display: block; height: 1px; margin: 17px 0; background: var(--line); }
.w45 { width: 45%; } .w50 { width: 50%; } .w70 { width: 70%; } .w85 { width: 85%; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.error-state {
  max-width: 620px;
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--danger-soft);
}
.error-state h2 { font-size: 16px; }
.error-state p { margin-top: 7px; color: var(--danger-strong-text); line-height: 1.7; }
.error-state button { height: 36px; margin-top: 16px; }

.result {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 32px;
}
.summary {
  /* 不用 sticky：浏览器“整页/长截图”时 sticky 元素会被重复绘制，看起来像页面坏了 */
  position: static;
  top: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.summary-head { padding: 18px; border-bottom: 1px solid var(--line); }
.sn {
  color: var(--text);
  font: 12.5px/1.5 var(--mono);
  word-break: break-all;
}
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 27px;
  margin-top: 13px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}
.verdict::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.verdict.is-scrap { color: var(--danger); background: var(--danger-soft); }
.verdict.is-clear { color: var(--ok); background: var(--ok-soft); }
.verdict.is-unknown { color: var(--warn); background: var(--warn-soft); }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.badge.fail { color: var(--danger-text); background: var(--danger-soft); }
.badge.ok { color: var(--ok-text); background: var(--ok-soft); }
.badge.warn { color: var(--warn-text); background: var(--warn-soft); }

.facts { padding: 4px 18px 15px; }
.fact {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.fact:last-child { border-bottom: 0; }
.fact dt { color: var(--dim); font-size: 11.5px; }
.fact dd { min-width: 0; color: var(--text); font-size: 12.5px; overflow-wrap: anywhere; }
.fact dd.mono { font: 11.5px/1.55 var(--mono); }
.summary-foot { padding: 12px 18px 15px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11.5px; line-height: 1.7; }
.summary-foot .data-session { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(63, 185, 80, .12); color: #56d364; font-size: 11px; }
.summary-foot .data-session.warn { background: rgba(227, 179, 65, .12); color: #e3b341; }

.evidence {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  animation: enter .22s ease-out both;
}
@keyframes enter { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.evidence-section { border-bottom: 1px solid var(--line); }
.evidence-section:last-child { border-bottom: 0; }
.section-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
}
.section-head h2 { font-size: 14px; font-weight: 600; }
.section-meta { margin-left: auto; color: var(--dim); font-size: 11.5px; }
.section-body { padding: 0 18px 18px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 12.5px; }
th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--table-head);
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
td { padding: 8px 10px; border-bottom: 1px solid var(--row-line); color: var(--text); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--table-hover); }
td.mono { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
td.clip { max-width: 290px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-ok { color: var(--ok-text); }
.st-warn { color: var(--warn-text); }
.st-fail { color: var(--danger-text); }
.source-note {
  margin-top: 10px;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.65;
}

.account-record + .account-record {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.account-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.record-index {
  color: var(--dim);
  font-size: 11px;
}

.account-record-head h3 {
  margin: 3px 0 0;
  font-size: 15px;
  font-weight: 600;
}

.account-record-head p {
  margin-top: 3px;
  color: var(--dim);
  font-size: 11.5px;
}

.account-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.account-field {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.account-field:nth-child(4n) { border-right: 0; }
.account-field.wide {
  grid-column: 1 / -1;
  border-right: 0;
}
.account-fields > .account-field:last-child { border-bottom: 0; }
.account-field dt {
  color: var(--dim);
  font-size: 10.5px;
}
.account-field dd {
  margin-top: 3px;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.account-field dd.mono {
  font-family: var(--mono);
  font-size: 11.5px;
}

@media (max-width: 980px) {
  .account-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-field:nth-child(4n) { border-right: 1px solid var(--line); }
  .account-field:nth-child(2n) { border-right: 0; }
  .account-field.wide { border-right: 0; }
}

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 34px; }
.kv-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--row-line);
}
.kv-row:nth-last-child(-n+2) { border-bottom: 0; }
.kv dt { color: var(--dim); font-size: 11.5px; }
.kv dd { min-width: 0; color: var(--text); font-size: 12.5px; overflow-wrap: anywhere; }

.notice {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--notice-bg);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
.notice.warn { border-color: var(--warn-border); background: var(--warn-soft); color: var(--warn-text); }
.notice.fail { border-color: var(--notice-danger-border); background: var(--danger-soft); color: var(--danger-strong-text); }

@media (max-width: 1050px) {
  .result, .loading { grid-template-columns: 260px minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .topbar, main { width: min(100% - 28px, 760px); }
  .brand-sub { display: none; }
  .intro-grid { grid-template-columns: 1fr; gap: 22px; }
  .result, .loading { grid-template-columns: 1fr; }
  .summary { position: static; }
  .kv { grid-template-columns: 1fr; }
  .kv-row:nth-last-child(2) { border-bottom: 1px solid var(--row-line); }
}

@media (max-width: 560px) {
  .topbar { min-height: 58px; gap: 8px; }
  .back { width: 34px; padding: 0; font-size: 0; justify-content: center; }
  .readonly { font-size: 0; }
  #searchForm { flex-direction: column; }
  #searchBtn { width: 100%; }
  .search-meta { align-items: flex-start; flex-wrap: wrap; }
  #history { width: 100%; }
  .facts { grid-template-columns: 1fr; }
  .account-record-head { gap: 10px; }
}

@media (max-width: 360px) {
  .account-fields { grid-template-columns: 1fr; }
  .account-field,
  .account-field:nth-child(2n),
  .account-field:nth-child(4n) { border-right: 0; }
}

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