/* ============================================================
   实时语音翻译 H5 —— 设计 token 与布局
   light / dark 两套；移动端优先，≥768px 放大字号，≥1024px 限宽居中
   ============================================================ */

:root {
  /* 色彩 */
  --bg: #f4f6f9;
  --bg-accent: #eef1f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --text-soft: #475569;
  --text-muted: #8b96a8;
  --border: #e4e8ef;
  --border-strong: #d5dbe6;
  --accent: #4f46e5;
  --accent-soft: #ecebfe;
  --accent-contrast: #ffffff;
  --listen: #e5484d;
  --listen-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fff6e6;
  --ok: #0f9d76;

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* 字号 */
  --fs-dst: 32px;
  --fs-dst-lead: 21px;
  --fs-src: 17px;
  --fs-title: 17px;
  --fs-meta: 13px;
  --fs-status: 14px;
  --lh-dst: 1.45;

  /* 间距尺度 4/8/12/16/24/32/48 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;

  /* 形状与阴影 */
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-panel: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px -24px rgba(15, 23, 42, 0.35);
  --shadow-mic: 0 10px 24px -10px rgba(79, 70, 229, 0.65);
  --shadow-mic-live: 0 12px 30px -8px rgba(229, 72, 77, 0.55);

  /* 动效 */
  --dur-fast: 150ms;
  --dur-base: 300ms;
  --dur-slow: 500ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* 布局 */
  --topbar-h: 56px;
  --dock-h: 132px;
  --page-pad: 12px;
  --content-max: 1024px;
  --mic-size: 76px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --bg-accent: #141821;
    --surface: #161a22;
    --surface-soft: #1b202a;
    --text: #eef1f6;
    --text-soft: #b3bccb;
    --text-muted: #7c8798;
    --border: #262c37;
    --border-strong: #333a47;
    --accent: #8f88ff;
    --accent-soft: #23203c;
    --accent-contrast: #0f1115;
    --listen: #ff6b70;
    --listen-soft: #33191b;
    --warn: #fbbf24;
    --warn-soft: #2c2410;
    --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -24px rgba(0, 0, 0, 0.8);
    --shadow-mic: 0 10px 24px -10px rgba(143, 136, 255, 0.5);
    --shadow-mic-live: 0 12px 30px -8px rgba(255, 107, 112, 0.45);
  }
}

@media (min-width: 768px) {
  :root {
    --fs-dst: 40px;
    --fs-dst-lead: 24px;
    --fs-src: 18px;
    --fs-title: 18px;
    --topbar-h: 68px;
    --dock-h: 148px;
    --page-pad: 24px;
    --mic-size: 88px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app {
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--dock-h);
  height: 100dvh;
  min-height: 100dvh;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--page-pad) env(safe-area-inset-bottom, 0px);
}

/* ---------- 顶部标题栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-contrast);
}

.brand__name {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.lang__label {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  white-space: nowrap;
}

.lang__select {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 2px 20px 2px 2px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 9px) 55%, calc(100% - 4px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.lang__select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.lang[hidden] {
  display: none;
}

/* ---------- 识别服务分段控件（仅 ?mode=dialect，占用「译为」选择器腾出的位置） ---------- */

.provider {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.provider[hidden] {
  display: none;
}

/* 触控热区 ≥44×44：高度撑满标题栏可用高度，宽度由 padding 保证 */
.provider__opt {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.provider__opt[aria-checked="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
}

.provider__opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .provider__opt { transition: none; }
}

/* ---------- 中间舞台：上 55% 译文 / 下 30% 原文 ---------- */

.stage {
  display: grid;
  grid-template-rows: minmax(0, 55fr) minmax(0, 30fr);
  gap: var(--sp-2);
  min-height: 0;
  padding-bottom: var(--sp-2);
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease);
}

.panel--dst {
  border-color: var(--border-strong);
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  flex: none;
}

.panel__title {
  margin: 0;
  font-size: var(--fs-meta);
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.panel--dst .panel__title {
  color: var(--accent);
}

.panel__meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel__head-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
  min-width: 0;
}

/* ---------- 小喇叭（仅方言模式出现） ---------- */
/* 44×44 触控热区（WCAG 2.2 目标尺寸）；朗读中切实心方块「停止」；无朗读能力时置灰。 */
.speak {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.speak[hidden] {
  display: none;
}

.speak:hover:not([disabled]) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.speak:active:not([disabled]) {
  transform: scale(0.95);
}

.speak:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.speak[disabled] {
  color: var(--text-muted);
  border-color: var(--border);
  background: transparent;
  opacity: 0.55;
  cursor: not-allowed;
}

/* 不支持朗读时：置灰按钮不吃指针事件，点击落到外层槽位 → app.js 给可见提示。
   （否则用户在微信里点一下完全没反应，正是本卡要修的静默失败。） */
.speak-slot {
  display: inline-flex;
}

.speak[data-unsupported="1"] {
  pointer-events: none;
}

.speak.is-speaking {
  color: var(--accent-contrast);
  border-color: var(--accent);
  background: var(--accent);
}

.speak__icon {
  grid-area: 1 / 1;   /* 两个图标叠在同一格，靠 display 切换 */
  pointer-events: none;
}

.speak__icon--stop {
  display: none;
}

.speak.is-speaking .speak__icon--play {
  display: none;
}

.speak.is-speaking .speak__icon--stop {
  display: block;
}

/* 方言模式：只有上区（普通话文字），下区隐藏，上区占满整块舞台 */
.panel[hidden] {
  display: none;
}

.app[data-mode="dialect"] .stage {
  grid-template-rows: minmax(0, 1fr);
}

.panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--sp-4) var(--sp-4);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.panel__body::-webkit-scrollbar {
  width: 6px;
}

.panel__body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.placeholder {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-src);
  line-height: 1.6;
}

.panel__alert {
  margin: 0 0 var(--sp-2);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.5;
}

.text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.text--dst {
  font-size: var(--fs-dst);
  line-height: var(--lh-dst);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.text--src {
  font-size: var(--fs-src);
  line-height: 1.65;
  color: var(--text-soft);
}

/* 方言原话小字行：只在 result.normalized=true 且原话≠普通话时出现。
   默认最多 2 行（省略号），点一下展开全文；用 --text-soft 而不是 --text-muted，
   是为了在浅/深两套主题下都满足 4.5:1 的文字对比度。 */
.origin {
  display: block;
  width: 100%;
  margin: var(--sp-3) 0 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: var(--fs-meta);
  line-height: 1.5;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
  -webkit-appearance: none;
  appearance: none;
}

.origin[hidden] {
  display: none;
}

.origin[data-clamped="0"] {
  cursor: default;
}

.origin:hover {
  color: var(--text);
}

.origin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.origin__body {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 展开态：不再截断（点过才需要看全文，收起来时行高占用固定 ≤2 行） */
.origin[aria-expanded="true"] .origin__body {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

.origin__label {
  color: inherit;
  opacity: 0.92;
}

.text__partial {
  color: var(--text-muted);
}

.text__caret {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  margin-left: 2px;
  vertical-align: -0.1em;
  background: currentColor;
  opacity: 0.5;
  animation: caret-blink 1s steps(2, start) infinite;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

.panel.has-text .placeholder {
  display: none;
}

/* ---------- 底部：麦克风 + 状态 ---------- */

.dock {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding-bottom: var(--sp-2);
}

.notice {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(92vw, 520px);
  margin: 0;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  box-shadow: var(--shadow-panel);
  z-index: 3;
}

.mic {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--mic-size);
  height: var(--mic-size);
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-mic);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform var(--dur-fast) var(--ease),
    background-color var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}

.mic:hover {
  transform: translateY(-1px);
}

.mic:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

.mic:active {
  transform: scale(0.97);
}

.mic__icon {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.mic__pulse,
.mic__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

/* 按下：实心圈 + 扩散波纹 */
.mic.is-pressed {
  background: var(--listen);
  box-shadow: var(--shadow-mic-live);
}

.mic.is-pressed .mic__pulse {
  border: 2px solid var(--listen);
  animation: mic-pulse 1.6s var(--ease) infinite;
}

.mic.is-pressed .mic__ring {
  background: radial-gradient(circle at 50% 50%, rgba(229, 72, 77, 0.16), transparent 70%);
}

@keyframes mic-pulse {
  0% { transform: scale(1); opacity: 0.55; }
  70% { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

.status {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin: 0;
  font-size: var(--fs-status);
  color: var(--text-soft);
  white-space: nowrap;
}

.status__text {
  font-weight: 500;
}

.status__timer {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.app[data-phase="connecting"] .status__text,
.app[data-phase="listening"] .status__text,
.app[data-phase="releasing"] .status__text,
.app[data-phase="translating"] .status__text {
  color: var(--accent);
}

.app[data-phase="error"] .status__text {
  color: var(--listen);
}

.demo-badge {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.boot-hint {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(92vw, 520px);
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  box-shadow: var(--shadow-panel);
}

/* ============================================================
   全屏录音遮罩（按下出现 → 录音中 → 翻译中 → 淡出）
   只复用上面的 token：强调色取 --listen / --accent，字号取 --fs-*，
   动效 260ms + --ease；遮罩本身是半透明深色 + blur，不改变既有布局。
   ============================================================ */

.rec-overlay {
  --ov-tint: var(--listen);
  --ov-text: #f8fafc;
  --ov-text-soft: rgba(248, 250, 252, 0.9);
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + var(--sp-6)) var(--sp-6)
    calc(env(safe-area-inset-bottom, 0px) + var(--sp-6));
  background: rgba(9, 12, 20, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 260ms var(--ease);
  overscroll-behavior: contain;
  touch-action: none;
  /* 录音/翻译中只做视觉反馈，不抢指针：按压事件依旧落到麦克风，
     保持既有「按住说话」语义（包括翻译中再按的提示）。错误态才接管交互。 */
  pointer-events: none;
}

.rec-overlay.is-open[data-state="error"] {
  pointer-events: auto;
}

/* 不支持 backdrop-filter 时降级为更高不透明度的纯色，保证文字可读 */
@supports not ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .rec-overlay {
    background: rgba(9, 12, 20, 0.88);
  }
}

.rec-overlay[hidden] {
  display: none;
}

.rec-overlay.is-open {
  opacity: 1;
}

.rec-overlay[data-state="translating"] {
  --ov-tint: var(--accent);
}

.rec-overlay__inner {
  display: grid;
  justify-items: center;
  gap: var(--sp-4);
  width: 100%;
  max-width: 360px;
  text-align: center;
  transform: translateY(8px) scale(0.985);
  transition: transform 260ms var(--ease);
}

.rec-overlay.is-open .rec-overlay__inner {
  transform: none;
}

.rec-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
}

.rec-visual__halo,
.rec-visual__disc,
.rec-visual__spinner {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.rec-visual__disc {
  inset: 18px;
  background: var(--ov-tint);
  opacity: 0.16;
  transition: background-color var(--dur-base) var(--ease);
}

.rec-visual__halo {
  inset: 18px;
  border: 2px solid var(--ov-tint);
  opacity: 0.5;
  animation: rec-halo 1.8s var(--ease) infinite;
  transition: border-color var(--dur-base) var(--ease);
}

.rec-visual__spinner {
  inset: 8px;
  border: 3px solid transparent;
  border-top-color: var(--ov-tint);
  border-right-color: var(--ov-tint);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}

.rec-overlay[data-state="translating"] .rec-visual__halo {
  animation: rec-breathe 1.6s var(--ease) infinite;
}

.rec-overlay[data-state="translating"] .rec-visual__spinner {
  opacity: 0.9;
  animation: rec-spin 900ms linear infinite;
}

.rec-overlay[data-state="error"] .rec-visual__halo,
.rec-overlay[data-state="error"] .rec-visual__spinner {
  animation: none;
  opacity: 0;
}

/* 错误态：圆内给「麦克风+斜线」图标，避免中间留一块空白圆 */
.rec-visual__icon {
  position: absolute;
  color: var(--ov-tint);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease);
}

.rec-overlay[data-state="error"] .rec-visual__icon {
  opacity: 1;
}

.rec-bars {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 88px;
  transition: opacity var(--dur-base) var(--ease);
}

.rec-bars__bar {
  width: 7px;
  height: 78px;
  border-radius: var(--radius-pill);
  background: var(--ov-tint);
  transform: scaleY(0.16);
  transform-origin: 50% 50%;
  will-change: transform;
}

.rec-overlay[data-state="translating"] .rec-bars,
.rec-overlay[data-state="error"] .rec-bars {
  opacity: 0;
}

.rec-overlay__title {
  margin: 0;
  font-size: var(--fs-dst-lead);
  font-weight: 650;
  letter-spacing: 0.01em;
  /* 文字用高对比白（深色遮罩上 5.6:1）；状态色由圆环/竖条/转圈承担，
     --listen 与 --accent 在 0.62 深色遮罩上只有 1.5:1 / 1.1:1，做正文不可读。 */
  color: var(--ov-text);
  transition: color var(--dur-base) var(--ease);
}

.rec-overlay__sub {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin: 0;
  font-size: var(--fs-status);
  color: var(--ov-text-soft);
  font-variant-numeric: tabular-nums;
}

.rec-overlay__timer {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--ov-text);
}

.rec-overlay__close {
  margin-top: var(--sp-2);
  min-height: 44px;
  padding: 10px var(--sp-6);
  border: 1px solid rgba(248, 250, 252, 0.4);
  border-radius: var(--radius-pill);
  background: rgba(248, 250, 252, 0.08);
  color: var(--ov-text);
  font: inherit;
  font-size: var(--fs-status);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.rec-overlay__close:hover {
  background: rgba(248, 250, 252, 0.16);
}

.rec-overlay__close:focus-visible {
  outline: 2px solid var(--ov-tint);
  outline-offset: 3px;
}

.rec-overlay__close[hidden] {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes rec-halo {
  0% { transform: scale(0.96); opacity: 0.55; }
  70% { transform: scale(1.14); opacity: 0; }
  100% { transform: scale(1.14); opacity: 0; }
}

@keyframes rec-breathe {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.06); opacity: 0.26; }
}

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

@media (prefers-reduced-motion: reduce) {
  .mic.is-pressed .mic__pulse,
  .text__caret {
    animation: none;
  }

  /* 遮罩全部降级为静态：无脉冲、无旋转、无淡入淡出，仅状态文字变化 */
  .rec-overlay,
  .rec-overlay__inner,
  .rec-overlay__close,
  .rec-bars,
  .rec-bars__bar,
  .rec-overlay__title,
  .rec-visual__disc,
  .rec-visual__halo,
  .rec-visual__spinner,
  .rec-visual__icon {
    transition: none;
  }

  .rec-overlay .rec-visual__halo,
  .rec-overlay[data-state="translating"] .rec-visual__halo,
  .rec-overlay[data-state="translating"] .rec-visual__spinner {
    animation: none;
  }

  .rec-visual__spinner {
    display: none;
  }
}

/* 窄屏（≤360）与矮屏（≤680 高）：压缩留白，保证上下两区仍可读 */
@media (max-width: 360px) {
  :root { --fs-dst: 28px; --mic-size: 72px; }
}

@media (max-height: 680px) {
  :root { --topbar-h: 48px; --dock-h: 112px; --fs-dst: 28px; }
}
