/* =============================================================
   260628-token-cost-best-practice
   定制 showcase 页 · 仿 260621 设计语言（诊断/手帐/建筑/剧场/诊室 5 modifier）
   ============================================================= */

:root {
  /* ---- 排版 ---- */
  --serif: "Anthropic Serif", "Noto Serif SC", Georgia, serif;
  --sans: "Anthropic Sans", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* ---- 亮色 token ---- */
  --bg: #FDFDFC;
  --bg-soft: #f2efe4;
  --bg-card: #fffdf7;
  --bg-warm: #f5f1e3;
  --ink: #141413;
  --ink-soft: #3d3d3a;
  --ink-faint: #6f6e66;
  --line: rgba(31, 30, 29, 0.13);
  --line-strong: rgba(31, 30, 29, 0.22);
  --accent: #d97757;
  --accent-deep: #b85a3d;
  --accent-soft: #f1d8c8;
  --accent-wash: #fbe9dd;
  --shadow-sm: 0 1px 2px rgba(20, 20, 19, 0.04), 0 1px 3px rgba(20, 20, 19, 0.05);
  --shadow-md: 0 2px 6px rgba(20, 20, 19, 0.06), 0 10px 28px rgba(20, 20, 19, 0.08);
  --shadow-glow: 0 10px 40px rgba(217, 119, 87, 0.18);
  --radius: 14px;
  --radius-lg: 22px;
}

[data-theme="dark"] {
  --bg: #262624;
  --bg-soft: #1f1e1c;
  --bg-card: #30302e;
  --bg-warm: #2e2c28;
  --ink: #faf9f5;
  --ink-soft: #c2c0b6;
  --ink-faint: #93918a;
  --line: rgba(222, 220, 209, 0.13);
  --line-strong: rgba(222, 220, 209, 0.22);
  --accent: #e08b6b;
  --accent-deep: #f0a487;
  --accent-soft: rgba(217, 119, 87, 0.22);
  --accent-wash: rgba(217, 119, 87, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 10px 40px rgba(217, 119, 87, 0.25);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  transition: background 0.4s ease, color 0.4s ease;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ---- 全局滚动条美化（兜底） ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  background-clip: content-box;
  border: 2px solid transparent;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

/* ---- 全局装饰：噪点纸张纹理 ---- */
.grain {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.08, 0 0 0 0 0.08, 0 0 0 0 0.08, 0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
[data-theme="dark"] .grain { opacity: 0.5; mix-blend-mode: screen; }

/* ---- 顶部阅读进度条 ---- */
.reading-progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  z-index: 1000;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 12px var(--accent-soft);
}

/* =============================================================
   Layout · sidebar + content
   ============================================================= */
.layout {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  max-width: 1320px;
  margin: 0 auto;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 38px 26px 28px 32px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* nav.js 注入固定顶栏（56px）时，桌面端侧栏吸顶位置与高度同步下移，避免顶部一行被顶栏遮住 */
@media (min-width: 769px) {
  body.has-qa-nav .sidebar { top: 56px; height: calc(100vh - 56px); }
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 34px;
}
.sidebar__dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
  flex-shrink: 0;
}
.sidebar__brand-text {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}
.toc__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 14px;
  color: var(--ink-faint);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  transition: color 0.25s, background 0.25s, padding 0.25s var(--ease);
}
.toc__link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  transform: translateY(-50%);
  background: var(--accent);
  border-radius: 3px;
  transition: height 0.25s var(--ease);
}
.toc__link:hover {
  color: var(--ink);
  background: var(--bg-soft);
}
.toc__link.is-active {
  color: var(--accent-deep);
  font-weight: 500;
  background: var(--accent-wash);
  padding-left: 18px;
}
.toc__link.is-active::before {
  height: 18px;
}
.toc__num {
  display: inline-block;
  width: 28px;
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}
.toc__link.is-active .toc__num {
  color: var(--accent);
}

.sidebar__foot {
  margin-top: 22px;
  padding-top: 16px;
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

/* 移动端目录开关 */
.toc-toggle {
  display: none;
  position: fixed; top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  z-index: 1100;
  align-items: center; justify-content: center;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}
.toc-toggle span {
  width: 18px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.toc-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.toc-toggle.is-open span:nth-child(2) { opacity: 0; }
.toc-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.toc-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20, 20, 19, 0.4);
  z-index: 1050;
  opacity: 0;
  transition: opacity 0.3s;
}
.toc-backdrop.is-open { opacity: 1; }

/* =============================================================
   Content
   ============================================================= */
.content {
  padding: 0 64px 140px;
  min-width: 0;
}

.section {
  padding: 78px 0 8px;
  scroll-margin-top: 28px;
  position: relative;
}

.section__head {
  display: flex; align-items: flex-end; gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.section__index {
  font-family: var(--serif);
  font-size: 64px;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.04em;
  font-weight: 500;
  font-style: italic;
  opacity: 0.85;
}
.section__title {
  font-family: var(--serif);
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 1.2;
  color: var(--ink);
}
.section__intro {
  font-size: 17px;
  color: var(--ink-soft);
  margin-bottom: 24px;
  line-height: 1.75;
}

/* ---- 正文排版 ---- */
.content p {
  font-size: 15.5px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  line-height: 1.78;
}
.content p + p { margin-top: -2px; }
.content strong { color: var(--ink); font-weight: 600; }
.content em { color: var(--accent-deep); font-style: italic; }
.content ul, .content ol { margin: 10px 0 18px; padding-left: 26px; }
.content li {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 7px;
  line-height: 1.7;
}
.content li strong { color: var(--ink); }

/* 不间断分组（防止「项目初始化 (A)」这种被在汉字和全角括号间断行）*/
.nowrap { white-space: nowrap; }

.content h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 36px 0 14px;
}
.content h4 {
  font-family: var(--sans);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 22px 0 10px;
  letter-spacing: -0.005em;
}

.content code {
  font-family: var(--mono);
  background: var(--bg-warm);
  color: var(--accent-deep);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.88em;
}
.content pre {
  background: var(--bg-soft);
  color: var(--ink);
  padding: 18px 22px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.68;
  margin: 14px 0 22px;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) transparent;
}
.content pre::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}
.content pre::-webkit-scrollbar-track {
  background: transparent;
}
.content pre::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 999px;
}
.content pre::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
.content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ---- Hero ---- */
.hero {
  position: relative;
  padding: 96px 0 56px;
  overflow: hidden;
}
.hero__glow {
  position: absolute;
  top: -140px; right: -120px;
  width: 520px; height: 520px;
  background: radial-gradient(circle at center, var(--accent-soft) 0%, transparent 65%);
  pointer-events: none;
  filter: blur(8px);
  opacity: 0.85;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 22px;
  padding: 5px 14px 5px 10px;
  background: var(--accent-wash);
  border-radius: 999px;
}
.hero__eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero__title {
  font-family: var(--serif);
  font-size: clamp(34px, 5.6vw, 58px);
  line-height: 1.12;
  letter-spacing: -0.022em;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 28px;
  max-width: 880px;
}
.hero__title span { display: block; }
.hero__title-accent {
  color: var(--accent-deep);
  font-style: italic;
}
.hero__title em {
  font-style: italic;
  color: var(--accent);
  background: linear-gradient(180deg, transparent 60%, var(--accent-wash) 60%);
  padding: 0 4px;
}
.hero__lead {
  font-size: 18px;
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 720px;
  margin-bottom: 30px;
}
.hero__lead mark {
  background: linear-gradient(180deg, transparent 55%, var(--accent-wash) 55%);
  color: var(--ink);
  padding: 0 2px;
}
.hero__keywords {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 36px;
}
.kw {
  font-size: 13px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.kw:hover {
  color: var(--accent-deep);
  background: var(--accent-wash);
  border-color: var(--accent-soft);
}
.hero__scroll {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 30px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.hero__scroll:hover {
  background: var(--accent-wash);
  border-color: var(--accent-soft);
  color: var(--accent-deep);
}
.hero__scroll svg { animation: bob 2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* ---- 卡片基础（无边框，仅留白） ---- */
.card {
  background: transparent;
  border-radius: var(--radius);
  padding: 4px 0;
  margin: 18px 0;
}
.card h4:first-child { margin-top: 0; }
.card h3:first-child { margin-top: 0; }

/* ---- 表格（仅行底线，无外框） ---- */
.content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  margin: 16px 0 24px;
  background: transparent;
}
.content table th {
  background: var(--bg-warm);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
}
.content table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: top;
}
.content table tr:last-child td { border-bottom: none; }
.content table tr:hover td { background: var(--bg-warm); }

/* ---- callout / pullquote（无边框，仅左 3px） ---- */
.callout {
  margin: 18px 0;
  padding: 16px 22px;
  border-radius: 12px;
  background: var(--bg-warm);
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.callout--warn {
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
}
.callout--note { border-left: 3px solid var(--line-strong); }
.callout strong { color: var(--ink); }

.pullquote {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.55;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 22px;
  margin: 28px 0;
  font-style: italic;
}
.pullquote strong { font-style: normal; color: var(--accent-deep); }

/* ---- conclusion box（保留左侧橙条标识） ---- */
.conclusion-box {
  margin: 36px 0;
  padding: 32px 36px;
  background: var(--bg-warm);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.conclusion-box h3 {
  margin-top: 0;
  color: var(--accent-deep);
}

/* =============================================================
   reveal-up 动画
   ============================================================= */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  animation: rise 0.9s var(--ease) forwards;
  animation-delay: calc(var(--d, 0) * 0.12s);
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}
.reveal-up {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal-up.is-visible {
  opacity: 1;
  transform: none;
}

/* =============================================================
   特殊构件占位（下一轮补完）
   ============================================================= */

/* ---- 01 章：根因 · 诊断报告风 ---- */

/* 章节冷调底色，营造剖检台氛围 */
.section--diagnosis {
  position: relative;
}
.section--diagnosis::before {
  content: "";
  position: absolute;
  inset: 40px -32px 0;
  background: #f6f5ef;
  border-radius: 18px;
  z-index: -1;
}
[data-theme="dark"] .section--diagnosis::before {
  background: #222220;
}
.section--diagnosis .section__index {
  color: #8a857a;
  font-style: normal;
  font-family: var(--mono);
  font-size: 44px;
  letter-spacing: -0.02em;
  opacity: 1;
  position: relative;
}
.section--diagnosis .section__index::before {
  content: "DX";
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: #c83232;
  letter-spacing: 0.18em;
  font-weight: 600;
  margin-bottom: 2px;
}

/* 段引：左侧灰竖线 + 引文 */
.section--diagnosis .section__intro {
  border-left: 3px solid #c2bfb4;
  padding-left: 18px;
  font-size: 16.5px;
  font-style: italic;
  color: var(--ink-soft);
}

/* 病历卡片 · 默认全展开 + 等高 */
.cause-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 28px 0 22px;
  align-items: stretch;
}
.cause-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 30px 22px 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.cause-card::before {
  /* 顶部 2px 橙红色诊断条 */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #c83232 0%, var(--accent) 100%);
}
.cause-card::after {
  /* 右上角病历号 */
  content: "CASE #" attr(data-case);
  position: absolute;
  top: 10px; right: 14px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: #a39e90;
}

.cause-card__tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: #c83232;
  background: #fce8e8;
  padding: 3px 9px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-weight: 600;
  align-self: flex-start;
}
[data-theme="dark"] .cause-card__tag {
  background: rgba(200, 50, 50, 0.2);
  color: #ee7a7a;
}
.cause-card__title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.4;
  min-height: 48px;
}
.cause-card__lead {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}
.cause-card__detail {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.7;
  flex: 1;
}
.cause-card__detail p {
  font-size: 13.5px;
  margin-bottom: 8px;
}
.cause-card__detail p:last-child {
  margin-bottom: 0;
}
.cause-card__detail ul {
  margin: 6px 0;
  padding-left: 18px;
}
.cause-card__detail li {
  font-size: 13px;
  margin-bottom: 4px;
  line-height: 1.6;
}
.cause-card__detail code {
  font-size: 0.85em;
}

/* 心电图风衰减容器 */
.attention-decay {
  margin: 32px 0;
  padding: 32px 28px 22px;
  background: #fcfbf6;
  border-radius: var(--radius);
  position: relative;
}
[data-theme="dark"] .attention-decay {
  background: #2a2826;
}
.attention-decay::before {
  /* 顶部像监护仪屏幕的标记条 */
  content: "● MONITOR";
  position: absolute;
  top: 14px; left: 24px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: #c83232;
  font-weight: 600;
}
.attention-decay__title {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 14px;
}
.attention-decay svg { width: 100%; height: auto; max-height: 200px; }
.attention-decay__legend {
  display: flex; gap: 22px;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 10px;
  flex-wrap: wrap;
}
.attention-decay__legend span { display: flex; align-items: center; gap: 6px; }
.attention-decay__legend i {
  width: 12px; height: 3px; border-radius: 2px;
  display: inline-block;
}

/* 诊断结论 callout */
.callout--diagnosis {
  position: relative;
  background: linear-gradient(135deg, #fff5ed, #fbe9dd);
  border-left: 3px solid #c83232;
  padding: 18px 22px 18px 60px;
}
.callout--diagnosis::before {
  content: "Rx";
  position: absolute;
  left: 20px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
  color: #c83232;
  font-weight: 600;
}
[data-theme="dark"] .callout--diagnosis {
  background: linear-gradient(135deg, rgba(200, 50, 50, 0.16), rgba(217, 119, 87, 0.16));
}
[data-theme="dark"] .callout--diagnosis::before { color: #ee7a7a; }

@media (max-width: 960px) {
  .cause-grid { grid-template-columns: 1fr; }
  .section--diagnosis::before { inset: 30px -16px 0; }
}

/* ---- 02 章：L1→L5 层堆叠 · 建筑分层风 ---- */

.section--architecture {
  position: relative;
}
.section--architecture .section__index {
  color: #8c6f50;
  font-style: normal;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 64px;
  opacity: 1;
  position: relative;
}
.section--architecture .section__index::after {
  content: "";
  display: block;
  width: 48px;
  height: 2px;
  background: #c89868;
  margin-top: 6px;
}
.section--architecture .section__intro {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 760px;
}
.section--architecture .section__intro em {
  font-style: normal;
  color: var(--accent-deep);
  background: linear-gradient(180deg, transparent 60%, var(--accent-wash) 60%);
  padding: 0 4px;
}

.layers {
  margin: 32px 0 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 0;
  position: relative;
  padding: 0 4%;
}
/* 楼层左侧地基阴影线 */
.layers::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -8px;
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    var(--line-strong),
    var(--line-strong) 1px,
    transparent 1px,
    transparent 8px
  );
  opacity: 0.5;
}

.layer {
  position: relative;
  display: grid;
  grid-template-columns: 70px 1fr 130px;
  align-items: center;
  gap: 18px;
  padding: 18px 26px;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s var(--ease);
  border-radius: 0;
  margin: 0 auto;
  width: 100%;
}

/* 楼层底色：自下而上从浅米到深米褐 + 宽度递减（像金字塔/建筑剖面） */
.layer[data-level="L1"] {
  background: #f8f5ec;
  max-width: 100%;
}
.layer[data-level="L2"] {
  background: #f1ebd9;
  max-width: 96%;
}
.layer[data-level="L3"] {
  background: #ebe2c6;
  max-width: 92%;
}
.layer[data-level="L4"] {
  background: #e3d6b0;
  max-width: 88%;
}
.layer[data-level="L5"] {
  background: #d9c79a;
  max-width: 84%;
  border-radius: 8px 8px 0 0;
}
.layer[data-level="L1"] {
  border-radius: 0 0 8px 8px;
}

[data-theme="dark"] .layer[data-level="L1"] { background: #2c2a26; }
[data-theme="dark"] .layer[data-level="L2"] { background: #34302a; }
[data-theme="dark"] .layer[data-level="L3"] { background: #3d362d; }
[data-theme="dark"] .layer[data-level="L4"] { background: #463c30; }
[data-theme="dark"] .layer[data-level="L5"] { background: #504434; }

/* 楼层间细分割线 */
.layer + .layer {
  border-bottom: 1px solid rgba(140, 111, 80, 0.18);
}
[data-theme="dark"] .layer + .layer {
  border-bottom: 1px solid rgba(255, 245, 220, 0.08);
}

.layer:hover {
  transform: scale(1.015);
  z-index: 2;
  box-shadow: 0 4px 18px rgba(140, 111, 80, 0.15);
}
.layer.is-active {
  background: var(--accent-wash);
  border-left: 4px solid var(--accent);
  padding-left: 22px;
  z-index: 3;
  box-shadow: 0 6px 24px rgba(217, 119, 87, 0.18);
}
[data-theme="dark"] .layer.is-active {
  background: rgba(217, 119, 87, 0.22);
}

.layer__no {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: #8c6f50;
  font-style: italic;
  line-height: 1;
}
[data-theme="dark"] .layer__no { color: #d9b890; }
.layer.is-active .layer__no { color: var(--accent-deep); }

.layer__name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}
.layer__desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.layer__strength {
  font-size: 12px;
  color: #8c6f50;
  letter-spacing: 0.04em;
  text-align: right;
  font-weight: 600;
}
[data-theme="dark"] .layer__strength { color: #d9b890; }
.layer.is-active .layer__strength { color: var(--accent-deep); }
.layer__strength i {
  display: inline-block;
  margin-left: 1px;
  color: inherit;
  opacity: 0.4;
}

/* 建筑解说卡：像建筑设计说明书 */
.layer-explain {
  margin: 28px 0 0;
  padding: 18px 22px 18px 56px;
  background: #fdfbf2;
  border-left: 3px solid #c89868;
  border-radius: 0 12px 12px 0;
  font-size: 14.5px;
  color: var(--ink);
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity 0.3s;
  position: relative;
}
.layer-explain::before {
  content: "BLUEPRINT";
  position: absolute;
  left: 16px;
  top: 10px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: #c89868;
  font-weight: 700;
}
[data-theme="dark"] .layer-explain {
  background: #2e2a23;
}

@media (max-width: 960px) {
  .layers { padding: 0; }
  .layer[data-level="L1"],
  .layer[data-level="L2"],
  .layer[data-level="L3"],
  .layer[data-level="L4"],
  .layer[data-level="L5"] {
    max-width: 100%;
  }
}

/* ---- 03 章：5 步 SOP · 手帐本阶梯风 ---- */

.section--notebook {
  position: relative;
}
.section--notebook .section__index {
  color: var(--accent-deep);
  font-family: var(--serif);
  font-style: italic;
  font-size: 64px;
  font-weight: 500;
  opacity: 1;
}
.section--notebook .section__index::after {
  content: "/ 05";
  display: inline-block;
  font-family: var(--mono);
  font-size: 14px;
  font-style: normal;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  margin-left: 8px;
  vertical-align: middle;
  font-weight: 400;
}
.section--notebook .section__intro em {
  font-style: normal;
  color: var(--accent-deep);
  font-weight: 500;
}

/* 手帐纸张容器：米黄底 + 浅蓝横线背景 */
.notebook {
  margin: 32px 0 24px;
  padding: 36px 44px 28px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 31px,
      rgba(150, 180, 210, 0.15) 31px,
      rgba(150, 180, 210, 0.15) 32px
    ),
    #fdfaf0;
  border-radius: 8px;
  position: relative;
}
.notebook::before {
  /* 左侧装订红线（手帐本竖红边） */
  content: "";
  position: absolute;
  left: 26px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(217, 119, 87, 0.35);
}
[data-theme="dark"] .notebook {
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 31px,
      rgba(150, 180, 210, 0.06) 31px,
      rgba(150, 180, 210, 0.06) 32px
    ),
    #2a2826;
}

.nb-step {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 24px;
  padding: 18px 0 18px 12px;
  margin-left: 0;
  transition: margin-left 0.3s var(--ease);
}
/* 阶梯效果：每个 step 向右偏移一档 */
.nb-step:nth-child(1) { margin-left: 0; }
.nb-step:nth-child(2) { margin-left: 14px; }
.nb-step:nth-child(3) { margin-left: 28px; }
.nb-step:nth-child(4) { margin-left: 42px; }
.nb-step:nth-child(5) { margin-left: 56px; }

.nb-step + .nb-step::before {
  /* step 之间的手绘连接线 + 箭头 */
  content: "";
  position: absolute;
  left: -14px;
  top: -6px;
  width: 24px;
  height: 22px;
  border-left: 1.5px dashed rgba(217, 119, 87, 0.4);
  border-bottom: 1.5px dashed rgba(217, 119, 87, 0.4);
  border-bottom-left-radius: 12px;
  pointer-events: none;
}

.nb-step__no {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 6px;
}
.nb-step__no-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 2px;
}
.nb-step__no-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 56px;
  font-weight: 500;
  color: var(--ink-faint);
  line-height: 1;
  transition: color 0.25s;
}
.nb-step:hover .nb-step__no-num {
  color: var(--accent);
}

.nb-step__body {
  padding-top: 4px;
}
.nb-step__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.nb-step__title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.nb-step__time {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  background: var(--accent-wash);
  color: var(--accent-deep);
  border-radius: 999px;
  font-weight: 600;
}
.nb-step__desc {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.75;
  margin-bottom: 12px;
}
.nb-step__desc:last-child { margin-bottom: 0; }
.nb-step__desc code {
  font-family: var(--mono);
  background: rgba(217, 119, 87, 0.1);
  color: var(--accent-deep);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.nb-step__list {
  margin: 8px 0 12px;
  padding-left: 18px;
}
.nb-step__list li {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  line-height: 1.65;
}
.nb-step__list li strong { color: var(--ink); }
.nb-step__quote {
  margin: 12px 0;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.6);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13.5px;
  color: var(--ink);
}
[data-theme="dark"] .nb-step__quote {
  background: rgba(255, 255, 255, 0.04);
}
.nb-step__quote strong { color: var(--accent-deep); }

@media (max-width: 960px) {
  .notebook { padding: 28px 22px 20px; }
  .notebook::before { left: 14px; }
  .nb-step { grid-template-columns: 62px 1fr; gap: 16px; padding-left: 6px; }
  .nb-step:nth-child(1),
  .nb-step:nth-child(2),
  .nb-step:nth-child(3),
  .nb-step:nth-child(4),
  .nb-step:nth-child(5) { margin-left: 0; }
  .nb-step + .nb-step::before { display: none; }
  .nb-step__no-num { font-size: 40px; }
  .nb-step__title { font-size: 18px; }
}

/* ---- 05 章：售货机 · 剧场演示风 ---- */

.section--theatre {
  position: relative;
}
.section--theatre .section__index {
  color: #b85a3d;
  font-family: var(--serif);
  font-style: italic;
  font-size: 60px;
  font-weight: 500;
  opacity: 1;
  position: relative;
  padding-left: 0;
}
.section--theatre .section__index::after {
  content: "ACT 01";
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  font-weight: 600;
  margin-left: 14px;
  vertical-align: middle;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}
.section--theatre .section__intro em {
  font-style: italic;
  color: var(--accent-deep);
  font-weight: 500;
}

/* 剧场幕布容器 */
.theatre-stage {
  position: relative;
  margin: 32px 0 28px;
  padding: 48px 44px 36px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(217, 119, 87, 0.12), transparent 60%),
    linear-gradient(180deg, #f8efe2 0%, #f1e3cf 100%);
  border-radius: 8px;
  overflow: hidden;
}
[data-theme="dark"] .theatre-stage {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(217, 119, 87, 0.18), transparent 60%),
    linear-gradient(180deg, #2e2924 0%, #25201c 100%);
}
/* 顶部幕布褶皱 */
.theatre-stage::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 18px;
  background: repeating-linear-gradient(
    90deg,
    #b85a3d 0,
    #b85a3d 12px,
    #a04a30 12px,
    #a04a30 14px,
    #b85a3d 14px,
    #b85a3d 26px,
    #c96b4e 26px,
    #c96b4e 28px
  );
  border-bottom: 2px solid rgba(0, 0, 0, 0.18);
}
.theatre-stage::after {
  /* 幕布底部投影 */
  content: "";
  position: absolute;
  top: 18px; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent);
  pointer-events: none;
}

/* 左侧聚光灯标签 */
.theatre-stage__act-label {
  position: absolute;
  top: 32px;
  left: 22px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: #b85a3d;
  font-weight: 700;
}

.vending {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  align-items: center;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  position: relative;
}
.vending__svg {
  width: 100%;
  max-width: 240px;
  filter: drop-shadow(0 12px 24px rgba(60, 40, 30, 0.18));
}

/* 右侧字幕 / 旁白区 */
.vending__side {
  position: relative;
}
.vending__side h4 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 16px;
  line-height: 1.35;
}
.vending__side h4 strong {
  color: var(--accent-deep);
  font-style: normal;
  font-weight: 600;
}
.vending__side > p {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 20px;
  line-height: 1.75;
}
.vending__side > p strong {
  color: var(--ink);
  background: linear-gradient(180deg, transparent 55%, rgba(217, 119, 87, 0.18) 55%);
  padding: 0 3px;
}
.vending__side > p code {
  background: rgba(217, 119, 87, 0.12);
  color: var(--accent-deep);
}

/* 旁白气泡 */
.vending__caption {
  margin-top: 16px;
  margin-bottom: 16px;
  padding: 14px 18px 14px 44px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 4px 10px 10px 10px;
  font-size: 13.5px;
  color: var(--ink);
  font-style: italic;
  min-height: 24px;
  position: relative;
  transition: background 0.3s;
}
.vending__caption::before {
  content: "❝";
  position: absolute;
  left: 14px;
  top: 6px;
  font-family: var(--serif);
  font-size: 28px;
  color: var(--accent);
  font-style: normal;
  line-height: 1;
}
[data-theme="dark"] .vending__caption {
  background: rgba(255, 255, 255, 0.06);
}

/* 暖橙扁平按钮（克制版） */
.vending__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.02em;
}
.vending__btn:hover {
  background: var(--accent-deep);
}
.vending__btn::before {
  content: "▸";
  font-size: 11px;
  opacity: 0.85;
}

/* 售货机 SVG 内饮料弹出动画：由 JS Web Animations API 驱动（兼容 SVG 元素） */
.vending-drink {
  transition: none;
}

@media (max-width: 960px) {
  .theatre-stage { padding: 40px 22px 28px; }
  .vending { grid-template-columns: 1fr; gap: 28px; }
  .vending__svg { max-width: 200px; margin: 0 auto; }
  .vending__side h4 { font-size: 19px; }
}

/* ---- 08 章：决策树 · 诊室问诊风 ---- */

.section--clinic {
  position: relative;
}
.section--clinic .section__index {
  color: #9c3a2a;
  font-family: var(--mono);
  font-style: normal;
  font-weight: 600;
  font-size: 48px;
  letter-spacing: -0.02em;
  opacity: 1;
  position: relative;
}
.section--clinic .section__index::before {
  content: "ROOM";
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: #9c3a2a;
  letter-spacing: 0.22em;
  font-weight: 700;
  margin-bottom: 2px;
}
.section--clinic .section__intro em {
  font-style: italic;
  color: var(--accent-deep);
  font-weight: 500;
}

/* 问诊单容器 */
.tree {
  margin: 32px 0 24px;
  background: #fdfbf2;
  border-radius: 4px;
  padding: 36px 40px 28px;
  position: relative;
  border-top: 4px solid #9c3a2a;
}
[data-theme="dark"] .tree {
  background: #2c2a26;
  border-top-color: #b85a3d;
}
.tree::before {
  /* 顶部门诊抬头 */
  content: "INTAKE FORM · 决策问诊";
  position: absolute;
  top: 12px;
  left: 40px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #9c3a2a;
  font-weight: 700;
}
.tree::after {
  /* 顶部右侧"门诊号" */
  content: "NO. 2026·06·21-A";
  position: absolute;
  top: 12px;
  right: 40px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  font-weight: 600;
}

.tree__question {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  margin: 24px 0 14px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(156, 58, 42, 0.25);
}
.tree__question-no {
  font-family: var(--mono);
  font-size: 11px;
  color: #9c3a2a;
  padding: 3px 8px;
  background: rgba(156, 58, 42, 0.1);
  border-radius: 3px;
  letter-spacing: 0.08em;
  font-weight: 700;
  flex-shrink: 0;
}
[data-theme="dark"] .tree__question-no {
  background: rgba(217, 119, 87, 0.18);
  color: #ee8a6a;
}
.tree__question-no::before {
  content: "Q";
}
.tree__question-no::before {
  content: "";  /* reset, 我们直接在 HTML 写 Q1 */
}

.tree__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.tree__option {
  padding: 12px 16px 12px 38px;
  background: #fffefa;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: left;
  font-family: inherit;
  position: relative;
  transition: color 0.2s, background 0.2s;
}
[data-theme="dark"] .tree__option {
  background: rgba(255, 255, 255, 0.04);
}
.tree__option::before {
  /* 选择框（空心方块） */
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink-faint);
  border-radius: 2px;
  transition: border-color 0.2s, background 0.2s;
}
.tree__option:hover {
  color: var(--ink);
  background: #fff8ee;
}
.tree__option:hover::before {
  border-color: #9c3a2a;
}
.tree__option.is-yes {
  background: rgba(217, 119, 87, 0.1);
  color: var(--accent-deep);
  font-weight: 500;
}
.tree__option.is-yes::before {
  border-color: var(--accent);
  background: var(--accent);
}
.tree__option.is-yes::after {
  /* 勾选标 */
  content: "✓";
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-55%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.tree__option.is-yes:hover {
  background: rgba(217, 119, 87, 0.2);
}

/* 处方笺结果 */
.tree__result {
  display: none;
  margin-top: 22px;
  padding: 22px 26px 22px 64px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 27px,
      rgba(156, 58, 42, 0.05) 27px,
      rgba(156, 58, 42, 0.05) 28px
    ),
    #fffdf3;
  border-radius: 2px;
  border-left: 4px solid #9c3a2a;
  font-size: 14.5px;
  color: var(--ink);
  position: relative;
}
[data-theme="dark"] .tree__result {
  background: #322f29;
}
.tree__result.is-shown {
  display: block;
  animation: rxRise 0.5s var(--ease);
}
.tree__result::before {
  /* Rx 处方标识 */
  content: "Rx";
  position: absolute;
  left: 20px;
  top: 18px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 700;
  color: #9c3a2a;
  line-height: 1;
}
.tree__result::after {
  /* "处方笺"右上角小标 */
  content: "PRESCRIPTION";
  position: absolute;
  top: 12px;
  right: 22px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: #9c3a2a;
  font-weight: 700;
}
.tree__result strong {
  color: var(--accent-deep);
}
@keyframes rxRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tree__reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--ink-faint);
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  letter-spacing: 0.06em;
  transition: color 0.2s, border-color 0.2s;
}
.tree__reset::before { content: "↻"; }
.tree__reset:hover {
  color: #9c3a2a;
  border-color: #9c3a2a;
}

@media (max-width: 960px) {
  .tree { padding: 32px 22px 22px; }
  .tree::before, .tree::after { left: 22px; right: 22px; }
  .tree::after { right: 22px; }
  .tree__options { grid-template-columns: 1fr; }
  .tree__result { padding-left: 56px; }
}

/* =============================================================
   终章 · final 深色总结块
   ============================================================= */
.section--final { padding-top: 90px; }
.final {
  position: relative;
  padding: 56px 50px;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(150deg, #2B2A27 0%, #3A352F 100%);
  color: #F5F4EE;
}
.final__glow {
  position: absolute;
  top: -40%;
  right: -10%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(217, 119, 87, 0.4), transparent 60%);
  filter: blur(18px);
  pointer-events: none;
}
.final__index {
  display: inline-block;
  position: relative;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-soft);
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.final__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.4;
  margin: 14px 0 26px;
  position: relative;
  color: #F5F4EE;
}
.final__title em {
  font-style: italic;
  color: var(--accent);
}
.final .final__lead {
  font-size: 16px;
  color: #EDE9DE;
  margin: 0 0 22px;
  position: relative;
  line-height: 1.7;
  font-weight: 400;
}
.final .final__lead strong {
  color: #fff;
  font-weight: 600;
}
.final__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.final .final__list span {
  display: block;
  font-size: 15px;
  padding: 14px 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d8d4c8;
  font-weight: 400;
  line-height: 1.6;
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.final .final__list span strong {
  color: #ffffff;
  font-weight: 700;
}
.final__list span:hover {
  background: rgba(217, 119, 87, 0.22);
  border-color: var(--accent);
  transform: translateX(4px);
}

.doc-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 60px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-faint);
}
.doc-foot__dot { color: var(--accent); }

/* =============================================================
   Page footer · 跨整屏宽度 · 仿 260620
   ============================================================= */
.page-footer {
  position: relative;
  z-index: 2;
  margin-top: 24px;
  padding: 64px 0 36px;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg-warm) 100%);
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--sans);
}
.page-footer__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 64px;
}
.page-footer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.page-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-footer__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
  width: max-content;
  transition: opacity 0.25s;
}
.page-footer__logo:hover { opacity: 0.85; }
.page-footer__mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.page-footer__mark svg { width: 28px; height: 28px; display: block; }
.page-footer__name { font-weight: 400; }
.page-footer__name em { font-style: italic; color: var(--accent); }
.page-footer__tagline {
  font-size: 14.5px;
  color: var(--ink-faint);
  line-height: 1.85;
  max-width: 380px;
  margin: 0;
}
.page-footer__keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.page-footer__keywords span {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--ink-faint);
  font-weight: 500;
  transition: color 0.25s, background 0.25s, border-color 0.25s;
}
.page-footer__keywords span:hover {
  background: var(--accent-wash);
  border-color: var(--accent-soft);
  color: var(--accent-deep);
}

.page-footer__cta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 28px;
  background: var(--bg-card);
  border-radius: var(--radius);
  text-align: left;
  margin: 0;
  max-width: none;
}
.page-footer__cta-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.005em;
}
.page-footer__cta-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.75;
  margin: 0 0 4px;
}
.page-footer__cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  background: var(--accent);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 9px;
  text-decoration: none;
  width: max-content;
  transition: background 0.2s;
}
.page-footer__cta-btn:hover {
  background: var(--accent-deep);
}
.page-footer__cta-btn svg { transition: transform 0.2s var(--ease); }
.page-footer__cta-btn:hover svg { transform: translateX(2px); }

.page-footer__minor {
  display: flex;
  gap: 18px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.page-footer__minor-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.25s;
}
.page-footer__minor-link:hover { color: var(--accent-deep); }
.page-footer__minor-link svg { opacity: 0.7; }

.page-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  font-size: 13px;
  color: var(--ink-faint);
}
.page-footer__made-with {
  font-family: var(--serif);
  font-style: italic;
}

@media (max-width: 1080px) {
  .page-footer__inner { padding: 0 40px; }
  .page-footer__grid { gap: 36px; }
}
@media (max-width: 820px) {
  .page-footer { padding: 48px 0 32px; }
  .page-footer__inner { padding: 0 22px; }
  .page-footer__grid { grid-template-columns: 1fr; gap: 32px; padding-bottom: 28px; }
  .page-footer__cta { padding: 22px 22px; }
  .page-footer__bottom { flex-direction: column; gap: 8px; padding-top: 18px; }
  .final { padding: 40px 26px; }
  .final__title { font-size: 22px; line-height: 1.5; }
  .doc-foot { margin-top: 42px; padding-top: 20px; font-size: 12.5px; }
}

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: min(280px, 80vw);
    height: 100vh;
    z-index: 1080;
    transform: translateX(-100%);
    transition: transform 0.32s var(--ease);
    box-shadow: var(--shadow-md);
    border-right: 1px solid var(--line);
  }
  .sidebar.is-open { transform: none; }
  .toc-toggle { display: flex; }
  .toc-backdrop.is-open { display: block; }
  .content { padding: 0 22px 100px; }
  .hero { padding: 64px 0 36px; }
  .hero__title { font-size: clamp(28px, 7vw, 38px); }
  .section { padding: 56px 0 4px; }
  .section__index { font-size: 48px; }
  .cause-grid { grid-template-columns: 1fr; }
  .layer { grid-template-columns: 50px 1fr 90px; padding: 14px 16px; gap: 12px; }
  .layer__name { font-size: 15px; }
  .layer__desc { font-size: 12.5px; }
  .pipeline__track { grid-template-columns: 1fr 1fr; row-gap: 24px; }
  .pipeline__track::before { display: none; }
  .vending { grid-template-columns: 1fr; gap: 18px; }
  .vending__svg { max-width: 220px; margin: 0 auto; }
  .tree__options { grid-template-columns: 1fr; }
  .conclusion-box { padding: 24px; }
}

@media (max-width: 560px) {
  .hero__keywords { gap: 8px; }
  .kw { font-size: 12px; padding: 5px 11px; }
  .section__head { gap: 12px; align-items: center; }
  .section__index { font-size: 40px; }
  .section__title { font-size: 22px; }
  .content pre { padding: 14px 16px; font-size: 12px; }
  .content table { font-size: 13px; }
  .content table th, .content table td { padding: 10px 12px; }
  .pullquote { font-size: 18px; }
}

/* =============================================================
   本文专属构件 · 260628
   ============================================================= */

/* ---- 01 章：成本占比条形图（诊断风）---- */
.cost-bars {
  margin: 30px 0 24px;
  padding: 32px 28px 24px;
  background: #fcfbf6;
  border-radius: var(--radius);
  position: relative;
}
[data-theme="dark"] .cost-bars { background: #2a2826; }
.cost-bars::before {
  content: "● TOKEN BREAKDOWN";
  position: absolute;
  top: 14px; left: 24px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: #c83232;
  font-weight: 600;
}
.cost-bars__title {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  margin: 14px 0 20px;
}
.cost-bar {
  display: grid;
  grid-template-columns: 132px 1fr 64px;
  align-items: center;
  gap: 14px;
  margin-bottom: 11px;
}
.cost-bar__label {
  font-size: 13px;
  color: var(--ink-soft);
  text-align: right;
  font-family: var(--mono);
  letter-spacing: -0.01em;
}
.cost-bar__track {
  height: 22px;
  background: var(--bg-warm);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.cost-bar__fill {
  height: 100%;
  border-radius: 5px;
  width: 0;
  transition: width 1s var(--ease);
  background: linear-gradient(90deg, #c8988c, #b06a52);
}
.cost-bar.is-user .cost-bar__fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
}
.cost-bar__val {
  font-size: 12.5px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-weight: 600;
}
.cost-bar.is-user .cost-bar__label,
.cost-bar.is-user .cost-bar__val { color: var(--accent-deep); }
.cost-bars__note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-faint);
  font-style: italic;
}

/* ---- 07 章：Orchestrator-Worker 编排图（剧场风）---- */
.orchestra {
  margin: 8px 0 4px;
}
.orchestra__lead {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: var(--bg-card);
  border-radius: 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--accent);
}
.orchestra__lead-badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #fff;
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 700;
  flex-shrink: 0;
}
.orchestra__lead-text { font-size: 14px; color: var(--ink-soft); }
.orchestra__lead-text strong { color: var(--ink); }
.orchestra__arrow {
  text-align: center;
  color: var(--accent);
  font-size: 18px;
  margin: 2px 0;
  opacity: 0.6;
}
.orchestra__workers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.worker-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 16px 16px 14px;
  border-top: 2px solid var(--accent-soft);
  transition: transform 0.25s var(--ease), border-color 0.25s;
}
.worker-card:hover {
  transform: translateY(-2px);
  border-top-color: var(--accent);
}
.worker-card__no {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent-deep);
  font-weight: 700;
  margin-bottom: 6px;
}
.worker-card__title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}
.worker-card__ctx {
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.6;
}
.worker-card__ctx code {
  font-size: 0.85em;
  background: var(--bg-warm);
  color: var(--accent-deep);
  padding: 1px 4px;
  border-radius: 3px;
}
@media (max-width: 960px) {
  .orchestra__workers { grid-template-columns: 1fr; }
  .cost-bar { grid-template-columns: 96px 1fr 52px; gap: 10px; }
  .cost-bar__label { font-size: 11.5px; }
}
