/* ============================================================
   《证伪》 FALSIFY — 写给 AI 时代的测试小书
   设计系统:验证台 · 红绿账
   暖白账本纸底(横向账本线 + 左侧红margin线)、绿=通过 / 红=未过
   双色贯穿全书;琥珀=抖动/存疑,青板=中性说明,紫=AI 的声音。
   测试运行器的输出(✓ / ✗ / 点阵)是一等公民,和 demo 同一套颜色。
   亮色 only(用户眼睛受不了暗色)。零依赖,系统字体栈。
   ============================================================ */

:root {
  /* —— 纸与墨(暖白账本) —— */
  --paper: #F7F5EF;          /* 暖白检验单纸 */
  --paper-2: #F0ECE1;        /* 卡片 / 表头 */
  --paper-3: #E5DFCE;        /* 分隔 */
  --ink: #211F1A;            /* 标题墨 */
  --ink-body: #45423A;       /* 正文 */
  --ink-faint: #8B8577;      /* 次要标注 */
  --line: #DBD5C4;           /* 账本线 */
  --line-strong: #CDC6B2;

  /* —— 两个主角:通过 / 未过 —— */
  --pass: #1E8E52;           /* 绿:通过 PASS */
  --pass-deep: #14643A;
  --pass-mist: #E6F2E9;
  --fail: #CB3A34;           /* 红:未过 FAIL */
  --fail-deep: #98231F;
  --fail-mist: #FAE7E4;

  /* —— 配角 —— */
  --flag: #C08A1E;           /* 琥珀:抖动 / 存疑 / 掌故 */
  --flag-deep: #8C6210;
  --flag-mist: #F7EFD9;
  --info: #2C6E8C;           /* 青板:中性说明 / 结构 / 链接 */
  --info-deep: #1E4E64;
  --info-mist: #E3EFF3;
  --ai: #6B54C9;             /* 紫:AI 的声音(它"确信"的那一栏) */
  --ai-deep: #4C39A0;
  --ai-mist: #ECE7FA;

  /* —— 语言色(代码纸顶条) —— */
  --kt: #7F52FF; --kt-mist: #F0EBFF;      /* Kotlin */
  --ts: #2F74C0; --ts-mist: #E6F0FA;      /* TypeScript / JS */
  --java: #C0672B; --java-mist: #F8ECE0;  /* Java */
  --xml: #4B8f6a; --xml-mist: #E7F1EB;    /* XML / Gradle */

  /* —— 代码 token —— */
  --tok-kw: #B5462F;         /* 关键字:砖红 */
  --tok-ty: #1E6E7C;         /* 类型:青 */
  --tok-str: #1E8E52;        /* 字符串:绿 */
  --tok-num: #A65A1E;        /* 数字:棕 */
  --tok-com: #9A9384;        /* 注释:灰 */
  --tok-op:  #7A4FC0;        /* 操作符:紫 */
  --tok-fn:  #211F1A;        /* 函数名 */
  --tok-ann: #C08A1E;        /* 注解:琥珀 */

  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;

  --topbar-h: 56px;
  --maxw: 800px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }

body {
  font-family: var(--sans);
  background-color: var(--paper);
  /* 账本纸:极淡横向账线,顶部对齐排版基线 */
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 31px, rgba(33,31,26,0.035) 31px 32px);
  color: var(--ink-body);
  line-height: 1.9;
  font-size: 16.5px;
  padding-top: var(--topbar-h);
}

::selection { background: rgba(30, 142, 82, 0.18); }

a { color: var(--info-deep); text-decoration: none; border-bottom: 1px solid rgba(44, 110, 140, 0.35); }
a:hover { color: var(--fail); border-bottom-color: var(--fail); }

code {
  font-family: var(--mono);
  font-size: 0.855em;
  background: rgba(33, 31, 26, 0.055);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--ink);
  word-break: break-word;
}

strong { color: var(--ink); }
em { font-style: normal; color: var(--info-deep); font-weight: 600; }

/* ============ 顶部条(fixed):验证台状态栏 ============ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  height: var(--topbar-h);
  background: rgba(247, 245, 239, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
}
.topbar .brand {
  font-family: var(--serif);
  font-weight: 700; font-size: 19px; letter-spacing: 0.2em;
  color: var(--ink); border: none; white-space: nowrap;
  display: flex; align-items: center; gap: 9px;
}
.topbar .brand:hover { color: var(--pass-deep); }
.topbar .brand .mark {
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  color: #fff; background: var(--pass);
  width: 24px; height: 24px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.35);
}
/* 阅读进度:一条测试运行点阵(读过=绿,读头=琥珀,未读=灰) */
.topbar .run-strip {
  flex: 1; min-width: 60px; height: 100%;
  display: flex; align-items: center; gap: 3px; overflow: hidden;
}
.topbar .run-strip i {
  flex: 1 1 0; min-width: 0; height: 10px; border-radius: 2px;
  background: var(--paper-3);
  transition: background 0.2s ease;
}
.topbar .run-strip i.done { background: var(--pass); }
.topbar .run-strip i.cur  { background: var(--flag); box-shadow: 0 0 0 2px rgba(192,138,30,0.22); }
.topbar .ch-pos {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--ink-faint); white-space: nowrap;
}
.topbar .ch-pos b { color: var(--pass-deep); font-weight: 600; }
.topbar .toc-btn {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em;
  color: var(--ink); background: transparent;
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 6px 13px; cursor: pointer; white-space: nowrap;
}
.topbar .toc-btn:hover { border-color: var(--pass); color: var(--pass-deep); background: var(--pass-mist); }
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar .ch-pos { display: none; }
}

/* ============ 目录覆盖层:测试清单 ============ */
.toc-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(247, 245, 239, 0.985);
  overflow-y: auto;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease;
}
.toc-overlay.open { opacity: 1; pointer-events: auto; }
.toc-inner { max-width: 730px; margin: 0 auto; padding: 60px 22px 90px; }
.toc-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.toc-head h2 {
  font-family: var(--serif); font-size: 30px; letter-spacing: 0.26em;
  color: var(--ink); font-weight: 700;
}
.toc-head .close {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  background: none; border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
}
.toc-head .close:hover { color: var(--fail); border-color: var(--fail); }
.toc-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--ink-faint); margin-bottom: 34px; }

.toc-vol { position: relative; padding-left: 34px; margin-bottom: 8px; }
.toc-vol::before {
  content: ""; position: absolute; left: 10px; top: 6px; bottom: -8px;
  width: 3px; border-radius: 2px;
  background: linear-gradient(to bottom, var(--pass) 0%, var(--fail) 100%);
  opacity: 0.45;
}
.toc-vol:last-child::before { bottom: 12px; }
.toc-vol::after {
  content: ""; position: absolute; left: 4px; top: 8px;
  width: 15px; height: 15px; border-radius: 4px;
  background: var(--paper); border: 3px solid var(--pass);
}
.toc-vol .vol-name {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.18em;
  color: var(--pass-deep); font-weight: 700; margin-bottom: 2px;
}
.toc-vol .vol-desc { font-size: 13px; color: var(--ink-faint); margin-bottom: 12px; }
.toc-vol ol { list-style: none; margin-bottom: 26px; }
.toc-vol li a {
  display: flex; align-items: baseline; gap: 12px;
  padding: 7px 10px; border: none; border-radius: 7px;
  color: var(--ink-body); font-size: 15px;
}
.toc-vol li a:hover { background: var(--pass-mist); color: var(--pass-deep); }
.toc-vol li a .no { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); min-width: 22px; }
.toc-vol li a .demo-tag {
  margin-left: auto; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em;
  color: var(--fail); border: 1px solid rgba(203, 58, 52, 0.4);
  border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}
.toc-vol li a.cur { background: var(--pass-mist); color: var(--pass-deep); font-weight: 600; }
.toc-vol li a.cur .no { color: var(--pass); }

/* ============ 章节页骨架 ============ */
.content { display: block; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

.chapter-head { padding: 58px 0 10px; }
.chapter-head .kicker {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  color: var(--ink-faint); margin-bottom: 18px;
}
.chapter-head .kicker .vol { color: var(--pass-deep); font-weight: 700; }
.chapter-head .kicker .heat { color: var(--fail); }
.chapter-head .kicker .sep { width: 24px; height: 1px; background: var(--line-strong); }
.chapter-head h1 {
  font-family: var(--serif); font-size: 40px; line-height: 1.35;
  color: var(--ink); font-weight: 700; letter-spacing: 0.01em;
  margin-bottom: 20px;
}
.chapter-head h1 em { font-style: normal; color: var(--fail); }
.chapter-head .lede {
  font-size: 17px; line-height: 2.0; color: var(--ink-body);
  border-left: 3px solid transparent;
  border-image: linear-gradient(to bottom, var(--pass), var(--fail)) 1;
  padding-left: 18px;
  margin-bottom: 22px;
}
.chapter-head .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.chapter-head .tags span {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--pass-deep); background: var(--pass-mist);
  border-radius: 5px; padding: 3px 10px;
}
.headrule {
  border: none; height: 3px; margin: 34px 0 8px; border-radius: 2px;
  background: linear-gradient(to right, var(--pass), var(--fail) 60%, rgba(203,58,52,0) 100%);
  opacity: 0.65;
}

/* ============ 正文排印 ============ */
.prose { padding-bottom: 30px; }
.prose h2 {
  font-family: var(--serif); font-size: 26px; color: var(--ink);
  font-weight: 700; line-height: 1.5;
  margin: 54px 0 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.prose h2::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 62px; height: 2px;
  background: linear-gradient(to right, var(--pass), var(--fail));
}
.prose h3 {
  font-family: var(--serif); font-size: 20px; color: var(--ink);
  font-weight: 700; margin: 38px 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.prose h3::before { content: "▍"; color: var(--fail); font-size: 15px; }
.prose p { margin: 0 0 18px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 26px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--pass); font-family: var(--mono); font-size: 0.9em; }
.prose hr { border: none; border-top: 1px dashed var(--line-strong); margin: 40px 0; }

.prose table {
  width: 100%; border-collapse: collapse; margin: 22px 0;
  font-size: 14.5px; line-height: 1.75;
  background: rgba(255, 255, 255, 0.6);
}
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 13px; text-align: left; vertical-align: top; }
.prose th {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em;
  color: var(--ink); background: var(--paper-2); font-weight: 600;
  white-space: nowrap;
}
.prose td.y { color: var(--pass-deep); font-weight: 600; }
.prose td.n { color: var(--fail-deep); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 560px; }

/* ============================================================
   验证条(本书一等公民)—— 正文里可手写的测试运行点阵
   <div class="run">
     <span class="run-l">45 tests</span>
     <span class="run-cells">
       <i class="p"></i><i class="p"></i><i class="f"></i>...
     </span>
     <span class="run-v pass">PASS</span> / <span class="run-v fail">FAIL</span>
   </div>
   ============================================================ */
.run {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(255,255,255,0.7); padding: 11px 15px; margin: 22px 0;
}
.run-l { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); flex: none; }
.run-cells { display: flex; gap: 3px; flex-wrap: wrap; flex: 1; min-width: 120px; }
.run-cells i { width: 12px; height: 12px; border-radius: 2px; display: block; }
.run-cells i.p { background: var(--pass); }
.run-cells i.f { background: var(--fail); box-shadow: 0 0 0 2px rgba(203,58,52,0.18); }
.run-cells i.s { background: var(--paper-3); }        /* skipped */
.run-cells i.q { background: var(--flag); }           /* flaky */
.run-v { font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; flex: none; }
.run-v.pass { color: var(--pass-deep); }
.run-v.fail { color: var(--fail-deep); }

/* ============================================================
   验讫印章 —— 旋转的橡皮图章
   <span class="stamp pass">通过</span> / <span class="stamp fail">未过</span>
   ============================================================ */
.stamp {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: 0.16em;
  border: 2.5px solid; border-radius: 8px; padding: 3px 12px;
  transform: rotate(-4deg); text-transform: none;
  vertical-align: middle;
}
.stamp.pass { color: var(--pass-deep); border-color: var(--pass); background: var(--pass-mist); }
.stamp.fail { color: var(--fail-deep); border-color: var(--fail); background: var(--fail-mist); }
.stamp.flag { color: var(--flag-deep); border-color: var(--flag); background: var(--flag-mist); transform: rotate(3deg); }
.stamp::before { content: "✓"; }
.stamp.fail::before { content: "✗"; }
.stamp.flag::before { content: "≈"; }

/* ============================================================
   断言卡 —— 期望 vs 实际
   <div class="assert ok|bad">
     <div class="as-row"><span class="k">expected</span><b>42</b></div>
     <div class="as-row"><span class="k">actual</span><b>41</b></div>
     <div class="as-msg">off-by-one</div>
   </div>
   ============================================================ */
.assert {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 9px;
  background: rgba(255,255,255,0.7); padding: 12px 16px; margin: 22px 0;
  font-family: var(--mono); font-size: 13px;
}
.assert.ok  { border-left-color: var(--pass); }
.assert.bad { border-left-color: var(--fail); }
.assert .as-row { display: flex; align-items: baseline; gap: 12px; padding: 3px 0; }
.assert .as-row .k { color: var(--ink-faint); min-width: 78px; letter-spacing: 0.08em; }
.assert .as-row b { color: var(--ink); font-weight: 600; word-break: break-all; }
.assert.ok  .as-row.act b { color: var(--pass-deep); }
.assert.bad .as-row.act b { color: var(--fail-deep); }
.assert .as-msg {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-strong);
  font-size: 12px; color: var(--ink-body);
}
.assert.bad .as-msg { color: var(--fail-deep); }

/* ============ callout 卡 ============ */
.co {
  border-radius: 10px; padding: 16px 20px 14px; margin: 24px 0;
  border: 1px solid; border-left-width: 4px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 15.2px; line-height: 1.95;
}
.co .co-t {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.co p { margin-bottom: 10px; }
.co p:last-child { margin-bottom: 2px; }
.co code { background: rgba(33, 31, 26, 0.06); }
.co ul, .co ol { margin: 0 0 10px; padding-left: 22px; }
.co li { margin-bottom: 6px; }

/* ◆ 判词:必须带走的结论(青板) */
.co.core { border-color: rgba(44,110,140,0.4); border-left-color: var(--info); background: var(--info-mist); }
.co.core .co-t { color: var(--info-deep); }
/* ⚠ 陷阱:会咬人的地方(红) */
.co.trap { border-color: rgba(203,58,52,0.4); border-left-color: var(--fail); background: var(--fail-mist); }
.co.trap .co-t { color: var(--fail-deep); }
/* ▲ AI 说:AI 自信输出的那一栏(紫) */
.co.ai { border-color: rgba(107,84,201,0.4); border-left-color: var(--ai); background: var(--ai-mist); }
.co.ai .co-t { color: var(--ai-deep); }
/* ◈ 落地:Android / Web 的具体映射(绿) */
.co.land { border-color: rgba(30,142,82,0.38); border-left-color: var(--pass); background: var(--pass-mist); }
.co.land .co-t { color: var(--pass-deep); }
/* 🕘 掌故:历史与出处(琥珀) */
.co.hist { border-color: rgba(192,138,30,0.42); border-left-color: var(--flag); background: var(--flag-mist); }
.co.hist .co-t { color: var(--flag-deep); }
/* ✚ 动手:练习(绿描边 + 纸底) */
.co.try { border-color: rgba(30,142,82,0.4); border-left-color: var(--pass); background: rgba(230,242,233,0.5); }
.co.try .co-t { color: var(--pass-deep); }

/* 平台徽章 */
.plat-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  border-radius: 4px; padding: 1px 7px; white-space: nowrap;
  vertical-align: 0.12em; font-weight: 600; color: #fff;
}
.plat-badge.and { background: var(--pass); }
.plat-badge.web { background: var(--ts); }
.plat-badge.kt  { background: var(--kt); }

/* ============ 代码块 ============ */
pre {
  font-family: var(--mono); font-size: 13.5px; line-height: 1.8;
  border-radius: 10px; padding: 18px 20px; margin: 22px 0;
  overflow-x: auto; position: relative;
  white-space: pre; tab-size: 4;
}
pre .tag-corner {
  position: absolute; top: 0; right: 0;
  font-size: 9.5px; letter-spacing: 0.12em; font-weight: 600;
  padding: 3px 10px; border-radius: 0 9px 0 8px;
  user-select: none; color: #fff;
}
pre.kt   { background: #FFFFFF; color: var(--ink-body); border: 1px solid var(--line); border-top: 3px solid var(--kt); }
pre.kt   .tag-corner { background: var(--kt); }
pre.ts   { background: #FFFFFF; color: var(--ink-body); border: 1px solid var(--line); border-top: 3px solid var(--ts); }
pre.ts   .tag-corner { background: var(--ts); }
pre.java { background: #FFFFFF; color: var(--ink-body); border: 1px solid var(--line); border-top: 3px solid var(--java); }
pre.java .tag-corner { background: var(--java); }
pre.xml  { background: var(--xml-mist); color: var(--ink-body); border: 1px solid rgba(75,143,106,0.3); }
pre.xml  .tag-corner { background: var(--xml); }
/* 终端命令 */
pre.sh { background: var(--paper-2); color: var(--ink-body); border: 1px solid var(--line); }
pre.sh .tag-corner { background: var(--ink); }
/* 测试运行器输出 / 报告 */
pre.out { background: #FBFAF6; color: var(--ink-body); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); }
pre.out .tag-corner { background: var(--ink-faint); }
pre.out .oerr { color: var(--fail-deep); font-weight: 600; }
pre.out .ook  { color: var(--pass-deep); }
pre.out .odim { color: var(--ink-faint); }

/* 高亮 token */
.tk-kw { color: var(--tok-kw); font-weight: 600; }
.tk-ty { color: var(--tok-ty); font-weight: 600; }
.tk-st { color: var(--tok-str); }
.tk-nu { color: var(--tok-num); }
.tk-co { color: var(--tok-com); font-style: italic; }
.tk-op { color: var(--tok-op); }
.tk-fn { color: var(--tok-fn); font-weight: 600; }
.tk-an { color: var(--tok-ann); font-weight: 600; }
.hl-bad  { background: rgba(203, 58, 52, 0.14); border-radius: 3px; }
.hl-good { background: rgba(30, 142, 82, 0.16); border-radius: 3px; }
.hl-hot  { background: rgba(192, 138, 30, 0.18); border-radius: 3px; }

/* ============ Demo 部件 ============ */
.demo {
  border: 1.5px solid var(--pass); border-radius: 12px;
  margin: 30px 0; background: #fff;
  box-shadow: 0 2px 0 rgba(20, 100, 58, 0.13);
  overflow: hidden;
}
.demo-head {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(to right, var(--pass-mist), rgba(250, 231, 228, 0.55));
  border-bottom: 1px solid rgba(30, 142, 82, 0.22);
  padding: 9px 16px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--pass-deep); font-weight: 700;
}
.demo-head .led {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--pass);
  box-shadow: 0 0 0 3px rgba(30, 142, 82, 0.16);
  animation: led-pulse 2.2s ease-in-out infinite;
}
@keyframes led-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(30, 142, 82, 0.16); opacity: 1; }
  50% { box-shadow: 0 0 0 5px rgba(30, 142, 82, 0.05); opacity: 0.72; }
}
.demo-head .d-hint { margin-left: auto; color: var(--ink-faint); font-weight: 400; letter-spacing: 0.06em; font-size: 10px; }
.demo-body { padding: 16px; }

.d-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.d-row:last-child { margin-bottom: 0; }
.d-btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em;
  background: var(--pass); color: #fff;
  border: none; border-radius: 7px; padding: 7px 15px; cursor: pointer;
}
.d-btn:hover { background: var(--pass-deep); }
.d-btn:disabled { background: var(--paper-3); color: var(--ink-faint); cursor: not-allowed; }
.d-btn.ghost { background: transparent; color: var(--pass-deep); border: 1px solid var(--pass); }
.d-btn.ghost:hover { background: var(--pass-mist); }
.d-btn.hot { background: var(--fail); }
.d-btn.hot:hover { background: var(--fail-deep); }
.d-btn.info { background: var(--info); }
.d-btn.info:hover { background: var(--info-deep); }

.d-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.d-chip {
  font-family: var(--mono); font-size: 11.5px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: #fff; color: var(--ink-body);
  padding: 5px 13px; cursor: pointer; white-space: nowrap;
  transition: all 0.14s ease;
}
.d-chip:hover { border-color: var(--pass); color: var(--pass-deep); }
.d-chip.on { background: var(--pass); border-color: var(--pass); color: #fff; font-weight: 600; }
.d-chip.on.red { background: var(--fail); border-color: var(--fail); }
.d-chip.on.ai  { background: var(--ai); border-color: var(--ai); }

.d-in, .d-sel, textarea.d-in {
  font-family: var(--mono); font-size: 13px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--paper); color: var(--ink);
  padding: 7px 11px; outline: none;
}
.d-in:focus, .d-sel:focus { border-color: var(--pass); background: #fff; }
.d-note { font-size: 12.5px; color: var(--ink-faint); line-height: 1.75; }
.d-note b { color: var(--ink); }
.d-note .bad { color: var(--fail-deep); font-weight: 600; }
.d-note .good { color: var(--pass-deep); font-weight: 600; }

/* 滑块 */
.d-slider { display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.d-slider input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: var(--paper-3); outline: none; width: 130px; }
.d-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--pass); cursor: pointer; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--pass);
}
.d-slider input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: var(--pass); cursor: pointer; border: 2px solid #fff;
}
.d-slider b { color: var(--pass-deep); font-weight: 600; min-width: 34px; display: inline-block; }

/* SVG 舞台 */
.d-stage { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); overflow: hidden; }
.d-stage svg { display: block; width: 100%; height: auto; }

/* 结果面板 */
.d-panel {
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); padding: 11px 14px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.8;
  color: var(--ink-body);
}
.d-panel b { color: var(--pass-deep); }
.d-panel .big { font-size: 19px; font-weight: 700; color: var(--fail); }
.d-panel .big.g { color: var(--pass); }
.d-out {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  border: 1px solid var(--line); border-radius: 8px;
  background: #FBFAF6; padding: 11px 13px;
  white-space: pre-wrap; word-break: break-word;
  max-height: 280px; overflow-y: auto; color: var(--ink-body);
}
.d-out.err { border-left: 3px solid var(--fail); }
.d-out .err { color: var(--fail-deep); font-weight: 600; }
.d-out .ok  { color: var(--pass-deep); }
.d-out .dim { color: var(--ink-faint); }
.d-out .hot { color: var(--flag-deep); font-weight: 600; }
.d-out .ai  { color: var(--ai-deep); font-weight: 600; }

/* 步进器 */
.d-steps { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); flex-wrap: wrap; }
.d-steps .cur { color: var(--fail); font-weight: 700; }
.d-dots { display: flex; gap: 5px; }
.d-dots i { width: 9px; height: 9px; border-radius: 2px; display: block; background: var(--paper-3); cursor: pointer; }
.d-dots i.on { background: var(--fail); }
.d-dots i.done { background: var(--pass); }

/* 左右对照 */
.d-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.d-split > div { min-width: 0; }
.d-pane-t {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--ink-faint); margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.d-pane-t .dot { width: 7px; height: 7px; border-radius: 2px; }
.d-pane-t .dot.a { background: var(--pass); }
.d-pane-t .dot.b { background: var(--fail); }
.d-pane {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
  border-radius: 8px; padding: 12px 13px;
  overflow-x: auto; white-space: pre; tab-size: 4;
  border: 1px solid var(--line); background: #fff;
  min-height: 90px;
}
.d-pane.b { background: var(--paper); }
@media (max-width: 620px) { .d-split { grid-template-columns: 1fr; } }

/* 徽章 */
.d-badge {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  border-radius: 5px; padding: 2px 8px; white-space: nowrap;
}
.d-badge.ok   { color: var(--pass-deep); background: var(--pass-mist); border: 1px solid rgba(30,142,82,0.4); }
.d-badge.bad  { color: var(--fail-deep); background: var(--fail-mist); border: 1px solid rgba(203,58,52,0.4); }
.d-badge.info { color: var(--info-deep); background: var(--info-mist); border: 1px solid rgba(44,110,140,0.35); }
.d-badge.warn { color: var(--flag-deep); background: var(--flag-mist); border: 1px solid rgba(192,138,30,0.4); }

/* 决策树 / 判词 */
.d-tree-q { font-size: 15px; color: var(--ink); margin-bottom: 10px; font-weight: 600; }
.d-path { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); margin-bottom: 10px; }
.d-path span { color: var(--pass-deep); }
.d-verdict { border: 1px solid var(--pass); border-radius: 9px; padding: 13px 15px; background: var(--pass-mist); }
.d-verdict .vt { font-family: var(--mono); font-size: 16px; color: var(--pass-deep); font-weight: 700; margin-bottom: 6px; }

/* demo 内的金字塔条 / 柱 */
.d-bars { display: flex; flex-direction: column; gap: 7px; }
.d-bar { display: flex; align-items: center; gap: 9px; }
.d-bar .bl { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); min-width: 74px; text-align: right; flex: none; }
.d-bar .bt { flex: 1; height: 22px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.d-bar .bt i { display: block; height: 100%; transition: width 0.3s ease; }
.d-bar .bt i.p { background: var(--pass); }
.d-bar .bt i.f { background: var(--fail); }
.d-bar .bt i.q { background: var(--flag); }
.d-bar .bt i.info { background: var(--info); }
.d-bar .bv { font-family: var(--mono); font-size: 11px; color: var(--ink-body); min-width: 46px; flex: none; }

/* ============ 折叠问答 ============ */
.qa {
  border: 1px solid var(--line); border-left: 4px solid var(--info);
  border-radius: 9px; margin: 12px 0; background: rgba(255, 255, 255, 0.65);
  overflow: hidden;
}
.qa > summary {
  cursor: pointer; padding: 13px 18px; list-style: none;
  font-size: 15.5px; color: var(--ink); font-weight: 600;
  display: flex; align-items: baseline; gap: 10px;
}
.qa > summary::-webkit-details-marker { display: none; }
.qa > summary::after {
  content: "点开对答案"; margin-left: auto; flex: none;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  color: var(--ink-faint); font-weight: 400;
}
.qa[open] > summary::after { content: "收起"; }
.qa[open] > summary { border-bottom: 1px dashed var(--line-strong); }
.qa > summary:hover { background: var(--info-mist); }
.qa > summary .qn { font-family: var(--mono); font-size: 12px; color: var(--fail); font-weight: 700; flex: none; }
.qa .qbody { padding: 14px 18px 6px; font-size: 15.2px; line-height: 1.95; }
.qa .qbody pre { margin: 12px 0; }
.qa .qbody .hit {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--pass-deep); background: var(--pass-mist);
  border-radius: 5px; padding: 2px 9px; display: inline-block; margin-bottom: 8px;
}

/* ============ 翻页 ============ */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 56px 0 30px; }
.pager a {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 15px 18px; background: rgba(255, 255, 255, 0.65);
  display: block; color: var(--ink-body);
}
.pager a:hover { border-color: var(--pass); background: var(--pass-mist); }
.pager a .dir {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
  color: var(--ink-faint); display: block; margin-bottom: 5px;
}
.pager a .t { font-size: 14.5px; color: var(--ink); font-weight: 600; }
.pager a.next { text-align: right; }
.pager a.none { visibility: hidden; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager a.next { text-align: left; } }

.foot {
  border-top: 1px solid var(--line);
  padding: 22px 0 46px; text-align: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--ink-faint);
}
.foot a { color: var(--pass-deep); border: none; }

/* ============ 总览页(index) ============ */
.hero { padding: 72px 0 30px; position: relative; }
.hero .surv {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.26em;
  color: var(--fail); margin-bottom: 22px;
  display: flex; align-items: center; gap: 12px;
}
.hero .surv::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.hero h1 {
  font-family: var(--serif); font-size: 76px; letter-spacing: 0.1em;
  color: var(--ink); font-weight: 700; line-height: 1.15; margin-bottom: 6px;
}
.hero h1 .sig {
  background: linear-gradient(135deg, var(--pass), var(--fail));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--fail);
}
.hero .en {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.4em;
  color: var(--ink-faint); margin-bottom: 30px;
}
.hero .pitch { font-size: 17.5px; line-height: 2.05; max-width: 660px; margin-bottom: 14px; }
.hero .pitch strong { color: var(--pass-deep); }
.hero-scope { margin: 36px 0 8px; }
.hero-scope svg { width: 100%; height: auto; display: block; }
.hero .meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; align-items: center; }
.hero .meta-row span {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  color: var(--ink); background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px;
}
.hero .meta-row span b { color: var(--fail); font-weight: 600; }
@media (max-width: 640px) { .hero h1 { font-size: 54px; } }

.station { margin: 46px 0 12px; position: relative; }
.station .st-kick {
  display: flex; align-items: center; gap: 12px; margin-bottom: 6px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--pass-deep); font-weight: 700;
}
.station .st-kick .dot {
  width: 13px; height: 13px; border-radius: 4px; flex: none;
  background: var(--paper); border: 3px solid var(--pass);
}
.station .st-kick .bar {
  flex: 1; height: 3px; border-radius: 2px;
  background: linear-gradient(to right, rgba(30,142,82,0.5), rgba(203,58,52,0.08));
}
.station h2 { font-family: var(--serif); font-size: 27px; color: var(--ink); font-weight: 700; margin-bottom: 4px; }
.station .st-desc { font-size: 14.5px; color: var(--ink-faint); margin-bottom: 20px; }

.ch-list { display: grid; gap: 12px; margin-bottom: 14px; }
.ch-card {
  display: flex; gap: 16px; align-items: baseline;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  padding: 15px 18px; color: var(--ink-body);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.ch-card:hover { border-color: var(--pass); background: var(--pass-mist); transform: translateX(4px); }
.ch-card .no { font-family: var(--mono); font-size: 13px; color: var(--fail); font-weight: 600; min-width: 30px; }
.ch-card .body { flex: 1; }
.ch-card .t { font-size: 16.5px; color: var(--ink); font-weight: 600; margin-bottom: 3px; display: block; }
.ch-card .d { font-size: 13.5px; color: var(--ink-faint); line-height: 1.75; display: block; }
.ch-card .demo-tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em;
  color: var(--fail); border: 1px solid rgba(203, 58, 52, 0.4);
  border-radius: 4px; padding: 2px 7px; white-space: nowrap; align-self: center;
}

/* ============ 杂项 ============ */
.kbd {
  font-family: var(--mono); font-size: 0.82em;
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 0.05em 0.45em;
  background: #fff; color: var(--ink);
}
.small-cap { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--ink-faint); }

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .chapter-head h1 { font-size: 30px; }
  .prose h2 { font-size: 22px; }
  pre { font-size: 12.5px; padding: 14px 14px; }
}
