/* ============================================================
   汽车润滑系统解剖 · 《图解手册》纸感编辑排版
   ------------------------------------------------------------
   调性：精装技术手册 + 杂志内页版式（不是企业官网 / SaaS 后台）
   受众：汽修专业学生，教室投影讲解 + 课后自学
   硬约束：投影远距离可读（正文 ≥ 17px）、对比度留富余、无重量级外部资源
   色彩：OKLCH 暖调纸白中性色；朱红为唯一结构强调色；琥珀/青为功能性油路双色
   字阶：1.333（完全四度）
   ------------------------------------------------------------
   注意：3D 视口为全屏固定层（z-index 0），本文件的 UI 层浮动其上。
   ============================================================ */

/* ───────────────────────── 设计令牌 ───────────────────────── */

/* 主题令牌注册为 <color>：切换系统（body[data-sys]）时这些变量可参与 transition，
   纸面 / 墨线 / 强调色整体随切换渐变而非瞬切（不支持的浏览器退化为直接换色） */
@property --paper       { syntax: "<color>"; inherits: true; initial-value: #eff1f6; }
@property --paper-2     { syntax: "<color>"; inherits: true; initial-value: #e7eaf1; }
@property --paper-3     { syntax: "<color>"; inherits: true; initial-value: #dfe2eb; }
@property --surface     { syntax: "<color>"; inherits: true; initial-value: #fcfdfe; }
@property --surface-2   { syntax: "<color>"; inherits: true; initial-value: #f0f2f7; }
@property --ink         { syntax: "<color>"; inherits: true; initial-value: #222937; }
@property --ink-2       { syntax: "<color>"; inherits: true; initial-value: #38404e; }
@property --ink-3       { syntax: "<color>"; inherits: true; initial-value: #586173; }
@property --rule        { syntax: "<color>"; inherits: true; initial-value: #d3d8e0; }
@property --rule-2      { syntax: "<color>"; inherits: true; initial-value: #e2e5ec; }
@property --oil         { syntax: "<color>"; inherits: true; initial-value: #47699f; }
@property --oil-ink     { syntax: "<color>"; inherits: true; initial-value: #2b3f63; }
@property --oil-wash    { syntax: "<color>"; inherits: true; initial-value: #e4ebf5; }
@property --return      { syntax: "<color>"; inherits: true; initial-value: #33799c; }
@property --return-wash { syntax: "<color>"; inherits: true; initial-value: #e2eff4; }
@property --cool-hot    { syntax: "<color>"; inherits: true; initial-value: #28406b; }
@property --cool-cold   { syntax: "<color>"; inherits: true; initial-value: #3f83a8; }
@property --cool-wash   { syntax: "<color>"; inherits: true; initial-value: #e6f1f7; }
@property --seal        { syntax: "<color>"; inherits: true; initial-value: #2f4d8f; }
@property --seal-wash   { syntax: "<color>"; inherits: true; initial-value: #e5ecf7; }

:root {
  /* 纸感中性色 —— 冷蓝相位（暖调已全部转为蓝） */
  --paper:       oklch(96.6% 0.012 240);
  --paper-2:     oklch(93.6% 0.016 238);
  --paper-3:     oklch(90.4% 0.019 236);
  --surface:     oklch(99.0% 0.005 242);
  --surface-2:   oklch(96.2% 0.010 240);

  /* 墨色文字 —— 三级，均满足 4.5:1 以上（对 --surface） */
  --ink:         oklch(24%  0.030 250);   /* 标题 / 数值 */
  --ink-2:       oklch(35%  0.026 248);   /* 正文 */
  --ink-3:       oklch(46%  0.020 246);   /* 标签 / 次要 */

  /* 发丝线 */
  --rule:        oklch(85%  0.014 240);
  --rule-2:      oklch(91%  0.010 240);

  /* 机油（功能色：润滑系统使用，整套蓝调） */
  --oil:         oklch(55%  0.100 248);
  --oil-ink:     oklch(38%  0.095 252);
  --oil-wash:    oklch(94.5%  0.028 250);

  /* 回流（功能色：冷却系统副线 / 润滑系统回油） */
  --return:      oklch(50%  0.095 218);
  --return-wash: oklch(94.5% 0.024 220);

  /* 冷热标识：冷却系统内部深浅两段（统一蓝调） */
  --cool-hot:    oklch(38%  0.110 252);   /* 热侧：深沉蓝 */
  --cool-cold:   oklch(55%  0.095 220);   /* 冷侧：浅蓝 */
  --cool-wash:   oklch(95%  0.032 244);

  /* 蓝印 —— 唯一结构性强调色：当前阶段 / 激活 / 章节标记 */
  --seal:        oklch(42% 0.118 252);
  --seal-wash:   oklch(94%  0.032 250);

  /* 字体 —— 中文走系统黑体（不加载 CJK 网络字体）；拉丁走 Newsreader */
  --font-sans:  "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC",
                "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  /* 关键：中文族名排在通用 serif 之前，避免中文回落到 SimSun */
  --font-serif: "Newsreader", "PingFang SC", "Microsoft YaHei",
                "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --font-num:   "Newsreader", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* 字阶 1.333 —— 层级跨度刻意拉大，投影下也要一眼分得清 */
  --fs-xs:   0.75rem;    /* 12px  角标 */
  --fs-sm:   0.8125rem;  /* 13px  次要 UI */
  --fs-base: 1.0625rem;  /* 17px  正文（投影下限） */
  --fs-md:   0.9375rem;  /* 15px  列表 / 注释 */
  --fs-lg:   1.3125rem;  /* 21px  小标题 */
  --fs-xl:   clamp(1.75rem, 3.2vw, 2.5rem);  /* 28→40px 版块大标题 */

  /* 间距 —— 4pt 基准 */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* 圆角 —— 印刷感，结构件只给 2~3px */
  --r-1: 2px;
  --r-2: 3px;
  --r-pill: 999px;

  /* 阴影 —— 只有两级，且必须接近不可见 */
  --sh-1: 0 1px 2px oklch(40% 0.02 60 / .06), 0 2px 6px oklch(40% 0.02 60 / .04);
  --sh-2: 0 1px 3px oklch(40% 0.02 60 / .06), 0 10px 30px oklch(40% 0.02 60 / .08);

  /* 动效曲线 —— back-out 轻过冲（CSS 版 spring），面板行 / 字符弹出共用 */
  --ease-spring: cubic-bezier(.3, 1.36, .5, 1);

  /* z-index 语义化层级 */
  --z-viewport: 0;
  --z-scroll:   2;
  --z-tag:      3;
  --z-chrome:   30;
  --z-loader:   100;
}

/* ───────────────────────── 基础 ───────────────────────── */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--ink-2);
  background:
    radial-gradient(1200px 700px at 76% 16%,
      color-mix(in oklab, var(--oil-wash) 60%, transparent), transparent 62%),
    radial-gradient(1000px 620px at 12% 88%,
      color-mix(in oklab, var(--return-wash) 50%, transparent), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  overflow-x: hidden;
  /* 系统切换：主题令牌整体渐变（布局与车身不动，只有颜色在流动） */
  transition:
    --paper .95s ease, --paper-2 .95s ease, --paper-3 .95s ease,
    --surface .95s ease, --surface-2 .95s ease,
    --ink .95s ease, --ink-2 .95s ease, --ink-3 .95s ease,
    --rule .95s ease, --rule-2 .95s ease,
    --oil .95s ease, --oil-ink .95s ease, --oil-wash .95s ease,
    --return .95s ease, --return-wash .95s ease,
    --cool-hot .95s ease, --cool-cold .95s ease, --cool-wash .95s ease,
    --seal .95s ease, --seal-wash .95s ease;
}

::selection { background: var(--oil-wash); color: var(--ink); }

/* 展示层文字不参与选区：面板/标签本就 pointer-events:none，
   若被全选等途径罩进选区，::selection 的主题 wash 底会随打字改写文本节点而残留扩散 */
#stagePanel,
#stageTags,
.sys-toggle-wrap,
.rail__item {
  -webkit-user-select: none;
  user-select: none;
}

/* ───────────── 深色影棚幕（animejs.com 式换幕联动） ─────────────
   仅由 3D 换幕进度联动（JS 挂 body.is-dark）：纸/墨变量整体翻转，
   色相取暖炭（animejs.com 主页同款暖黑），文字布局零改动。 */
body.is-dark {
  --paper:       oklch(20% 0.008 70);
  --paper-2:     oklch(18% 0.008 70);
  --paper-3:     oklch(16% 0.008 70);
  --surface:     oklch(22% 0.010 70);
  --surface-2:   oklch(20% 0.010 70);
  --ink:         oklch(92% 0.010 80);
  --ink-2:       oklch(83% 0.012 80);
  --ink-3:       oklch(60% 0.014 78);
  --rule:        oklch(30% 0.012 70);
  --rule-2:      oklch(25% 0.010 70);
  --oil-wash:    oklch(26% 0.028 70);
  --return-wash: oklch(24% 0.026 220);
  --seal-wash:   oklch(26% 0.030 70);
  background:
    radial-gradient(1200px 700px at 76% 16%,
      color-mix(in oklab, oklch(23% 0.026 65) 55%, transparent), transparent 62%),
    linear-gradient(180deg, oklch(19% 0.008 70) 0%, oklch(16% 0.008 70) 100%);
}
body.is-dark .vp-grid { opacity: .16; }
body.is-dark .vp-vignette {
  background:
    radial-gradient(120% 90% at 52% 44%,
      transparent 42%,
      color-mix(in oklab, oklch(13% 0.010 258) 82%, transparent) 100%),
    linear-gradient(90deg,
      color-mix(in oklab, oklch(18% 0.010 258) 88%, transparent) 0%,
      transparent 34%);
}
.vp-grid, .vp-vignette { transition: opacity .8s ease, background .8s ease; }

:where(a, button):focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
}

/* ───────────────────────── 3D 视口 ───────────────────────── */

#viewport {
  position: fixed;
  inset: 0;
  z-index: var(--z-viewport);
  cursor: grab;
}
#viewport.is-hover { cursor: pointer; }
#viewport.is-grabbing { cursor: grabbing; }

#scene { display: block; width: 100%; height: 100%; }

/* ───────────── 讲解引线：从部件延伸到文字面板（参考图2 标注手法） ───────────── */
#leaderSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity .5s ease;
  color: var(--seal);
  z-index: 3;
}
#leaderSvg.is-on { opacity: 1; }
#leaderSvg .leader-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  opacity: .78;
}
#leaderSvg .leader-dot {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  opacity: .9;
}
#leaderSvg .leader-core { fill: currentColor; }
/* ───────────── 部件讲解标签：左下 + 右上两簇，左上标题区（参考图1/图2） ───────────── */
#stageTags {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  --tag-size: 15.5px;
}
#stageTags .tag-head {
  position: absolute;
  left: 3.2vw;
  top: 8%;
  max-width: 340px;
  font-size: 27px;
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--ink);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .65s var(--ease-spring), transform .65s var(--ease-spring);
  text-shadow: 0 1px 6px color-mix(in oklab, var(--paper) 85%, transparent);
}
#stageTags .tag-head i {
  display: block;
  font-size: 13px;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-3);
  margin-top: 5px;
}
#stageTags .tag-col {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 340px;
}
#stageTags .tag-col-r { top: 9%; right: 3.4vw; align-items: flex-end; text-align: right; }
#stageTags .tag-col-l { bottom: 9%; left: 3.2vw; align-items: flex-start; }
#stageTags .stagetag {
  position: static;
  font-size: var(--tag-size);
  line-height: 1.5;
  font-weight: 550;
  color: var(--ink);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .65s var(--ease-spring), transform .65s var(--ease-spring);
  text-shadow: 0 1px 6px color-mix(in oklab, var(--paper) 85%, transparent);
}
#stageTags.is-on .stagetag,
#stageTags.is-on .tag-head { opacity: 1; transform: none; }
#stageTags .tag-spec b {
  color: var(--seal);
  font-weight: 750;
  margin-right: 3px;
}

/* 部件讲解阶段隐藏左栏（文字已迁移到两侧标签簇） */
#stagePanel.is-part { opacity: 0; visibility: hidden; }
body.is-dark #leaderSvg { color: oklch(80% 0.085 78); }   /* 深色幕下用暖棕高亮 */

.vp-vignette,
.vp-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* 暖调纸边压暗，替代原先的冷灰渐变 */
.vp-vignette {
  background:
    radial-gradient(120% 90% at 52% 44%,
      transparent 40%,
      color-mix(in oklab, var(--paper-2) 72%, transparent) 100%),
    linear-gradient(90deg,
      color-mix(in oklab, var(--paper) 90%, transparent) 0%,
      transparent 34%);
}
/* 图纸方格网 —— 暖调发丝线，比 UI 网格更淡 */
.vp-grid {
  background-image:
    linear-gradient(var(--rule-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule-2) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: .5;
  mask-image: radial-gradient(88% 78% at 58% 46%, #000 18%, transparent 76%);
  -webkit-mask-image: radial-gradient(88% 78% at 58% 46%, #000 18%, transparent 76%);
}

/* ───────────── 开场滚动提示 ───────────── */

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(24px, 6vh, 52px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 11.5px;
  letter-spacing: .18em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
  z-index: var(--z-tag);
}
.scroll-hint.is-on { opacity: 1; }
/* 弃用鼠标图标：改作一条细竖线 + 下落的朱红线段 */
.hint__mouse {
  position: relative;
  width: 1px; height: 36px;
  background: var(--rule);
  overflow: hidden;
}
.hint__mouse i {
  position: absolute;
  left: 0; top: 0;
  width: 1px; height: 12px;
  background: var(--seal);
  animation: hintDrop 1.9s cubic-bezier(.65, 0, .35, 1) infinite;
}
@keyframes hintDrop {
  0%        { transform: translateY(-14px); opacity: 0; }
  22%       { opacity: 1; }
  70%       { transform: translateY(36px); opacity: 0; }
  100%      { transform: translateY(36px); opacity: 0; }
}

/* ───────────────────────── 报头（顶栏） ───────────────────────── */

#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-chrome);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 98px;              /* 容纳内嵌的流体监控面板（表盘高度） */
  padding: 13px clamp(18px, 3vw, 36px);
  background: color-mix(in oklab, var(--paper) 94%, transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; }
/* 印章：朱红实心方块 */
/* 龙蟠四水滴标记：官方 PNG 抠形（assets/images/lopal-mark-*.png）作 CSS 蒙版，
   双层对角分组各染 --seal / --oil，令牌切换时背景色走渐变而非瞬切 */
.brand__mark {
  position: relative;
  width: 25px; height: 25px;
  flex: none;
}
.brand__mark .m-a,
.brand__mark .m-b {
  position: absolute; inset: 0;
  transition: background-color .45s ease;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain;    mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.brand__mark .m-a {
  background-color: var(--seal);
  -webkit-mask-image: url("../assets/images/lopal-mark-a.png");
          mask-image: url("../assets/images/lopal-mark-a.png");
}
.brand__mark .m-b {
  background-color: var(--oil);
  -webkit-mask-image: url("../assets/images/lopal-mark-b.png");
          mask-image: url("../assets/images/lopal-mark-b.png");
}
.brand__txt { display: flex; flex-direction: column; line-height: 1.3; }
.brand__txt strong {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: .06em;
  color: var(--ink);
}
.brand__txt em {
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 11.5px;
  letter-spacing: .02em;
  color: var(--ink-3);
}

/* ───────────── 系统模式切换器（润滑 / 冷却 / 电力）：三态滑块开关（The switch，无文字） ───────────── */

.sys-toggle-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 320px;
  margin: 0 8px;
}

/* The switch - the box around the slider（三态加宽版）
   轨道 = 主题 wash 底色；滑块（钥匙块）= 当前系统印章色 --seal，
   借 @property 注册色随 body[data-sys] 渐变换肤；三停位 0 / 2.2em / 4.4em。
   圆点浮于滑块之上（z-index 更高）：当前停位圆点变白点亮，全部圆点恒可点击直达 */
.sys-switch {
  font-size: 1rem;
  position: relative;
  display: inline-block;
  width: 6.5em;
  height: 2em;
}
.sys-switch__track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--seal-wash);
  border: 1px solid var(--rule);
  transition: 0.4s;
  border-radius: 0.5em;
  box-shadow: 0 0.2em #dfd9d9;
}
.sys-switch__track::before {
  position: absolute;
  content: "";
  height: 1.5em;
  width: 1.4em;
  border-radius: 0.3em;
  left: 0.35em;
  bottom: 0.7em;
  z-index: 2;
  background: var(--seal);
  transition: 0.4s;
  box-shadow: 0 0.4em #bcb4b4;
}
.sys-switch__track:hover::before {
  box-shadow: 0 0.2em #bcb4b4;
  bottom: 0.5em;
}
body[data-sys="cool"] .sys-switch__track::before { transform: translateX(2.2em); }
body[data-sys="ev"]   .sys-switch__track::before { transform: translateX(4.4em); }

/* 停位指示点：置于滑块上层，点哪个点直达哪个系统；
   当前停位圆点变白（落在印章色滑块上），其余为墨色 */
.sys-dot {
  appearance: none;
  border: 0;
  padding: 0;
  font: inherit;
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 1em;
  height: 1em;
  margin: -0.5em 0 0 -0.5em;         /* 1em 方形热区，圆点居中绘制 */
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.sys-dot::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 0.32em;
  height: 0.32em;
  margin: -0.16em 0 0 -0.16em;
  border-radius: 50%;
  background: var(--ink-3);
  opacity: .45;
  transition: opacity .3s ease, background-color .3s ease, transform .3s ease;
}
.sys-dot:nth-of-type(1) { left: 1.05em; }
.sys-dot:nth-of-type(2) { left: 3.25em; }
.sys-dot:nth-of-type(3) { left: 5.45em; }
.sys-dot:hover::after { opacity: .95; transform: scale(1.25); }
.sys-dot[aria-checked="true"]::after {
  background: #fff;
  opacity: 1;
  transform: scale(1.25);
}
.sys-dot:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
}

/* 旧双态滑块开关（保留样式供 fpFlowOn 等复用） */

.switch {
  /* 未拨 = 发丝灰；拨动 = 当前系统主题色（--seal 随润滑 / 冷却 / 电力换相） */
  --button-width: 3.5em;
  --button-height: 2em;
  --toggle-diameter: 1.5em;
  --button-toggle-offset: calc((var(--button-height) - var(--toggle-diameter)) / 2);
  --toggle-shadow-offset: 10px;
  --toggle-wider: 3em;
  font-size: 14px;
  position: relative;
  display: inline-block;
  user-select: none;
}

.slider {
  display: inline-block;
  width: var(--button-width);
  height: var(--button-height);
  background-color: var(--rule);
  border-radius: calc(var(--button-height) / 2);
  position: relative;
  transition: 0.3s all ease-in-out;
  cursor: pointer;
  vertical-align: middle;
}

.slider::after {
  content: "";
  display: inline-block;
  width: var(--toggle-diameter);
  height: var(--toggle-diameter);
  background-color: #fff;
  border-radius: calc(var(--toggle-diameter) / 2);
  position: absolute;
  top: var(--button-toggle-offset);
  transform: translateX(var(--button-toggle-offset));
  box-shadow: var(--toggle-shadow-offset) 0 calc(var(--toggle-shadow-offset) * 4) rgba(0, 0, 0, 0.1);
  transition: 0.3s all ease-in-out;
}

.switch input[type="checkbox"]:checked + .slider {
  background-color: var(--seal);
}

.switch input[type="checkbox"]:checked + .slider::after {
  transform: translateX(calc(var(--button-width) - var(--toggle-diameter) - var(--button-toggle-offset)));
  box-shadow: calc(var(--toggle-shadow-offset) * -1) 0 calc(var(--toggle-shadow-offset) * 4) rgba(0, 0, 0, 0.1);
}

.switch input[type="checkbox"] {
  display: none;
}

/* ───────────── 顶栏环状拆解进度 ─────────────
   整周 = 全部拆解阶段；描边由 JS 每帧按 f_show 擦洗（stroke-dashoffset），
   环心数字为当前阶段序号（01 起）。 */
.ring {
  position: relative;
  flex: 0 0 auto;
  width: 44px; height: 44px;
  pointer-events: none;
}
.ring svg {
  display: block;
  width: 100%; height: 100%;
  transform: rotate(-90deg);   /* 起点 12 点钟方向 */
}
.ring circle { fill: none; stroke-width: 2; }
.ring__bg { stroke: var(--rule); }
.ring__fg { stroke: var(--seal); stroke-linecap: round; }
/* 落位脉冲：吸附归位瞬间由 JS 加 is-pulse 触发一次 */
.ring.is-pulse .ring__fg { animation: ringPulse .5s ease; }
@keyframes ringPulse {
  0%   { stroke-width: 2; }
  35%  { stroke-width: 3.2; }
  100% { stroke-width: 2; }
}

/* ───────────── 右侧目录 ───────────── */

#rail {
  position: fixed;
  right: clamp(12px, 2vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-chrome);
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 72vh;
  padding-left: 14px;
  overflow: hidden;
}
/* 目录左侧竖线，条目用短横线引出 —— 索引页的引线 */
#rail::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--rule);
}
/* 连续进度线：叠在竖线上，由 f_show 每帧 scaleY 擦洗 */
.rail__fill {
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--seal);
  transform-origin: top;
  transform: scaleY(0);
  pointer-events: none;
}
.rail__head {
  padding-bottom: 6px;
  font-size: 10.5px;
  letter-spacing: .2em;
  color: var(--ink-3);
}
.rail__item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 10px 5px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: color .2s ease, opacity .2s ease;
}
.rail__item i {
  font: 400 12px/1 var(--font-num);
  font-style: normal;
  font-variant-numeric: tabular-nums;
  min-width: 18px;
  opacity: .8;
}
.rail__item span {
  font-size: 12.5px;
  white-space: nowrap;
  letter-spacing: .01em;
}
.rail__item:hover { color: var(--ink); }
.rail__item.is-done { color: var(--ink-3); opacity: .72; }
.rail__item.is-active { color: var(--seal); }
.rail__item.is-active i { opacity: 1; }
/* 当前条目：从竖线引出的短横线 */
.rail__item.is-active::before {
  content: "";
  position: absolute;
  left: -14px; top: 50%;
  width: 10px; height: 1px;
  background: var(--seal);
  transform: translateY(-50%);
}

kbd {
  font: 500 10.5px/1 var(--font-sans);
  padding: 3px 6px;
  border-radius: var(--r-1);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-2);
}

/* ───────────────────────── 滚动叙事区 ───────────────────────── */

/* 滚动区只承担「滚动距离 = 进度」，自身无可见内容 */
#scroll {
  position: relative;
  z-index: var(--z-scroll);
  pointer-events: none;
}

.stage {
  height: 100vh;
  height: 100dvh;   /* 移动端地址栏伸缩不再引起阶段跳变 */
  min-height: 600px;
}

/* ───────────── 固定层介绍面板：不随滚动位移 ─────────────
   位于视口左侧垂直居中；滚动只改变「当前阶段」，
   内容替换后整组文字缓慢弹出（错峰 + 轻微上浮回正）。 */
#stagePanel {
  position: fixed;
  left: clamp(24px, 4.5vw, 64px);
  top: 50%;
  transform: translateY(-50%);
  width: min(460px, 40vw);
  padding: 22px 4px 24px;
  z-index: var(--z-tag);
  pointer-events: none;

  --row-stagger: 110ms;
  --row-base:    90ms;
}
/* 每一「行」默认隐藏、轻微下压缩小；激活时按索引错峰缓慢弹出（spring 过冲曲线）。
   向上滚动（is-reverse）时改为从上方沉入 —— 方向感知的"倒带"感 */
#stagePanel.is-reverse > * { transform: translateY(-14px) scale(.988); }
#stagePanel > * {
  opacity: 0;
  transform: translateY(14px) scale(.988);
  transition: opacity .72s var(--ease-spring),
              transform .72s var(--ease-spring);
  will-change: opacity, transform;
}
#stagePanel.is-active > *:nth-child(1) { transition-delay: calc(var(--row-base) + var(--row-stagger) * 0); opacity: 1; transform: none; }
#stagePanel.is-active > *:nth-child(2) { transition-delay: calc(var(--row-base) + var(--row-stagger) * 1); opacity: 1; transform: none; }
#stagePanel.is-active > *:nth-child(3) { transition-delay: calc(var(--row-base) + var(--row-stagger) * 2); opacity: 1; transform: none; }
#stagePanel.is-active > *:nth-child(4) { transition-delay: calc(var(--row-base) + var(--row-stagger) * 3); opacity: 1; transform: none; }
#stagePanel.is-active > *:nth-child(5) { transition-delay: calc(var(--row-base) + var(--row-stagger) * 4); opacity: 1; transform: none; }
#stagePanel.is-active > *:nth-child(6) { transition-delay: calc(var(--row-base) + var(--row-stagger) * 5); opacity: 1; transform: none; }
/* 退场：快速上浮淡出（比直接替换 innerHTML 多一层交叉过渡）。
   !important 用于压过 JS 注入的行级 transition-delay 内联样式 */
#stagePanel.is-leaving > * {
  opacity: 0;
  transform: translateY(-10px) scale(.988);
  transition: opacity .18s ease, transform .18s ease;
  transition-delay: 0s !important;
}

/* ───── 标题字符切分（splitText 手法）：整行淡入改为逐字错峰上升 ───── */
.panel__title .ch-wrap { white-space: pre-wrap; }
.panel__title .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.55em);
  transition: opacity .48s var(--ease-spring), transform .48s var(--ease-spring);
}
#stagePanel.is-reverse .panel__title .ch { transform: translateY(-0.55em); }
#stagePanel.is-active .panel__title .ch { opacity: 1; transform: none; }

/* ───── specs 规格表：条目级隐藏态，由 JS 注入"从中心扩散"的延迟 ───── */
.panel__specs .spec {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .6s var(--ease-spring), transform .6s var(--ease-spring);
}
#stagePanel.is-active .panel__specs .spec { opacity: 1; transform: none; }
#stagePanel.is-leaving .panel__specs .spec {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  transition-delay: 0s !important;
}

.panel__title {
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -.012em;
  color: var(--ink);
  text-wrap: balance;
}
.panel__title em {
  display: block;
  margin-top: var(--sp-2);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(14px, 1.3vw, 16.5px);
  letter-spacing: .01em;
  color: var(--ink-3);
}

.panel__lead {
  margin: var(--sp-4) 0 0;
  font-size: var(--fs-base);
  line-height: 1.86;
  color: var(--ink-2);
}
/* 荧光笔式强调，替代原来的纯变色 */
.panel__lead b,
.panel__list b {
  color: var(--ink);
  font-weight: 700;
  background: linear-gradient(180deg, transparent 56%, var(--oil-wash) 56%);
  padding: 0 .1em;
}

.panel__list {
  margin: var(--sp-5) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.panel__list li {
  position: relative;
  padding-left: 22px;
  font-size: var(--fs-md);
  line-height: 1.78;
  color: var(--ink-2);
}
/* 短横标记，比圆点更接近手册排版 */
.panel__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(.89em - 1px);
  width: 12px; height: 1.5px;
  background: var(--oil-ink);
}

/* 规格表：发丝线分隔的数据表，不是卡片网格 */
.panel__specs {
  margin-top: var(--sp-5);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
}
.spec {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--rule-2);
}
.spec:nth-child(odd)  { padding-right: 16px; border-right: 1px solid var(--rule-2); }
.spec:nth-child(even) { padding-left: 16px; }
.spec b {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--ink-3);
}
.spec span {
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 侧栏注释：左侧油色竖线 */
.panel__flow {
  margin-top: var(--sp-5);
  padding-left: var(--sp-4);
  border-left: 3px solid var(--oil);
}
.flow__label {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: .14em;
  font-weight: 600;
  color: var(--paper);
  background: var(--oil-ink);
  padding: 3px 8px;
  border-radius: var(--r-1);
  margin-bottom: var(--sp-2);
}
.panel__flow p {
  margin: 0;
  font-size: var(--fs-md);
  line-height: 1.78;
  color: var(--ink-2);
}

/* 全文统一蓝调：热侧 / 回程段。两套系统共享功能色，不再随 sys 切换 */
.c-oil    { color: var(--oil-ink);  font-weight: 600; }
.c-hot    { color: var(--oil-ink);  font-weight: 600; }
.c-return { color: var(--return);   font-weight: 600; }

/* ───────────── 系统配色：润滑 = 浅棕（初版色调）/ 冷却 = 蓝 ─────────────
   印章强调色、油路标签、目录高亮、环状进度随系统整体换相 */
body[data-sys="lub"] {
  --seal:     oklch(58% 0.095 68);
  --seal-wash: oklch(93% 0.035 80);
  --oil:      oklch(60% 0.105 70);
  --oil-ink:  oklch(42% 0.095 62);
  --oil-wash: oklch(94% 0.030 80);
  /* 中性色随系统换相：润滑 = 暖米纸 + 暖墨（消除蓝残留，回归初版浅棕） */
  --paper:       oklch(96.4% 0.016 88);
  --paper-2:     oklch(93.6% 0.020 86);
  --paper-3:     oklch(90.6% 0.024 84);
  --surface:     oklch(98.8% 0.008 88);
  --surface-2:   oklch(95.8% 0.014 86);
  --ink:         oklch(26%  0.026 70);
  --ink-2:       oklch(36%  0.024 68);
  --ink-3:       oklch(47%  0.020 66);
  --rule:        oklch(85%  0.018 82);
  --rule-2:      oklch(91%  0.012 84);
  --return:      oklch(50% 0.080 60);
  --return-wash: oklch(94% 0.030 78);
  --cool-hot:    oklch(42% 0.080 60);
  --cool-cold:   oklch(55% 0.070 75);
  --cool-wash:   oklch(95% 0.028 80);
}
body[data-sys="cool"] {
  --seal:     oklch(42% 0.118 252);
  --seal-wash: oklch(94% 0.032 250);
  --oil:      oklch(50% 0.095 218);
  --oil-ink:  oklch(38% 0.095 252);
  --oil-wash: oklch(94.5% 0.028 250);
}

/* 电力系统（混动）：绿色相位。印章 / 功能色 / 中性纸墨整体换绿 */
body[data-sys="ev"] {
  --seal:      oklch(46% 0.115 155);
  --seal-wash: oklch(94% 0.045 150);
  --oil:       oklch(50% 0.110 152);
  --oil-ink:   oklch(38% 0.100 155);
  --oil-wash:  oklch(94.5% 0.040 150);
  --paper:     oklch(96.4% 0.018 150);
  --paper-2:   oklch(93.6% 0.022 148);
  --paper-3:   oklch(90.6% 0.026 146);
  --surface:   oklch(98.8% 0.010 150);
  --surface-2: oklch(95.8% 0.016 148);
  --ink:       oklch(25%  0.028 152);
  --ink-2:     oklch(35%  0.026 150);
  --ink-3:     oklch(46%  0.022 148);
  --rule:      oklch(85%  0.018 148);
  --rule-2:    oklch(91%  0.012 148);
  --return:      oklch(46% 0.085 172);
  --return-wash: oklch(94% 0.030 168);
  --cool-hot:    oklch(40% 0.095 158);
  --cool-cold:   oklch(58% 0.100 145);
  --cool-wash:   oklch(95% 0.030 150);
  /* 电力珠链分色（端口标签 / 图例用） */
  --ev-hv:      oklch(45% 0.115 152);   /* 高压段：深绿 */
  --ev-lv:      oklch(60% 0.125 140);   /* 低压段：亮绿 */
  --ev-ground:  oklch(44% 0.085 172);   /* 搭铁回流：青绿 */
}

/* 电力端口标签：进（高压侧深绿）/ 出（搭铁侧青绿） */
body[data-sys="ev"] .port-tag--in  { color: var(--ev-hv); }
body[data-sys="ev"] .port-tag--out { color: var(--ev-ground); }


/* ───────────── 系统切换过渡 ─────────────
   不再整页淡出：主体颜色由 body[data-sys] 驱动经 @property 渐变；
   切换期间仅暂蔽视口交互，车身 / 镜头 / 滚动位置保持不动 */
body.is-switching #viewport { pointer-events: none; }

/* ───────────── TextType 打字机光标（React Bits TextType 手法） ───────────── */
.type-cursor {
  display: inline-block;
  margin-left: 2px;
  color: var(--seal);
  font-weight: 400;
  animation: typeBlink .8s steps(1) infinite;
}
@keyframes typeBlink {
  0%, 55%  { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* ───────────── 加载层 ───────────── */

#loader {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: opacity .6s ease;
}
#loader.is-hidden { opacity: 0; pointer-events: none; }
.loader__in { text-align: center; }
.loader__ring {
  width: 44px; height: 44px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  border-top-color: var(--seal);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader__msg {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: .06em;
}
.loader__sub {
  margin: var(--sp-2) 0 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-3);
}

/* ───────────────────────── 响应式 ───────────────────────── */

/* 目录在空间不足时收成纯序号列 */
@media (max-width: 1280px) {
  .rail__item span { display: none; }
  .rail__item { padding-right: 4px; }
}

@media (max-width: 900px) {
  #rail { display: none; }
  /* 固定面板收成底部横向铺满，可滚动 */
  #stagePanel {
    left: 12px; right: 12px;
    top: auto; bottom: 84px;
    transform: none;
    width: auto;
    max-height: 52vh;
    overflow-y: auto;
    pointer-events: auto;
    padding: 18px 4px 16px;
  }
  .brand__txt em { display: none; }
  .sys-toggle-wrap { margin: 0 4px; }
  #topbar { gap: 16px; }
  .ring { width: 36px; height: 36px; }
  .scroll-hint { display: none; }
}

/* 极窄视口（如内嵌侧栏预览）：隐藏品牌文字、进一步收小开关，
   保证开关完整留在屏幕内 */
@media (max-width: 520px) {
  .brand__txt { display: none; }
  #topbar { gap: 12px; padding: 10px 14px; }
}

@media (max-height: 620px) {
  #stagePanel .panel__list { gap: 7px; }
  #stagePanel .panel__specs { margin-top: var(--sp-4); }
}

/* 尊重系统降低动效设置 */
@media (prefers-reduced-motion: reduce) {
  #stagePanel > * { transition: opacity .2s ease; transform: none; }
  #stagePanel.is-reverse > * { transform: none; }
  .panel__title .ch { opacity: 1; transform: none; transition: none; }
  .panel__specs .spec { opacity: 1; transform: none; transition: none; }
  #stagePanel.is-leaving > * { transition: none; }
  #viewport, #stagePanel, #rail, #topbar { transition: none; }
  .slider, .slider::after { transition: none; }
  .type-cursor { animation: none; }
  .loader__ring { animation: none; }
  .hint__mouse i { animation: none; }
  .ring.is-pulse .ring__fg { animation: none; }
}

/* ═════════ 流体监控面板（顶栏内嵌：系统开关与进度环之间）═════════
   无标题、无边框、无底色：表盘与滑杆直接融入顶栏背景。
   绝对定位挂在顶栏右段，不参与 flex 排布 → 系统开关居中不受影响 */
#fluidPanel {
  position: absolute;
  top: 50%;
  right: calc(clamp(18px, 3vw, 36px) + 44px + 20px);  /* 顶栏右距 + 进度环宽 + 间距 */
  transform: translateY(-50%);
  z-index: 1;
  display: flex;
  align-items: center;
  user-select: none;
  transition: opacity .35s ease;
}
#fluidPanel.is-folded { opacity: 0; pointer-events: none; }

.fp__body {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

/* 三只 270° 圆表盘：压力 / 流速 / 温度（顶栏内定宽横排） */
.fp__gauges {
  display: flex;
  gap: 26px;
}
.fp__dial {
  width: 60px;
  text-align: center;
}
.fp__dial em {
  display: block;
  font-style: normal;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  letter-spacing: .1em;
  margin-bottom: 2px;
}
.fp__dial svg { width: 100%; display: block; }
.fp__dial .gd-track {
  fill: none;
  stroke: var(--rule);
  stroke-width: 3;
  stroke-linecap: round;
}
.fp__dial .gd-val {
  fill: none;
  stroke: var(--seal);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 0 999;
  transition: stroke-dasharray .3s ease;
}
.fp__dial .gd-tick {
  stroke: var(--ink-3);
  stroke-width: 1;
  opacity: .55;
}
.fp__dial .gd-tick--major { stroke: var(--ink-2); stroke-width: 1.4; opacity: .8; }
.fp__dial .gd-needle {
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linecap: round;
  transition: transform .3s cubic-bezier(.34, 1.4, .64, 1);
}
.fp__dial .gd-hub {
  fill: var(--surface);
  stroke: var(--ink);
  stroke-width: 1.4;
}
.fp__dial .gd-num {
  font-family: var(--font-num);
  font-size: 12.5px;
  fill: var(--ink);
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.fp__dial .gd-unit {
  font-size: 6.2px;
  letter-spacing: .08em;
  fill: var(--ink-3);
  text-anchor: middle;
}

/* 控件区：双列舒展（与表盘同融背景，无分隔线）。
   流向动画开关独立成列（.fp__switch），滑杆区恒为 2×2 —— 三行布局
   在绝对定位模式下会超出顶栏高度被视口裁掉（1920 宽实测溢出 13px） */
.fp__ctrls {
  align-content: center;
  display: grid;
  grid-template-columns: 140px 140px;
  gap: 14px 44px;
}
/* 流向动画：独立列（名称在上 / 开关在下），宽屏下纵排省宽度 */
.fp__switch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}
.fp__ctl {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px var(--sp-2);
}
.fp__ctl--row { grid-template-columns: 1fr auto; }
.fp__name {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  letter-spacing: .03em;
}
.fp__ctl output {
  font-family: var(--font-num);
  font-size: var(--fs-xs);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.fp__ctl input[type="range"] {
  grid-column: 1 / -1;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 16px;
  background: none;
  cursor: pointer;
  margin: 0;
}
.fp__ctl input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--rule);
  border-radius: 1px;
}
.fp__ctl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--seal);
  margin-top: -4.5px;
  transition: transform .15s var(--ease-spring);
}
.fp__ctl input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }
.fp__ctl input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--rule);
  border-radius: 1px;
}
.fp__ctl input[type="range"]::-moz-range-thumb {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--seal);
}
/* 冷却系统时才显示节温器开度 */
#fpThermoRow { display: none; }
body[data-sys="cool"] #fpThermoRow { display: grid; }

/* ═════════ 进 / 出口浮动标签 ═════════ */
#portTags {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-tag);
}
.port-tag {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  font-size: var(--fs-xs);
  letter-spacing: .1em;
  color: var(--ink);
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-1);
  opacity: 0;
  transform: translate(-50%, -140%);
  transition: opacity .25s ease;
  white-space: nowrap;
}
.port-tag.is-on { opacity: 1; }
.port-tag i {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.port-tag--in i {
  background: var(--oil);
  box-shadow: 0 0 0 2px var(--oil-wash);
}
.port-tag--out i {
  background: var(--return);
  box-shadow: 0 0 0 2px var(--return-wash);
}
body[data-sys="cool"] .port-tag--in i {
  background: var(--cool-hot);
  box-shadow: 0 0 0 2px var(--cool-wash);
}
body[data-sys="cool"] .port-tag--out i {
  background: var(--cool-cold);
  box-shadow: 0 0 0 2px var(--cool-wash);
}
body[data-sys="cool"] .port-tag--in { color: var(--cool-hot); }
body[data-sys="cool"] .port-tag--out { color: var(--cool-cold); }
/* 电力系统端口标签圆点：进 = 高压深绿 / 出 = 搭铁青绿 */
body[data-sys="ev"] .port-tag--in i {
  background: var(--ev-hv);
  box-shadow: 0 0 0 2px var(--seal-wash);
}
body[data-sys="ev"] .port-tag--out i {
  background: var(--ev-ground);
  box-shadow: 0 0 0 2px var(--seal-wash);
}

/* 顶栏放不下时（绝对定位面板会与居中的系统开关相撞：面板 ~670px + 右距 100px，
   与居中开关（半宽 160px）在视口窄于 ~1860px 时相撞，阈值留足余量）：
   面板换到顶栏下方独占一行（仍在纸色底条内），开关居中不受影响；
   此时控件排成一行四列、开关恢复横排，整行更矮更透气 */
@media (max-width: 1880px) {
  #topbar { flex-wrap: wrap; row-gap: 2px; min-height: 0; padding-bottom: 10px; }
  #fluidPanel { position: static; order: 10; transform: none; flex: 1 1 100%; justify-content: center; }
  .fp__ctrls { grid-template-columns: repeat(4, minmax(120px, 150px)); column-gap: 40px; }
  .fp__switch { flex-direction: row; gap: 12px; }
}
@media (max-width: 860px) {
  .fp__dial { width: 52px; }
  .fp__dial .gd-num { font-size: 11.5px; }
  .fp__body { flex-wrap: wrap; justify-content: center; row-gap: 4px; }
  .fp__ctrls { grid-template-columns: repeat(2, minmax(110px, 128px)); }
  .fp__switch { flex-direction: column; }
}
@media (max-width: 520px) {
  .fp__ctrls { grid-template-columns: minmax(0, 128px); }
}
