/* AIbci Claude 会话报告站 — 遵循 codex/collaboration/page-design-standard.md v1.0
   视觉方向：科研观测站 + 证据编辑报告 */

:root {
  /* 共享色彩 token（与页面设计标准一致） */
  --ink: #1b1e1f;
  --ink-soft: #4c5353;
  --charcoal: #15191a;
  --charcoal-2: #242a2b;
  --paper: #f5f7f4;
  --surface: #ffffff;
  --line: #c9cfcb;
  --line-dark: #3c4445;
  --green: #267a54;
  --green-soft: #dcece3;
  --yellow: #e6b938;
  --yellow-soft: #f8edc8;
  --red: #a84337;
  --red-soft: #f6e3e0;

  /* 布局 token */
  --content: 1180px;
  --reading: 860px;
  --toc-min: 15rem;
  --toc-max: 18rem;
  --layout-gap: 2rem;
  --mobile-gutter: 1rem;
  --desktop-gutter: 1rem;

  /* 字体 token */
  --font-sans: "Source Han Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  --dur: 200ms;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  letter-spacing: 0;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 跳到正文 ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--yellow); color: var(--charcoal);
  padding: 0.75rem 1.25rem; z-index: 200; font-weight: 700;
}
.skip-link:focus { left: 0; }

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

/* ---------- 容器 ---------- */
.wrap { width: min(calc(100% - 2rem), var(--content)); margin-inline: auto; }

/* ---------- 全站页头 ---------- */
.site-header { background: var(--charcoal); color: var(--paper); border-bottom: 3px solid var(--yellow); }

.header-row-1 {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 0 0.55rem;
}
.brand {
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 700;
  color: var(--paper); text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; min-height: 44px;
}
.brand span { color: var(--yellow); }

.tabs-scroll { overflow-x: auto; overflow-y: hidden; flex: 1 1 auto; min-width: 0; scrollbar-width: thin; }
.tabs { display: flex; gap: 0.4rem; list-style: none; margin: 0; padding: 0 0 0.2rem; }
.tabs a {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0.35rem 0.85rem; font-size: 0.82rem; white-space: nowrap;
  text-decoration: none; color: var(--paper);
  background: var(--charcoal-2); border: 1px solid var(--line-dark); border-radius: 3px;
  transition: background var(--dur), border-color var(--dur);
}
.tabs a:hover { border-color: var(--yellow); }
.tabs a[aria-current="page"] { background: var(--yellow); color: var(--charcoal); font-weight: 700; border-color: var(--yellow); }

.header-row-2 {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  border-top: 1px solid var(--line-dark); padding: 0.15rem 0;
}
.tool-nav { display: flex; gap: 1.1rem; list-style: none; margin: 0; padding: 0; }
.tool-nav a {
  color: var(--paper); text-decoration: none; font-size: 0.84rem;
  display: inline-flex; align-items: center; min-height: 44px;
  border-bottom: 2px solid transparent;
}
.tool-nav a:hover { border-bottom-color: var(--line); }
.tool-nav a[aria-current="page"] { border-bottom-color: var(--yellow); font-weight: 700; }
.pub-status { margin-left: auto; font-family: var(--font-mono); font-size: 0.72rem; color: #9aa3a2; }

/* ---------- 报告英雄区 ---------- */
.hero { background: var(--charcoal); color: var(--paper); border-bottom: 3px solid var(--yellow); padding: 2.4rem 0 0; }
.hero-eyebrow {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--green-soft); margin: 0 0 0.6rem;
}
.hero h1 {
  font-family: var(--font-serif); font-size: 3rem; line-height: 1.15;
  margin: 0 0 0.9rem; max-width: 22ch; font-weight: 700;
}
.hero-deck { font-size: 1.05rem; color: #d7dedb; max-width: 62ch; margin: 0 0 1.6rem; }
.hero-metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-dark); margin-top: 1.5rem;
}
.hero-metrics div { padding: 1rem 1.2rem 1.3rem 0; border-right: 1px solid var(--line-dark); }
.hero-metrics div:last-child { border-right: 0; }
.hero-metrics dt { font-size: 0.74rem; color: #9aa3a2; margin: 0 0 0.35rem; font-family: var(--font-mono); }
.hero-metrics dd { margin: 0; font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700; color: var(--yellow); line-height: 1.2; }
.hero-metrics dd small { display: block; font-family: var(--font-sans); font-size: 0.78rem; color: #c3cac8; font-weight: 400; margin-top: 0.2rem; }

/* ---------- band 章节 ---------- */
.band { padding: 2.6rem 0; border-bottom: 1px solid var(--line); }
.band-paper { background: var(--surface); }
.band h2 {
  font-family: var(--font-serif); font-size: 2rem; line-height: 1.25;
  margin: 0 0 0.5rem; scroll-margin-top: 5rem;
}
.band h3 { font-size: 1.25rem; margin: 1.8rem 0 0.5rem; scroll-margin-top: 5rem; font-family: var(--font-serif); }
.band-lede { color: var(--ink-soft); max-width: 68ch; margin: 0 0 1.6rem; }
.eyebrow {
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--green); margin: 0 0 0.5rem;
}

/* ---------- 三方案对比 ---------- */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; margin-top: 1.5rem; }
.plan { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--line-dark); border-radius: 3px; padding: 1.2rem 1.15rem 1.3rem; transition: transform var(--dur), border-color var(--dur); }
.plan:hover { transform: translateY(-2px); }
.plan.is-advanced { border-top-color: var(--green); }
.plan.is-optimal { border-top-color: var(--charcoal); }
.plan.is-value { border-top-color: var(--yellow); }
.plan-rank { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.06em; }
.plan h3 { font-family: var(--font-serif); font-size: 1.3rem; margin: 0.3rem 0 0.2rem; }
.plan-sub { font-size: 0.86rem; color: var(--ink-soft); margin: 0 0 0.9rem; }
.plan dl { margin: 0; font-size: 0.88rem; }
.plan dt { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.75rem; }
.plan dd { margin: 0.15rem 0 0; }

/* ---------- 提示框 ---------- */
.note { border-left: 4px solid var(--line); background: var(--surface); padding: 0.9rem 1.1rem; margin: 1.2rem 0; border-radius: 0 3px 3px 0; }
.note-evidence { border-left-color: var(--green); background: var(--green-soft); }
.note-decision { border-left-color: var(--yellow); background: var(--yellow-soft); }
.note-risk { border-left-color: var(--red); background: var(--red-soft); }
.note p:first-child { margin-top: 0; }
.note p:last-child { margin-bottom: 0; }
.note-label { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; display: block; margin-bottom: 0.3rem; }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); margin: 1.2rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.86rem; min-width: 40rem; }
caption { text-align: left; font-size: 0.82rem; color: var(--ink-soft); padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); }
th, td { padding: 0.55rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
thead th { background: var(--charcoal); color: var(--paper); font-size: 0.78rem; font-weight: 700; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.grade { display: inline-block; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.4rem; border: 1px solid var(--line); border-radius: 2px; }
.grade-A { background: var(--green-soft); border-color: var(--green); color: #17492f; }
.grade-B { background: var(--surface); }
.grade-C { background: var(--yellow-soft); border-color: var(--yellow); color: #6b5310; }
.grade-D { background: var(--red-soft); border-color: var(--red); color: #7a2d24; }

/* ---------- 报告正文 + 右侧目录 ---------- */
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(var(--toc-min), var(--toc-max)); gap: var(--layout-gap); align-items: start; }
.report-body { min-width: 0; max-width: var(--reading); }
.report-body h2 { font-family: var(--font-serif); font-size: 2rem; margin: 2.6rem 0 0.6rem; scroll-margin-top: 5rem; padding-top: 0.6rem; border-top: 2px solid var(--charcoal); }
.report-body h2:first-child { margin-top: 0; }
.report-body h3 { font-family: var(--font-serif); font-size: 1.25rem; margin: 1.7rem 0 0.4rem; scroll-margin-top: 5rem; }
.report-body h4 { font-size: 1rem; margin: 1.2rem 0 0.3rem; scroll-margin-top: 5rem; }
.report-body p, .report-body li { overflow-wrap: anywhere; }
.report-body ul, .report-body ol { padding-left: 1.4rem; }
.report-body code { font-family: var(--font-mono); font-size: 0.87em; background: var(--paper); border: 1px solid var(--line); border-radius: 2px; padding: 0.05rem 0.28rem; }
.report-body pre { overflow-x: auto; background: var(--charcoal); color: var(--paper); padding: 1rem; border-radius: 3px; font-size: 0.82rem; }
.report-body pre code { background: none; border: 0; color: inherit; }
.report-body blockquote { margin: 1.2rem 0; padding: 0.2rem 0 0.2rem 1rem; border-left: 4px solid var(--green); color: var(--ink-soft); }

.toc { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 3px; }
.toc-head { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); background: var(--paper); }
.toc-list { overflow-y: auto; list-style: none; margin: 0; padding: 0.5rem 0; font-size: 0.84rem; }
.toc-list li { margin: 0; }
.toc-list a { display: block; padding: 0.32rem 0.9rem; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.toc-list a:hover { background: var(--paper); }
.toc-list a[aria-current="location"] { color: var(--green); border-left-color: var(--green); font-weight: 700; background: var(--green-soft); }
.toc-list .lvl-3 a { padding-left: 1.7rem; font-size: 0.79rem; color: var(--ink-soft); }

.toc-mobile-btn { display: none; }

/* 阅读进度 */
.progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--yellow); width: 0; z-index: 150; transition: width 120ms linear; }

/* ---------- 交互模块 ---------- */
.weights { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem 1.5rem; margin: 1.3rem 0; }
.weight-row label { display: block; font-size: 0.84rem; font-weight: 700; margin-bottom: 0.2rem; }
.weight-row input[type="range"] { width: 100%; height: 44px; }
.weight-val { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); }
.score-bars { margin-top: 1.2rem; }
.score-row { display: grid; grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr) 4rem; gap: 0.8rem; align-items: center; margin-bottom: 0.6rem; font-size: 0.86rem; }
.score-track { background: var(--paper); border: 1px solid var(--line); height: 1.5rem; position: relative; border-radius: 2px; overflow: hidden; }
.score-fill { position: absolute; inset: 0 auto 0 0; background: var(--green); width: 0; transition: width 480ms ease-out; }
.score-fill.is-optimal { background: var(--charcoal-2); }
.score-fill.is-value { background: var(--yellow); }
.score-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; font-weight: 700; }

/* 时间轴 */
.timeline { list-style: none; margin: 1.4rem 0 0; padding: 0 0 0 1.6rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.3rem 0.3rem; }
.timeline li::before { content: ""; position: absolute; left: -2.05rem; top: 0.45rem; width: 0.7rem; height: 0.7rem; background: var(--surface); border: 2px solid var(--green); border-radius: 50%; }
.timeline .tl-date { font-family: var(--font-mono); font-size: 0.74rem; color: var(--green); font-weight: 700; }
.timeline .tl-title { font-weight: 700; display: block; }
.timeline .tl-desc { font-size: 0.88rem; color: var(--ink-soft); }

/* 四条件判定器 */
.checker { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 1.2rem; margin-top: 1.4rem; }
.checker fieldset { border: 0; margin: 0; padding: 0; }
.checker legend { font-weight: 700; font-size: 0.95rem; padding: 0; margin-bottom: 0.7rem; }
.cond { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.55rem 0; border-bottom: 1px solid var(--line); min-height: 44px; }
.cond:last-of-type { border-bottom: 0; }
.cond input[type="checkbox"] { width: 1.35rem; height: 1.35rem; margin-top: 0.15rem; flex: 0 0 auto; accent-color: var(--green); }
.cond label { font-size: 0.9rem; cursor: pointer; }
.cond label b { display: block; }
.cond label span { color: var(--ink-soft); font-size: 0.84rem; }
.checker-out { margin-top: 1rem; padding: 0.9rem 1.1rem; border-left: 4px solid var(--line); background: var(--paper); font-size: 0.92rem; }
.checker-out.is-yes { border-left-color: var(--green); background: var(--green-soft); }
.checker-out.is-no { border-left-color: var(--yellow); background: var(--yellow-soft); }

/* 来源筛选 */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.8rem; margin: 1.2rem 0; }
.filters label { display: block; font-size: 0.78rem; font-weight: 700; margin-bottom: 0.2rem; color: var(--ink-soft); }
.filters select, .filters input[type="search"] { width: 100%; min-height: 44px; padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); font-size: 0.88rem; font-family: inherit; color: var(--ink); }
.result-count { font-family: var(--font-mono); font-size: 0.82rem; color: var(--green); font-weight: 700; margin: 0.8rem 0; }

/* 下载 */
.dl-list { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.dl-list li { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.dl-name { flex: 1 1 16rem; min-width: 0; overflow-wrap: anywhere; }
.dl-name b { display: block; }
.dl-meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 44px; min-width: 44px; padding: 0.4rem 0.95rem;
  border: 1px solid var(--charcoal); border-radius: 3px; background: var(--surface);
  color: var(--ink); text-decoration: none; font-size: 0.85rem; font-family: inherit; cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.btn:hover { background: var(--charcoal); color: var(--paper); }
.btn-primary { background: var(--charcoal); color: var(--paper); }
.btn-primary:hover { background: var(--green); border-color: var(--green); }

/* 页脚 */
.site-footer { background: var(--charcoal); color: #9aa3a2; padding: 2rem 0; font-size: 0.84rem; }
.site-footer a { color: var(--green-soft); }
.site-footer p { margin: 0.35rem 0; }

/* 来源抽屉 */
dialog { border: 1px solid var(--line-dark); border-radius: 3px; padding: 0; max-width: min(94vw, 40rem); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(21, 25, 26, 0.55); }
.dlg-head { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1rem; background: var(--charcoal); color: var(--paper); }
.dlg-head h2, .dlg-head h3 { margin: 0; font-size: 1rem; font-family: var(--font-serif); }
.dlg-close { margin-left: auto; background: none; border: 1px solid var(--line-dark); color: var(--paper); min-width: 44px; min-height: 44px; border-radius: 3px; cursor: pointer; font-size: 1.1rem; }
.dlg-body { padding: 1rem 1.15rem 1.3rem; max-height: 70vh; overflow-y: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .hero h1 { font-size: 2.6rem; }
}

@media (max-width: 980px) {
  .plans { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .report-layout { grid-template-columns: minmax(0, 1fr); }
  .toc-desktop { display: none; }
  .toc-mobile-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    min-height: 44px; padding: 0.4rem 1rem; margin-bottom: 1.2rem;
    background: var(--charcoal); color: var(--paper); border: 0; border-radius: 3px;
    font-size: 0.88rem; font-family: inherit; cursor: pointer;
  }
  .hero { padding-top: 1.8rem; }
  .hero h1 { font-size: 2.15rem; line-height: 1.2; }
  .hero-metrics { grid-template-columns: 1fr; }
  .hero-metrics div { border-right: 0; border-bottom: 1px solid var(--line-dark); padding: 0.8rem 0; }
  .hero-metrics div:last-child { border-bottom: 0; }
  .band h2, .report-body h2 { font-size: 1.6rem; }
  .band { padding: 2rem 0; }
  .score-row { grid-template-columns: minmax(5.5rem, 8rem) minmax(0, 1fr) 3.2rem; gap: 0.5rem; font-size: 0.8rem; }
}

@media (max-width: 560px) {
  .wrap { width: calc(100% - 1.6rem); }
  .hero h1 { font-size: 1.95rem; }
  .header-row-1 { flex-wrap: wrap; gap: 0.5rem; }
  .brand { font-size: 0.98rem; }
}

@media print {
  .site-header, .toc, .toc-mobile-btn, .progress, .site-footer { display: none; }
  body { background: #fff; }
}
