/* 引用核验 · 原型样式
   视觉：Apple 式简约（大留白、灰白底、主色只用于操作）
   状态色：只用于图标和浅底色，文字始终用正文色；每个状态同时有图标 + 文字 */

:root {
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --focus: rgba(0, 113, 227, 0.32);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --toast-bg: rgba(29, 29, 31, 0.92);
  --toast-ink: #ffffff;

  /* 状态色：经 dataviz 校验脚本从 256 组候选中筛选（浅色 CVD ΔE 6.3 / 正常 18.2），
     6–8 区间须配合图标 + 文字，不得单独用颜色表达状态 */
  --s-verified: #0A7F5A;
  --s-mismatch: #A15C00;
  --s-fabricated: #BF3989;
  --s-retracted: #6639BA;
  --s-unverifiable: #6e6e73;

  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-2: #2c2c2e; /* 卡片内的引用框、按钮须与卡片底色区分 */
    --card: #1c1c1e;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #86868b;
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.16);
    --accent: #2997ff;
    --accent-hover: #47a6ff;
    --focus: rgba(41, 151, 255, 0.4);
    --nav-bg: rgba(22, 22, 23, 0.8);
    --toast-bg: rgba(245, 245, 247, 0.94);
    --toast-ink: #1d1d1f;

    --s-verified: #2F9E6B;
    --s-mismatch: #B7791F;
    --s-fabricated: #DB61A2;
    --s-retracted: #8B7CF6;
    --s-unverifiable: #98989d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.47 var(--font);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

a { color: var(--accent); }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1120px; height: 48px; margin: 0 auto; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.tag {
  margin-left: 8px; padding: 1px 7px; border-radius: 980px;
  font-size: 11px; font-weight: 500; color: var(--ink-2); background: var(--bg-2); vertical-align: 2px;
}
.nav-links { display: flex; gap: 24px; }
.nav-links a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }

/* ---------- 版式 ---------- */
main { padding-bottom: 96px; }
.view { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.eyebrow { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.fineprint { margin: 32px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ---------- 按钮 ---------- */
button { font: inherit; }
.btn-primary, .btn-secondary, .btn-text {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.2s, opacity 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; border-radius: 980px; padding: 10px 22px; font-size: 15px; font-weight: 500; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-2); color: var(--ink); border-radius: 980px; padding: 8px 16px; font-size: 14px; }
.btn-secondary:hover { background: var(--line-2); }
.btn-text { background: none; color: var(--accent); padding: 8px 10px; border-radius: 8px; font-size: 15px; }
.btn-text:hover { background: var(--bg-2); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: var(--bg-2); color: var(--ink-2); cursor: pointer;
}

.icon {
  width: 14px; height: 14px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 96px 0 8px; }
.hero h1 {
  margin: 12px 0 0; font-size: clamp(40px, 6.4vw, 72px); line-height: 1.07;
  font-weight: 700; letter-spacing: -0.02em; text-wrap: balance;
}
.lead { max-width: 640px; margin: 20px auto 0; font-size: clamp(19px, 2.2vw, 24px); line-height: 1.4; color: var(--ink-2); text-wrap: balance; }

.composer {
  max-width: 760px; margin: 48px auto 0; padding: 6px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}
.composer textarea {
  display: block; width: 100%; min-height: 168px; resize: vertical;
  padding: 16px 16px 8px; border: 0; outline: none; background: transparent;
  color: var(--ink); font: 16px/1.6 var(--font);
}
.composer textarea::placeholder { color: var(--ink-3); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 8px; }
.composer-left { display: flex; gap: 2px; flex-wrap: wrap; }

.features {
  list-style: none; padding: 0; margin: 80px auto 0; max-width: 1000px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px;
}
.features li { padding: 28px; background: var(--bg-2); border-radius: var(--radius-lg); }
.features h3 { margin: 0 0 8px; font-size: 19px; font-weight: 600; }
.features p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }

/* ---------- 结果页 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 48px 0 20px; }
.page-head h2 { margin: 4px 0 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; font-weight: 700; letter-spacing: -0.015em; }
.page-actions { display: flex; gap: 10px; }

.steps { list-style: none; padding: 0; margin: 8px 0 0; display: flex; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); }
.steps li:last-child { flex: none; }
.steps li:not(:last-child)::after { content: ""; flex: 1; height: 2px; margin: 0 12px; background: var(--line-2); border-radius: 2px; }
.steps li.done:not(:last-child)::after { background: var(--accent); }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); flex: none; }
.steps li.done, .steps li.current { color: var(--ink); }
.steps li.done .step-dot { background: var(--accent); }
.steps li.current .step-dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--focus); } }
.step-detail { min-height: 22px; margin: 12px 0 24px; font-size: 15px; color: var(--ink-2); }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; text-align: left;
  background: var(--bg-2); color: var(--ink); border: 1px solid transparent; border-radius: var(--radius-md);
  cursor: pointer; transition: border-color 0.2s, background-color 0.2s;
}
.kpi:hover { border-color: var(--line-2); }
.kpi.active { background: var(--card); border-color: var(--ink); }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.kpi-icon { display: inline-flex; color: var(--s); }
.kpi-value { font-size: 28px; font-weight: 600; line-height: 1; }

.result-body { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; align-items: start; }

.ref-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ref-btn {
  width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px;
  text-align: left; color: inherit; background: var(--card); cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--radius-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ref-btn:hover { border-color: var(--ink-3); }
.ref.selected .ref-btn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.ref-top { display: flex; align-items: center; gap: 10px; }
.ref-num { min-width: 16px; font-size: 13px; color: var(--ink-3); }
.ref-raw { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.ref-summary { font-size: 14px; color: var(--ink-2); }
.ref.skeleton {
  height: 104px; border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--line) 50%, var(--bg-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
.ref.skeleton span { display: none; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { padding: 40px; text-align: center; color: var(--ink-2); background: var(--bg-2); border-radius: var(--radius-md); }

/* 状态徽标：文字用正文色，颜色只给图标和浅底 */
.s-verified { --s: var(--s-verified); }
.s-mismatch { --s: var(--s-mismatch); }
.s-fabricated { --s: var(--s-fabricated); }
.s-retracted { --s: var(--s-retracted); }
.s-unverifiable { --s: var(--s-unverifiable); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 7px;
  border-radius: 980px; font-size: 13px; font-weight: 600; color: var(--ink);
  background: color-mix(in srgb, var(--s) 13%, transparent); white-space: nowrap;
}
.badge .icon { color: var(--s); stroke-width: 2.2; }
.chip { display: inline-block; white-space: nowrap; padding: 2px 9px; border-radius: 980px; font-size: 12px; color: var(--ink-2); background: var(--bg-2); }
.chip-done { color: var(--ink); background: color-mix(in srgb, var(--s-verified) 14%, transparent); }

/* ---------- 证据面板 ---------- */
.evidence {
  position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow: auto;
  padding: 20px 22px; background: var(--card);
  border: 1px solid var(--line-2); border-radius: var(--radius-lg);
}
.ev-empty { padding: 56px 12px; text-align: center; }
.ev-empty p { margin: 0 0 4px; }
.ev-empty p:first-child { font-size: 17px; font-weight: 500; }
.ev-head { display: flex; align-items: center; gap: 10px; }
.ev-id { font-size: 13px; color: var(--ink-3); }
.sheet-close { display: none; margin-left: auto; }
.ev-summary { margin: 14px 0 0; font-size: 17px; font-weight: 500; line-height: 1.45; }
.evidence h4 { margin: 22px 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ev-raw { margin: 0; padding: 12px 14px; background: var(--bg-2); border-radius: var(--radius-sm); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.ev-corrected {
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.ev-corrected p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.ev-note { padding: 12px 14px; background: var(--bg-2); border-radius: var(--radius-sm); }
.ev-note p { margin: 0 0 6px; font-size: 14px; line-height: 1.6; }
.link { font-size: 14px; }

.table-scroll { overflow-x: auto; }
.diff { width: 100%; border-collapse: collapse; font-size: 13px; }
.diff th, .diff td { padding: 8px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.diff thead th { font-weight: 500; color: var(--ink-3); }
.diff tbody th { font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.diff-row { background: color-mix(in srgb, var(--s-mismatch) 9%, transparent); }
.diff-row td:last-child { font-weight: 600; }
.diff-mark { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; color: var(--ink); }
.diff-mark::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--s-mismatch); }

.alts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.alts li { padding: 12px 14px; background: var(--bg-2); border-radius: var(--radius-sm); }
.alts p { margin: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.alts .alt-why { margin-bottom: 4px; font-size: 12px; color: var(--ink-2); }
.alt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.alts .small { margin-top: 8px; }

.sources { list-style: none; padding: 0; margin: 0; }
.sources li {
  display: grid; grid-template-columns: 18px minmax(96px, auto) 48px minmax(0, 1fr); gap: 8px;
  align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.sources li:last-child { border-bottom: 0; }
.src-icon { display: inline-flex; align-self: center; color: var(--ink-3); }
.src-hit .src-icon { color: var(--s-verified); }
.src-pending .src-icon { color: var(--s-mismatch); }
.src-result { font-size: 13px; color: var(--ink-2); }
.src-note { font-size: 13px; color: var(--ink-3); }

.ev-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.evidence .fineprint { text-align: left; margin-top: 18px; }

/* ---------- 复核台 ---------- */
.table-card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius-lg); overflow: auto; }
.review-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.review-table th { padding: 12px 16px; text-align: left; font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.review-table td { padding: 14px 16px; vertical-align: top; border-bottom: 1px solid var(--line); }
.review-table th:nth-child(n+3), .review-table td:nth-child(n+3) { width: 1%; white-space: nowrap; }
.review-table tbody tr:last-child td { border-bottom: 0; }
.review-table tbody tr { cursor: pointer; transition: background-color 0.15s; }
.review-table tbody tr:hover { background: var(--bg-2); }
.review-table tbody tr.selected { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cell-id { display: block; margin-bottom: 2px; font-size: 12px; color: var(--ink-3); }
.cell-raw { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }

.review-form .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 14px; color: var(--ink-2); }
.review-form select, .review-form textarea {
  font: 15px/1.5 var(--font); color: var(--ink); background: var(--card);
  padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px;
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 50;
  padding: 10px 18px; border-radius: 980px; font-size: 14px;
  background: var(--toast-bg); color: var(--toast-ink);
  opacity: 0; transform: translate(-50%, 12px); transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.32); }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .result-body { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero { padding-top: 64px; }
  .features { grid-template-columns: 1fr; margin-top: 56px; }
  .result-body { grid-template-columns: 1fr; }
  .evidence {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 30;
    max-height: 84vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0;
    transform: translateY(100%); visibility: hidden; transition: transform 0.3s ease, visibility 0.3s;
  }
  .evidence.open { transform: none; visibility: visible; }
  .sheet-close { display: inline-flex; }
  .review-table th:nth-child(4), .review-table td:nth-child(4) { display: none; }
}

@media (max-width: 560px) {
  .view { padding: 0 16px; }
  .page-head { flex-direction: column; align-items: flex-start; padding-top: 32px; }
  .kpis { gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 22px; }
  .composer-bar { flex-wrap: wrap; }
  .composer-bar .btn-primary { width: 100%; }
  .steps li { font-size: 13px; }
  .steps li:not(:last-child)::after { margin: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
