/* ============================================================
   Tinus · 耳鸣开放研究项目
   全局样式 —— 学术期刊 × 安静疗愈
   暖纸底 / 松墨绿 / 黄铜点缀 / 衬线标题 / 声波纹母题
   （所有 --teal-* / --ink-* 变量名为 JS 内联样式依赖的契约，只换值不换名）
   ============================================================ */

:root {
  --teal-700: #0c4f4a;   /* 松墨 */
  --teal-600: #10605a;
  --teal-500: #17827a;
  --teal-300: #7fb3ac;
  --teal-100: #ddece6;   /* 片 chip 背景 */
  --teal-050: #eef4f0;
  --ink-900: #1a2e2a;    /* 深松墨正文 */
  --ink-700: #3d514c;
  --ink-500: #5d6e68;
  --ink-300: #626f6a;
  --bg: #f6f8f7;         /* 淡绿灰白（机构净） */
  --card: #ffffff;       /* 纯白卡 */
  --bg-panel: #f5f2ea;   /* 暖纸面板（index AI 命令块内联 var 引用，r32 起随主题翻转） */
  --line: #e2e1d3;       /* 暖色发丝线 */
  --brass-700: #8a6528;
  --brass-600: #a57d35;
  --brass-500: #bd9350;
  --amber-600: #a16207;
  --amber-bg: #fbf4e2;
  --red-600: #b3261e;
  --red-bg: #fdf1ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(26, 46, 42, 0.05), 0 10px 28px -12px rgba(26, 46, 42, 0.13);
  --shadow-lift: 0 2px 4px rgba(26, 46, 42, 0.06), 0 16px 36px -14px rgba(26, 46, 42, 0.2);
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, "Times New Roman", serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1400 620' fill='none'%3E%3Cpath d='M0 330 Q 87 258 175 330 T 350 330 T 525 330 T 700 330 T 875 330 T 1050 330 T 1225 330 T 1400 330' stroke='%230c4f4a' stroke-opacity='0.10' stroke-width='1.6'/%3E%3Cpath d='M0 376 Q 87 322 175 376 T 350 376 T 525 376 T 700 376 T 875 376 T 1050 376 T 1225 376 T 1400 376' stroke='%230c4f4a' stroke-opacity='0.07' stroke-width='1.4'/%3E%3Cpath d='M0 428 Q 87 392 175 428 T 350 428 T 525 428 T 700 428 T 875 428 T 1050 428 T 1225 428 T 1400 428' stroke='%230c4f4a' stroke-opacity='0.05' stroke-width='1.2'/%3E%3Cpath d='M0 262 Q 87 172 175 262 T 350 262 T 525 262 T 700 262 T 875 262 T 1050 262 T 1225 262 T 1400 262' stroke='%23a57d35' stroke-opacity='0.30' stroke-width='1.6'/%3E%3Cpath d='M175 150 V 520 M525 150 V 520 M875 150 V 520 M1225 150 V 520' stroke='%230c4f4a' stroke-opacity='0.05' stroke-width='1'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html { overflow-x: hidden; overflow-x: clip; } /* 分带负边距防横滚 */

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--bg);
  overflow-x: hidden; /* 分带负边距防横滚（clip 更优，hidden 兼容回退） */
  overflow-x: clip;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  position: relative;
  font-size: 16px;
}

/* 纸面颗粒（极淡，固定不随滚动） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  background-size: 240px 240px;
  opacity: 0.05;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

::selection { background: #cfe4dc; color: var(--ink-900); }

/* 全局链接色：吃不到组件级规则的裸链接此前落回浏览器默认蓝/紫（访问后变紫，
   2026-10-02 用户反馈难看）。统一为品牌青；:visited 同族微暗，暗色模式经
   token 自动适配。组件级规则（.prose a / .site-footer a / .pagenav a / .btn 等）
   特异性更高，不受影响。 */
a { color: var(--teal-600); }
a:visited { color: var(--teal-700); }
a:hover { color: var(--teal-500); }
a:active { color: var(--teal-700); }

/* ---------- 跳到主要内容（首个 Tab 焦点可见） ---------- */

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-200%);
  background: var(--teal-700);
  color: #f7f3e8;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.12s;
}
.skip-link:focus { transform: translateY(0); outline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--brass-500);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ---------- 布局 ---------- */

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

main { padding: 36px 0 76px; }

/* ---------- 顶部导航 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 246, 239, 0.88);
  backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 20px;
  max-width: 1040px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: 0.02em;
  color: var(--teal-700);
  text-decoration: none;
  margin-right: auto;
}

.brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--teal-700);
  color: #f7f3e8;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px rgba(247, 243, 232, 0.22), 0 2px 6px rgba(12, 79, 74, 0.28);
}

.nav a.page-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink-700);
  font-size: 14.5px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 8px;
  transition: background 0.16s, color 0.16s;
}

.nav a.page-link:hover { background: rgba(12, 79, 74, 0.07); color: var(--teal-700); }

.nav a.page-link.active {
  background: transparent;
  color: var(--teal-700);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--brass-500);
  border-radius: 6px 6px 2px 2px;
}

/* 分组下拉导航 */
.nav-group { position: relative; }

.nav-toggle {
  font-family: inherit;
  font-size: 14.5px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-700);
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.16s, color 0.16s;
}
.nav-toggle:hover { background: rgba(12, 79, 74, 0.07); color: var(--teal-700); }
.nav-group.active > .nav-toggle { color: var(--teal-700); font-weight: 700; }

.nav-toggle .caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.6;
  transition: transform 0.15s;
}
.nav-group:hover .caret,
.nav-group:focus-within .caret,
.nav-group.open .caret { transform: rotate(180deg); }

.nav-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  /* 关闭方向：visibility 延迟 0.15s 翻转，保留淡出；
     打开方向（.open 覆写）立即可见，保证键盘焦点可落 */
  transition: opacity 0.15s, transform 0.15s, visibility 0s linear 0.15s;
  z-index: 60;
}
.nav-group:hover .nav-drop,
.nav-group:focus-within .nav-drop,
.nav-group.open .nav-drop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.15s, transform 0.15s, visibility 0s;
}
.nav-drop .page-link { display: block; white-space: nowrap; }
.nav-drop .page-link.active { box-shadow: none; background: var(--teal-050); border-radius: 8px; }

/* 顶栏高亮入口（支持我们）——r32 对比度修复：
   原 color:#fff 被 :168 .nav a.page-link 的 color:var(--ink-700)（特异度更高）压制，
   白字从未生效，金底实显墨字仅 2.25:1（亮暗同病）；且 15px 粗体需 4.5:1，
   白字配 brass-600（#a57d35）也只有 3.76 —— 改用 brass-700 深度字面值
   （不随暗色变量翻转，深金在暗底同样 ≥4.5:1），字色以足额特异度锁定；
   文件尾部另有主题锚定版兜底 hover/active。 */
.nav a.page-link.nav-cta {
  background: #8a6528;
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 18px;
}
.nav a.page-link.nav-cta:hover,
.nav a.page-link.nav-cta.active { background: #75551f; color: #fff; }
.nav a.page-link.nav-cta.active { box-shadow: none; }

/* 顶栏 GitHub 入口（开源项目惯例：右上角仓库图标，Octicons mark-github） */
.nav-gh { padding: 10px 9px; }
.nav-gh svg { display: block; }

/* ---------- 首页：三支柱 / 项目动态 ---------- */

.pillar :is(h2, h3) {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--font-serif);
}
.pillar-no {
  flex: none;
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
  color: var(--brass-600);
}
.pillar-no::after {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: var(--brass-500);
  margin-top: 6px;
}
.card.pillar .btn { margin: 6px 6px 0 0; }

.news-list { list-style: none; margin: 10px 0 8px; padding: 0; }
.news-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line);
}
.news-item:last-child { border-bottom: none; }
.news-date {
  flex: none;
  font-family: var(--font-serif);
  font-size: 13.5px;
  color: var(--brass-700);
  font-weight: 700;
  padding-top: 2px;
  letter-spacing: 0.02em;
}
.news-item .tag { flex: none; margin-top: 1px; }
.news-body b { display: block; color: var(--ink-900); font-size: 15px; margin-bottom: 2px; }
.news-body p { margin: 0; color: var(--ink-700); font-size: 14px; }
@media (max-width: 640px) { .news-item { flex-wrap: wrap; } }

/* ---------- 支持页 ---------- */

.fund-list { list-style: none; margin: 8px 0 0; padding: 0; }
.fund-list li { display: flex; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.fund-list li:last-child { border-bottom: none; }
.fund-list b { flex: none; min-width: 44px; font-family: var(--font-serif); color: var(--teal-700); font-size: 17px; }
.fund-list span { color: var(--ink-700); font-size: 14.5px; }

.donate-card { padding: 20px 22px; }
.qr-box {
  margin-top: 12px;
  width: 150px; height: 150px;
  border: 1.5px dashed var(--ink-300);
  border-radius: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
  font-size: 12.5px;
  background: #fff;
}
.qr-box img { max-width: 100%; max-height: 100%; }

/* ---------- 故事页（叙事排版） ---------- */

.story-hero { padding: 18px 0 26px; }
.story-hero h1 { font-family: var(--font-serif); font-size: clamp(26px, 3.8vw, 38px); margin: 0 0 12px; line-height: 1.3; }
.story-hero .kicker { margin-bottom: 8px; }
.story-hero p { color: var(--ink-700); font-size: 16.5px; max-width: 46em; margin: 0; }

.chapter { display: flex; gap: 22px; margin-bottom: 18px; align-items: flex-start; }
.chapter-no {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--brass-500);
  color: var(--brass-700);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
}
.chapter-hl { border-color: var(--teal-500); }
.chapter-hl .chapter-no { background: var(--teal-700); border-color: var(--teal-700); color: #f7f3e8; }
.chapter-body { flex: 1; min-width: 0; }
.chapter-body :is(h2, h3) { margin: 6px 0 10px; font-family: var(--font-serif); font-size: 20px; color: var(--teal-700); }
.chapter-body p { color: var(--ink-700); font-size: 15.5px; margin: 0 0 10px; }
@media (max-width: 560px) {
  .chapter { gap: 14px; }
  .chapter-no { width: 36px; height: 36px; font-size: 15px; }
}

/* 语言切换器 */
.lang-switch { display: inline-flex; gap: 4px; margin-left: 8px; }
.lang-btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink-500);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.lang-btn:hover { border-color: var(--teal-500); color: var(--teal-600); }
.lang-btn.active { background: var(--teal-700); border-color: var(--teal-700); color: #f7f3e8; }

/* ---------- 英雄区 ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 380px at 20% -60px, rgba(23, 130, 122, 0.07), transparent),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  padding: 76px 0 64px;
}

/* 声波纹母题：右侧淡淡的频率曲线 */
.hero::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(62vw, 900px);
  background-image: var(--wave);
  background-size: cover;
  background-position: right center;
  background-repeat: no-repeat;
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 2; }

.hero h1 {
  font-family: var(--font-sans);
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.24;
  margin: 0 0 18px;
  letter-spacing: 0.01em;
  max-width: 14em;
}

.hero h1 em {
  font-style: normal;
  color: var(--teal-700);
  background: linear-gradient(transparent 78%, rgba(189, 147, 80, 0.45) 78%);
}

.hero p.lead { font-size: 17.5px; color: var(--ink-700); max-width: 44em; margin: 0 0 30px; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 10px;
  text-decoration: none;
  letter-spacing: 0.01em;
  min-height: 44px !important; /* 触控目标下限；压过 JS 内联 min-height */
  transition: transform 0.14s, box-shadow 0.14s, background 0.14s, border-color 0.14s;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--teal-700);
  color: #f7f3e8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 3px 10px -2px rgba(12, 79, 74, 0.45);
}
.btn-primary:hover { background: #0a423e; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 5px 14px -2px rgba(12, 79, 74, 0.5); }

.btn-ghost { background: var(--card); color: var(--teal-700); border: 1.5px solid var(--teal-700); }
.btn-ghost:hover { background: var(--teal-050); border-color: var(--teal-700); }

.btn-small { padding: 7px 14px; font-size: 13.5px; border-radius: 8px; }

.btn-danger { background: var(--card); color: var(--red-600); border: 1.5px solid #e3b7b1; }
.btn-danger:hover { background: var(--red-bg); }

/* ---------- 卡片与网格 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: #d3d2bf;
}

.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 860px) {
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
}

.card :is(h2, h3) { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: var(--teal-700); }
.card p { margin: 0 0 8px; color: var(--ink-700); font-size: 15px; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--brass-700);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.kicker::before {
  content: '';
  width: 22px;
  height: 1.5px;
  background: var(--brass-500);
}

/* ---------- 页面标题 ---------- */

.page-head { margin-bottom: 30px; }
.page-head h1 { font-size: clamp(25px, 3.6vw, 34px); font-weight: 800; letter-spacing: -0.01em; margin: 0 0 8px; line-height: 1.3; }
/* 页中区块 .page-head（原 h1 借用视觉，2026-10-02 语义降级 h2 保同款外观） */
.page-head h2 { font-size: clamp(25px, 3.6vw, 34px); font-weight: 800; letter-spacing: -0.01em; margin: 0 0 8px; line-height: 1.3; }
.page-head p { color: var(--ink-500); margin: 0; max-width: 46em; }

/* ---------- 文章排版（科研/资源页） ---------- */

/* 长页渲染优化：重复文本块/时间线项/章节离屏跳过渲染与布局，
   首次渲染后记忆真实尺寸（contain-intrinsic-size auto），滚动无跳动。
   不适用于含 JS 测量的图表区（.prose 外的 diagram/astats 均不受影响）。 */
.prose > * { content-visibility: auto; contain-intrinsic-size: auto 120px; }
.prose > .table-scroll, .prose > table { content-visibility: visible; }
.tl-item { content-visibility: auto; contain-intrinsic-size: auto 140px; }
.chapter { content-visibility: auto; contain-intrinsic-size: auto 180px; }
.news-item { content-visibility: auto; contain-intrinsic-size: auto 90px; }

.prose h2 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--teal-700);
  margin: 42px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.prose h3 { font-size: 17px; margin: 26px 0 10px; color: var(--ink-900); }
.prose p, .prose li { color: var(--ink-700); font-size: 15.5px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 4px 0; }
.prose a:not(.btn) { color: var(--teal-600); text-decoration: underline; text-decoration-color: rgba(23, 130, 122, 0.35); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--teal-600); }
/* 长表格：窄屏横向滚动而不是挤压单元格 */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose .table-scroll { margin: 14px 0; }
.prose .table-scroll table { margin: 0; min-width: 620px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 14px 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--teal-050); color: var(--teal-700); font-weight: 700; }

/* ---------- 提示框 ---------- */

.callout {
  border-radius: 10px;
  padding: 15px 18px;
  font-size: 14.5px;
  margin: 18px 0;
  border: 1px solid transparent;
  border-left-width: 3px;
}
.callout > strong { display: block; margin-bottom: 4px; } /* 仅标题独占行；正文内联 strong 保持行内 */
.callout.info { background: var(--teal-050); border-color: #d5e4dd; border-left-color: var(--teal-500); color: var(--ink-700); }
.callout.warn { background: var(--amber-bg); border-color: #ecdfbd; border-left-color: var(--brass-500); color: var(--ink-700); }
.callout.warn strong { color: var(--brass-700); }
.callout.danger { background: var(--red-bg); border-color: #ecd2cb; border-left-color: var(--red-600); color: var(--ink-700); }
.callout.danger strong { color: var(--red-600); }
.callout p { margin: 4px 0; }

/* ---------- 表单 ---------- */

.form-section { margin-bottom: 34px; }
.form-section > :is(h2, h3) {
  font-family: var(--font-serif);
  font-size: 17.5px;
  color: var(--teal-700);
  border-left: 3px solid var(--brass-500);
  padding-left: 12px;
  margin: 0 0 6px;
}
.form-section > .section-desc { color: var(--ink-500); font-size: 14px; margin: 0 0 14px; padding-left: 15px; }

.field { margin-bottom: 18px; }
.field > label.question {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
}
.field .hint { font-weight: 400; color: var(--ink-500); font-size: 13px; margin-left: 6px; }

.choices { display: flex; flex-wrap: wrap; gap: 8px 10px; }

.choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 14.5px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.13s, background 0.13s;
  color: var(--ink-700);
}
.choice:hover { border-color: var(--teal-500); }
.choice input { accent-color: var(--teal-600); margin: 0; }
.choice:has(input:checked) { border-color: var(--teal-600); background: var(--teal-050); color: var(--teal-700); font-weight: 600; }

input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink-900);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 13px;
  outline: none;
  transition: border-color 0.13s, box-shadow 0.13s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(23, 130, 122, 0.12);
}
textarea { width: 100%; resize: vertical; min-height: 76px; }

/* 滑杆 */
.slider-row { display: flex; align-items: center; gap: 16px; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--teal-600); }
.slider-value {
  min-width: 52px;
  text-align: center;
  font-weight: 700;
  color: var(--teal-700);
  background: var(--teal-100);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 15px;
}
.slider-labels { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }

/* 触控目标：密集 pill 用 ::before 外扩命中区（视觉不变） */
.thi-item label, .choice { position: relative; }
.thi-item label::before, .choice::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 999px;
}
input[type="radio"], input[type="checkbox"] { width: 15px; height: 15px; }

/* THI 量表（fieldset 题组：aria-labelledby 指向 .q 题干） */
.thi-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border: none;
  margin: 0;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.thi-item .q { flex: 1 1 320px; font-size: 15px; }
.thi-item .opts { display: flex; gap: 8px; }
.thi-item label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  padding: 6px 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink-700);
  transition: border-color 0.13s, background 0.13s;
}
.thi-item label:hover { border-color: var(--teal-500); }
.thi-item label:has(input:checked) { border-color: var(--teal-600); background: var(--teal-050); color: var(--teal-700); font-weight: 600; }
.thi-item input { accent-color: var(--teal-600); margin: 0; }

/* 治疗经历行 */
.treatment-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--teal-050);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
}
.treatment-row .eff { display: flex; align-items: center; gap: 8px; }
.treatment-row input[type="range"] { width: 110px; accent-color: var(--teal-600); }
.treatment-row .t-name { min-width: 0; } /* grid item 默认 min-width:auto 取最长选项文本宽——EN 长药名在 700-830px 窄带撑破三列（2026-10-02 r28）；下拉展开面板仍完整显示选项 */
@media (max-width: 700px) {
  .treatment-row { grid-template-columns: 1fr; }
}

/* ---------- 结果展示 ---------- */

.score-hero { text-align: center; padding: 32px 20px; }
.score-hero .num {
  font-family: var(--font-serif);
  font-size: 60px;
  font-weight: 800;
  color: var(--teal-700);
  line-height: 1;
}
.score-hero .unit { color: var(--ink-300); font-size: 18px; }
.score-hero .grade {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  background: var(--teal-100);
  color: var(--teal-700);
}

.stat-strip { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.stat {
  flex: 1 1 150px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 2.5px solid var(--brass-500);
  border-radius: 10px;
  padding: 14px 18px 12px;
  text-align: center;
}
.stat .v { font-family: var(--font-serif); font-size: 28px; font-weight: 800; color: var(--teal-700); line-height: 1.2; }
.stat .k { font-size: 13px; color: var(--ink-500); }

/* ---------- 列表与空状态 ---------- */

.record-list { list-style: none; margin: 0; padding: 0; }
.record-list li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14.5px;
}
.record-list .meta { color: var(--ink-500); font-size: 13px; }
.record-list .spacer { flex: 1; }
.empty {
  text-align: center;
  color: var(--ink-500);
  padding: 30px 10px;
  font-size: 14.5px;
  border: 1.5px dashed var(--ink-300);
  border-radius: 12px;
  background: rgba(255, 253, 249, 0.6);
}

/* ---------- 页脚 ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: #0e332f;
  color: #c8d6cf;
  padding: 34px 0 42px;
  font-size: 13.5px;
  position: relative;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brass-500), rgba(189, 147, 80, 0));
}
.site-footer a { color: #9ec4ba; text-decoration: none; }
.site-footer a:hover { color: #d5e8e1; text-decoration: underline; text-underline-offset: 3px; }
.site-footer .cols { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.site-footer p { margin: 6px 0; }
.site-footer strong { font-family: var(--font-serif); color: #f0ede2; font-size: 15px; }
.site-footer .footnote { color: #9fb8af; }

/* ---------- 步骤条 ---------- */

.steps { display: flex; gap: 0; margin: 8px 0 26px; padding: 0; list-style: none; }
.steps li {
  flex: 1;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-300);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
  position: relative;
}
.steps li.active { color: var(--teal-700); font-weight: 700; border-bottom-color: var(--brass-500); }
.steps li.done { color: var(--teal-500); border-bottom-color: var(--teal-100); }

/* ---------- 其他 ---------- */

.divider { border: none; height: 1px; background: linear-gradient(90deg, transparent, var(--line) 12%, var(--line) 88%, transparent); margin: 36px 0; }

.tag {
  display: inline-block;
  font-size: 12.5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--teal-100);
  color: var(--teal-700);
  font-weight: 600;
  line-height: 1.7;
}

.muted { color: var(--ink-500); font-size: 13.5px; }

canvas { max-width: 100%; }

.footnote { font-size: 12.5px; color: var(--ink-300); }

/* ---------- 机制页：交互通路图 ---------- */

.diagram-card { padding: 20px 22px; }

.diagram-legend {
  display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 13px; color: var(--ink-500);
  margin-bottom: 10px;
}
.diagram-legend span { display: inline-flex; align-items: center; gap: 6px; }
.diagram-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.diagram-scroll { overflow-x: auto; }
#pathway { min-width: 720px; width: 100%; height: auto; }

#pathway .dgm-arrows line,
#pathway .dgm-arrows path { stroke: #8fa19f; stroke-width: 2; }
#pathway .dgm-arrow-label { font-size: 11.5px; fill: var(--ink-300); }
#pathway .dgm-footnote { font-size: 11.5px; fill: var(--ink-300); }

.dgm-node { cursor: pointer; outline: none; }
.dgm-node rect {
  fill: var(--teal-050);
  stroke: var(--teal-500);
  stroke-width: 1.6;
  transition: fill 0.15s, stroke 0.15s;
}
.dgm-node .t1 { font-size: 14.5px; font-weight: 700; fill: var(--teal-700); text-anchor: middle; }
.dgm-node .t2 { font-size: 11px; fill: var(--ink-500); text-anchor: middle; }
.dgm-node:hover rect { fill: var(--teal-100); }
.dgm-node:focus rect, .dgm-node.active rect { stroke-width: 3; fill: var(--teal-100); }

.dgm-node.net rect { fill: #fdf6e8; stroke: #c08a2e; }
.dgm-node.net .t1 { fill: #8a6528; }
.dgm-node.net:hover rect, .dgm-node.net.active rect, .dgm-node.net:focus rect { fill: #f9eccf; }

.dgm-node.somatic rect { fill: #f1eef9; stroke: #7c6ba8; }
.dgm-node.somatic .t1 { fill: #4c3d75; }
.dgm-node.somatic:hover rect, .dgm-node.somatic.active rect, .dgm-node.somatic:focus rect { fill: #e6e0f5; }

.node-detail {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding: 16px 6px 4px;
  min-height: 120px;
}
.node-detail :is(h2, h3) { margin: 8px 0 8px; font-family: var(--font-serif); font-size: 17.5px; color: var(--ink-900); }
.node-detail p { color: var(--ink-700); font-size: 14.5px; margin: 0 0 8px; }

/* ---------- 前沿页：时间线与证据分级 ---------- */

.timeline { position: relative; padding-left: 26px; margin: 10px 0 26px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 1.5px;
  background: var(--teal-100);
}
.tl-item { position: relative; margin-bottom: 22px; }
.tl-item::before {
  content: '';
  position: absolute;
  left: -25px; top: 6px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--card);
  border: 2.5px solid var(--teal-500);
  box-shadow: 0 0 0 3px var(--bg);
}
.tl-date { font-family: var(--font-serif); font-size: 13.5px; font-weight: 700; color: var(--brass-700); letter-spacing: 0.02em; }
.tl-body { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; transition: border-color 0.16s, box-shadow 0.16s; }
.tl-body:hover { border-color: #d3d2bf; box-shadow: var(--shadow); }
.tl-body :is(h3, h4) { margin: 0 0 6px; font-size: 15.5px; color: var(--ink-900); }
.tl-body p { margin: 0; font-size: 14px; color: var(--ink-700); }

.stage {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 1px 9px;
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}
.stage-approved { background: #e2efdd; color: #35682c; border: 1px solid #c4ddb9; }
.stage-p3 { background: #e0eaf6; color: #2b5cad; border: 1px solid #c2d6ee; }
.stage-p2 { background: #e8e6f6; color: #55479e; border: 1px solid #d2cdea; }
.stage-research { background: var(--teal-100); color: var(--teal-700); border: 1px solid #c2ddd4; }
.stage-case { background: var(--amber-bg); color: var(--brass-700); border: 1px solid #ecdfbd; }

/* ---------- 评估页：标签页与诱因画像 ---------- */

.tabs { display: flex; gap: 2px; margin: 4px 0 22px; border-bottom: 1.5px solid var(--line); flex-wrap: wrap; }
.tab-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-500);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--teal-600); }
.tab-btn.active { color: var(--teal-700); border-bottom-color: var(--brass-500); }

.factor-list { list-style: none; margin: 10px 0 0; padding: 0; }
.factor-item { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.factor-item:last-child { border-bottom: none; }
.factor-item .fi-icon { font-size: 18px; line-height: 1.6; }
.factor-item .fi-body b { display: block; color: var(--ink-900); font-size: 15px; }
.factor-item .fi-body span { color: var(--ink-700); font-size: 14px; line-height: 1.7; }
@media (prefers-color-scheme: dark) {

/* ============================================================
   深色模式（暖墨层）——D1
   策略：文字型变量（teal-700/brass-700）翻亮；少数把 teal-700 当
   背景的组件（按钮/logo/激活 pill）固定深松墨底 + 原亮字。
   ============================================================ */
html:not([data-theme]) {
  --bg: #101b19;
  --card: #1a2825;
  --bg-panel: #14201d;
  --brass-600: #c99b4e;  /* r32: 金族暗底翻亮（cm-tile-arrow 16px 粗体需 4.5:1） */
  --brass-500: #e3c48a;
  --line: #2c3b37;
  --ink-900: #e8ede9;
  --ink-700: #c2cdc7;
  --ink-500: #93a39c;
  --ink-300: #8b9a94;
  --teal-700: #8ec7be;
  --teal-600: #6db8ae;
  --teal-500: #5faea4;   /* 图表主色在暗底的提亮 */
  --teal-100: #24403c;
  --teal-050: #1f3330;
  --amber-600: #d3b071;
  --brass-700: #d3b071;
  --amber-bg: #2e2818;
  --red-600: #e88f86;
  --red-bg: #33201d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -12px rgba(0, 0, 0, 0.5);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 36px -14px rgba(0, 0, 0, 0.6);
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1400 620' fill='none'%3E%3Cpath d='M0 330 Q 87 258 175 330 T 350 330 T 525 330 T 700 330 T 875 330 T 1050 330 T 1225 330 T 1400 330' stroke='%23a9d3cc' stroke-opacity='0.10' stroke-width='1.6'/%3E%3Cpath d='M0 376 Q 87 322 175 376 T 350 376 T 525 376 T 700 376 T 875 376 T 1050 376 T 1225 376 T 1400 376' stroke='%23a9d3cc' stroke-opacity='0.07' stroke-width='1.4'/%3E%3Cpath d='M0 428 Q 87 392 175 428 T 350 428 T 525 428 T 700 428 T 875 428 T 1050 428 T 1225 428 T 1400 428' stroke='%23a9d3cc' stroke-opacity='0.05' stroke-width='1.2'/%3E%3Cpath d='M0 262 Q 87 172 175 262 T 350 262 T 525 262 T 700 262 T 875 262 T 1050 262 T 1225 262 T 1400 262' stroke='%23d3b071' stroke-opacity='0.30' stroke-width='1.6'/%3E%3Cpath d='M175 150 V 520 M525 150 V 520 M875 150 V 520 M1225 150 V 520' stroke='%23a9d3cc' stroke-opacity='0.05' stroke-width='1'/%3E%3C/svg%3E");
  background: #101b19;
  color-scheme: dark;
}
html:not([data-theme]) body::before { opacity: 0.07; mix-blend-mode: soft-light; }
html:not([data-theme]) .site-header { background: rgba(16, 27, 25, 0.92); }
html:not([data-theme]) .hero { background: linear-gradient(180deg, #16231f 0%, #101b19 100%); }
html:not([data-theme]) .hero h1 em { background: linear-gradient(transparent 78%, rgba(211, 176, 113, 0.35) 78%); }
html:not([data-theme]) .brand .logo { background: #0f4a45; color: #f7f3e8; }
html:not([data-theme]) .btn-primary { background: #0f4a45; color: #f7f3e8; }
html:not([data-theme]) .btn-primary:hover { background: #0c3f3a; }
html:not([data-theme]) .chapter-hl .chapter-no { background: #0f4a45; color: #f7f3e8; }
html:not([data-theme]) .lang-btn.active { background: #0f4a45; border-color: #0f4a45; color: #f7f3e8; }
html:not([data-theme]) input[type="text"], input[type="password"], html:not([data-theme]) input[type="date"], html:not([data-theme]) input[type="number"], html:not([data-theme]) select, html:not([data-theme]) textarea,
html:not([data-theme]) .choice, html:not([data-theme]) .thi-item label, html:not([data-theme]) .qr-box, html:not([data-theme]) .tl-body, html:not([data-theme]) .empty { background: var(--card); color: var(--ink-900); }
html:not([data-theme]) .btn-ghost { background: var(--card); color: var(--teal-700); border-color: #3d6a62; }
html:not([data-theme]) .btn-ghost:hover { background: #20342f; }
html:not([data-theme]) .callout.info { border-color: #2f4a44; }
html:not([data-theme]) .callout.warn { border-color: #4a3d22; }
html:not([data-theme]) .callout.danger { border-color: #4d2c26; }
html:not([data-theme]) .prose a:not(.btn) { text-decoration-color: rgba(109, 184, 174, 0.5); }
html:not([data-theme]) .stage-approved { background: #223527; border-color: #35503a; color: #a4d39c; }
html:not([data-theme]) .stage-p3 { background: #22303f; border-color: #354961; color: #8ab9e8; }
html:not([data-theme]) .stage-p2 { background: #262b42; border-color: #3b4263; color: #b3abe8; }
html:not([data-theme]) .stage-research { background: #24403c; border-color: #35544e; }
html:not([data-theme]) .stage-case { background: #2e2818; border-color: #4a3d22; }
html:not([data-theme]) .skip-link { background: #8ec7be; color: #10201d; }
html:not([data-theme]) .treatment-row { background: var(--teal-050); }
html:not([data-theme]) ::selection { background: #2f5d55; color: #e8ede9; }
html:not([data-theme]) .nav a.page-link:hover, html:not([data-theme]) .nav-toggle:hover { background: rgba(142, 199, 190, 0.09); }

}

/* 手动深色（切换按钮写入 data-theme，优先于系统偏好） */

/* ============================================================
   深色模式（暖墨层）——D1
   策略：文字型变量（teal-700/brass-700）翻亮；少数把 teal-700 当
   背景的组件（按钮/logo/激活 pill）固定深松墨底 + 原亮字。
   ============================================================ */
html[data-theme="dark"] {
  --bg: #101b19;
  --card: #1a2825;
  --bg-panel: #14201d;
  --brass-600: #c99b4e;  /* r32: 金族暗底翻亮（cm-tile-arrow 16px 粗体需 4.5:1） */
  --brass-500: #e3c48a;
  --line: #2c3b37;
  --ink-900: #e8ede9;
  --ink-700: #c2cdc7;
  --ink-500: #93a39c;
  --ink-300: #8b9a94;
  --teal-700: #8ec7be;
  --teal-600: #6db8ae;
  --teal-500: #5faea4;   /* 图表主色在暗底的提亮 */
  --teal-100: #24403c;
  --teal-050: #1f3330;
  --amber-600: #d3b071;
  --brass-700: #d3b071;
  --amber-bg: #2e2818;
  --red-600: #e88f86;
  --red-bg: #33201d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -12px rgba(0, 0, 0, 0.5);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 36px -14px rgba(0, 0, 0, 0.6);
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1400 620' fill='none'%3E%3Cpath d='M0 330 Q 87 258 175 330 T 350 330 T 525 330 T 700 330 T 875 330 T 1050 330 T 1225 330 T 1400 330' stroke='%23a9d3cc' stroke-opacity='0.10' stroke-width='1.6'/%3E%3Cpath d='M0 376 Q 87 322 175 376 T 350 376 T 525 376 T 700 376 T 875 376 T 1050 376 T 1225 376 T 1400 376' stroke='%23a9d3cc' stroke-opacity='0.07' stroke-width='1.4'/%3E%3Cpath d='M0 428 Q 87 392 175 428 T 350 428 T 525 428 T 700 428 T 875 428 T 1050 428 T 1225 428 T 1400 428' stroke='%23a9d3cc' stroke-opacity='0.05' stroke-width='1.2'/%3E%3Cpath d='M0 262 Q 87 172 175 262 T 350 262 T 525 262 T 700 262 T 875 262 T 1050 262 T 1225 262 T 1400 262' stroke='%23d3b071' stroke-opacity='0.30' stroke-width='1.6'/%3E%3Cpath d='M175 150 V 520 M525 150 V 520 M875 150 V 520 M1225 150 V 520' stroke='%23a9d3cc' stroke-opacity='0.05' stroke-width='1'/%3E%3C/svg%3E");
  background: #101b19;
  color-scheme: dark;
}
html[data-theme="dark"] body::before { opacity: 0.07; mix-blend-mode: soft-light; }
html[data-theme="dark"] .site-header { background: rgba(16, 27, 25, 0.92); }
html[data-theme="dark"] .hero { background: linear-gradient(180deg, #16231f 0%, #101b19 100%); }
html[data-theme="dark"] .hero h1 em { background: linear-gradient(transparent 78%, rgba(211, 176, 113, 0.35) 78%); }
html[data-theme="dark"] .brand .logo { background: #0f4a45; color: #f7f3e8; }
html[data-theme="dark"] .btn-primary { background: #0f4a45; color: #f7f3e8; }
html[data-theme="dark"] .btn-primary:hover { background: #0c3f3a; }
html[data-theme="dark"] .chapter-hl .chapter-no { background: #0f4a45; color: #f7f3e8; }
html[data-theme="dark"] .lang-btn.active { background: #0f4a45; border-color: #0f4a45; color: #f7f3e8; }
html[data-theme="dark"] input[type="text"], input[type="password"], html[data-theme="dark"] input[type="date"], html[data-theme="dark"] input[type="number"], html[data-theme="dark"] select, html[data-theme="dark"] textarea,
html[data-theme="dark"] .choice, html[data-theme="dark"] .thi-item label, html[data-theme="dark"] .qr-box, html[data-theme="dark"] .tl-body, html[data-theme="dark"] .empty { background: var(--card); color: var(--ink-900); }
html[data-theme="dark"] .btn-ghost { background: var(--card); color: var(--teal-700); border-color: #3d6a62; }
html[data-theme="dark"] .btn-ghost:hover { background: #20342f; }
html[data-theme="dark"] .callout.info { border-color: #2f4a44; }
html[data-theme="dark"] .callout.warn { border-color: #4a3d22; }
html[data-theme="dark"] .callout.danger { border-color: #4d2c26; }
html[data-theme="dark"] .prose a:not(.btn) { text-decoration-color: rgba(109, 184, 174, 0.5); }
html[data-theme="dark"] .stage-approved { background: #223527; border-color: #35503a; color: #a4d39c; }
html[data-theme="dark"] .stage-p3 { background: #22303f; border-color: #354961; color: #8ab9e8; }
html[data-theme="dark"] .stage-p2 { background: #262b42; border-color: #3b4263; color: #b3abe8; }
html[data-theme="dark"] .stage-research { background: #24403c; border-color: #35544e; }
html[data-theme="dark"] .stage-case { background: #2e2818; border-color: #4a3d22; }
html[data-theme="dark"] .skip-link { background: #8ec7be; color: #10201d; }
html[data-theme="dark"] .treatment-row { background: var(--teal-050); }
html[data-theme="dark"] ::selection { background: #2f5d55; color: #e8ede9; }
html[data-theme="dark"] .nav a.page-link:hover, html[data-theme="dark"] .nav-toggle:hover { background: rgba(142, 199, 190, 0.09); }


/* ---------- 返回顶部 ---------- */

.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid #3d6a62;
  background: var(--card);
  color: var(--teal-700);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
  box-shadow: var(--shadow);
}
.back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { background: var(--teal-050); }

/* ---------- 打印样式（研究页适合打印存档） ---------- */

@media print {
  /* 强制浅色（覆盖深色模式与系统偏好） */
  html, html[data-theme="dark"], html:not([data-theme]) {
    background: #fff !important;
    color-scheme: light;
    --bg: #fff; --card: #fff; --line: #ddd;
    --ink-900: #1a2e2a; --ink-700: #333; --ink-500: #555;
    --teal-700: #0c4f4a; --teal-500: #17827a; --brass-700: #8a6528; --brass-500: #a57d35;
  }
  body { background: #fff !important; color: #1a2e2a; font-size: 11pt; line-height: 1.6; }
  body::before { display: none; } /* 纸面颗粒 */

  /* 隐藏屏上交互件 */
  .site-header, .site-footer, .nav, .btn, .back-top, .skip-link,
  .lang-switch, .theme-btn, .tabs, .hero-actions, .callout.danger {
    display: none !important;
  }

  /* 卡片摊平为带 hairline 的分节，避免整块深色/阴影 */
  .card, .tl-body, .stat, .record-list li {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    border-radius: 6px;
    background: #fff !important;
    break-inside: avoid;
  }
  .card:hover { transform: none; }

  /* 正文衬线、标题不孤行 */
  .prose, .prose p, .prose li { font-family: var(--font-serif); }
  h1, h2, h3, .page-head h1, .page-head h2 { break-after: avoid; }
  .prose h2 { break-before: auto; }

  /* 表格完整打印 */
  .table-scroll { overflow: visible !important; }
  .prose .table-scroll table { min-width: 0 !important; }
  .prose th, .prose td { border: 1px solid #bbb !important; }
  .prose table { break-inside: auto; }
  .prose tr { break-inside: avoid; }

  /* 外链打印出地址，纸质可追溯 */
  .prose a[href^="http"]::after, .footer a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8.5pt;
    color: #666;
    word-break: break-all;
  }
  a { text-decoration: none !important; color: #0c4f4a !important; }

  .hero { background: #fff !important; }
  .hero::after { display: none; } /* 波纹装饰 */
  .grid { gap: 10px; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr 1fr; }
  main { padding: 0; }
  .callout { border: 1px solid #bbb !important; background: #fff !important; }
  .diagram-card svg { max-height: 85vh; }
}

/* ---------- 页内小节索引（sticky 芯片） ---------- */

.pagenav {
  position: sticky;
  top: 66px; /* 顶栏下方 */
  z-index: 40;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin: 0 0 22px;
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.pagenav a {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  transition: border-color 0.14s, color 0.14s, background 0.14s;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}
.pagenav a:hover { border-color: var(--teal-500); color: var(--teal-700); background: var(--teal-050); }
html[data-theme="dark"] .pagenav, html:not([data-theme]) .pagenav { }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .pagenav { background: rgba(26, 40, 37, 0.92); }
}
html[data-theme="dark"] .pagenav { background: rgba(26, 40, 37, 0.92); }
@media print { .pagenav { display: none !important; } }

/* ---------- 红旗速查卡（资源页置顶） ---------- */

.alert-card { border-left: 4px solid var(--red-600); }
.alert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; margin-top: 6px; }
.alert-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--teal-050);
}
.alert-grid b { color: var(--ink-900); font-size: 15px; }
.alert-grid span { color: var(--ink-700); font-size: 13.5px; line-height: 1.6; }
@media (max-width: 640px) { .alert-grid { grid-template-columns: 1fr; } }

/* ---------- 机构化增补：信任统计条 / 分带 / 支柱图标（借鉴医学非营利站） ---------- */

.trust-strip {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.trust-strip .t-item { flex: 1 1 140px; }
.trust-strip .t-num { font-family: var(--font-serif); font-size: 30px; font-weight: 700; color: var(--teal-700); line-height: 1.1; }
.trust-strip .t-k { font-size: 13px; color: var(--ink-500); margin-top: 3px; }

.band {
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 34px 0;
  margin: 34px -2000px 0;      /* 满宽分带（配合 wrap 内边距） */
  padding-left: 2000px;
  padding-right: 2000px;
  box-sizing: content-box;
}
.band .wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

.pillar-ico {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--teal-050);
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}
.pillar-ico svg { width: 24px; height: 24px; stroke: var(--teal-600); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="dark"] .band { background: #16231f; }

/* ---------- 评估页快速入口（患者入口模式） ---------- */

.quick-entry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}
.quick-entry a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.quick-entry a:hover {
  border-color: var(--teal-500);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.quick-entry b { color: var(--teal-700); font-size: 15.5px; font-weight: 700; }
.quick-entry span { color: var(--ink-500); font-size: 13px; }

/* ---------- 贡献页提交流程高亮 ---------- */

.flow-card { border-top: 3px solid var(--teal-500); }
.flow-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.f-step { display: flex; flex-direction: column; gap: 3px; }
.f-no {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal-700);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}
.f-step b { color: var(--ink-900); font-size: 15.5px; }
.f-step span { color: var(--ink-500); font-size: 13.5px; line-height: 1.6; }
/* r32：.f-no 本有 color:#fff（:1293），但被本节 .f-step span 的特异度 (0,1,1) 压制，
   徽章数字实显 ink-500（亮 1.79 / 暗 3.82 均违例）——足额特异度把白字锁回来 */
.f-step .f-no { color: #fff; }
html[data-theme="dark"] .f-no { background: #0f4a45; }

/* ---------- 知情同意弹窗（原生 <dialog>，提交前展示） ---------- */

dialog.tinus-consent {
  position: fixed;                 /* 显式居中：不依赖 UA 的 modal 定位（部分 webview 下失效） */
  left: 0; right: 0; top: 0; bottom: 0;   /* inset 的 longhand 展开（r58）：Safari <14.5 /
                                   Chrome <87 不识别 inset，四 longhand 在新旧引擎同值 */
  inset: 0;
  margin: auto;
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: none;
  border-radius: 14px;
  padding: 26px 26px 22px;
  background: var(--card, #fff);
  color: var(--ink-800, #2a3532);
  box-shadow: 0 24px 64px rgba(10, 37, 33, 0.28);
}
/* r58 降级路径：无原生 <dialog> 的引擎里 createElement('dialog') 是未知元素
   （display:inline、无 UA modal 样式）——JS 垫片设 open 属性后由本规则承载显示。
   原生路径不受影响：UA 样式表已 display:block，本规则仅补齐且只在 open 时命中。 */
dialog.tinus-consent[open] { display: block; }
dialog.tinus-consent::backdrop { background: rgba(10, 30, 27, 0.45); }
dialog.tinus-consent h3 {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 19px;
  color: var(--teal-800, #0f4a45);
}
dialog.tinus-consent .c-intro { margin: 0 0 10px; font-size: 14.5px; line-height: 1.7; }
dialog.tinus-consent .c-list {
  margin: 0 0 12px; padding-left: 20px;
  display: grid; gap: 8px;
  font-size: 13.8px; line-height: 1.65;
}
dialog.tinus-consent .c-list strong { color: var(--teal-800, #0f4a45); }
dialog.tinus-consent .c-chk {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 14px; font-weight: 600; line-height: 1.6;
  cursor: pointer; margin: 0 0 6px;
}
dialog.tinus-consent .c-chk input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal-600, #0e7a6c); flex: none; }
dialog.tinus-consent .c-note { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-500, #5d6f6a); }
dialog.tinus-consent .c-actions { display: flex; justify-content: flex-end; gap: 10px; }
html[data-theme="dark"] dialog.tinus-consent { background: #16211f; color: #c8d4d0; }
html[data-theme="dark"] dialog.tinus-consent h3,
html[data-theme="dark"] dialog.tinus-consent .c-list strong { color: #6fc2b5; }

/* ---------- 语言/主题合并下拉（省空间：一个入口替代三个并排按钮） ---------- */

[data-lang-switch] { position: relative; }
.lang-drop-btn { display: inline-flex; align-items: center; gap: 6px; }
.lang-drop-btn .lang-drop-globe { font-size: 14px; line-height: 1; }
.lang-drop-btn .lang-drop-cur { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-drop-btn .lang-drop-caret { font-size: 10px; opacity: 0.7; }
.lang-drop-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  min-width: 200px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 37, 33, 0.16);
  display: grid;
  gap: 2px;
}
.lang-drop-menu[hidden] { display: none; }
.lang-drop-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-800, #2a3532);
  font-size: 13.5px;
  cursor: pointer;
  min-height: 40px;
}
.lang-drop-opt:hover { background: var(--teal-050, #eef5f1); }
.lang-drop-opt.active { font-weight: 700; color: var(--teal-700, #0f4a45); }
.lang-drop-opt.active::after { content: '✓'; margin-left: auto; font-size: 12px; }
.lang-drop-sep {
  border: none;
  border-top: 1px solid var(--line);
  margin: 4px 8px;
  width: calc(100% - 16px);
}
html[data-theme="dark"] .lang-drop-menu { background: #1a2622; border-color: #2c3b35; }
html[data-theme="dark"] .lang-drop-opt { color: #c8d4d0; }
html[data-theme="dark"] .lang-drop-opt:hover { background: #22312c; }
html[data-theme="dark"] .lang-drop-opt.active { color: #6fc2b5; }

/* ---------- 睡眠重建：打印适配（处方卡/周课可打印贴床头） ---------- */

@media print {
  #cbti-root .card, #cbti-root .callout { break-inside: avoid; }
  #cbti-root .stat { border: 1px solid #ccc; }
  .lang-switch, .back-top { display: none !important; }
}

/* ---------- 社区平台组件（web/community，2026-10-02 重做） ---------- */

/* 命令卡：一句话启动 AI（社区首页核心动作） */
.cm-cmd-label { font-weight: 600; margin: 0 0 8px; }
.cm-cmd-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.cm-cmd {
  flex: 1 1 320px; display: block; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
  background: var(--card); color: var(--ink-900);
}
.cm-cmd-btn { flex: 0 0 auto; }
.cm-quiet { margin: 10px 0 0; font-size: 13px; }

/* 目的地瓦片：社区首页三入口（整卡可点） */
.cm-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
.cm-tile { display: block; padding: 16px 18px; text-decoration: none; }
.cm-tile :is(h2, h3) { margin: 0 0 6px; }
/* r32：箭头为 aria-hidden 装饰字形，但 16px 粗体仍按 4.5:1 对齐——brass-600 亮色
   3.76 不过线，改 brass-700（亮 #8a6528×白 5.29 / 暗翻转 #d3b071×暗卡 7.2 双过）；
   hover 提亮是瞬时装饰提示，保持 brass-500 */
.cm-tile-arrow { margin-left: 4px; font-size: 16px; font-weight: 700; color: var(--brass-700); }
.cm-tile:hover .cm-tile-arrow { color: var(--brass-500); }
.cm-tile-desc { margin: 0; font-size: 14px; }
@media (max-width: 860px) { .cm-tiles { grid-template-columns: 1fr; } }

/* 动态列表（首页最新主题/任务、论坛主题列表等） */
.cm-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.cm-list li { padding: 7px 0; border-top: 1px solid var(--line); }
.cm-list li:first-child { border-top: 0; }

/* 论坛/任务条目卡与元信息 */
.cm-item { margin-bottom: 10px; padding: 12px 16px; }
.cm-item-meta { margin: 4px 0 0; }
.cm-click { cursor: pointer; }
/* r37：条目卡从 div+onclick 改为 <a href="#/...">（键盘 Tab/Enter 原生可达）。
   锚点默认 inline + 全局链接色，此处补块级形态与配色中立——卡片文字色
   由 .card 子规则/继承承担，:focus-visible 全局金环已覆盖。 */
a.cm-item { display: block; color: inherit; text-decoration: none; }

/* 详情页标题与键值表 */
.cm-h2 { font-size: 22px; margin: 0 0 4px; }
.cm-kv { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0 14px; }
.cm-kv td { vertical-align: top; padding: 3px 0; }
.cm-kv td:first-child { width: 88px; white-space: nowrap; padding-right: 8px; }
.cm-kv.cm-kv-gap { margin: 8px 0 14px; }
.cm-ev-list { margin: 2px 0; padding-left: 18px; }
.cm-ev-list li { margin: 2px 0; }

/* 首页文末安静链接行 */
.cm-docs { margin-top: 22px; }

/* r32 对比度兜底（须置文件尾：与暗色通用 hover :1069 同特异度，靠源序取胜；
   nav-cta 的悬停/激活不落入通用导航的薄荷水洗背景，深金字面值亮暗一致） */
html[data-theme="dark"] .nav a.page-link.nav-cta,
html:not([data-theme]) .nav a.page-link.nav-cta { background: #8a6528; color: #fff; }
html[data-theme="dark"] .nav a.page-link.nav-cta:hover,
html[data-theme="dark"] .nav a.page-link.nav-cta.active,
html:not([data-theme]) .nav a.page-link.nav-cta:hover,
html:not([data-theme]) .nav a.page-link.nav-cta.active { background: #75551f; color: #fff; }
