/* ============================================================
 * style.css · Shadow AI Monitor
 * 纯本地样式，无 @import / 无外链字体 / 无外部资源
 * 断点：≥900px 双栏微调，≤600px 移动优先；375px 无横向滚动
 * ============================================================ */

:root {
  color-scheme: light dark;
  --bg: #f6f8fb;
  --bg-alt: #eef2f7;
  --card: #ffffff;
  --ink: #10202e;
  --muted: #47596b;
  --line: #d7dee8;
  --brand: #0f5d8c;
  --brand-ink: #ffffff;
  --accent: #0f766e;
  --high-bg: #fdece9;
  --high-ink: #8c1d18;
  --mid-bg: #fdf3d8;
  --mid-ink: #6a4b00;
  --low-bg: #e6f6ec;
  --low-ink: #0f5132;
  --shadow: 0 1px 2px rgba(16, 32, 46, .06), 0 8px 24px rgba(16, 32, 46, .05);
  --radius: 12px;
  --focus: #0b63d6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1319;
    --bg-alt: #111a22;
    --card: #161f29;
    --ink: #e9eff5;
    --muted: #a9b7c5;
    --line: #2a3744;
    --brand: #63b6e8;
    --brand-ink: #08121a;
    --accent: #6fd3bf;
    --high-bg: #3a1c19;
    --high-ink: #ff9f97;
    --mid-bg: #362b12;
    --mid-ink: #f2d489;
    --low-bg: #12301f;
    --low-ink: #8ce3af;
    --shadow: none;
    --focus: #8fc4ff;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 10px; overflow-wrap: anywhere; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; margin-top: 26px; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 20px; }

a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }

.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.wrap > * { min-width: 0; }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 20;
  background: var(--brand); color: var(--brand-ink);
  padding: 12px 16px; border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------------- 头部 ---------------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding-top: 10px; padding-bottom: 10px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.brand-mark { flex: 0 0 auto; border-radius: 6px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-left: auto; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 15px;
}
.site-nav a:hover { background: var(--bg-alt); }
.lang-switch { display: flex; gap: 6px; }
.lang-btn {
  min-height: 44px; min-width: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font: inherit; cursor: pointer;
}
.lang-btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }

/* ---------------- 通用块 ---------------- */
.section { padding: 34px 0; }
.section.alt { background: var(--bg-alt); }
.hero { padding: 40px 0 30px; }
.hero h1 { font-size: 32px; max-width: 22ch; }
.lead { color: var(--muted); max-width: 68ch; }
.note { color: var(--muted); font-size: 14px; max-width: 74ch; }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; }
.status { min-height: 22px; font-size: 14px; margin: 6px 0 10px; }
.status.ok { color: var(--low-ink); }
.status.err { color: var(--high-ink); }
.noscript { padding: 14px 16px; background: var(--mid-bg); color: var(--mid-ink); }

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  overflow-wrap: anywhere; text-align: center;
}
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; }

.badges, .stats { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.badges li {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; color: var(--muted);
}
.stats li { font-size: 14px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 10px; }

/* ---------------- 工具清单库 ---------------- */
.filter-bar { margin: 16px 0 10px; }
.filter-label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--brand-ink); font-weight: 600; }
.count-line { font-size: 15px; color: var(--muted); }

.tool-list {
  max-height: 62vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px 6px 4px 2px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card);
}
.tool-card { border-bottom: 1px solid var(--line); padding: 12px 14px; }
.tool-card:last-child { border-bottom: 0; }
.tool-card[data-tier="high"] { border-left: 4px solid var(--high-ink); }
.tool-card[data-tier="medium"] { border-left: 4px solid var(--mid-ink); }
.tool-card[data-tier="low"] { border-left: 4px solid var(--low-ink); }
.tool-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-height: 44px; cursor: pointer; }
.tool-cb { width: 24px; height: 24px; flex: 0 0 auto; }
.tool-name { font-weight: 600; overflow-wrap: anywhere; }
.tier { font-size: 12px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tier-high { background: var(--high-bg); color: var(--high-ink); }
.tier-medium { background: var(--mid-bg); color: var(--mid-ink); }
.tier-low { background: var(--low-bg); color: var(--low-ink); }
.tool-line { font-size: 14px; color: var(--muted); margin: 4px 0 0; }
.tool-line strong { color: var(--ink); }

/* ---------------- 问卷 ---------------- */
#questions { margin-top: 14px; }
.q { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 12px 14px; margin: 0 0 12px; }
.q legend { font-weight: 600; padding: 0 4px; overflow-wrap: anywhere; }
.opts { display: grid; gap: 6px; margin-top: 6px; }
.opt {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  background: var(--bg);
}
.opt:hover { border-color: var(--brand); }
.opt input { width: 24px; height: 24px; flex: 0 0 auto; }
.opt-text { font-size: 15px; overflow-wrap: anywhere; }
.progress { font-size: 15px; color: var(--muted); }

/* ---------------- 结果 ---------------- */
.score-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.score-num { margin: 0; display: flex; align-items: baseline; gap: 6px; }
.score-num strong { font-size: 46px; line-height: 1; }
.score-of { color: var(--muted); font-size: 15px; }
.score-label { color: var(--muted); font-size: 14px; margin: 2px 0 12px; }
.meter { height: 10px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--accent); }
.band-critical .meter-fill { background: #b3261e; }
.band-high .meter-fill { background: #c2600a; }
.band-moderate .meter-fill { background: #b08800; }
.band-low .meter-fill { background: #14804a; }
.band-name { font-weight: 700; margin: 12px 0 4px; }
.band-desc { color: var(--muted); max-width: 72ch; }
.score-parts { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; margin: 0; }
.gaps { margin-top: 18px; }
.gap-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.gap { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--high-ink); border-radius: var(--radius); padding: 12px 14px; }
.gap-q { display: block; margin-bottom: 4px; }
.gap-fix { display: block; color: var(--muted); }
.gap-impact { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--muted); }

/* ---------------- 政策 / 登记表 ---------------- */
.firm-row { margin: 6px 0 14px; }
.firm-row label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.firm-row input {
  width: 100%; max-width: 380px; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit;
}
.policy-text, .policy-pre {
  width: 100%; max-width: 100%; font: 13px/1.6 ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink);
  padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.policy-text { min-height: 320px; resize: vertical; }
.policy-pre { display: none; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
#register-table { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 14px; }
#register-table th, #register-table td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
#register-table th { background: var(--bg-alt); font-size: 13px; }
.example-row td { color: var(--muted); font-style: italic; }

/* ---------------- 应急卡 / 来源 ---------------- */
.incident-list { display: grid; gap: 8px; }
.incident-list li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.src-list li { margin-bottom: 8px; color: var(--muted); }

/* ---------------- 页脚 ---------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 24px 0 34px; font-size: 14px; color: var(--muted); }
.foot-strong { font-weight: 600; color: var(--ink); }

/* ---------------- 无障碍 / 打印 ---------------- */
@media (max-width: 640px) {
  .site-nav { margin-left: 0; width: 100%; overflow-x: auto; }
  .hero h1 { font-size: 26px; }
  h1 { font-size: 25px; }
  h2 { font-size: 20px; }
  .tool-list { max-height: 58vh; }
}

@media print {
  :root { --bg: #fff; --card: #fff; --ink: #000; --muted: #333; --line: #999; }
  body { background: #fff; color: #000; }
  .site-header, .hero, #tools, #check, #result, #sources, .site-footer,
  .actions, .status, .note, #intent-slot, #bac-intent, .lang-switch { display: none !important; }
  #policy { display: block !important; padding: 0; }
  #policy h2, #policy .lead, #policy .firm-row, .table-scroll { display: none !important; }
  .policy-text { display: none !important; }
  .policy-pre { display: block !important; border: 0; padding: 0; font-size: 11pt; }
  #incident { display: block !important; background: #fff; padding: 0; page-break-before: always; }
  #incident .lead { display: block !important; }
  .incident-list li { border: 0; border-bottom: 1px solid #999; border-radius: 0; padding: 6px 0; }
  a[href]::after { content: ""; }
}
