/* =============================================================================
 * theme.css —— 《从对称到周期》主题样式
 * -----------------------------------------------------------------------------
 * 规范来源：设计文档 §3（浅色学术风）
 *   · 配色、字号、边距、logo 位置、按钮尺寸均按文档取值
 *   · 动画只动 transform / opacity（GPU 合成）
 *   · ⚠️ 动画状态段（.is-on 等）必须留在文件**末尾**，否则被同权重规则覆盖
 *     （slidekit/AGENTS.md 坑 E3）
 * ========================================================================== */

/* ---------------------------------------------------------------- 0. 变量 */
:root {
  --bg:        #FAFAF8;
  --ink:       #1F2A44;
  --ink-2:     #5A6478;
  --ink-3:     #8A93A6;
  --curve:     #1D4ED8;   /* 曲线主色（基础段） */
  --curve-2:   #60A5FA;   /* 镜像 / 旋转段 */
  --curve-3:   #93C5FD;   /* 二次镜像 / 旋转段 */
  --accent:    #E8552D;   /* 轴 / 中心 / 结论 / 按钮强调 */
  --accent-l:  #FDE8D8;   /* 周期高亮底纹 */
  --grid:      #F0F2F7;
  --axis:      #8A93A6;
  --line:      #D5DAE5;
  --card-bg:   #FFFFFF;
  --cn: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #E9EAE6;
  font-family: var(--cn);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- 1. 舞台 */
#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  background: var(--bg);
  transform-origin: 50% 50%;
  overflow: hidden;
}

.slide {
  position: absolute; inset: 0;
  padding: 78px 120px 126px;   /* 底部多留：工具栏与 HUD 固定在舞台底边 */
  opacity: 0; visibility: hidden;
  transition: opacity 300ms ease, transform 300ms ease;
  transform: translateY(14px);
}
.slide.active {
  opacity: 1; visibility: visible;
  transform: translateY(0);
}

/* ------------------------------------------------------------ 1.5 品牌 logo */
#brand {
  position: absolute; top: 40px; right: 48px;
  width: 160px; height: 45px;
  object-fit: contain;
  z-index: 50;
  opacity: .92;
  pointer-events: none;
}

/* ---------------------------------------------------------------- 2. 页头 */
.head { text-align: center; margin-bottom: 28px; }
.head__title {
  font-size: 52px; font-weight: 700; line-height: 1.25; letter-spacing: .5px;
}
.head__ask {
  font-size: 30px; font-weight: 400; color: var(--ink-2);
  margin-left: 14px; letter-spacing: 1px;
}
.head__formula {
  margin-top: 16px; font-size: 34px; color: var(--ink);
}
.head__tag {
  display: inline-block; margin-top: 14px; padding: 6px 20px;
  font-size: 22px; color: var(--accent);
  background: var(--accent-l); border-radius: 999px;
}

/* ---------------------------------------------------------------- 3. 封面 */
.slide--cover {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.cover__kicker {
  font-size: 24px; color: var(--ink-2); letter-spacing: 3px; margin-bottom: 30px;
}
.cover__title {
  font-size: 88px; font-weight: 700; letter-spacing: 6px; line-height: 1.1;
}
.cover__sub {
  margin-top: 22px; font-size: 36px; color: var(--ink-2); letter-spacing: 2px;
}
.cover__rule {
  width: 160px; height: 5px; background: var(--accent);
  margin: 40px 0 34px; border-radius: 3px;
}
.cover__meta {
  font-size: 28px; color: var(--ink-2); letter-spacing: 1px;
}
.cover__meta b { color: var(--ink); }
.cover__dot { margin: 0 14px; color: var(--ink-3); }
.cover__hint {
  position: absolute; left: 0; right: 0; bottom: 76px;
  font-size: 22px; color: var(--ink-3); letter-spacing: 1px;
}

/* ------------------------------------------------------- 4. 动画页（P2–P6） */
.slide--anim { display: flex; flex-direction: column; }

.figwrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
  padding: 0 10px;
}
/* 交给 SVG 的 preserveAspectRatio 适配：填满图区且不变形 */
.fig { width: 100%; height: 100%; }

/* 说明文字只留"结论"一行 —— 口语化的解释由老师现场讲，不占版面 */
.caption { text-align: center; min-height: 92px; padding: 12px 0 0; }
.caption__conc {
  font-size: 38px; font-weight: 700; color: var(--accent); letter-spacing: .5px;
}
.caption__conc em { font-style: normal; font-size: 44px; }

/* ---------------------------------------------------------- 5. 按钮（触屏） */
.btn {
  font-family: var(--cn); font-size: 26px; font-weight: 700;
  color: #fff; background: var(--accent);
  border: none; border-radius: 999px;
  padding: 18px 52px; min-width: 220px;
  cursor: pointer; letter-spacing: 2px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease, opacity 160ms ease;
  box-shadow: 0 6px 18px rgba(232, 85, 45, .28);
}
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .35; box-shadow: none; }
.btn--ghost {
  background: #fff; color: var(--accent);
  border: 2px solid var(--accent); box-shadow: none;
}

/* ------------------------------------------------------------ 6. 方法总结 */
.cards { display: flex; flex-direction: column; gap: 22px; margin-top: 26px; }
.card {
  display: flex; align-items: center; gap: 26px;
  background: var(--card-bg); border: 2px solid var(--line);
  border-radius: 18px; padding: 24px 40px;
}
.card--star { border-color: var(--accent); background: var(--accent-l); }
.card__no {
  font-size: 40px; font-weight: 700; color: var(--accent);
  min-width: 56px; text-align: center;
}
.card__main { display: flex; align-items: baseline; gap: 34px; flex: 1; }
.card__eq { font-size: 30px; color: var(--ink); min-width: 620px; }
.card__res { font-size: 38px; font-weight: 700; color: var(--curve); }
.card--star .card__res { color: var(--accent); }
.card__why { font-size: 22px; color: var(--ink-2); margin-left: auto; }

.mnemonic {
  margin-top: 34px; display: flex; align-items: center; justify-content: center; gap: 26px;
}
.mnemonic__key {
  font-size: 24px; color: #fff; background: var(--ink);
  padding: 8px 22px; border-radius: 10px; letter-spacing: 4px;
}
.mnemonic__txt { font-size: 40px; font-weight: 700; letter-spacing: 2px; }
.mnemonic__txt em { font-style: normal; color: var(--accent); font-size: 50px; }

.note {
  margin-top: 26px; padding: 18px 30px; font-size: 24px; color: var(--ink-2);
  background: #fff; border-left: 6px solid var(--line); border-radius: 8px;
}
.note b { color: var(--accent); }

/* -------------------------------------------------------------- 7. 题页 */
/* 注意：题页最容易超屏（长题干 + 4 选项 + 4 步解析）。
   这里的字号/间距是按「P10 例3 全展开也不溢出 876px 内容区」定的，改大前先跑自检的溢出检查。 */
.slide--prob { display: flex; flex-direction: column; }
.prob__tag {
  display: inline-block; font-size: 19px; color: var(--accent);
  background: var(--accent-l); border-radius: 999px; padding: 4px 16px;
}
.prob__head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.prob__no { font-size: 28px; font-weight: 700; }
.prob__stem { font-size: 26px; line-height: 1.62; margin-bottom: 16px; }
.prob__opts { display: flex; flex-direction: column; gap: 9px; margin-bottom: 6px; }
.opt {
  display: flex; align-items: flex-start; gap: 14px;
  font-size: 26px; line-height: 1.42;
  padding: 10px 22px; border-radius: 12px; border: 2px solid transparent;
  background: #fff;
}
.opt__key { font-weight: 700; color: var(--ink-2); min-width: 38px; }
.opt.is-correct { border-color: var(--accent); background: var(--accent-l); }
.opt.is-correct .opt__key { color: var(--accent); }
.prob__sol { margin-top: 4px; }
.sol__title {
  font-size: 24px; font-weight: 700; color: var(--accent); margin-bottom: 8px;
}
.sol__step {
  font-size: 23px; line-height: 1.55; color: var(--ink);
  padding: 5px 0 5px 46px; position: relative;
}
.sol__step::before {
  content: attr(data-idx);
  position: absolute; left: 6px; top: 7px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--curve); color: #fff;
  font-size: 17px; line-height: 28px; text-align: center; font-weight: 700;
}
.sol__hint { font-size: 22px; color: var(--ink-2); padding-left: 46px; line-height: 1.6; }

/* -------------------------------------------------------------- 8. 结束页 */
.slide--end {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.end__title { font-size: 72px; font-weight: 700; letter-spacing: 6px; }
.end__sub {
  margin-top: 30px; font-size: 30px; color: var(--ink-2); line-height: 1.8;
}
.end__thanks {
  margin-top: 60px; font-size: 34px; color: var(--accent); letter-spacing: 6px;
}

/* ------------------------------------------------------------ 9. 工具栏 */
#toolbar {
  position: absolute; left: 48px; bottom: 34px;
  display: flex; align-items: center; gap: 12px; z-index: 60;
}
/* 进度提示（右下）：告诉老师"还能点几下"，与工具栏分工 */
#hud {
  position: absolute; right: 48px; bottom: 34px;
  display: flex; align-items: center; gap: 14px; z-index: 60;
  pointer-events: none;            /* 提示不挡点击 */
}
.hud-hint {
  font-size: 22px; color: var(--ink-2); letter-spacing: .5px;
  background: rgba(255,255,255,.86);
  border: 2px solid var(--line); border-radius: 999px;
  padding: 12px 26px;
  transition: color 300ms ease, border-color 300ms ease;
}
.hud-hint.is-done { color: #2F9E63; border-color: #BCE3CC; }
.hud-page {
  font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: 1px;
  background: rgba(255,255,255,.86);
  border: 2px solid var(--line); border-radius: 999px;
  padding: 12px 22px; min-width: 96px; text-align: center;
}
.tbtn {
  width: 56px; height: 56px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line); color: var(--ink);
  font-size: 26px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--cn);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 140ms ease, transform 120ms ease;
}
.tbtn:active { border-color: var(--accent); transform: scale(.94); }
.tbtn.is-hidden { display: none; }
/* ------------------------------------------------- 10. SVG 图元（通用） */
.ax-line   { stroke: var(--axis); stroke-width: 2.5; fill: none; }
.ax-arrow  { fill: var(--axis); }
.ax-name   { font-family: var(--cn); font-size: 26px; fill: var(--ink-2); font-weight: 700; }
.grid-line { stroke: var(--grid); stroke-width: 1.5; }
.tick-mark { stroke: var(--axis); stroke-width: 2; }
.tick-txt  { font-family: var(--cn); font-size: 22px; fill: var(--ink-3); }
.guide     { stroke: var(--accent); stroke-width: 3.5; stroke-dasharray: 12 9; }
.center-dot{ fill: var(--accent); stroke: #fff; stroke-width: 3; }
.band      { fill: var(--accent-l); opacity: .85; }
.tag-txt   { font-family: var(--cn); font-size: 24px; font-weight: 700; fill: var(--accent); }
.note-txt  { font-family: var(--cn); font-size: 22px; fill: var(--ink-2); }
.curve     { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.curve--base { stroke: var(--curve);   stroke-width: 6; }
.curve--m1   { stroke: var(--curve-2); stroke-width: 6; }
.curve--m2   { stroke: var(--curve-3); stroke-width: 6; }
.curve--ghost{ stroke: var(--ink-3);   stroke-width: 3.5; opacity: .40; }
.eq-dot      { fill: var(--curve); stroke: #fff; stroke-width: 2.5; }
.eq-line     { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 9 7; opacity: .9; }
.pulse-ring  { fill: none; stroke: var(--accent); stroke-width: 3; }

svg text { -webkit-user-select: none; user-select: none; }
svg, .fig { -webkit-tap-highlight-color: transparent; }

/* =============================================================================
 * 11. 动画状态段 —— 必须留在文件末尾（坑 E3：同权重靠文件顺序决胜）
 * ========================================================================== */

/* 默认隐藏：所有带 data-step 的元素，只有加了 .is-on 才出现 */
[data-step] { opacity: 0; }
[data-step].is-on { opacity: 1; }

/* 需要位移动画的元素：基态写在这里，目标态在 .is-on */
.rise       { transform: translateY(26px); transition: opacity 520ms ease, transform 520ms ease; }
.rise.is-on { transform: translateY(0); }

/* ⚠️ 描边生长由 JS 逐帧写 stroke-dashoffset（rAF），这里**绝不能**再加
   `transition: stroke-dashoffset` —— 两者叠加会让渲染值一直"追赶"每帧的目标值，
   表现为曲线出现时诡异的伸缩/抖动（实测踩过，见 AGENTS.md 坑 S9）。 */

/* 曲线与图形元素统一过渡（用于 class 驱动的淡入） */
.curve, .guide, .center-dot, .eq-dot, .eq-line, .band, .tag-txt, .note-txt {
  transition: opacity 420ms ease;
}
/* ⚠️ 凡是**由 JS 逐帧写 opacity** 的元素都要加这个类：
   否则 CSS 过渡会对每一帧的赋值再做一次 420ms 插值，渲染值永远在追目标值
   （与描边生长的 stroke-dashoffset 是同一类坑，见 AGENTS.md 坑 S9）。 */
.no-ftrans { transition: none !important; }

/* 弹入（公式卡/结论条） */
.pop       { transform: scale(.94); transition: opacity 320ms ease, transform 320ms cubic-bezier(.34,1.3,.64,1); }
.pop.is-on { transform: scale(1); }
