/* 非遗数字化传承智能辅助系统 V1.0 —— 界面样式（零外部依赖，离线可用）
   布局：左侧分组导航 + 顶栏面包屑 + 内容区（页头 / 子页签 / 卡片） */
:root {
  --ink: #26221d;
  --ink-2: #6b6459;
  --ink-3: #9a9285;
  --line: #e8e2d8;
  --line-soft: #f0ebe2;
  --bg: #f5f2ec;
  --surface: #ffffff;
  --brand: #9a2a1c;
  --brand-2: #b8452f;
  --brand-soft: #f7e9e5;
  --side-bg: #241f1a;
  --side-bg-2: #2e2822;
  --side-ink: #cfc7ba;
  --side-ink-dim: #8f877a;
  --ok: #166534;
  --warn: #8a5a12;
  --warn-bg: #fdf6e7;
  --c-bg: #fdf0ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(38, 30, 20, .05), 0 4px 14px rgba(38, 30, 20, .05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.65;
}

/* ================================================================ 布局外壳 */
.shell { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
#main { flex: 1; padding: 22px 28px 36px; }

/* ------------------------------------------------ 侧边栏 */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--side-bg), #1d1915);
  color: var(--side-ink);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #4a4238 transparent;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.side-brand .logo {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-2), #7f1d1d);
  border: 1px solid rgba(255,255,255,.25);
  display: grid; place-items: center;
  font-size: 19px; font-weight: 700; color: #fff;
}
.side-brand-text h1 {
  margin: 0; font-size: 13px; font-weight: 700; color: #f3ede4;
  line-height: 1.4; letter-spacing: .3px;
}
.side-brand-text p { margin: 1px 0 0; font-size: 11px; color: var(--side-ink-dim); }
.side-brand-text em { font-style: normal; color: #e0a898; }

.nav { flex: 1; padding: 10px 10px 14px; }
.nav-group { margin-bottom: 6px; }
.nav-label {
  font-size: 11px; letter-spacing: 2px; color: var(--side-ink-dim);
  padding: 12px 10px 5px; user-select: none;
}
.nav .tab {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: transparent; border: none; cursor: pointer;
  color: var(--side-ink); font: inherit; font-size: 13px;
  padding: 8px 10px; border-radius: 8px;
  position: relative;
  transition: background .15s, color .15s;
}
.nav .tab:hover { background: rgba(255,255,255,.07); color: #f3ede4; }
.nav .tab.active {
  background: rgba(184, 69, 47, .22);
  color: #fff; font-weight: 600;
}
.nav .tab.active::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-2);
}
.nav .idx {
  font-size: 12px; color: var(--side-ink-dim); width: 16px; flex-shrink: 0;
  text-align: center;
}
.nav .tab.active .idx { color: #e0a898; }
.side-foot {
  padding: 12px 16px; font-size: 11px; color: var(--side-ink-dim);
  border-top: 1px solid rgba(255,255,255,.08);
}

/* 移动端抽屉 */
.backdrop {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 15, 10, .45);
}
body.nav-open .backdrop { display: block; }

/* ------------------------------------------------ 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 28px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; cursor: pointer; color: var(--ink-2);
}
.crumb { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.crumb::before { content: "当前位置："; font-weight: 400; color: var(--ink-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.status {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  background: #eef4ea; border: 1px solid #cfe0c6; color: var(--ok);
  white-space: nowrap;
}
.status.bad { background: #fdecea; color: #991b1b; border-color: #f5b8b1; }

.userbar {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  background: var(--brand-soft); border: 1px solid #ecd2ca;
  white-space: nowrap;
}
.userbar .hint { color: #7a4a3c; }
.userbar button {
  background: #fff; color: var(--brand); border: 1px solid #e3c2b8;
  border-radius: 999px; padding: 3px 12px; font-size: 12px; cursor: pointer;
}
.userbar button:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ================================================================ 内容区 */
.view { display: none; }
.view.active { display: block; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 页头 */
.page-head { margin: 2px 0 16px; }
.ph-group {
  display: inline-block; font-size: 11px; letter-spacing: 2px;
  color: var(--brand-2); background: var(--brand-soft);
  border-radius: 999px; padding: 2px 10px; margin-bottom: 8px;
}
.page-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.ph-sub { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }

/* 子页签 */
.subnav {
  display: inline-flex; flex-wrap: wrap; gap: 4px;
  background: #ece7dd; border-radius: 10px; padding: 4px;
  margin-bottom: 16px;
}
.subnav-item {
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--ink-2);
  padding: 6px 16px; border-radius: 7px;
  transition: background .15s, color .15s;
}
.subnav-item:hover { color: var(--ink); }
.subnav-item.active {
  background: var(--surface); color: var(--brand); font-weight: 700;
  box-shadow: 0 1px 3px rgba(38, 30, 20, .12);
}

/* 面板（子页签内容） */
.panel { display: none; }
.panel.active { display: block; }

/* 卡片 */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 16px; color: var(--brand); }
.card h3 {
  margin: 18px 0 8px; font-size: 14px; color: var(--ink);
  padding-left: 9px; border-left: 3px solid var(--brand-2); line-height: 1.35;
}
.card h3:first-child { margin-top: 0; }
.view h4 { margin: 14px 0 6px; font-size: 13px; color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat {
  border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 12px 14px; background: linear-gradient(180deg, #fffefc, #faf7f1);
}
.stat b { display: block; font-size: 21px; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-2); }

.notice {
  background: var(--warn-bg); border: 1px solid #eddfba; border-left: 3px solid #d9a93f;
  color: var(--warn); padding: 8px 12px; border-radius: 8px;
  margin-bottom: 12px; font-size: 13px;
}
.notice.c { background: var(--c-bg); border-color: #f3d2cb; border-left-color: #c94f3d; color: #991b1b; }
.hint { color: var(--ink-2); font-size: 12px; margin: 6px 0 10px; }
.rules { margin: 0; padding-left: 18px; }
.rules li { margin: 3px 0; }

/* 表单 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.filters.column { flex-direction: column; align-items: stretch; max-width: 460px; }
.filters input, .filters select, .filters textarea, .filters button {
  font: inherit; padding: 7px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
.filters input:focus, .filters select:focus, .filters textarea:focus {
  outline: 2px solid rgba(184, 69, 47, .25); border-color: var(--brand-2);
}
.filters input, .filters select { min-width: 150px; }
.filters button, .row-actions button {
  background: var(--brand); color: #fff; border: none; cursor: pointer; font-weight: 700;
  transition: background .15s;
}
.filters button:hover, .row-actions button:hover { background: var(--brand-2); }
.row-actions { margin-top: 12px; }
.row-actions button { padding: 8px 16px; border-radius: 8px; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line-soft); padding: 8px 10px; text-align: left; vertical-align: top; }
.tbl th {
  background: #f8f5ef; color: var(--ink-2); font-weight: 700;
  white-space: nowrap; border-bottom: 1px solid var(--line);
}
.tbl tbody tr:hover td { background: #fbf8f2; }
.tbl a { color: #1d4ed8; word-break: break-all; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--line); background: #f3f0ea; color: var(--ink-2);
}
.tag.A { background: #e5f5e9; border-color: #a8dfb8; color: var(--ok); }
.tag.B { background: #e4edfb; border-color: #aecbf2; color: #1e40af; }
.tag.C { background: #fdecea; border-color: #f5b8b1; color: #991b1b; }
.tag.warn { background: var(--warn-bg); border-color: #eddfba; color: var(--warn); }

.mono {
  font-family: Consolas, "Courier New", monospace; font-size: 12px;
  background: #221d17; color: #e8e2d6; padding: 14px; border-radius: 10px;
  overflow: auto; max-height: 340px; white-space: pre-wrap; word-break: break-all;
}
.pager { margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.empty { color: var(--ink-3); padding: 12px 0; }

/* 研究态势（OpenAlex 文献浏览） */
.concept-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.concept-chip {
  border: 1px solid var(--line); background: #fbf8f2; color: var(--ink);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; line-height: 1.4;
  transition: background .15s, border-color .15s;
}
.concept-chip:hover { background: #efe9df; border-color: var(--brand-2); }
.concept-chip em { font-style: normal; color: var(--ink-2); font-size: 11px; margin-left: 4px; }
.pager-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.pager-row .pager { margin: 0; }
.pager-row .btn-mini:disabled { opacity: .45; cursor: not-allowed; }
#litTrend svg { max-width: 100%; height: auto; }
#litTrend h3 { margin: 14px 0 6px; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 推荐结果 */
.rec-out {
  border: 1px solid var(--line); border-left: 4px solid var(--brand-2);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #fffdfc;
}
.rec-out h4 { margin: 0 0 8px; font-size: 14px; }
.ai-note {
  background: #eef4fb; border: 1px solid #c9dcf2; color: #1e3a8a;
  padding: 8px 12px; border-radius: 8px; margin: 8px 0; font-size: 13px;
}
.ai-text { white-space: pre-wrap; margin: 8px 0; }
.case-ref { border: 1px dashed var(--line); border-radius: 8px; padding: 9px 11px; margin: 7px 0; }
.case-ref .t { font-weight: 700; }
.case-ref .src { font-size: 12px; color: var(--ink-2); word-break: break-all; }
.review-box { margin-top: 10px; }
.review-box textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.review-box button {
  margin-top: 8px; padding: 8px 16px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-weight: 700; cursor: pointer;
}

/* 标签云与聚类卡片 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); background: #f8f5ef; color: var(--ink-2);
}
.case-card {
  border: 1px solid var(--line); border-left: 3px solid var(--brand-2);
  border-radius: 8px; padding: 10px 12px; margin-top: 10px; background: #fcfaf6;
}
.case-card h4 { margin: 0 0 6px; font-size: 13px; color: var(--brand); }
.case-card .hint { margin-top: 4px; }

/* 知识图谱：图例、节点胶囊、力导向画布 */
.kg-legend-bar {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px;
  font-size: 12px; color: var(--ink-2);
}
.kg-legend { display: inline-flex; align-items: center; gap: 5px; }
.kg-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.kg-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 4px 11px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); background: #f8f5ef; color: var(--ink-2);
  transition: background .15s, border-color .15s;
}
.kg-chip:hover { background: #efe9de; border-color: var(--brand-2); color: var(--ink); }
.kg-chip i { font-style: normal; font-size: 11px; color: var(--ink-3); }
#kgCanvas svg, #snaCanvas svg { border: 1px solid var(--line); border-radius: 10px; background: #fdfcf9; }
.kg-node circle { transition: opacity .15s; }
.kg-node:hover circle { opacity: 1; stroke: #111827; stroke-width: 1.5; }

.tbl-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* AHP 赋权 */
.ahp-pair {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
}
.ahp-pair-q { min-width: 240px; font-size: 13px; }
.ahp-cur { margin-left: 8px; color: var(--brand); font-weight: 600; }
.ahp-scale { display: flex; gap: 4px; flex-wrap: wrap; }
.ahp-btn {
  min-width: 38px; padding: 4px 7px; font-size: 12px; line-height: 1.4;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  color: var(--ink); cursor: pointer;
}
.ahp-btn:hover { border-color: var(--brand); color: var(--brand); }
.ahp-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.ahp-barwrap { position: relative; display: block; min-width: 120px; }
.ahp-bar { display: inline-block; height: 14px; border-radius: 3px; vertical-align: middle; min-width: 2px; }
.ahp-barwrap span { margin-left: 6px; font-size: 12px; color: var(--ink-2); }

/* 页脚 */
.footer {
  padding: 14px 28px; border-top: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 12px; text-align: center;
}
.footer .sep { margin: 0 6px; color: #d5cec2; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 99;
  background: #26221d; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.toast.show { opacity: .96; }

/* ================================================================ 响应式 */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,.3);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-toggle { display: inline-flex; align-items: center; }
  .topbar { padding: 10px 16px; }
  #main { padding: 16px 16px 28px; }
}

@media (max-width: 720px) {
  .crumb { display: none; }
  .topbar .status { display: none; }
  .card { padding: 14px; }
  .card h2 { font-size: 15px; }
  .card h3 { font-size: 13px; }
  .page-head h2 { font-size: 18px; }
  .ph-sub { font-size: 12px; }
  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl th, .tbl td { padding: 6px 8px; font-size: 12px; }
  .filters input, .filters select { min-width: 120px; flex: 1 1 130px; }
  .filters button { flex: 1 1 100%; }
  .mono { max-height: 220px; font-size: 11px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .stat b { font-size: 17px; }
  .subnav { width: 100%; }
  .subnav-item { flex: 1 1 auto; padding: 6px 10px; }
  .ahp-pair-q { min-width: 100%; }
  .ahp-btn { min-width: 34px; padding: 4px 5px; }
}

/* 图表导出工具条（零依赖，纯前端下载 SVG / PNG） */
.export-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 2px; padding: 6px 10px;
  background: var(--bg-soft, #f6f5f1); border: 1px solid var(--line-soft, #e6e2da);
  border-radius: 8px;
}
.btn-mini {
  display: inline-block; padding: 4px 10px; font-size: 12px; line-height: 1.4;
  color: #2b2620; background: #fff; border: 1px solid var(--line-soft, #e6e2da);
  border-radius: 6px; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-mini:hover { background: #f0ede7; border-color: #cbb; }
.btn-mini:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

/* 数据报告页（成果输出） */
.report-head { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid var(--line-soft, #e6e2da); }
.report-head h1 { font-size: 22px; margin: 0 0 6px; }
.report-meta { color: #6b6459; font-size: 13px; margin: 4px 0; }
.report-sec { margin: 22px 0; }
.report-sec h2 { font-size: 17px; border-left: 4px solid #9a2a1c; padding-left: 10px; margin: 0 0 10px; }
.report-sec h3 { font-size: 14px; color: #4b5563; margin: 14px 0 6px; }
.report-list { margin: 6px 0; padding-left: 20px; line-height: 1.8; }
.report-note { line-height: 1.9; color: #2b2620; }
.report-actions { margin: 24px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-primary { padding: 8px 16px; font-size: 14px; color: #fff; background: #9a2a1c; border: none; border-radius: 8px; cursor: pointer; }
.btn-primary:hover { background: #7d2117; }

/* 打印：截图与软著材料用 */
@media print {
  .sidebar, .topbar, .subnav, .filters, .footer, .toast, .export-bar { display: none !important; }
  .no-print { display: none !important; }
  .shell { display: block; }
  .view { display: none !important; }
  .view.active { display: block !important; }
  .panel { display: block !important; }
  .card { break-inside: avoid; border: 1px solid #ddd; box-shadow: none; }
  .report-sec { break-inside: avoid; }
}

/* ✦ 数字叙事页（scrolly-telling，零依赖） */
#view-story { background: #1f1b16; color: #f3ede4; margin: -22px -28px -36px; }
#view-story .story-rail {
  position: fixed; right: 22px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 11px; z-index: 40;
}
#view-story .rail-dot {
  width: 9px; height: 9px; border-radius: 50%; padding: 0; border: 1px solid rgba(243,237,228,.45);
  background: transparent; cursor: pointer; transition: all .25s;
}
#view-story .rail-dot.on { background: #e0a898; border-color: #e0a898; transform: scale(1.35); }
#view-story .scene {
  min-height: 84vh; display: flex; flex-direction: column; justify-content: center;
  padding: 6vh 9%; box-sizing: border-box; opacity: 1;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
#view-story .scene.in { animation: sceneRise .65s ease; }
@keyframes sceneRise { from { transform: translateY(18px) } to { transform: none } }
#view-story .story-hero { align-items: flex-start; text-align: left; }
#view-story .hero-kicker { font-size: 13px; letter-spacing: 3px; color: #e0a898; margin-bottom: 18px; }
#view-story .hero-title { font-size: clamp(30px, 5vw, 56px); line-height: 1.18; font-weight: 700; margin: 0; color: #fbf6ef; }
#view-story .hero-sub { font-size: 16px; color: #c9bfb2; margin-top: 18px; }
#view-story .scroll-cue { margin-top: 46px; font-size: 13px; color: #9a8f80; display: flex; align-items: center; gap: 10px; }
#view-story .scroll-cue i { width: 1px; height: 26px; background: #e0a898; animation: cue 1.6s infinite; transform-origin: top; }
@keyframes cue { 0%,100% { transform: scaleY(.3); opacity: .4 } 50% { transform: scaleY(1); opacity: 1 } }
#view-story .scene-num { font-size: 14px; letter-spacing: 2px; color: #e0a898; margin-bottom: 10px; }
#view-story .scene-h { font-size: clamp(22px, 3vw, 34px); margin: 0 0 22px; color: #fbf6ef; font-weight: 600; }
#view-story .stat-row { display: flex; flex-wrap: wrap; gap: 40px; margin-bottom: 22px; }
#view-story .bigstat { display: flex; flex-direction: column; }
#view-story .bigstat .cu { font-size: clamp(34px, 5vw, 58px); font-weight: 700; color: #f0b9a3; line-height: 1; font-variant-numeric: tabular-nums; }
#view-story .bigstat label { font-size: 13px; color: #b6ab9c; margin-top: 8px; max-width: 180px; }
#view-story .layer-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
#view-story .layer { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); border-radius: 12px; padding: 16px 18px; min-width: 160px; }
#view-story .layer b { display: block; font-size: 22px; color: #e0a898; }
#view-story .layer span { font-size: 15px; color: #f3ede4; }
#view-story .layer em { display: block; font-size: 12px; color: #9a8f80; margin-top: 6px; font-style: normal; }
#view-story .feat-list { list-style: none; padding: 0; margin: 0 0 18px; max-width: 720px; }
#view-story .feat-list li { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.07); font-size: 16px; color: #ddd3c6; }
#view-story .feat-list b { color: #f0b9a3; }
#view-story .scene-text { font-size: 16px; line-height: 1.8; color: #c9bfb2; max-width: 760px; margin: 0; }
#view-story .scene-text.lg { font-size: 19px; }
#view-story .scene-text b { color: #f3ede4; }
#view-story .story-end { align-items: flex-start; }
#view-story .story-enter { margin-top: 26px; background: #e0a898; color: #2a1c14; border: none; border-radius: 999px; padding: 13px 28px; font-size: 15px; font-weight: 600; cursor: pointer; }
#view-story .story-enter:hover { background: #efc1ad; }
#view-story .scene-foot { font-size: 12px; color: #8a7f70; margin-top: 30px; }
@media (max-width: 1024px) {
  #view-story { margin: -16px -16px -28px; }
}
@media (max-width: 720px) {
  #view-story .story-rail { display: none; }
  #view-story .scene { padding: 5vh 6%; min-height: 76vh; }
  #view-story .hero-title { font-size: clamp(24px, 7.5vw, 32px); }
  #view-story .bigstat .cu { font-size: clamp(28px, 8.5vw, 40px); }
  #view-story .stat-row { gap: 22px; }
}

/* ============================================================ ⑲ 知识图谱增强 */
.kg-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 10px 0 12px; padding: 10px 12px;
  background: var(--line-soft); border: 1px solid var(--line); border-radius: 10px;
}
.kg-toolbar .kg-ctl { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.kg-toolbar select {
  font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
.kg-zoom { display: inline-flex; gap: 4px; }
.kg-zoom button {
  width: auto; min-width: 30px; height: 30px; padding: 0 9px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2);
  font-size: 14px; line-height: 1;
}
.kg-zoom button:hover { border-color: var(--brand-2); color: var(--brand); }
.kg-legend-btn { cursor: pointer; user-select: none; padding: 2px 8px; border-radius: 999px;
  border: 1px solid transparent; transition: background .15s, border-color .15s; }
.kg-legend-btn:hover { border-color: var(--line); }
.kg-legend-btn.on { background: var(--brand-soft); border-color: #ecd2ca; color: var(--brand); font-weight: 700; }
#kgCanvas .kg-node { transition: opacity .18s ease; }

/* ============================================================ ⑫ 答案溯源 / 置信度 */
.qa-ans-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.qa-ans-head h4 { margin: 0; }
.qa-conf-summ { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.qa-answer { margin: 8px 0 4px; }
.qa-ans-line { margin: 6px 0; line-height: 1.7; color: var(--ink);
  padding: 8px 10px; background: #fff; border: 1px solid var(--line-soft);
  border-left: 3px solid var(--brand-2); border-radius: 6px; }
.cite-ref {
  display: inline-block; min-width: 22px; text-align: center;
  color: var(--brand); font-weight: 700; cursor: pointer;
  padding: 0 4px; border-radius: 5px; background: var(--brand-soft);
}
.cite-ref:hover { background: var(--brand); color: #fff; }
.qa-evs { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 6px; }
.qa-ev {
  border: 1px solid var(--line); border-left: 4px solid var(--ink-3);
  border-radius: 10px; padding: 10px 12px; background: #fff;
  scroll-margin-top: 92px;
}
.qa-ev.hi { border-left-color: #2f855a; }
.qa-ev.mid { border-left-color: #b7791f; }
.qa-ev.lo { border-left-color: #c53030; }
.qa-ev-flash { box-shadow: 0 0 0 3px var(--brand-soft); border-left-color: var(--brand); }
.qa-ev-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.qa-ref { font-family: "SFMono-Regular", Consolas, monospace; font-weight: 700; color: var(--brand); }
.qa-ev-title { color: var(--ink); }
.qa-ev-id { margin-left: auto; }
.qa-quote {
  margin: 6px 0 8px; padding: 8px 12px; background: var(--line-soft);
  border-left: 3px solid var(--line); border-radius: 4px;
  font-size: 13px; line-height: 1.65; color: var(--ink); white-space: pre-wrap;
}
.qa-conf { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-2); }
.qa-src { font-size: 12px; color: var(--brand-2); text-decoration: none; }
.qa-src:hover { text-decoration: underline; }

/* 置信度进度条 */
.conf-bar {
  position: relative; display: inline-block; width: 150px; height: 9px;
  background: var(--line-soft); border-radius: 6px; overflow: hidden; vertical-align: middle;
}
.conf-fill { display: block; height: 100%; border-radius: 6px; background: var(--ink-3); }
.conf-bar.hi .conf-fill { background: linear-gradient(90deg, #38a169, #2f855a); }
.conf-bar.mid .conf-fill { background: linear-gradient(90deg, #e0a83a, #b7791f); }
.conf-bar.lo .conf-fill { background: linear-gradient(90deg, #e05252, #c53030); }
.conf-thr { position: absolute; top: -2px; width: 2px; height: 13px; background: #111827; opacity: .7; }
@media (max-width: 720px) {
  .conf-bar { width: 110px; }
  .qa-ev-id { margin-left: 0; }
}

/* ============================================================ ①「一张图」驾驶舱 */
.cockpit-kpi {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.cock-kpi {
  background: linear-gradient(180deg, #fff, #fbfaf7);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.cock-kpi b { display: block; font-size: 26px; line-height: 1.1; color: var(--ink); font-weight: 800; }
.cock-kpi span { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.cock-kpi-p { border-left: 3px solid var(--brand-2); }
.cock-kpi-p b { color: var(--brand); }
.cockpit-grid {
  display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 14px;
}
.cockpit-cell {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.cockpit-cell h4 { margin: 0 0 10px; font-size: 13px; color: var(--ink); }
.cockpit-cell-wide { grid-column: span 1; }
.cock-geo svg { display: block; }
.cock-tile { transition: opacity .15s ease; }
.cock-tile:hover { opacity: .82; }
.cock-cat .cock-donut { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cock-legend { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 120px; }
.cock-lg { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.cock-lg i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.cock-lg b { margin-left: auto; color: var(--ink); }
.cock-feed { display: flex; flex-direction: column; }
.cock-feed-item { padding: 8px 0; border-bottom: 1px dashed var(--line-soft); }
.cock-feed-item:last-child { border-bottom: 0; }
.cock-feed-item a { color: var(--brand-2); text-decoration: none; font-size: 13px; }
.cock-feed-item a:hover { text-decoration: underline; }
.cock-feed-item .tag { margin-right: 6px; }
.cock-feed-item .hint { margin-top: 2px; }
@media (max-width: 1024px) {
  .cockpit-grid { grid-template-columns: 1fr 1fr; }
  .cockpit-cell-wide { grid-column: span 2; }
}
@media (max-width: 640px) {
  .cockpit-grid { grid-template-columns: 1fr; }
  .cockpit-cell-wide { grid-column: span 1; }
  .cock-kpi b { font-size: 22px; }
}
.cock-note { margin: -6px 0 14px; font-size: 12px; color: var(--ink-2); }

/* ================================================================
   UI 细节优化包（2026-10-24）
   ① 暗色主题（html[data-theme="dark"]，由 JS 按记忆/系统偏好设定）
   ② 微交互与无障碍（reduced-motion / focus-visible / hover / 滚动条）
   ③ 空状态与骨架屏
   ④ 回到顶部按钮
   说明：默认仍是浅色（历史截图与软著手册不受影响）；暗色仅在用户主动
   切换或系统偏好为暗时生效，所有组件色均落到 CSS 变量便于维护。
   ================================================================ */

/* ---------- ① 暗色主题 ---------- */
html[data-theme="dark"] {
  --ink: #e9e3d7; --ink-2: #b6ad9d; --ink-3: #877e70;
  --line: #3b352c; --line-soft: #2e2921;
  --bg: #16130e; --surface: #1f1b15;
  --brand: #d0563f; --brand-2: #e06b52; --brand-soft: #35221c;
  --side-bg: #100e0a; --side-bg-2: #181510;
  --side-ink: #c9c0b2; --side-ink-dim: #7d7466;
  --ok: #7fd8a2; --warn: #e2ba6e; --warn-bg: #2c2416;
  --c-bg: #33201a;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 4px 14px rgba(0,0,0,.4);
  color-scheme: dark;
}
html[data-theme="dark"] .topbar { background: rgba(31, 27, 21, .92); }
html[data-theme="dark"] .status { background: #1d2b1f; border-color: #35503a; }
html[data-theme="dark"] .status.bad { background: #3a1d18; border-color: #6e3a30; color: #f2a08e; }
html[data-theme="dark"] .userbar .hint { color: #d8a294; }
html[data-theme="dark"] .userbar button { background: #2a231d; border-color: #4a352d; }
html[data-theme="dark"] .stat { background: linear-gradient(180deg, #241f18, #1e1a14); }
html[data-theme="dark"] .notice { border-color: #4a3d22; }
html[data-theme="dark"] .notice.c { border-color: #5c352c; color: #f2a08e; }
html[data-theme="dark"] .filters input, html[data-theme="dark"] .filters select,
html[data-theme="dark"] .filters textarea { background: #26211a; }
html[data-theme="dark"] .tbl th { background: #262019; }
html[data-theme="dark"] .tbl tbody tr:hover td { background: #26211a; }
html[data-theme="dark"] .tbl a { color: #8ab4f8; }
html[data-theme="dark"] .tag { background: #2a251d; }
html[data-theme="dark"] .tag.A { background: #16291c; border-color: #2c5a3c; }
html[data-theme="dark"] .tag.B { background: #18233a; border-color: #33507e; color: #9cbcf0; }
html[data-theme="dark"] .tag.C { background: #381c16; border-color: #6e3a30; color: #f2a08e; }
html[data-theme="dark"] .tag.warn { border-color: #4a3d22; }
html[data-theme="dark"] .btn-mini:hover { background: #2c2720; border-color: #4a4238; }
html[data-theme="dark"] .rec-out { background: #221d16; }
html[data-theme="dark"] .concept-chip { background: #26211a; }
html[data-theme="dark"] .concept-chip:hover { background: #2e2820; }
html[data-theme="dark"] .subnav-item.active,
html[data-theme="dark"] .subnav-item:hover { background: #2a241c; }
html[data-theme="dark"] .kg-legend-btn.on { background: #35221c; border-color: #5c352c; }
html[data-theme="dark"] .export-bar { background: #221d16; }
html[data-theme="dark"] .btn-mini { background: #2a241d; color: var(--ink); border-color: #3b352c; }
html[data-theme="dark"] .btn-primary { background: var(--brand); }
html[data-theme="dark"] { --side-ink-dim: #948a7b; }

/* ---------- ② 微交互与无障碍 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
::selection { background: var(--brand); color: #fff; }
.card, .case-card, .stat, .rec-out, .concept-chip {
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease, background .18s ease;
}
.card:hover, .case-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 10px 26px rgba(38, 30, 20, .09);
  border-color: #d8cfc0;
}
html[data-theme="dark"] .card:hover, html[data-theme="dark"] .case-card:hover {
  box-shadow: var(--shadow), 0 10px 26px rgba(0, 0, 0, .5);
  border-color: #4a4238;
}
.stat:hover { transform: translateY(-1px); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
*::-webkit-scrollbar-track { background: transparent; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
/* 长表格滚动时表头吸附（.tbl-scroll 为既有滚动容器） */
.tbl-scroll { max-height: 62vh; overflow: auto; }
.tbl-scroll .tbl { border-collapse: separate; border-spacing: 0; }
.tbl-scroll .tbl th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }

/* ---------- ③ 空状态与骨架屏 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 26px 12px; color: var(--ink-3); text-align: center;
}
.empty::before {
  content: ""; width: 42px; height: 42px; opacity: .55; margin-bottom: 2px;
  background: currentColor; border-radius: 10px;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'><path d='M3 7l9-4 9 4v10l-9 4-9-4z'/><path d='M3 7l9 4 9-4M12 11v10'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'><path d='M3 7l9-4 9 4v10l-9 4-9-4z'/><path d='M3 7l9 4 9-4M12 11v10'/></svg>") center/contain no-repeat;
}
.skeleton {
  position: relative; overflow: hidden; border-radius: 8px;
  background: var(--line-soft); color: transparent !important;
  pointer-events: none; user-select: none; min-height: 1em;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: skeleton-sweep 1.15s ease-in-out infinite;
}
html[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
}
@keyframes skeleton-sweep { 100% { transform: translateX(100%); } }

/* ---------- ④ 回到顶部 ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 24px; z-index: 60;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  box-shadow: var(--shadow); cursor: pointer; font-size: 15px; line-height: 1;
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, color .15s, border-color .15s;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--brand); border-color: var(--brand); }
.to-top:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* 一张图 · 地理真实地图缩略容器（ECharts svg 渲染器） */
#cockGeo { height: 320px; }
#cockGeo svg { width: 100%; height: 100%; }
