/* MVP 样式：只允许 docs/02 §1 的 13 色 token 与 radius/spacing 变量（tokens:check 管色值）。
   动效只用 02 §4 白名单里的：句间切换(250ms)、录音三点跳动(1s bounce)、进度条(300ms)。 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

#app { max-width: 430px; min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; }

/* ---------- S1 ---------- */
.s1 { flex: 1; display: flex; flex-direction: column; gap: var(--gap); padding: var(--pad); padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom)); }
.stat { font-size: 14px; color: var(--muted); }
.lesson-h { display: flex; align-items: baseline; justify-content: space-between; gap: var(--gap); }
.lesson-h h1 { font-size: 20px; font-weight: 600; }
.lesson-h .prog { font-size: 13px; color: var(--muted); }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 14px var(--pad); min-height: 56px;
}
.row .n { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 20px; }
.row .en { flex: 1; font-size: 16px; }
.dot { width: 10px; height: 10px; border-radius: 999px; flex: none; background: var(--score-none); }
.dot.D1 { background: var(--score-hi); }
.dot.D2 { background: var(--score-mid); }
.s1 .foot { margin-top: auto; }

/* ---------- S2 ---------- */
.s2 { flex: 1; display: flex; flex-direction: column; padding: var(--pad); padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom)); gap: var(--gap); position: relative; }
.topbar { display: flex; align-items: center; gap: var(--gap); }
.back { font-size: 15px; color: var(--muted); padding: 8px; margin-left: -8px; }
.progress { font-size: 13px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.sentence {
  font-size: 40px; font-weight: 600; line-height: 1.5; letter-spacing: .2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding: var(--gap) 0;
}
.sentence.sliding { animation: slide 250ms ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

.hint { font-size: 15px; color: var(--muted); min-height: 44px; display: flex; align-items: center; justify-content: center; text-align: center; }
.hint.ok { color: var(--score-hi); font-weight: 600; }
.hint.err { color: var(--danger); }
.hint .sub { font-size: 13px; color: var(--muted); }

/* 词级三态（02 §3，不新增 token、不新增第 14 色） */
.words { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 24px; font-weight: 600; padding: var(--gap) 0; }
.w-match { color: var(--text); }
.w-unclear { color: var(--text); text-decoration: underline wavy var(--score-mid); text-underline-offset: 6px; opacity: .85; }
.w-omitted { color: var(--danger); text-decoration: line-through; opacity: .6; }
.w-extra { color: var(--muted); font-style: italic; }

/* 录音三点（动效 3） */
.dots { display: inline-flex; gap: 6px; align-items: center; }
.dots i { width: 8px; height: 8px; border-radius: 999px; background: var(--danger); animation: bounce 1s infinite; }
.dots i:nth-child(2) { animation-delay: .16s; }
.dots i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-6px); } }

/* 音量波形条（动效 4：高度 120ms 线性，B 态采集中）。--level 由 Recorder 的实时帧能量写入（0..100）；
   按 `02` §4 约束只用 transform 做动效，且颜色/文字通道已由三点 + "我在听"承担（`02` §5 双通道）。 */
.level {
  display: inline-block; width: 4px; height: 18px; margin-left: 8px; border-radius: 999px;
  background: var(--danger); transform-origin: bottom center;
  transform: scaleY(calc(.15 + var(--level, 0) / 100 * .85));
  transition: transform 120ms linear;
}

.controls { margin-top: auto; display: flex; flex-direction: column; gap: var(--gap); }
.main-btn {
  height: 68px; border-radius: 999px; background: var(--green); color: var(--card);
  font-size: 18px; font-weight: 600; width: 100%;
}
.main-btn.recording { background: var(--danger); }
.main-btn:disabled { background: var(--line); color: var(--muted); }
.listen-btn {
  height: 48px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--card);
  font-size: 15px; width: 100%;
}
.secondary { display: flex; gap: var(--gap); }
.secondary button { flex: 1; height: 48px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--card); font-size: 15px; }
.secondary .primary { background: var(--green-light); border-color: var(--green); color: var(--green); font-weight: 600; }

/* 引擎标识（09 §4.3 第 2 条：10px、--muted，D 态常显——这不是装饰） */
.engine-badge { position: absolute; right: var(--pad); bottom: calc(var(--pad) + env(safe-area-inset-bottom)); font-size: 10px; color: var(--muted); letter-spacing: .5px; }

@media (prefers-reduced-motion: reduce) {
  .sentence.sliding { animation: none; }
  .dots i { animation: none; }
  .level { transition: none; }
}
