/* 「语音」页（views/voice.js）：开车用，字大、按钮大、盲点也点得到。配色走外壳 style.css 的变量（亮 / 暗两套自动跟）。
   大按钮四态按颜色区分：空闲蓝（--accent）/ 在听红（--bad）/ 在想黄（--wait）/ 在说绿（--ok）。 */

.voice { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 14px; max-width: 640px; margin: 0 auto;
  min-height: calc(100dvh - var(--top-h) - var(--tabs-h) - env(safe-area-inset-bottom) - 40px); }

/* ── 右上角：历史 / 设置（小，不常用） ── */
.voice-tools { display: flex; justify-content: flex-end; gap: 8px; }
.voice-tool { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.voice-tool.icon { padding: 0; }
.voice-tool:active { background: var(--panel-2); }

.voice-banner { padding: 12px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 17px; font-weight: 600; line-height: 1.45; text-align: center; }
.voice-banner.bad { background: var(--bad-soft); color: var(--bad); }
.voice-note { text-align: center; color: var(--wait); font-size: 17px; font-weight: 600; }

/* ── 大按钮 ── */
.voice-stage { display: grid; place-items: center; padding: 6px 0; }
.voice-big { --c: var(--accent); --lvl: 0; position: relative; width: min(80vw, 46dvh, 400px); aspect-ratio: 1; border-radius: 50%; border: none; padding: 0;
  background: var(--c); color: #fff; box-shadow: 0 10px 34px color-mix(in srgb, var(--c) 40%, transparent); touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; transition: background .2s, transform .1s; cursor: pointer; }
.voice-big:active { transform: scale(.97); }
.voice-big:focus-visible { outline: 4px solid color-mix(in srgb, var(--c) 50%, transparent); outline-offset: 6px; }
.voice-big.vb-listen { --c: var(--bad); }
.voice-big.vb-think { --c: var(--wait); }
.voice-big.vb-speak { --c: var(--ok); }
/* 外圈：在听时跟着音量放大，在想 / 在说时慢慢呼吸 */
.vb-ring { position: absolute; inset: -2%; border-radius: 50%; border: 6px solid color-mix(in srgb, var(--c) 55%, transparent); opacity: 0; pointer-events: none;
  transform: scale(calc(1 + var(--lvl) * .08)); transition: transform 70ms linear, opacity .2s; }
.vb-listen .vb-ring { opacity: calc(.35 + var(--lvl) * .65); }
.vb-think .vb-ring, .vb-speak .vb-ring { opacity: .6; animation: vb-breath 1.6s ease-in-out infinite; }
@keyframes vb-breath { 0%, 100% { transform: scale(1); opacity: .25; } 50% { transform: scale(1.08); opacity: .7; } }
.vb-in { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12%; }
.vb-in .icon { width: 18%; height: 18%; min-width: 36px; min-height: 36px; }
.vb-big { font-size: clamp(36px, 12vw, 60px); line-height: 1.1; font-weight: 800; letter-spacing: 2px; white-space: nowrap; }
.vb-small { font-size: clamp(16px, 4.6vw, 22px); opacity: .9; font-weight: 600; }
.vb-dots i { font-style: normal; animation: vb-dot 1.2s infinite; }
.vb-dots i:nth-child(2) { animation-delay: .2s; }
.vb-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes vb-dot { 0%, 60%, 100% { opacity: .2; } 30% { opacity: 1; } }
@media (prefers-color-scheme: dark) { .voice-big { color: #0b1220; } }
:root[data-theme="dark"] .voice-big { color: #0b1220; }
:root[data-theme="light"] .voice-big { color: #fff; }

/* 有待确认时大按钮缩小，确认 / 取消往上提 */
.voice.has-pending .voice-big { width: min(62vw, 32dvh, 300px); }

/* ── 待确认：两个超大按钮 ── */
.voice-pending { display: grid; gap: 12px; padding: 14px; border-radius: 16px; background: var(--warn-soft); border: 2px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.vp-sum { font-size: 20px; font-weight: 700; line-height: 1.45; color: var(--fg); text-align: center; overflow-wrap: anywhere; }
.vp-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vp-btn { min-height: 88px; border-radius: 16px; border: none; font-size: 30px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; touch-action: manipulation; color: #fff; }
.vp-btn.yes { background: var(--ok); }
.vp-btn.no { background: var(--idle); }
.vp-btn:active { filter: brightness(.92); }

/* ── 最近一句：大字 ── */
.voice-last { display: grid; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.vl-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: baseline; }
.vl-tag { font-size: 14px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.vl-row.it .vl-tag { background: var(--accent-soft); color: var(--accent); }
.vl-text { font-size: 21px; line-height: 1.5; overflow-wrap: anywhere; }
.vl-row.you .vl-text { color: var(--muted); }
.vl-row.it .vl-text { font-weight: 600; }
.vl-row.err .vl-text { color: var(--bad); }
.vl-empty { font-size: 18px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ── 本次问答（往下滑看） ── */
.voice-log { display: grid; gap: 8px; }
.vlog-title { font-size: 14px; font-weight: 700; color: var(--muted); padding: 4px 4px 0; }
.vlog-item { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.vlog-you { color: var(--muted); font-size: 16px; overflow-wrap: anywhere; }
.vlog-it { font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
.vlog-it.err { color: var(--bad); }
.vlog-at { font-size: 12.5px; color: var(--muted); }

/* ── 设置 / 历史抽屉 ── */
.voice-sheet { display: grid; gap: 16px; }
.vs-sec { display: grid; gap: 8px; }
.vs-h { font-weight: 700; font-size: 15px; }
.vs-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.vs-opt { min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--panel); color: var(--fg); text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; }
.vs-opt span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.vs-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.vs-opt.on span { color: var(--accent); font-weight: 600; }
.vs-opt.off { background: var(--panel-2); color: var(--idle); cursor: not-allowed; }
.vs-opt.off span { color: var(--idle); }
.vs-foot { line-height: 1.5; }
.vh-new { justify-content: center; min-height: 46px; font-size: 16px; }
.vh-list { display: grid; gap: 6px; }
.vh-item { display: grid; gap: 3px; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); min-width: 0; }
.vh-item b { font-size: 16px; }
.vh-item.on { border-color: var(--accent); background: var(--accent-soft); }
.vh-head { flex-wrap: wrap; }
.vh-turns { display: grid; gap: 8px; }

/* 电脑宽屏：按钮小一点，居中 */
@media (min-width: 900px) {
  .voice { min-height: calc(100dvh - var(--top-h) - 72px); }
  .voice-big { width: min(46dvh, 380px); }
}
@media (prefers-reduced-motion: reduce) {
  .vb-ring, .vb-dots i { animation: none !important; }
}
