/**
 * 研究页样式：沿用阅读站的中文报刊编辑风格（纸张底色、红色强调、微软雅黑）。
 * 布局为双栏：左栏提问与历史，右栏结果展示；窄屏自动叠放。
 */

:root {
  --ink: #171713;
  --muted-ink: #69665e;
  --paper: #f3f0e7;
  --paper-deep: #e9e4d7;
  --card: #fbfaf5;
  --line: #c9c2b2;
  --accent: #c94328;
  --accent-dark: #8c2f1c;
  --forest: #23483e;
  --link: #065fd4;
  --link-hover: #003d99;
  --shadow: 0 18px 50px rgba(45, 39, 28, 0.1);
  --font-sans: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-sans);
}

/* 左右栏各自独立滚动的整体骨架：报头固定，主体占满余下视口。 */
.research-frame {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh; /* 双保险：任何情况下 frame 不得撑破视口 */
  overflow: hidden; /* 页面级不滚动，滚动发生在各栏内部 */
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.42;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.65), transparent 25%),
    repeating-linear-gradient(90deg, rgba(39, 34, 25, 0.018) 0 1px, transparent 1px 4px);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* —— 顶部报头（与阅览室 .masthead 完全同款样式，仅类名不同） —— */

.research-masthead {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  flex: none; /* frame 内固定占位，不参与滚动 */
  gap: 22px;
  align-items: center;
  min-height: 68px;
  padding: 10px clamp(18px, 3vw, 48px);
  color: #f7f1e4;
  background: var(--ink);
  border-bottom: 4px solid var(--accent);
  box-shadow: 0 8px 20px rgba(20, 18, 14, 0.18);
}

.research-brand {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 10px;
  align-items: end;
}

.research-brand .edition {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: #d2cab9;
  font: 700 8px/1.1 ui-monospace, monospace;
  letter-spacing: 0.18em;
}

.research-brand h1 {
  grid-column: 1;
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(24px, 2.4vw, 31px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}

.research-brand p {
  grid-column: 2;
  margin: 0 0 1px;
  padding-left: 10px;
  border-left: 1px solid #6c675f;
  color: #d9d1c1;
  font-size: 12px;
  letter-spacing: 0.14em;
}

.research-rule {
  height: 1px;
  background: linear-gradient(90deg, #767065, transparent);
}

.research-metrics {
  display: flex;
  gap: 20px;
}

.research-metrics div {
  display: grid;
  gap: 2px;
  min-width: 64px;
  text-align: right;
}

.research-metrics strong {
  font: 700 18px/1 ui-monospace, monospace; /* 颜色继承报头 #f7f1e4，与阅览室一致 */
}

.research-metrics span {
  color: #aaa395;
  font-size: 9px;
  letter-spacing: 0.06em;
}

.back-reader {
  align-self: center;
  margin-right: 4px;
  padding: 7px 15px;
  color: #f7f1e4;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-decoration: none;
  border: 1px solid rgba(247, 241, 228, 0.4);
  border-radius: 4px;
  white-space: nowrap;
}

.back-reader:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* —— 主体三栏：提问 / 报告正文 / 报告目录，各自独立滚动 —— */

.research-shell {
  display: grid;
  grid-template-columns: minmax(270px, 310px) 1fr auto; /* 第三栏按内容自适应，无报告时收起 */
  gap: 22px;
  align-items: stretch; /* 各栏撑满高度，各自出滚动条 */
  flex: 1;
  min-height: 0; /* 允许子元素收缩出滚动 */
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 26px clamp(12px, 1.6vw, 24px) 40px;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.panel-heading span {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--accent);
}

.panel-heading strong {
  font-size: 15px;
  letter-spacing: 0.08em;
}

/* —— 提问面板 —— */

.ask-panel {
  display: flex;
  flex-direction: column;
  min-height: 0; /* grid item 默认 min-height:auto，显式收缩才能内部滚动 */
  overflow-y: auto; /* 左栏整体滚动（提问表单 + 历史） */
  scrollbar-color: var(--line) transparent;
  overscroll-behavior: contain; /* 滚到头不把滚动传播给页面 */
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 16px;
  box-shadow: var(--shadow);
}

.ask-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  line-height: 1.6;
}

.ask-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ask-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

/* 模式开关（深度研究/快速模式共用） */
.deep-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted-ink);
  cursor: pointer;
  user-select: none;
}

.deep-toggle input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.deep-toggle:hover {
  color: var(--ink);
}

/* 选中档位文字加深，与未选中拉开层级 */
.deep-toggle:has(input:checked) {
  color: var(--ink);
  font-weight: 600;
}

.ask-submit {
  padding: 7px 14px;
  border: none;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.ask-submit:hover {
  background: var(--accent-dark);
}

.ask-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ask-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: rgba(201, 67, 40, 0.08);
  font-size: 13px;
  color: var(--accent-dark);
}

/* —— 历史列表 —— */

.history {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.history-list {
  display: grid;
  gap: 6px;
  align-content: start;
}

.history-empty {
  margin: 0;
  font-size: 13px;
  color: var(--muted-ink);
}

.history-item {
  position: relative; /* 锚定右上角删除钮 */
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 9px 26px 9px 10px; /* 右侧留出删除钮空间 */
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

/* button 默认 user-select:none 导致问题文字无法选中复制：显式恢复文本选择 */
.history-item .q,
.history-item .meta {
  user-select: text;
  -webkit-user-select: text;
}

.history-item:hover,
.history-item.active {
  border-color: var(--accent);
}

/* 删除钮：悬停或选中当前项时出现在右上角 */
.history-item .history-del {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  color: var(--muted-ink);
  background: rgba(23, 23, 19, 0.06);
  cursor: pointer;
  user-select: none;
}

.history-item:hover .history-del,
.history-item.active .history-del {
  display: inline-flex;
}

.history-item .history-del:hover {
  background: var(--accent);
  color: #fff;
}

.history-item .q {
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-item .meta {
  font-size: 11px;
  color: var(--muted-ink);
  display: flex;
  gap: 8px;
  align-items: center;
}

.stage-tag {
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.stage-tag.done,
.stage-tag.complete {
  background: rgba(35, 72, 62, 0.14);
  color: var(--forest);
}

.stage-tag.failed {
  background: rgba(201, 67, 40, 0.14);
  color: var(--accent-dark);
}

.stage-tag.running {
  background: rgba(6, 95, 212, 0.12);
  color: var(--link);
}

/* 历史问题前的深度研究小旗标 */
.deep-flag {
  display: inline-block;
  margin-right: 5px;
  padding: 0 4px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  font-size: 10px;
  font-style: normal;
  line-height: 1.5;
  color: var(--accent-dark);
  vertical-align: 1px;
}

/* —— 结果面板：右栏独立滚动 —— */

.result-panel {
  position: relative; /* 锚定内部绝对定位元素（如 visually-hidden 标签），防止其以视口为包含块把文档撑高 */
  min-height: 0; /* grid item 默认 min-height:auto 会被内容撑开，必须显式收缩 */
  overflow-y: auto; /* 右栏独立滚动，长报告不再把左栏顶走 */
  scrollbar-color: var(--line) transparent;
  overscroll-behavior: contain; /* 滚到头不把滚动传播给页面 */
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px 28px;
  box-shadow: var(--shadow);
}

.result-idle {
  display: grid;
  place-content: center;
  gap: 10px;
  min-height: 380px;
  text-align: center;
  color: var(--muted-ink);
}

.result-idle .loading-kicker {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--accent);
}

.result-idle p {
  max-width: 420px;
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
}

/* 进度条 */

.progress-card {
  display: grid;
  gap: 12px;
}

.progress-question {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

.progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--paper-deep);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 12%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #e07a4f);
  transition: width 0.5s ease;
}

.progress-stage {
  font-size: 13px;
  color: var(--muted-ink);
  display: flex;
  gap: 8px;
  align-items: center;
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 结果分区 */

.report {
  display: grid;
  gap: 22px;
}

.report-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px 12px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
}

.report-question {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
}

/* 导出 PDF 按钮：标题右侧 */
.report-export {
  padding: 6px 14px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease;
}

.report-export:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* 标题过长时按钮换行不挤压问题：meta 占满两列 */
.report-header .report-meta {
  grid-column: 1 / -1;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--muted-ink);
}

.confidence-high {
  color: var(--forest);
  font-weight: 600;
}

.confidence-medium {
  color: #9a6b1f;
  font-weight: 600;
}

.confidence-low {
  color: var(--accent-dark);
  font-weight: 600;
}

/* 深研徽标 */
.deep-badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent-dark);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* 段尾补挂的角标组：margin 隔开，不会被 justify 拉伸成大空格 */
.cite-extra {
  margin-left: 4px;
  white-space: nowrap;
}

/* 联网来源列表 */
.evidence-web .evidence-link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.evidence-web .evidence-link:hover {
  text-decoration-color: var(--accent);
}

.evidence-host {
  font-size: 11px;
  color: var(--muted-ink);
}

.refs-subtitle {
  margin: 14px 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted-ink);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.report-section h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.08em;
}

/* 章节锚点：目录点击滚动时留出呼吸空间 */
.article-anchor {
  scroll-margin-top: 8px;
}

.report-section h3 .kicker {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--accent);
}

.summary-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.9;
}

/* 结论列表 */

.finding {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--paper);
  border-left: 3px solid var(--forest);
  border-radius: 0 6px 6px 0;
}

.finding-date {
  font-size: 12px;
  color: var(--muted-ink);
  letter-spacing: 0.06em;
}

.finding-claim {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
}

.finding-quotes {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted-ink);
  line-height: 1.7;
}

/* 引用编号角标：句末原位上标 */
.cite {
  display: inline-block;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.2;
  vertical-align: 0.42em;
  color: var(--accent-dark);
  background: none;
  border: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-decoration: none;
  cursor: pointer;
}

.cite + .cite {
  margin-left: 2px;
}

.cite:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 1px;
}

/* 时间线 */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--line);
}

.timeline-item {
  position: relative;
  padding: 0 0 14px 22px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card);
}

.timeline-date {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  font-weight: 600;
}

.timeline-event {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.7;
}

/* 证据列表 */

.evidence-list {
  display: grid;
  gap: 8px;
}

.evidence-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.evidence-index {
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  text-align: center;
  font-size: 11px;
  line-height: 22px;
  border-radius: 11px;
  background: var(--ink);
  color: #f7f1e4;
}

.evidence-body {
  display: grid;
  gap: 4px;
}

.evidence-meta {
  font-size: 12px;
  color: var(--muted-ink);
}

.evidence-meta a {
  color: var(--link);
  text-decoration: none;
}

.evidence-meta a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

.evidence-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 联网补充 */

.web-supplement {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(6, 95, 212, 0.045), transparent);
}

.web-supplement .web-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 9px;
  font-size: 11px;
  letter-spacing: 0.1em;
  border-radius: 3px;
  background: rgba(6, 95, 212, 0.12);
  color: var(--link);
}

.web-point {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.web-point:last-of-type {
  border-bottom: none;
}

.web-point-text {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.7;
}

.web-point-source {
  font-size: 12px;
  color: var(--muted-ink);
}

.web-point-source a {
  color: var(--link);
  text-decoration: none;
}

.web-point-source a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

.web-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted-ink);
}

/* 局限说明 */

.limitations {
  margin: 0;
  padding: 10px 14px;
  border-left: 3px solid var(--line);
  background: var(--paper);
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted-ink);
}

/* —— 报告目录（右栏，沿阅读站 toc 风格） —— */

.report-toc {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 280px;
  flex: none;
  padding: 18px 10px 18px 16px;
  overflow: hidden;
  background: rgba(237, 232, 219, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.report-toc[hidden] {
  display: none;
}

.report-toc .panel-heading {
  margin-bottom: 8px;
}

.report-toc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-color: var(--line) transparent;
  padding-right: 4px;
}

/* 两级目录：分组标签 + 缩进子级（沿阅读站"栏目→子观点"层次） */
.toc-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-group-label {
  padding: 6px 10px 3px;
  font: 700 9px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-ink);
  border-bottom: 1px solid rgba(201, 194, 178, 0.55);
  border-radius: 0;
}

.toc-sublist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 10px;
  border-left: 1px solid rgba(201, 194, 178, 0.62);
  margin: 0 0 2px 8px;
}

.report-toc-list .toc-link {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid rgba(201, 194, 178, 0.46);
  border-radius: 8px;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.report-toc-list .toc-sublink {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted-ink);
  border-bottom-style: dashed;
}

.report-toc-list .toc-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.52);
  transform: translateX(2px);
}

.report-toc-list .toc-link.active {
  color: var(--accent-dark);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(201, 67, 40, 0.07);
}

/* —— 文章版式 —— */

.article-section .article-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.article-title::before {
  content: "";
  flex: none;
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(1px);
}

.article-para {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 2; /* 报刊式疏朗行距，长文阅读友好 */
  text-align: justify;
  text-indent: 2em; /* 段首缩进两字符，中文长文阅读习惯 */
}

/* 段内关键句加粗（模型标注 **…**） */
.article-para strong,
.summary-text strong {
  color: var(--ink);
  font-weight: 600;
  background: linear-gradient(transparent 68%, rgba(214, 69, 65, 0.16) 68%);
  padding: 0 1px;
}

/* 章节要点提炼：标题与正文之间的速读块 */
.section-points {
  margin: 0 0 16px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: rgba(23, 23, 19, 0.025);
  list-style: none;
}

.section-points li {
  position: relative;
  padding: 3px 0 3px 18px;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink);
}

.section-points li::before {
  content: "◆";
  position: absolute;
  left: 2px;
  top: 3px;
  font-size: 9px;
  color: var(--accent);
}

.section-points li + li {
  border-top: 1px dashed var(--line);
}

.article-quote {
  margin: 0 0 14px;
  padding: 8px 14px;
  border-left: 3px solid var(--line);
  color: var(--muted-ink);
  font-size: 13.5px;
  line-height: 1.8;
  background: var(--paper);
}

/* 参考文献：details 折叠，默认收起（像论文的文末参考列表） */
.refs-details summary {
  cursor: pointer;
  list-style: none;
}

.refs-details summary::-webkit-details-marker {
  display: none;
}

.refs-details summary .article-title::after {
  content: "（点击展开）";
  font-size: 11px;
  font-weight: 400;
  color: var(--muted-ink);
  letter-spacing: 0.02em;
}

.refs-details[open] summary .article-title::after {
  content: "（点击收起）";
}

.refs-note {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--muted-ink);
}

/* 证据条目里的打开方式：正文按钮开抽屉 + 角标图标新标签开阅览室 */
.evidence-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.evidence-open {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font-size: 12px;
  cursor: pointer;
}

.evidence-open:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

.evidence-external {
  color: var(--muted-ink);
  font-size: 11px;
  text-decoration: none;
}

.evidence-external:hover {
  color: var(--accent-dark);
}

/* —— 日报原文抽屉（右侧滑入，可关闭，正文独立滚动） —— */

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(23, 23, 19, 0.32);
}

.drawer-mask[hidden] {
  display: none;
}

.source-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(640px, 94vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(45, 39, 28, 0.22);
  transform: translateX(100%);
  transition: transform 0.28s ease;
}

.source-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 16px 18px 12px;
  border-bottom: 2px solid var(--ink);
  background: var(--card);
}

.drawer-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.drawer-date {
  font: 700 9px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  color: var(--accent-dark);
}

.drawer-title strong {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-section {
  font-size: 11.5px;
  color: var(--muted-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-reader-link {
  font-size: 11.5px;
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
}

.drawer-reader-link:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

.drawer-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.drawer-close:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 24px;
  scrollbar-color: var(--line) transparent;
}

.drawer-loading,
.drawer-error {
  padding: 30px 0;
  font-size: 13px;
  color: var(--muted-ink);
  text-align: center;
}

.drawer-error a {
  color: var(--link);
}

.drawer-intro {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--line);
  background: var(--paper);
}

.drawer-intro p {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted-ink);
}

.drawer-intro p:last-child {
  margin-bottom: 0;
}

.drawer-section-block {
  margin-bottom: 18px;
}

.drawer-section-heading {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(201, 194, 178, 0.55);
  margin-bottom: 8px;
}

.drawer-section-number {
  flex: none;
  min-width: 22px;
  height: 22px;
  text-align: center;
  font-size: 11px;
  line-height: 22px;
  border-radius: 3px;
  background: var(--ink);
  color: #f7f1e4;
}

.drawer-section-category {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent-dark);
}

.drawer-section-heading h4 {
  margin: 1px 0 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
}

.drawer-section-body p {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.9;
}

.drawer-section-body p.drawer-bullet {
  padding-left: 14px;
  position: relative;
}

.drawer-section-body p.drawer-bullet::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: var(--accent);
}

.drawer-subpoint {
  font-weight: 600;
  color: var(--ink);
}

.drawer-inline-link {
  color: var(--link);
  text-underline-offset: 2px;
}

/* 抽屉内锚点高亮（与阅读站同款动画） */
@keyframes anchor-flash-fade {
  from {
    background-color: rgba(214, 69, 65, 0.18);
  }
  to {
    background-color: transparent;
  }
}

/* —— 删除确认弹窗：居中模态，报刊风格 —— */

.confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 23, 19, 0.38);
  opacity: 0;
  transition: opacity 0.18s ease;
}

/* hidden 属性优先于 display:flex，关闭后彻底不拦截点击 */
.confirm-mask[hidden] {
  display: none;
}

.confirm-mask.open {
  opacity: 1;
}

.confirm-dialog {
  width: min(380px, 88vw);
  padding: 20px 22px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(45, 39, 28, 0.28);
  text-align: center;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.18s ease;
}

.confirm-mask.open .confirm-dialog {
  transform: translateY(0) scale(1);
}

.confirm-kicker {
  display: block;
  margin-bottom: 4px;
  font: 700 9px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.2em;
  color: var(--accent-dark);
}

.confirm-dialog h4 {
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.confirm-dialog p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted-ink);
  white-space: pre-line;
  word-break: break-all;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-cancel,
.confirm-ok {
  min-width: 88px;
  padding: 8px 18px;
  border-radius: 5px;
  font-size: 13px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.confirm-cancel {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.confirm-cancel:hover {
  border-color: var(--ink);
}

.confirm-ok {
  border: none;
  background: var(--accent);
  color: #fff;
}

.confirm-ok:hover {
  background: var(--accent-dark);
}

.confirm-ok:focus,
.confirm-cancel:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.source-drawer .anchor-flash {
  animation: anchor-flash-fade 1.6s ease-out;
  border-radius: 4px;
}

/* 窄屏抽屉全宽 */
@media (max-width: 900px) {
  .source-drawer {
    width: 100vw;
    border-left: none;
  }
}

/* 错误态 */

.error-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid rgba(201, 67, 40, 0.4);
  border-radius: 8px;
  background: rgba(201, 67, 40, 0.05);
}

.error-card .error-code {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent-dark);
}

.error-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
}

/* 追问框 */

.followup-card {
  margin-top: 4px;
  padding-top: 18px;
  border-top: 2px solid var(--ink);
}

.followup-form {
  display: grid;
  gap: 10px;
}

.followup-form textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  line-height: 1.6;
}

.followup-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.followup-actions {
  display: flex;
  justify-content: flex-end;
}

.followup-submit {
  padding: 8px 20px;
  border: none;
  border-radius: 5px;
  background: var(--ink);
  color: #f7f1e4;
  font-size: 13px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.followup-submit:hover {
  background: #000;
}

.followup-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 窄屏叠放：恢复整页滚动，三栏上下排列 */

@media (max-width: 900px) {
  .research-frame {
    height: auto;
    overflow: visible;
  }

  .research-shell {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .ask-panel,
  .result-panel {
    overflow: visible; /* 窄屏不锁滚动 */
  }

  /* 窄屏目录变横向滚动条 */
  .report-toc {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 14px;
  }

  .report-toc .panel-heading {
    margin-bottom: 0;
    flex: none;
  }

  .report-toc-list {
    flex-direction: row;
    gap: 6px;
    overflow: visible;
    padding-right: 0;
  }

  /* 窄屏两级目录退化为一行组块：分组头 + 子项横向排 */
  .toc-group {
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .toc-group-label {
    display: none;
  }

  .toc-sublist {
    flex-direction: row;
    padding-left: 0;
    border-left: none;
    margin: 0;
    gap: 6px;
  }

  .report-toc-list .toc-link {
    flex: none;
    white-space: nowrap;
    border-bottom: none;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 12px;
  }

  .report-toc-list .toc-link.active {
    border-left: 1px solid var(--accent);
    border-color: var(--accent);
  }

  .research-masthead {
    position: sticky; /* 窄屏恢复整页滚动时重新吸顶 */
    top: 0;
    z-index: 100;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .research-rule,
  .research-metrics div:not(:first-child),
  .research-brand p {
    display: none;
  }

  .research-masthead {
    grid-template-columns: 1fr auto;
    min-height: 60px;
    padding: 10px 16px;
  }
}

/* ============ 导出 PDF（打印样式） ============ */
/* is-exporting 由导出按钮临时挂到 body：只保留报告区，A4 纸张排版。 */
@page {
  margin: 14mm 14mm; /* 收紧页边距：屏幕四周 18mm 太奢侈，A4 给正文更多空间 */
}

@media print {
  body.is-exporting {
    background: #fff;
    color: #111;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.is-exporting .research-masthead,
  body.is-exporting .ask-panel,
  body.is-exporting .history,
  body.is-exporting .report-toc,
  body.is-exporting .followup-card,
  body.is-exporting .drawer-mask,
  body.is-exporting .source-drawer,
  body.is-exporting .confirm-mask,
  body.is-exporting .report-export,
  body.is-exporting .evidence-external,
  body.is-exporting .refs-note {
    display: none !important;
  }

  /* 来源列表的日期按钮在导出时已转为阅览室深链 <a>：保留可点击，去按钮观感 */
  body.is-exporting .evidence-open {
    display: inline !important;
    border: 0 !important;
    background: none !important;
    padding: 0 !important;
    font-size: 10.5px !important;
    color: #065fd4 !important;
    text-decoration: none !important;
    cursor: default !important;
  }

  body.is-exporting .research-frame,
  body.is-exporting main,
  body.is-exporting .result-panel,
  body.is-exporting .report-shell,
  body.is-exporting .result-scroll {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }

  body.is-exporting .result-panel {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  /* 报告主体：相对屏幕加大层级、收紧留白，给出可读的"研报"风 */
  body.is-exporting .report {
    display: block;
    font-family: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC",
      "SimSun", "Microsoft YaHei", serif; /* 正文走宋体，研报感 */
    color: #111;
    line-height: 1.7;
  }

  /* 报告主标题：屏幕 19px 偏小，PDF 直接拉满 */
  body.is-exporting .report-question {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0.01em;
    color: #111;
  }

  body.is-exporting .report-header {
    display: block;
    padding-bottom: 12px;
    margin-bottom: 18px;
    border-bottom: 2px solid #111;
  }

  body.is-exporting .report-meta {
    margin-top: 8px;
    font-size: 10.5px;
    color: #555;
    letter-spacing: 0.04em;
  }

  body.is-exporting .deep-badge {
    font-size: 10px;
    padding: 1px 7px;
    border-width: 1px;
  }

  /* SUMMARY 头标：去掉 2.8px 字距，避免 S U M M A R Y 散开 */
  body.is-exporting .kicker {
    font-size: 10.5px;
    letter-spacing: 0.16em;
    color: #c94328;
    font-weight: 700;
  }

  body.is-exporting .report-section h3 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  body.is-exporting .summary-text {
    margin: 0 0 14px;
    font-size: 11.5px;
    line-height: 1.85;
    text-align: justify;
    text-indent: 2em;
  }

  /* 章节标题：屏幕 16px / 正文 15px，层级几乎没有。PDF 拉大、加粗 */
  body.is-exporting .article-title {
    margin: 8px 0 10px;
    font-size: 14.5px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0.02em;
  }

  body.is-exporting .article-title::before {
    width: 3px;
    height: 14px;
    transform: translateY(2px);
  }

  /* 正文：屏幕 15px / 行高 2 显得稀疏。PDF 11.5px / 行高 1.75 更密 */
  body.is-exporting .article-para {
    margin: 0 0 10px;
    font-size: 11.5px;
    line-height: 1.75;
    text-align: justify;
    text-indent: 1.8em;
    color: #1a1a1a;
  }

  /* 段内加粗关键词：去高亮底色，纯字重区分（PDF 底色易脏） */
  body.is-exporting .article-para strong,
  body.is-exporting .summary-text strong {
    color: #111;
    font-weight: 700;
    background: none;
    padding: 0;
  }

  /* 要点提炼块：屏幕 13.5px，PDF 11px，加深左红线 + 浅灰底 */
  body.is-exporting .section-points {
    margin: 0 0 14px;
    padding: 8px 12px 8px 10px;
    border: 1px solid #ddd;
    border-left: 3px solid #c94328;
    background: #fafaf6;
    page-break-inside: avoid;
  }

  body.is-exporting .section-points li {
    padding: 2px 0 2px 14px;
    font-size: 11px;
    line-height: 1.7;
    color: #222;
  }

  body.is-exporting .section-points li::before {
    left: 1px;
    top: 2px;
    font-size: 7px;
    color: #c94328;
  }

  body.is-exporting .section-points li + li {
    border-top: 1px dashed #ddd;
  }

  /* 引述：与正文同字号但偏灰 */
  body.is-exporting .article-quote {
    margin: 0 0 10px;
    padding: 6px 12px;
    font-size: 11px;
    line-height: 1.7;
    color: #555;
    background: #faf8f1;
    border-left: 3px solid #bbb;
  }

  /* 角标在 PDF 里是 <a href>（导出时由 button 转换）：可点击跳转，但去掉链接默认观感 */
  body.is-exporting .article-para .cite,
  body.is-exporting .section-points .cite,
  body.is-exporting .summary-text .cite,
  body.is-exporting .web-point-text .cite,
  body.is-exporting .finding-claim .cite,
  body.is-exporting .timeline-event .cite {
    display: inline !important;
    border: 0 !important;
    background: none !important;
    color: #c94328 !important;
    font-size: 8.5px !important;
    font-weight: 600;
    vertical-align: 0.3em;
    text-decoration: none !important;
    cursor: default !important;
  }

  /* 章节不跨页断开，参考来源允许分页 */
  body.is-exporting .report-section {
    break-inside: avoid-page;
    page-break-inside: avoid;
    margin-bottom: 8px;
  }

  body.is-exporting .article-section {
    break-inside: avoid-page;
  }

  body.is-exporting .refs-details {
    break-inside: auto;
  }

  body.is-exporting .refs-details summary .article-title::after {
    content: ""; /* 去掉"点击展开"提示 */
  }

  /* 证据条目：去卡片样式，纯列表 */
  body.is-exporting .evidence-item {
    padding: 4px 0;
    background: none;
    border: 0;
    border-top: 1px solid #eee;
    border-radius: 0;
    gap: 6px;
    page-break-inside: avoid;
  }

  body.is-exporting .evidence-index {
    min-width: 24px;
    height: 18px;
    padding: 0 5px;
    font-size: 9.5px;
    line-height: 18px;
    border-radius: 9px;
  }

  body.is-exporting .evidence-meta {
    font-size: 10px;
    color: #666;
  }

  body.is-exporting .evidence-text {
    font-size: 10.5px;
    line-height: 1.6;
    color: #333;
    -webkit-line-clamp: unset;
    overflow: visible;
  }

  /* 时间线 */
  body.is-exporting .timeline {
    border-left: 1.5px solid #ccc;
  }

  body.is-exporting .timeline-item {
    padding: 0 0 8px 18px;
  }

  body.is-exporting .timeline-item::before {
    width: 8px;
    height: 8px;
    left: -5px;
    top: 4px;
  }

  body.is-exporting .timeline-date {
    font-size: 10.5px;
  }

  body.is-exporting .timeline-event {
    font-size: 11px;
    line-height: 1.6;
  }
}
