/**
 * 售后客服聊天页 — 单栏 + 消息区动态角色背景
 */
:root {
  --primary: #6c3ff5;
  --accent: #667eea;
  --text: #1a1a2e;
  --text-muted: #64748b;
  --user-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --mic-grad: linear-gradient(135deg, #6c3ff5 0%, #a855f7 100%);
  --mic-rec: linear-gradient(135deg, #f472b6 0%, #ef4444 100%);
  --overlay: rgba(15, 23, 42, 0.62);
  --zone-cancel: #ef4444;
  --zone-text: #10b981;
  --zone-chat: #6366f1;
  --msgs-bg: #f5f7fb;
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  font-family: "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  color: var(--text);
  background: #e8ecf4;
  min-height: 100vh;
  min-height: 100dvh;
}
body.voice-gesture-lock {
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

/* ========== 聊天主容器 ========== */
.widget {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 4px 32px rgba(31, 38, 135, 0.1);
  overflow: hidden;
}
@media (min-width: 520px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
  }
  .widget {
    height: min(780px, calc(100dvh - 24px));
    border-radius: var(--radius);
  }
}

.head {
  flex-shrink: 0;
  padding: 11px 16px;
  background: var(--user-grad);
  color: #fff;
}
.head strong { font-size: 16px; font-weight: 600; }
.head small { display: block; font-size: 11px; opacity: 0.88; margin-top: 2px; }

/* ========== 消息区：小人做背景 ========== */
.msgs-shell {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--msgs-bg);
}

.msgs-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
/* 底部淡紫氛围 + 顶部留白，保证气泡可读 */
.msgs-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 55% at 50% 100%, rgba(108, 63, 245, 0.14) 0%, transparent 70%),
    linear-gradient(180deg, rgba(245, 247, 251, 0.92) 0%, rgba(245, 247, 251, 0.55) 42%, rgba(245, 247, 251, 0.78) 100%);
  z-index: 2;
}

.scene-characters {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
}

.characters-wrap {
  position: relative;
  width: 420px;
  height: 300px;
  transform-origin: bottom center;
  margin-bottom: -8px;
  will-change: transform, opacity;
}
@media (min-width: 520px) {
  .characters-wrap {
    /* scale 由 JS 视差层控制 */
  }
}

.char {
  position: absolute;
  bottom: 0;
  transition: height 0.45s ease;
  transform-origin: bottom center;
  will-change: transform;
}
.char-purple { background: #6c3ff5; border-radius: 10px 10px 0 0; }
.char-black { background: #2d2d2d; border-radius: 8px 8px 0 0; }
.char-orange { background: #ff9b6b; border-radius: 120px 120px 0 0; }
.char-yellow { background: #e8d754; border-radius: 70px 70px 0 0; }

/* 角色手臂 — 击掌庆祝 / 留资举手 */
.char-arm {
  position: absolute;
  width: 16px;
  height: 52px;
  border-radius: 10px;
  opacity: 0;
  transform-origin: bottom center;
  pointer-events: none;
  z-index: 6;
  will-change: transform, opacity;
}
.char-purple .char-arm-left { left: 20px; top: 58px; background: #5a32d4; }
.char-purple .char-arm-right { right: 14px; top: 58px; background: #5a32d4; }
.char-black .char-arm-left { left: 10px; top: 48px; background: #1a1a1a; }
.char-black .char-arm-right { right: 8px; top: 48px; background: #1a1a1a; }
.char-orange .char-arm-left { left: 36px; top: 42px; background: #e8875a; width: 18px; height: 46px; }
.char-orange .char-arm-right { right: 36px; top: 42px; background: #e8875a; width: 18px; height: 46px; }
.char-yellow .char-arm-left { left: 14px; top: 52px; background: #d4c24a; width: 14px; height: 44px; }
.char-yellow .char-arm-right { right: 14px; top: 52px; background: #d4c24a; width: 14px; height: 44px; }

/* 击掌火花（紫 + 黑中间） */
.scene-clap-fx {
  position: absolute;
  left: 178px;
  bottom: 198px;
  width: 48px;
  height: 48px;
  pointer-events: none;
  z-index: 12;
  opacity: 0;
}
.scene-clap-fx.active {
  animation: clap-burst 0.52s ease-out forwards;
}
.clap-spark {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 220, 100, 0.9);
}
.clap-spark-1 { animation: clap-ring 0.52s ease-out forwards; }
.clap-spark-2 { animation: clap-ring 0.52s ease-out 0.06s forwards; transform: scale(0.6); opacity: 0.7; }
.clap-spark-3 {
  inset: 14px;
  border: none;
  background: radial-gradient(circle, #fff 0%, rgba(255, 230, 120, 0.9) 45%, transparent 70%);
  animation: clap-flash 0.35s ease-out forwards;
}
@keyframes clap-burst {
  0% { opacity: 0; transform: scale(0.4) rotate(0deg); }
  25% { opacity: 1; transform: scale(1) rotate(8deg); }
  100% { opacity: 0; transform: scale(1.6) rotate(-6deg); }
}
@keyframes clap-ring {
  0% { transform: scale(0.3); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}
@keyframes clap-flash {
  0% { opacity: 0; transform: scale(0.5); }
  40% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(0.8); }
}
.characters-wrap.scene-celebrate {
  filter: saturate(1.08);
}
.characters-wrap.scene-raise-hands {
  filter: saturate(1.05);
}

.char-eyes {
  position: absolute;
  display: flex;
  gap: 24px;
  transition: left 0.12s ease-out, top 0.12s ease-out;
}
.char-black .char-eyes { gap: 18px; }
.char-yellow .char-eyes { gap: 18px; }

.char-eye {
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: height 0.12s ease;
}
.char-pupil, .char-pupil-only {
  border-radius: 50%;
  background: #2d2d2d;
  transition: transform 0.06s ease-out, opacity 0.08s ease;
}
.char-mouth {
  position: absolute;
  width: 80px;
  height: 4px;
  background: #2d2d2d;
  border-radius: 999px;
  transition: left 0.12s ease-out, top 0.12s ease-out, width 0.2s ease, height 0.2s ease, border-radius 0.2s ease;
}
/* 黄色角色嘴型：录音张嘴 / 思考 O 形 / 打字微笑 */
.char-mouth.mouth-open {
  width: 52px;
  height: 30px;
  border-radius: 50%;
  background: #2d2d2d;
}
.char-mouth.mouth-think {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  border: 3px solid #2d2d2d;
}
.char-mouth.mouth-smile {
  width: 56px;
  height: 14px;
  border-radius: 0 0 28px 28px;
  background: transparent;
  border: 3px solid #2d2d2d;
  border-top: none;
}

.msgs {
  position: relative;
  z-index: 3;
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 14px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: transparent;
}

.m {
  position: relative;
  z-index: 1;
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  animation: msg-in 0.28s ease-out;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.m.user {
  align-self: flex-end;
  background: var(--user-grad);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.25);
}
.m.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

/* 语音气泡 */
.m.voice {
  display: flex;
  flex-direction: column;
  padding: 0;
  max-width: 76%;
  min-width: 108px;
  cursor: pointer;
  user-select: none;
  box-shadow: none;
  background: transparent;
}
.m.voice .voice-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 16px;
  width: 100%;
}
.m.voice.user .voice-body {
  background: var(--user-grad);
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.25);
}
.m.voice.user .voice-dur,
.m.voice.user .voice-bars i { color: rgba(255,255,255,.85); background: rgba(255,255,255,.85); }
.m.voice.user .voice-icon { filter: brightness(2); }
.m.voice.bot .voice-body {
  background: #fff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.m.voice.playing .voice-icon { animation: voice-pulse .8s ease-in-out infinite; }
.voice-icon { width: 22px; height: 22px; flex-shrink: 0; font-size: 15px; }
.m.voice.user .voice-icon { transform: scaleX(-1); }
.voice-bars { display: flex; align-items: center; gap: 3px; height: 18px; flex: 1; }
.voice-bars i {
  display: block;
  width: 3px;
  background: rgba(0,0,0,.35);
  border-radius: 2px;
  height: 6px;
}
.m.voice.playing .voice-bars i:nth-child(1) { animation: vbar .6s 0s ease-in-out infinite; }
.m.voice.playing .voice-bars i:nth-child(2) { animation: vbar .6s .12s ease-in-out infinite; }
.m.voice.playing .voice-bars i:nth-child(3) { animation: vbar .6s .24s ease-in-out infinite; }
@keyframes vbar { 0%, 100% { height: 6px; } 50% { height: 16px; } }
@keyframes voice-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.voice-dur { font-size: 13px; opacity: 0.75; flex-shrink: 0; min-width: 22px; text-align: right; }
.voice-transcript {
  display: none;
  font-size: 14px;
  line-height: 1.55;
  padding: 8px 13px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
/* 转写文字：浅色底 + 深色字，避免白字落在消息区浅灰背景上看不见 */
.m.voice.user .voice-transcript {
  color: var(--text);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid rgba(102, 126, 234, 0.22);
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.14);
}
.m.voice.user.show-text .voice-body { border-bottom-right-radius: 0; }
.m.voice.user.show-text .voice-transcript {
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 16px;
}
.m.voice.bot .voice-transcript {
  color: var(--text);
  background: #f1f5f9;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}
.m.voice.bot.show-text .voice-body { border-bottom-left-radius: 0; }
.m.voice.bot.show-text .voice-transcript {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 16px;
}
.m.voice.show-text .voice-transcript { display: block; }
.m.voice.voice-selected .voice-body { box-shadow: 0 0 0 2px rgba(255,255,255,.55); }
.m.bot .bot-reply-text { white-space: pre-wrap; word-break: break-word; }
.m.bot .bot-reply-audio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(102,126,234,.14), rgba(108,63,245,.1));
  border: 1px solid rgba(102, 126, 234, 0.22);
  border-radius: 12px;
  font-size: 14px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}
.m.bot .bot-reply-audio.playing {
  color: var(--primary);
  background: linear-gradient(135deg, rgba(108, 63, 245, 0.18), rgba(102,126,234,.12));
  border-color: rgba(108, 63, 245, 0.35);
}

/* ========== 留资表单（对齐官网申请体验） ========== */
.lead-form {
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.lead-form-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.lead-form-hint {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 10px;
  line-height: 1.45;
}
.lead-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid #dbe1ea;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.lead-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}
.lead-submit-btn {
  width: 100%;
  margin-top: 4px;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea, #6c3ff5);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.lead-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.lead-submitted-badge {
  margin-top: 10px;
  padding: 8px 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #047857;
  font-size: 13px;
  font-weight: 600;
}

/* ========== 底部输入 ========== */
.foot-wrap {
  flex-shrink: 0;
  padding: 8px 10px 10px;
  background: #fff;
  border-top: 1px solid #eceef3;
}
.foot { display: flex; gap: 8px; align-items: center; }
.foot.hidden { display: none; }

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: #f3f4f8;
  font-size: 19px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:disabled { opacity: 0.45; }

input[type="text"] {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
  font-size: 15px;
  background: #f3f4f8;
}
input[type="text"]:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(102,126,234,.35);
}
input[type="text"]:disabled { opacity: 0.6; }

.send-btn {
  background: var(--user-grad);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 16px;
  height: 40px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 500;
}
.send-btn:disabled { opacity: 0.5; }

.hold-btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 22px;
  background: var(--mic-grad);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(108, 63, 245, 0.28);
  position: relative;
  overflow: hidden;
}
.hold-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  animation: hold-shine 3s ease-in-out infinite;
}
@keyframes hold-shine {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}
.hold-btn:active, .hold-btn.recording {
  background: var(--mic-rec);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.35);
}
.hold-btn.disabled { opacity: 0.5; pointer-events: none; }
.hold-btn .mic-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}
.hold-btn.recording .mic-dot { animation: mic-blink 0.6s ease infinite; }
@keyframes mic-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 4px 0;
  text-align: center;
}

/* ========== 录音浮层（长按 + 上滑选区） ========== */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.35) 0%, rgba(15, 23, 42, 0.72) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.voice-overlay.show { opacity: 1; pointer-events: auto; touch-action: none; }

/* 未上滑时的引导 */
.voice-swipe-guide {
  position: absolute;
  left: 50%;
  bottom: 148px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  letter-spacing: 0.06em;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.voice-swipe-guide.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}
.swipe-chevron {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-left: none;
  border-bottom: none;
  transform: rotate(-45deg);
  animation: swipe-bounce 1.2s ease-in-out infinite;
}
@keyframes swipe-bounce {
  0%, 100% { transform: rotate(-45deg) translateY(4px); opacity: 0.45; }
  50% { transform: rotate(-45deg) translateY(-6px); opacity: 1; }
}
.swipe-tip { font-weight: 500; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }

/* 上滑选区：三枚胶囊按钮 */
.voice-zones {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 14px;
  padding: 0 16px 28px;
  opacity: 0;
  transform: translateY(28px) scale(0.96);
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.voice-overlay.swiped .voice-zones {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 76px;
  padding: 0 4px;
  transition: transform 0.18s ease, filter 0.18s ease;
}
.zone-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(8px);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.zone-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
  white-space: nowrap;
}
.zone.active { transform: translateY(-6px) scale(1.04); }
.zone.active .zone-label { color: #fff; font-weight: 600; }

.zone-cancel.active .zone-icon {
  background: linear-gradient(145deg, #f87171, #ef4444);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 10px 28px rgba(239, 68, 68, 0.45);
}
.zone-text.active .zone-icon {
  background: linear-gradient(145deg, #34d399, #10b981);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.45);
}
.zone-chat.active .zone-icon {
  background: linear-gradient(145deg, #818cf8, #6366f1);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
}

/* 底部录音面板 */
.voice-panel {
  margin: 0 14px max(14px, env(safe-area-inset-bottom));
  padding: 3px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(108, 63, 245, 0.55), rgba(102, 126, 234, 0.35));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.voice-panel-inner {
  background: rgba(22, 22, 32, 0.94);
  border-radius: 20px;
  padding: 22px 18px 18px;
  text-align: center;
  color: #fff;
}
.voice-overlay[data-zone="cancel"] .voice-panel {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.5), rgba(220, 38, 38, 0.35));
}
.voice-overlay[data-zone="text"] .voice-panel {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.5), rgba(5, 150, 105, 0.35));
}
.voice-overlay[data-zone="chat"] .voice-panel {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(79, 70, 229, 0.35));
}

.voice-mic-ring {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 2px solid rgba(167, 139, 250, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mic-ring-pulse 1.4s ease-in-out infinite;
}
.voice-overlay.swiped .voice-mic-ring { animation-duration: 0.9s; }
@keyframes mic-ring-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.35); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(167, 139, 250, 0); }
}
.voice-mic-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(145deg, #c4b5fd, #8b5cf6);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}

.voice-wave {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  height: 40px;
  margin-bottom: 12px;
}
.voice-wave span {
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(180deg, #a78bfa, #e9d5ff);
  animation: wave 0.85s ease-in-out infinite;
}
.voice-wave span:nth-child(2) { animation-delay: .08s; }
.voice-wave span:nth-child(3) { animation-delay: .16s; }
.voice-wave span:nth-child(4) { animation-delay: .24s; }
.voice-wave span:nth-child(5) { animation-delay: .32s; }
.voice-wave span:nth-child(6) { animation-delay: .40s; }
.voice-wave span:nth-child(7) { animation-delay: .48s; }
@keyframes wave {
  0%, 100% { height: 8px; opacity: 0.45; }
  50% { height: 32px; opacity: 1; }
}

.voice-hint {
  font-size: 15px;
  font-weight: 500;
  min-height: 22px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.92);
  transition: color 0.15s;
}
.voice-hint.danger { color: #fca5a5; }
.voice-hint.success { color: #fff; text-shadow: 0 1px 8px rgba(16, 185, 129, 0.55); }
.voice-hint.info { color: #e0e7ff; }

.toast {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.92);
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: 85vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.stt-status {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px auto;
  padding: 10px 18px;
  background: rgba(255,255,255,.96);
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.12);
  font-size: 14px;
  color: #047857;
  font-weight: 600;
}
.stt-dots { display: flex; align-items: center; gap: 5px; }
.stt-dots i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #059669;
  animation: stt-bounce 0.9s ease-in-out infinite;
}
.stt-dots i:nth-child(2) { animation-delay: .15s; }
.stt-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes stt-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-6px); opacity: 1; }
}

.voice-action-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(15, 23, 42, 0.18);
}
.voice-action-menu {
  position: fixed;
  z-index: 1501;
  background: rgba(30, 30, 40, 0.94);
  border-radius: 10px;
  padding: 4px 0;
  min-width: 128px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}
.voice-action-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  padding: 13px 20px;
  text-align: center;
  cursor: pointer;
}
