/* ============================================================
   ch05「输运流光」章节专属样式
   境界色：鎏金 #9E7A2E（从 ch04 黛紫的统计深海浮上「动」的世界）
   点亮色：琥珀 #E0A63E（渡口流光）
   对立色：铅灰 #8A8A9A（散射魅影与它的雾撞）
   一切基础色值仍走 tokens 变量；以下仅做本章变量映射与组件样式。
   ============================================================ */

/* ---------- 本章变量映射（仅影响本页，不改 tokens.css） ---------- */
:root, :root[data-theme="light"] {
  --accent: #9E7A2E;                     /* 鎏金 · 境界色 */
  --accent-ink: #9E7A2E;                 /* 亮底文字级 */
  --accent-soft: rgba(158, 122, 46, 0.13);
  --glow: 0 0 18px rgba(158, 122, 46, 0.25);
  --mist: #8A8A9A;                       /* 散射魅影铅灰 */
  --mist-ink: #5E5E6E;                   /* 铅灰·亮底文字级 */
  --mist-soft: rgba(138, 138, 154, 0.18);
  --calc: #E0A63E;                       /* 琥珀流光（演出/读数） */
  --calc-ink: #8A6420;
  --calc-soft: rgba(224, 166, 62, 0.16);
  --waterline: #3E6C8E;                  /* 实测/合法标记（沿用） */
  --waterline-ink: #3E6C8E;
  --color-correct: #1FA866;
  --color-insight: #8A6420;
}
:root[data-theme="dark"] {
  --accent: #9E7A2E;
  --accent-ink: #E0C07A;                 /* 鎏金·暗底提亮（文字级） */
  --accent-soft: rgba(158, 122, 46, 0.32);
  --glow: 0 0 22px rgba(224, 192, 122, 0.35);
  --mist: #8A8A9A;
  --mist-ink: #B8B8C6;                   /* 铅灰·暗底提亮 */
  --mist-soft: rgba(138, 138, 154, 0.16);
  --calc: #E0A63E;
  --calc-ink: #F0C26A;
  --calc-soft: rgba(224, 166, 62, 0.18);
  --waterline: #7FA8E0;
  --waterline-ink: #7FA8E0;
  --color-correct: #2BC47E;
  --color-insight: #F0C26A;
}
/* ---------- 漂移侠对话框（鎏金经典宗） ---------- */
.dlg.piaoxia { border-left-color: var(--accent); box-shadow: var(--shadow), 0 0 18px var(--accent-soft); }
.dlg.piaoxia .who { background: var(--accent-ink); color: #FBF6E8; }
.dlg.piaoxia .avatar { border-color: var(--accent); }
:root[data-theme="dark"] .dlg.piaoxia .who { color: #241A08; background: var(--accent-ink); }
.dlg.piaoxia em { color: var(--accent-ink); font-style: normal; font-weight: 700; }

/* ---------- 散射魅影对话框（铅灰对立色） ---------- */
.dlg.meiying { border-left-color: var(--mist); box-shadow: var(--shadow), 0 0 18px var(--mist-soft); }
.dlg.meiying .who { background: var(--mist-ink); color: #F0F0F4; }
.dlg.meiying .avatar { border-color: var(--mist); filter: grayscale(0.7) blur(0.4px); }
:root[data-theme="dark"] .dlg.meiying .who { color: #16161E; background: var(--mist-ink); }
.dlg.meiying em { color: var(--mist-ink); font-style: normal; font-weight: 700; }
/* ---------- 物品栏：本命石 / 帛书 / 小铜镜 / 铜马 ---------- */
#inventory {
  position: fixed; left: var(--sp-3); bottom: var(--sp-3); z-index: 110;
  display: flex; gap: var(--sp-2); align-items: flex-end;
}
#silk-panel {
  position: absolute; left: 0; bottom: 70px; width: min(78vw, 320px);
  padding: var(--sp-4); max-height: 50vh; overflow-y: auto;
}
#silk-panel h3 { font-size: var(--fs-sub); margin-bottom: var(--sp-2); }
.silk-item {
  font-family: var(--font-serif);
  color: var(--mist-ink);
  border-bottom: 1px solid var(--line);
  padding: var(--sp-2) 0;
  font-size: var(--fs-small);
  animation: carve-in 0.8s var(--ease-out);
}
.silk-item b { color: var(--accent-ink); }
.lattice-cv, .curve-cv {
  width: 100%; max-width: 680px; border-radius: var(--r-md);
  background: var(--bg-sunk); border: 1px solid var(--line);
  touch-action: none;
}
/* ---------- 石碑（双速石碑 / 双悔壁） ---------- */
.stele {
  width: 100%; max-width: 520px; margin: var(--sp-2) auto 0;
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--accent); border-radius: var(--r-md);
  background:
    linear-gradient(180deg, var(--accent-soft), transparent 60%),
    var(--bg-sunk);
  text-align: center; font-family: var(--font-serif);
  box-shadow: inset 0 0 24px rgba(0,0,0,0.18), var(--glow);
  animation: carve-in 1s var(--ease-out);
}
.stele-line s { color: var(--danger); text-decoration-thickness: 2px; }
/* ---------- S10 饯行演出 ---------- */
.s10-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); width: 100%; }
.s10-ctl { display: flex; align-items: center; gap: var(--sp-3); width: 100%; max-width: 620px; flex-wrap: wrap; justify-content: center; }
.s10-ctl input[type="range"] { flex: 1; min-width: 140px; }
.s10-lb { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-2); }
.s10-read { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--calc-ink); text-align: center; }
.s10-msg { font-size: var(--fs-small); color: var(--text-2); line-height: 1.8; max-width: 40rem; text-align: center; }
.s10-msg.ok { color: var(--color-correct); font-family: var(--font-serif); }
.s10-progress { font-family: var(--font-mono); color: var(--accent-ink); font-size: var(--fs-sub); }
.s10-wrap canvas {
  width: 100%; max-width: 680px; border-radius: var(--r-md);
  background: var(--bg-sunk); border: 1px solid var(--line);
  touch-action: none;
}
.corner-break { animation: cornerBreak 1.1s var(--ease-out); }
@keyframes cornerBreak {
  0% { filter: brightness(1); transform: none; }
  35% { filter: brightness(1.5) saturate(0.4); transform: rotate(-0.6deg); }
  100% { filter: brightness(1); transform: none; }
}
.spark-burn { animation: sparkBurn 1s var(--ease-out); }
@keyframes sparkBurn {
  0% { filter: brightness(1); }
  30% { filter: brightness(2.2) saturate(1.6) hue-rotate(-24deg); }
  100% { filter: brightness(1); }
}

@media (prefers-reduced-motion: reduce) {
  .stage.collapse, .corner-break, .spark-burn { animation: none; }
}

/* ============================================================
   规格书组件样式 · ch05-S0/S2/S5/S9
   境界色：炼气期翠绿 #10B981
   数据色：声子红 #EF4444 / 杂质青蓝 var(--realm-1) / 总翠绿 #10B981
   峰值金 #F59E0B / 靛蓝 #6366F1
   ============================================================ */

/* ---------- S0 漂移速度预测挑战器 ---------- */
.cmp-drift-velocity-predict {
  width: 100%; max-width: 560px; margin: var(--sp-4) auto 0;
  padding: var(--sp-4); border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--bg-sunk);
}
.cmp-title { font-size: var(--fs-sub); margin-bottom: var(--sp-1); }
.cmp-sub { margin-bottom: var(--sp-3); }
.predict-options {
  display: flex; flex-direction: column; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.predict-options .opt {
  padding: var(--sp-2) var(--sp-4);
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  background: transparent; color: var(--text-2);
  font-family: var(--font-serif); font-size: var(--fs-small);
  cursor: pointer; transition: all var(--dur-fast) var(--ease-out);
  text-align: left;
}
.predict-options .opt:hover { border-color: #10B981; color: var(--text-1); }
.predict-options .opt.sel {
  border-style: solid; border-color: #10B981;
  background: rgba(16,185,129,0.10); color: #10B981; font-weight: 600;
}
.reveal-zone {
  margin-top: var(--sp-3); padding: var(--sp-3);
  border: 1px solid #10B981; border-radius: var(--r-sm);
  background: rgba(16,185,129,0.06);
  animation: carve-in 0.8s var(--ease-out);
}
.dual-speed-display {
  display: flex; flex-direction: column; gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.thermal-readout, .drift-readout {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono); font-size: var(--fs-small);
  color: var(--text-1);
}
.speed-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.t-dot { background: #F59E0B; box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.d-dot { background: #10B981; box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.ratio-display {
  display: block; width: 100%; margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px dashed #F59E0B; border-radius: var(--r-sm);
  background: rgba(245,158,11,0.08); color: #B8770B;
  font-family: var(--font-mono); font-size: var(--fs-small);
  cursor: pointer; transition: all var(--dur-fast) var(--ease-out);
}
.ratio-display:hover { border-style: solid; }
.ratio-cv {
  width: 100%; max-width: 560px; margin-top: var(--sp-2);
  border-radius: var(--r-sm); background: var(--bg-sunk);
  border: 1px solid var(--line); touch-action: none;
}
.wrong-feedback {
  margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--danger); border-radius: var(--r-sm);
  background: var(--danger-soft); color: var(--danger);
  font-size: var(--fs-small); animation: carve-in 0.5s var(--ease-out);
}
.mystery-token {
  margin-top: var(--sp-2); padding: var(--sp-3);
  border: 1px solid #10B981; border-radius: var(--r-sm);
  background: rgba(16,185,129,0.10); color: #10B981;
  font-family: var(--font-serif); font-size: var(--fs-small);
  font-weight: 600; animation: carve-in 0.8s var(--ease-out);
}
.mentor-cue {
  margin-top: var(--sp-2); font-family: var(--font-serif);
  color: var(--text-3); font-size: var(--fs-small);
  font-style: italic; text-align: center;
}

/* ---------- S2 迁移率三旋钮实验台 ---------- */
.knob-panel {
  width: 100%; max-width: 560px; margin: var(--sp-3) auto 0;
  padding: var(--sp-3); border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--bg-sunk);
}
.formula-derivation {
  width: 100%; max-width: 560px; margin: var(--sp-3) auto 0;
  padding: var(--sp-3); border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--bg-sunk);
}
.deriv-step {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) 0; font-family: var(--font-mono);
  font-size: var(--fs-small); color: var(--text-3);
  border-bottom: 1px solid var(--line); transition: all var(--dur-mid) var(--ease-out);
}
.deriv-step:last-child { border-bottom: none; }
.deriv-step.done { color: #10B981; font-weight: 600; }
.deriv-step.ready { cursor: pointer; }
.deriv-step.ready:hover { color: var(--text-1); }
.deriv-step.ready .d-no { border-color: #10B981; }
.deriv-step.lit { color: #10B981; font-weight: 600; }
.d-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line-strong); font-size: 0.7rem;
  flex-shrink: 0; transition: all var(--dur-mid) var(--ease-out);
}
.deriv-step.lit .d-no, .deriv-step.done .d-no { border-color: #10B981; background: rgba(16,185,129,0.12); color: #10B981; }
.verification-panel {
  display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center;
  margin-top: var(--sp-2);
}

/* ---------- S5 Matthiessen曲线追踪器 ---------- */
.s5-toggle {
  margin: var(--sp-2) 0; gap: var(--sp-2);
}
.s5-cur {
  padding: 4px 12px; font-size: var(--fs-small);
  border-radius: 999px; transition: all var(--dur-fast) var(--ease-out);
}
.s5-cur.on {
  border-color: #10B981; color: #10B981;
  background: rgba(16,185,129,0.10); border-style: solid;
}

/* ---------- S9 输运排除法收网器 ---------- */
/* Boss战由 SICI.Boss.fight 框架渲染，此处仅补充数字链样式 */
.cmp-transport-boss-fight .number-chain {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  justify-content: center; margin-top: var(--sp-3);
}
.chain-item {
  padding: 4px 12px; border: 1px dashed var(--line-strong);
  border-radius: 999px; font-family: var(--font-mono);
  font-size: var(--fs-small); color: var(--text-3);
  transition: all var(--dur-mid) var(--ease-out);
}
.chain-item.lit {
  border-color: #10B981; border-style: solid;
  color: #10B981; background: rgba(16,185,129,0.10);
  box-shadow: 0 0 12px rgba(16,185,129,0.20);
}
