/* hidden 属性恒生效：任何元素级 display 规则不得让 [hidden] 元素可见
   （教训：.bank-panel{display:grid} 覆盖 UA 的 [hidden]→表达本收不起，v2.0.1） */
[hidden] {
  display: none !important;
}

/* ============================================================================
   M24 · 品牌视觉系统（Response C，交接文档 v4 / docs/web/M24-visual-identity.md）
   三层：原始色阶 primitive → 语义令牌 semantic → 组件规则。组件只准引用语义令牌。
   品牌锚点不可改：Evergreen #0A533C · Coach White #F7FFF9
                   Signal Amber #F4B44E（深底）· Signal Amber Dark #A45E00（浅底）· Ink #18211C
   ========================================================================= */

:root {
  /* ── 原始色阶：绿系由 Evergreen 反推色相 hsl(161 78% 18%) 铺满明度梯 ── */
  --g-50: #eff8f3;
  --g-100: #d8efe3;
  --g-200: #b0dec8;
  --g-300: #7fc7a6;
  --g-400: #4ca97f;
  --g-500: #2a8b62;
  --g-600: #14704e;
  --g-700: #0a533c;   /* Evergreen — 品牌锚点 */
  --g-800: #08402f;
  --g-900: #062e22;
  --g-950: #041a13;

  /* 中性系由 Ink 反推（同为微绿色相），保证中性面与品牌绿同族 */
  --n-0: #ffffff;
  --n-25: #f7fff9;    /* Coach White */
  --n-50: #f1f6f3;
  --n-100: #e7efea;
  --n-200: #d9e4de;
  --n-300: #bcccc3;
  --n-400: #788b82;
  --n-500: #52625a;
  --n-700: #3a4842;
  --n-800: #26312b;
  --n-900: #18211c;   /* Ink */
  --n-950: #0e1512;

  /* 琥珀系 = 反馈/标注家族（M24 §3.4：禁止用作品牌装饰色，以免稀释 SIM 信号） */
  --a-100: #fceed5;
  --a-400: #f4b44e;   /* Signal Amber */
  --a-600: #c57c0b;
  --a-700: #a45e00;   /* Signal Amber Dark */
  --a-800: #8a4f00;
  --a-900: #3b2a0a;

  /* ── 非色彩令牌 ── */
  --header-h: 68px;   /* 此前硬编码在 .app-header / .app-layout / .drawer-backdrop 三处 */

  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: clamp(23px, 2.1vw, 30px);
  --lh-tight: 1.25;
  --lh-snug: 1.45;
  --lh-body: 1.65;    /* 正文/气泡：中英混排靠行高而非字号补偿 */

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;

  /* 圆角家族取 logo 圆角比 rx=23/100 ≈ 23% 的气质 */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  /* 层次三档：阴影色取品牌深绿低透明度，落在绿系页面上不发灰 */
  --e-1: 0 1px 2px rgb(6 46 34 / 6%);
  --e-2: 0 4px 14px rgb(6 46 34 / 8%), 0 1px 3px rgb(6 46 34 / 5%);
  --e-3: 0 18px 44px rgb(6 46 34 / 16%), 0 2px 8px rgb(6 46 34 / 8%);

  --t-fast: 120ms ease;
  --t-base: 180ms ease;

  /* ── 语义令牌（浅色）；名字全部沿用，只换值：
        drawerView.ts 用 getPropertyValue('--wave'/'--wave-bg') 画波形，改名会静默退回兜底色 ── */
  color-scheme: light;
  --bg: #e9f1ec;
  --surface: var(--n-0);
  --surface-soft: #f3f8f5;
  --surface-strong: #e4eee8;
  --text: var(--n-900);
  --muted: var(--n-500);
  --line: var(--n-200);
  --line-strong: var(--n-400);   /* 表单控件边界：WCAG 1.4.11 要 3:1，--line 是装饰发丝线 */
  --brand: var(--g-700);
  --brand-strong: var(--g-800);
  --brand-soft: var(--g-100);
  --brand-tint: var(--g-50);
  --on-brand: var(--n-25);       /* 品牌色面上的文字（修深色模式白字不可读的既有 bug） */
  --focus: #1d6fd0;              /* 唯一有意的非品牌色：绿焦点环会与品牌绿混淆，见 M24 §3.7 */
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: var(--a-700);
  --real: var(--g-600);
  --real-bg: #ddf1e6;
  --heuristic: #1a6ba8;
  --heuristic-bg: #e2effa;
  --simulated: var(--a-800);
  --simulated-bg: var(--a-100);
  --provider: #6b46a6;
  --provider-bg: #eee7fb;
  --marker-1: var(--a-600);
  --marker-2: #d9541e;
  --marker-3: #b42318;
  --ok: var(--real);             /* 韵律行此前一直吃 var(--ok, #2e7d32) 兜底值——本次正式定义 */
  --warn: var(--warning);
  --shadow: var(--e-3);
  --wave: var(--g-600);
  --wave-bg: #e7f1eb;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60rem 32rem at 8% -6%, rgb(10 83 60 / 9%), transparent 70%),
    radial-gradient(ellipse 48rem 30rem at 104% 4%, rgb(10 83 60 / 5%), transparent 70%),
    var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

/* 滚动条收细并染成中性系（默认滚动条在绿系页面上过于突兀） */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: var(--r-full);
  background: var(--line);
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--line-strong);
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* offset 制造的间隙里露出的是所在"面"的底色，故焦点环对比度按面测量（M24 §3.7）：
   浅色 4.18–4.96:1、深色 6.63–9.10:1，四种可能落点全部达标 */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  position: relative;
  z-index: 30;
  display: flex;
  height: var(--header-h);
  align-items: center;
  gap: var(--sp-5);
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

/* Response C 标志（M24 §2）。宽高写死防首屏尺寸位移；圆角来自 SVG 自身的 rx=23%，
   此处 border-radius 只在图片加载失败时约束 alt 框，不裁切图形。 */
.brand-mark {
  display: block;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--r-md);
}

.brand-text {
  display: grid;
  gap: 1px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: var(--lh-tight);
}

.brand small {
  color: var(--muted);
  font-size: var(--fs-2xs);
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.provider-badges {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

/* 顶栏选择器；[hidden] 全局规则保证 display 不覆盖隐藏 */
.voice-picker,
.mode-picker {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.voice-picker select,
.mode-picker select {
  padding: 6px var(--sp-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  transition: border-color var(--t-fast);
}

.voice-picker select:hover,
.mode-picker select:hover {
  border-color: var(--brand);
}

.app-layout {
  display: grid;
  height: calc(100vh - var(--header-h));
  grid-template-columns: minmax(0, 1fr) 420px;
}

.chat-panel,
.drawer {
  min-height: 0;
  background: var(--surface);
}

.chat-panel {
  display: grid;
  /* heading / optional IELTS route shell / IELTS flow status / scrollable log /
     optional bank / composer.
     The flow status used to become an unplanned fourth grid item. That moved
     the log/composer into implicit rows and could push the input below the
     mobile viewport when IELTS practice made the status visible. */
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  border-right: 1px solid var(--line);
}

.chat-panel > .chat-heading { grid-row: 1; }
.chat-panel > .ielts-practice-tools { grid-row: 2; }
.chat-panel > .chat-flow-status {
  grid-row: 3;
  margin: 0;
}
.chat-panel > .chat-log { grid-row: 4; }
.chat-panel > .bank-panel { grid-row: 5; }
.chat-panel > .chat-form { grid-row: 6; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-heading {
  padding: var(--sp-6) var(--sp-7) var(--sp-4);
}

.chat-flow-status {
  min-width: 0;
  margin: 0;
  padding: var(--sp-2) max(var(--sp-7), 7vw);
  border-block: 1px solid var(--line);
  background: var(--brand-soft);
  line-height: var(--lh-snug);
  overflow-wrap: anywhere;
}

/* IELTS Practice 路线使用顶部原生下拉框；聊天区壳层只在一轮完成后承载复盘。 */
.ielts-practice-tools {
  min-width: 0;
  max-height: min(46vh, 430px);
  padding: var(--sp-3) max(var(--sp-7), 7vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-block: 1px solid var(--line);
  background: var(--surface-soft);
}

.ielts-practice-route-picker {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  align-items: center;
  gap: var(--sp-1);
  padding: 0;
  margin: 0;
  border: 0;
}

.ielts-practice-route-select-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.ielts-practice-route-select-label select {
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding: 7px 30px 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: var(--lh-snug);
}

.ielts-practice-route-select-label select:hover {
  border-color: var(--brand);
}

.ielts-practice-route-select-label select:focus-visible {
  border-color: var(--focus);
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.ielts-practice-route-retry {
  min-height: 40px;
  flex: 0 0 auto;
  padding-inline: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-weight: 700;
  white-space: nowrap;
}

.ielts-practice-review {
  min-width: 0;
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--line));
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--e-1);
}

.ielts-practice-review-heading {
  min-width: 0;
}

.ielts-practice-review-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
  margin: var(--sp-3) 0 0;
}

.ielts-practice-review-grid > div {
  min-width: 0;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}

.ielts-practice-review-grid dt {
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 750;
  line-height: var(--lh-snug);
}

.ielts-practice-review-grid dd {
  min-width: 0;
  margin: var(--sp-1) 0 0;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

#ielts-practice-review-pronunciation {
  color: var(--brand-strong);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.ielts-practice-review-actions {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.ielts-practice-review-actions > button {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  white-space: normal;
}

.drawer-heading {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: var(--lh-tight);
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.025em;
}

h1 {
  font-size: var(--fs-2xl);
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--fs-lg);
  line-height: var(--lh-tight);
}

h3 {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: var(--lh-snug);
}

.chat-log {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: var(--sp-4);
  overflow-y: auto;
  padding: var(--sp-4) max(var(--sp-7), 7vw) var(--sp-7);
  scroll-behavior: smooth;
}

.message {
  display: flex;
  max-width: min(680px, 88%);
  flex-direction: column;
  gap: 8px;
}

.message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message.tutor {
  align-self: flex-start;
}

.chat-mode-divider {
  display: flex;
  width: 100%;
  align-items: center;
  gap: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-xs);
  text-align: center;
}

.chat-mode-divider::before,
.chat-mode-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: '';
}

.chat-mode-divider span {
  flex: 0 1 auto;
}

.message-meta {
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.bubble {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  line-height: var(--lh-body);
  white-space: pre-wrap;
}

.bubble.user {
  border-bottom-right-radius: var(--r-xs);
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);   /* 深色模式下 --brand 是浅绿：白字仅 2.4:1，必须用 --on-brand */
}

.bubble.tutor {
  border-bottom-left-radius: var(--r-xs);
  background: var(--surface-soft);
  box-shadow: var(--e-1);
}

.chat-guide-toggle[aria-pressed='true'] {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.message.ielts-practice-opening {
  width: min(680px, 94%);
  max-width: min(680px, 94%);
}

.message.ielts-practice-opening .bubble {
  width: 100%;
  border-color: color-mix(in srgb, var(--brand) 34%, var(--line));
  background: color-mix(in srgb, var(--brand-soft) 62%, var(--surface));
}

.message.ielts-practice-opening[data-part='part2'] .bubble {
  line-height: var(--lh-snug);
}

.chat-mode-divider.ielts-practice-stage span {
  color: var(--brand-strong);
  font-weight: 750;
}

.practice-block {
  width: 100%;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: 14px;
  background: var(--brand-soft);
}

.practice-text {
  margin: 0 0 10px;
  color: var(--brand-strong);
  font-weight: 750;
  line-height: 1.45;
}

.ielts-structured-guidance {
  min-width: 0;
  overflow: hidden;
}

.ielts-guidance-heading {
  margin: 0 0 9px;
  color: var(--brand-strong);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.ielts-guidance-samples,
.ielts-guidance-framework {
  display: grid;
  min-width: 0;
  margin: 0;
  padding-inline-start: 1.45rem;
  gap: 10px;
}

.ielts-guidance-sample,
.ielts-guidance-framework-step {
  min-width: 0;
  padding-inline-start: 2px;
}

.ielts-guidance-sample + .ielts-guidance-sample {
  padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--brand) 25%, var(--line));
}

.ielts-guidance-sample-text,
.ielts-guidance-pattern {
  overflow-wrap: anywhere;
  word-break: normal;
}

.ielts-guidance-framework-heading {
  margin-top: 17px;
  padding-top: 13px;
  border-top: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line));
}

.ielts-guidance-framework-label {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 800;
}

.ielts-guidance-pattern {
  margin: 0;
  color: var(--brand-strong);
  line-height: var(--lh-snug);
  white-space: pre-wrap;
}

.practice-actions,
.sentence-actions,
.capture-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chat-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: var(--sp-4) var(--sp-7) var(--sp-5);
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.chat-form .mic-button[hidden] { display: none; }
.chat-form:has(.mic-button[hidden]) { grid-template-columns: minmax(0, 1fr) auto; }

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

input:hover,
textarea:hover {
  border-color: var(--brand);
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
  outline-offset: 3px;
}

input {
  min-height: 46px;
  padding: 0 var(--sp-4);
}

textarea {
  min-height: 74px;
  resize: vertical;
  padding: 11px var(--sp-3);
  line-height: var(--lh-snug);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

.primary-button,
.secondary-button,
.record-button,
.icon-button,
.text-button,
.mini-button {
  border: 0;
  border-radius: var(--r-md);
  touch-action: manipulation;   /* 手机上禁双击缩放，消除点按 300ms 迟滞感 */
  font-weight: 750;
  transition: background var(--t-fast), color var(--t-fast),
    border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.primary-button,
.secondary-button,
.record-button,
.mini-button {
  /* 按下时下沉 1px：给触屏一个不依赖 hover 的按压反馈 */
}

.primary-button:active,
.secondary-button:active,
.record-button:active,
.mini-button:active {
  transform: translateY(1px);
}

.primary-button {
  min-height: 44px;
  padding: 0 var(--sp-5);
  background: var(--brand);
  color: var(--on-brand);   /* 深色模式下 --brand 是浅绿，白字仅 2.4:1 */
  box-shadow: var(--e-1);
}

.primary-button:hover {
  background: var(--brand-strong);
  box-shadow: var(--e-2);
}

.secondary-button,
.mini-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.secondary-button:hover,
.mini-button:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.secondary-button {
  min-height: 42px;
  padding: 0 14px;
}

.mini-button {
  padding: 7px 10px;
  color: var(--brand-strong);
  font-size: var(--fs-xs);
}

.icon-button,
.text-button {
  background: transparent;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px;
}

.icon-button:hover {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.text-button {
  padding: 5px 7px;
  border-radius: var(--r-sm);
  color: var(--brand);
  font-size: var(--fs-xs);
}

.text-button:hover {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

/* v2.8.2 · 自动朗读冷启动：按钮保持可取消，真实出声前持续显示进度 */
#btn-chat-speak {
  white-space: nowrap;
}

#btn-chat-speak.is-starting {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: progress;
}

#btn-chat-speak.is-starting::before {
  width: 0.78em;
  height: 0.78em;
  flex: 0 0 auto;
  border: 2px solid currentcolor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: autospeak-spin 700ms linear infinite;
  content: '';
}

@keyframes autospeak-spin {
  to { transform: rotate(360deg); }
}

.drawer-toggle,
.drawer-close {
  display: none;
}

.drawer {
  overflow-y: auto;
  padding: 0 16px 40px;
}

.drawer > section,
.analysis-content > section {
  margin-bottom: 12px;
}

.card,
.capture-card,
.results-section {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--e-1);
}

.card,
.results-section {
  padding: var(--sp-4);
}

.capture-card {
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-soft);
}

.target-card.flash {
  animation: target-flash 900ms ease;
}

@keyframes target-flash {
  0%,
  100% {
    box-shadow: none;
  }
  35% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 24%, transparent);
  }
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.section-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-3);
  margin-bottom: 10px;
}

.section-title-row > h3 {
  min-width: 0;
  flex: 1 1 auto;
}

.field-hint,
.capture-status {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.capture-status.error {
  color: var(--danger);
}

.record-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--e-1);
}

.record-button:hover {
  background: var(--brand-strong);
  box-shadow: var(--e-2);
}

.record-button.recording {
  background: var(--danger);
  color: var(--n-0);
}

.record-dot {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: currentColor;
}

.recording .record-dot {
  border-radius: 2px;
}

.record-timer {
  min-width: 42px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.drawer-empty {
  padding: var(--sp-8) var(--sp-6);
  color: var(--muted);
  text-align: center;
}

.drawer-empty h3 {
  margin: 12px 0 7px;
  color: var(--text);
  font-size: 16px;
}

.drawer-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.empty-icon {
  font-size: 34px;
}

.analysis-content {
  padding-bottom: 20px;
}

.banner-sim {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: var(--sp-3) 14px;
  border: 1px solid color-mix(in srgb, var(--simulated) 45%, transparent);
  border-radius: var(--r-md);
  background: var(--simulated-bg);
  color: var(--simulated);
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
}

.banner-sim[hidden] {
  display: none;
}

.pipeline-trail {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.trail-entry {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 11px;
}

.transcript-text {
  margin: 7px 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.transcript-interim {
  color: var(--muted);
  font-style: italic;
}

.diff-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
}

.chip {
  padding: 4px 7px;
  background: var(--surface-strong);
}

.chip.missing {
  background: var(--danger-soft);
  color: var(--danger);
  text-decoration: line-through;
}

.chip.extra {
  background: var(--heuristic-bg);
  color: var(--heuristic);
}

.badge {
  padding: 4px 7px;
}

.badge.real {
  background: var(--real-bg);
  color: var(--real);
}

.badge.heuristic {
  background: var(--heuristic-bg);
  color: var(--heuristic);
}

.badge.simulated {
  background: var(--simulated-bg);
  color: var(--simulated);
}

.badge.provider {
  background: var(--provider-bg);
  color: var(--provider);
}

.badge.na {
  background: var(--surface-strong);
  color: var(--muted);
}

.score-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.tile {
  min-width: 0;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}

.tile.overall {
  grid-column: span 2;
  background: var(--brand-soft);
}

.tile-label {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: var(--lh-tight);
  text-transform: uppercase;
}

.tile-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.tile-value {
  font-size: var(--fs-xl);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tile-value.unavailable {
  max-width: 12rem;
  font-size: 11px;
  line-height: 1.35;
}

.score-note {
  grid-column: span 2;
  margin: 2px 0 0;
  color: var(--warning);
  font-size: 11px;
}

.sentence-list,
.issue-list {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.sentence-card,
.issue-card {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.issue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bubble-typing-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 5px;
  vertical-align: baseline;
}

.word-attempts {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed var(--line);
}

.word-attempts .word-aggregate {
  font-weight: 750;
}

.sentence-card p,
.issue-card p {
  margin: 0 0 9px;
  line-height: 1.5;
}

.sentence-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.sentence-index,
.issue-kind {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.marker-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 6px;
  margin-top: 12px;
  line-height: 1.8;
}

.marker {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 4px 4px 1px 1px;
  background: transparent;
  font: inherit;
}

.marker.has-issue {
  cursor: pointer;
}

.marker.sev1 {
  border-color: var(--marker-1);
}

.marker.sev2 {
  border-color: var(--marker-2);
}

.marker.sev3 {
  border-color: var(--marker-3);
}

.marker.omission {
  color: var(--danger);
  text-decoration: line-through 2px;
  text-decoration-color: var(--danger);
}

.issue-card.highlight {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 20%, transparent);
}

.issue-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.issue-ipa {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.audio-card audio,
#waveform {
  display: block;
  width: 100%;
}

#waveform {
  height: 76px;
  border-radius: 10px;
  background: var(--wave-bg);
}

.audio-card audio {
  height: 34px;
}

.compat-dialog-backdrop {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(var(--sp-5), env(safe-area-inset-top))
    max(var(--sp-4), env(safe-area-inset-right))
    max(var(--sp-5), env(safe-area-inset-bottom))
    max(var(--sp-4), env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgb(6 46 34 / 58%);
}

.compat-dialog {
  width: min(440px, 100%);
  padding: var(--sp-6);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--e-3);
  color: var(--text);
}

.compat-dialog-copy {
  display: grid;
  gap: var(--sp-2);
  margin: var(--sp-4) 0 var(--sp-5);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}

.compat-dialog-copy p {
  margin: 0;
}

.compat-dialog-copy strong {
  color: var(--text);
}

.compat-dialog .primary-button {
  width: 100%;
}

body.compat-dialog-open {
  overflow: hidden;
}

.toast-root {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 11px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--text);
  box-shadow: var(--e-3);
  color: var(--surface);
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
}

/* ===== M25 · IELTS Part 2 长独白与结果卡 ===== */
.part2-card {
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}

.part2-card-title {
  margin: 0;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 750;
  line-height: var(--lh-snug);
}

.part2-card-title-zh {
  margin: var(--sp-1) 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}

.part2-bullets {
  margin: var(--sp-3) 0 0;
  padding-left: var(--sp-5);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}

.part2-bullets li + li {
  margin-top: var(--sp-2);
}

.part2-bullet-zh {
  display: block;
  margin-top: var(--sp-1);
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: var(--lh-body);
}

.part2-provenance {
  margin: var(--sp-3) 0 0;
  padding-top: var(--sp-2);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-2xs);
  line-height: var(--lh-snug);
}

.part2-stale {
  margin: 0 0 var(--sp-3);
  padding-left: var(--sp-2);
  border-left: var(--sp-1) solid var(--warn);
  color: var(--warn);
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
}

.part2-prep {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}

.part2-prep-timer,
.part2-prep textarea {
  grid-column: 1 / -1;
}

.part2-prep-timer {
  justify-self: center;
  color: var(--brand);
  font-size: var(--fs-xl);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: var(--lh-tight);
}

.part2-prep .primary-button,
.part2-prep .text-button {
  width: 100%;
}

.part2-prep .text-button {
  min-height: var(--sp-8);
}

.part2-time-short {
  color: var(--muted);
}

.part2-time-target {
  color: var(--ok);
}

.part2-time-over {
  color: var(--warn);
}

.ielts-feedback > .field-hint {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}

.ielts-metrics,
.ielts-bands,
.ielts-upgrades {
  display: grid;
  gap: var(--sp-2);
}

.ielts-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ielts-bands,
.ielts-upgrades {
  margin-top: var(--sp-4);
}

.ielts-bands:empty,
.ielts-upgrades:empty {
  display: none;
}

.ielts-metrics-head {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 750;
  line-height: var(--lh-snug);
}

.ielts-metric,
.ielts-band,
.ielts-upgrade,
.ielts-improvements {
  min-width: 0;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}

.ielts-metric {
  display: grid;
  gap: var(--sp-1);
}

.ielts-metric-label {
  color: var(--muted);
  font-size: var(--fs-2xs);
  line-height: var(--lh-snug);
}

.ielts-metric-value {
  color: var(--text);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  line-height: var(--lh-tight);
}

.ielts-band {
  display: grid;
  gap: var(--sp-2);
}

.ielts-band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 750;
  line-height: var(--lh-snug);
}

.ielts-band-range {
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ielts-band-note,
.ielts-evidence,
.ielts-upgrade-original,
.ielts-upgrade-better {
  margin: 0;
  font-size: var(--fs-xs);
  line-height: var(--lh-body);
}

.ielts-band-note,
.ielts-upgrade-original {
  color: var(--muted);
}

.ielts-evidence {
  padding: var(--sp-2);
  border-left: var(--sp-1) solid var(--brand);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text);
}

.ielts-improvements {
  margin: 0;
  padding-left: calc(var(--sp-5) + var(--sp-3));
  color: var(--text);
  font-size: var(--fs-xs);
  line-height: var(--lh-body);
}

.ielts-improvements li + li {
  margin-top: var(--sp-1);
}

.ielts-upgrade {
  display: grid;
  gap: var(--sp-2);
}

.ielts-upgrade-better {
  color: var(--text);
  font-weight: 650;
}

.ielts-upgrade-actions,
.ielts-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.ielts-feedback-actions {
  margin-top: var(--sp-4);
}

.ielts-part3-button {
  flex: 1 1 auto;
}

.drawer-backdrop {
  display: none;
}

@media (max-width: 959px) {
  body {
    overflow: auto;
  }

  .app-layout {
    display: block;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));   /* 手机地址栏收展时 100vh 会溢出，动态视口单位兜底 */
  }

  .chat-panel {
    height: 100%;
    border-right: 0;
  }

  .provider-badges {
    display: none;
  }

  .drawer-toggle,
  .drawer-close {
    display: inline-flex;
  }

  .drawer {
    position: fixed;
    z-index: 50;
    inset: 0 0 0 auto;
    height: 100vh;
    height: 100dvh;
    width: min(440px, 94vw);
    padding-bottom: 40px;
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateX(102%);
    transition: transform 180ms ease;
  }

  .drawer-backdrop {
    position: fixed;
    z-index: 40;
    inset: var(--header-h) 0 0;
    background: rgb(13 25 18 / 45%);
  }

  body.drawer-open {
    overflow: hidden;
  }

  body.drawer-open .drawer {
    transform: translateX(0);
  }

  body.drawer-open .drawer-backdrop {
    display: block;
  }
}

@media (max-width: 560px) {
  .app-header {
    padding: 0 14px;
    gap: var(--sp-2);
  }

  .brand small,
  .voice-picker-label,
  .mode-picker-label,
  .drawer-toggle > span:last-child {
    display: none;
  }

  .chat-heading {
    padding: var(--sp-4) var(--sp-4) var(--sp-3);
  }

  .panel-heading {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--sp-2) var(--sp-3);
  }

  .chat-heading-tools {
    width: 100%;
    flex-wrap: wrap;
    gap: var(--sp-1) var(--sp-3);
  }

  .chat-log {
    padding: 15px 16px 24px;
  }

  .chat-flow-status {
    padding: 8px 16px;
  }

  .ielts-practice-tools {
    padding: var(--sp-3) var(--sp-4);
  }

  .ielts-practice-route-select-label > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .ielts-practice-route-select-label select {
    max-width: 132px;
  }

  .ielts-practice-review {
    padding: var(--sp-3);
  }

  .ielts-practice-review-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .message {
    max-width: 94%;
  }

  .ielts-structured-guidance {
    padding: 11px;
  }

  .ielts-guidance-samples,
  .ielts-guidance-framework {
    padding-inline-start: 1.2rem;
  }

  .ielts-guidance-sample-actions .mini-button {
    min-height: 40px;
    flex: 1 1 9rem;
  }

  .chat-form {
    padding: 12px;
  }

  .part2-prep,
  .ielts-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .part2-prep > *,
  .ielts-metrics-head {
    grid-column: 1;
  }

  .ielts-feedback > .section-title-row {
    align-items: flex-start;
  }

  .ielts-feedback-actions,
  .ielts-feedback-actions > *,
  .ielts-part3-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 深色模式：由 Evergreen 系统推导明度阶梯（此前是与品牌无推导关系的手调值）。
   关键修复 —— 旧版 --brand: #4db68b 配硬编码白字 ≈ 2.4:1，主按钮/用户气泡在深色下不可读；
   现引入 --on-brand（深绿字配浅绿底，实测 7.47:1）。 */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0c1310;
    --surface: #131c17;
    --surface-soft: #1a251f;
    --surface-strong: #24302a;
    --text: #e9f2ec;
    --muted: #9cada3;
    --line: #2c3a33;
    --line-strong: #5d6e65;
    --brand: var(--g-300);
    --brand-strong: var(--g-200);
    --brand-soft: #123829;
    --brand-tint: #101a15;
    --on-brand: var(--g-900);
    --focus: #7cb8ff;
    --danger: #ff9a90;
    --danger-soft: #3e211e;
    --warning: var(--a-400);
    --real: #6ecfa0;
    --real-bg: #123a28;
    --heuristic: #7fbef2;
    --heuristic-bg: #17334a;
    --simulated: var(--a-400);
    --simulated-bg: var(--a-900);
    --provider: #c2a7f2;
    --provider-bg: #372b50;
    --marker-1: var(--a-400);
    --marker-2: #f59a5e;
    --marker-3: #ff8a80;
    --wave: #6ecfa0;
    --wave-bg: #17251e;
    /* 深色下阴影靠"更黑"而非"更绿"才可见 */
    --e-1: 0 1px 2px rgb(0 0 0 / 30%);
    --e-2: 0 4px 14px rgb(0 0 0 / 38%), 0 1px 3px rgb(0 0 0 / 28%);
    --e-3: 0 18px 44px rgb(0 0 0 / 52%), 0 2px 8px rgb(0 0 0 / 34%);
  }
}

/* ===== v1.5 · Chat: real tutor, rephrase, expression bank, voice input ===== */
.chat-heading-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ===== M23 · 点词释义弹卡 + 生词本 ===== */
#word-pop {
  position: fixed;
  z-index: 60;
  width: min(320px, calc(100vw - 24px));
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--e-3);
  font-size: 0.88rem;
}
.word-pop-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}
.word-pop-head strong { font-size: 1.02rem; }
.word-pop-close { margin-left: auto; }
.word-pop-meaning { margin: 0 0 0.4rem; color: var(--brand-strong); font-weight: 600; }
.word-pop-sentence { margin: 0; padding-top: 0.35rem; border-top: 1px dashed var(--line); color: var(--text); font-size: 0.82rem; }
.word-pop-sentence-zh { margin: 0.15rem 0 0.5rem; color: var(--muted); font-size: 0.82rem; }
.word-pop-add { width: 100%; }
#chat-log .bubble { cursor: pointer; }

/* v2.1.0 · 导师回复重听按钮行 */
.reply-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

/* ===== M20 §8 · 聊天语音消息韵律分数条 ===== */
.voice-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
  max-width: min(78%, 34rem);
  cursor: pointer;
  user-select: none;
}
.message.user .voice-score { margin-left: auto; }
.voice-score-bar {
  flex: 1;
  height: 6px;
  min-width: 6rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.voice-score-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.voice-score-fill.good { background: var(--real); }
.voice-score-fill.mid { background: var(--warning); }
.voice-score-fill.low { background: var(--danger); }
.voice-score-label {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}
.voice-score-detail {
  margin-top: 0.3rem;
  max-width: min(78%, 34rem);
  margin-left: auto;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  font-size: 0.8rem;
}
.message.tutor .voice-score-detail { margin-left: 0; }
.voice-score-dim { margin: 0.12rem 0; }
.voice-score-dim.na { color: var(--muted); }
.voice-score-hint { margin: 0 0 0.2rem 1.1rem; font-size: 0.76rem; color: var(--muted); }
.voice-score-provenance {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 0.3rem;
}

.rephrase-block {
  margin-top: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--brand);
  border-radius: 0.5rem;
  background: var(--brand-soft);
}
.rephrase-label {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-strong);
}
.rephrase-original {
  margin: 0 0 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.rephrase-native {
  margin: 0 0 0.45rem;
  font-weight: 600;
}
.rephrase-saved {
  align-self: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.typing-bubble {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  min-height: 1.4rem;
}
.typing-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-blink 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.bank-panel {
  max-height: 38vh;
  overflow-y: auto;
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  display: grid;
  gap: 0.5rem;
}
.bank-empty {
  margin: 0.3rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.bank-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--surface);
}
.bank-texts { min-width: 0; }
.bank-native {
  margin: 0;
  font-weight: 600;
  font-size: 0.92rem;
}
.bank-original {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.bank-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.mic-button.recording {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
  animation: mic-pulse 1.1s infinite;
}
.mic-button.processing { opacity: 0.55; pointer-events: none; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(180, 35, 24, 0); }
}

/* ===== M20 · Prosody comparison vs demo（跟读模式韵律对比卡） ===== */
.prosody-list { display: grid; gap: 0.45rem; }
.prosody-row {
  display: grid;
  grid-template-columns: 5.5em 1fr auto;
  gap: 0.15rem 0.6rem;
  align-items: baseline;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
}
.prosody-row.close { background: color-mix(in srgb, var(--ok) 8%, transparent); }
.prosody-row.off { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.prosody-row.na { color: var(--muted); }
.prosody-label { font-weight: 600; }
.prosody-values { color: var(--text); overflow-wrap: anywhere; }
.prosody-mark { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.prosody-hint {
  grid-column: 1 / -1;
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ===== v1.7 · Free-speech diagnosis (Discovery / Verification) ===== */
.diagnosis-subtitle {
  margin: 0 0 0.7rem;
  font-size: 0.83rem;
  color: var(--muted);
}
.diagnosis-list { display: grid; gap: 0.65rem; }
.diagnosis-empty { margin: 0.2rem 0; font-size: 0.85rem; color: var(--muted); }
.hypo-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: 0.6rem;
  padding: 0.65rem 0.8rem;
  background: var(--surface);
}
.hypo-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.hypo-conf {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.hypo-conf.conf-medium { color: var(--heuristic); border-color: var(--heuristic); background: var(--heuristic-bg); }
.hypo-conf.conf-high { color: var(--simulated); border-color: var(--simulated); background: var(--simulated-bg); }
.hypo-evidence { margin: 0 0 0.5rem; font-size: 0.85rem; }
.hypo-drill {
  border-top: 1px dashed var(--line);
  padding-top: 0.5rem;
}
.hypo-focus { margin: 0 0 0.45rem; font-size: 0.82rem; color: var(--muted); }
.verify-box { margin-top: 0.45rem; }
.verify-verdict { margin: 0; font-size: 0.88rem; font-weight: 600; }
.verify-heard { margin: 0.2rem 0 0; font-size: 0.8rem; color: var(--muted); }
.verify-note { margin: 0.25rem 0 0; font-size: 0.72rem; color: var(--muted); }

/* ---------- v1.8 分段流式转写（M18）：前缀正文 + 尾部加载动画（复用 typing-dot） ---------- */
.transcript-stream { white-space: pre-wrap; }
.stream-dots {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
  padding: 0.2rem 0;
}
.stream-hint { display: block; margin-top: 0.35rem; }

/* M32 · Separate listening room, with bounded reading window and persistent transport. */
.speech-speed-picker { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.speech-speed-picker select { max-width: 98px; padding: 7px; }
.listening-toggle { flex-shrink: 0; padding: 9px 12px; color: var(--brand); background: var(--brand-tint); border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-weight: 600; }
.listening-room { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 0; width: min(1100px, calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 48px); box-shadow: var(--e-3); }
.listening-room::backdrop { background: rgb(4 26 19 / 48%); backdrop-filter: blur(4px); }
.listening-room button, .listening-mini button { min-height: 40px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 9px; padding: 8px 12px; font: inherit; cursor: pointer; }
.listening-room button:hover, .listening-mini button:hover { background: var(--brand-tint); }
.listening-room button:disabled { opacity: .45; cursor: default; }
.listening-heading { display: flex; justify-content: space-between; gap: 16px; padding: 22px 28px; align-items: center; border-bottom: 1px solid var(--line); }
.listening-heading h2 { margin: 0; font-size: 26px; }
.listening-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .16em; color: var(--brand); margin: 0 0 4px; }
.listening-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.listening-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.listening-editor, .listening-listen { padding: 24px 28px; min-width: 0; }
.listening-editor { border-right: 1px solid var(--line); background: var(--surface-soft); }
.listening-room label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; min-width: 0; }
.listening-room input, .listening-room textarea, .listening-room select { color: var(--text); background: var(--surface); font: inherit; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 10px; min-width: 0; width: 100%; }
.listening-text-label { margin: 20px 0 6px; }
#listening-text { min-height: 260px; height: 34vh; max-height: 60vh; resize: vertical; font-size: 15px; line-height: 1.75; }
.listening-editor-meta { display: flex; align-items: center; gap: 6px; margin: 8px 0 14px; }
.listening-editor-meta > span { flex: 1; font-size: 12px; color: var(--muted); }
#listening-saved, #listening-storage { font-size: 12px; color: var(--muted); }
.listening-library { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.listening-library summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.listening-library-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.listening-settings { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.listening-settings > label { flex: 1 1 80px; }
.listening-settings > .listening-voice-label { flex: 3 1 160px; }
.listening-hint { color: var(--muted); font-size: 12px; margin: 6px 0 12px; }
.listening-notice { color: var(--warning); font-size: 13px; line-height: 1.6; margin: 8px 0; }
.listening-notice:empty { display: none; }
.listening-reading { height: 285px; overflow-y: auto; overscroll-behavior: contain; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.listening-empty { color: var(--muted); font-size: 16px; padding: 44px 20px; line-height: 1.9; }
.listening-room .listening-chunk { display: flex; flex-direction: column; text-align: left; width: 100%; border: 1px solid transparent; background: transparent; font-size: 16px; line-height: 1.75; margin-bottom: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.listening-room .listening-chunk[aria-current="true"] { background: var(--brand-soft); border-color: var(--brand); }
.listening-chunk-number { font-size: 11px; color: var(--muted); }
.listening-player { margin-top: 16px; text-align: center; }
#listening-status { color: var(--brand); font-size: 13px; min-height: 20px; margin: 0 0 10px; }
.listening-transport { display: flex; justify-content: center; gap: 10px; }
.listening-room .listening-primary { color: var(--on-brand); background: var(--brand); border-color: var(--brand); min-width: 130px; }
.listening-mini { position: fixed; z-index: 80; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; width: min(660px, calc(100vw - 24px)); padding: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--e-3); }
.listening-mini[hidden] { display: none; }
#listening-mini-status { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 1050px) { .app-header { gap: 10px; } .speech-speed-picker > span { display: none; } .voice-picker select { max-width: 110px; } }
@media (max-width: 760px) {
  :root { --header-h: 112px; }
  .app-header { height: auto; min-height: var(--header-h); padding: 8px 14px; gap: 6px; flex-wrap: wrap; }
  .app-header .brand { flex: 1 1 calc(100% - 100px); }
  .app-header .brand-text { display: block; }
  .app-header .listening-toggle { order: -1; }
  .app-header .brand { order: -2; }
  .app-header .voice-picker, .app-header .mode-picker { margin: 0; }
  .app-header .mode-picker select { max-width: 114px; }
  .app-header .voice-picker select { max-width: 76px; }
  .app-header .speech-speed-picker select { max-width: 68px; }
  .app-header .drawer-toggle { margin-left: auto; }
  .app-header .drawer-toggle > span:last-child { display: none; }
  .listening-room { margin: 0; inset: 0; width: 100%; height: 100%; max-height: 100%; border: 0; border-radius: 0; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
  .listening-heading { padding: 16px; }
  .listening-heading h2 { font-size: 22px; }
  .listening-heading button { padding: 7px 10px; font-size: 13px; }
  .listening-body { display: block; }
  .listening-editor, .listening-listen { padding: 20px 16px; }
  .listening-editor { border-right: 0; border-bottom: 1px solid var(--line); }
  #listening-text { min-height: 180px; height: 25vh; font-size: 16px; }
  .listening-room input, .listening-room select { font-size: 16px; }
  .listening-reading { height: 260px; }
  .listening-player { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 max(12px, env(safe-area-inset-bottom)); }
}
