/* "Talk to us" voice button + panel. Loaded with the page; the voice JS itself loads only after a click. */
.voice-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 44px;
  min-height: 52px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red-hot), var(--red));
  color: #fff;
  font: 700 0.95rem/1 var(--sans);
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(200, 16, 46, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.voice-fab:hover { transform: translateY(-2px); }
.voice-fab:focus-visible,
.voice-panel button:focus-visible,
.voice-panel a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.voice-fab svg { width: 22px; height: 22px; flex: none; }
.voice-fab.is-open { background: #1a1a1e; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--line) inset; }

.voice-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 52px + 12px);
  z-index: 120;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  padding: 18px 18px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  color: var(--white);
}
.voice-panel[hidden], .voice-panel [hidden] { display: none !important; }
.voice-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.voice-head h2 { font-size: 1.1rem; letter-spacing: 0.04em; }
.voice-x {
  flex: none;
  width: 44px;
  height: 44px;
  margin: -8px -8px -8px 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--silver);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.voice-x:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.voice-state {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 3em;
  margin-bottom: 10px;
  color: var(--silver);
  font-size: 0.98rem;
}
.voice-state::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 0.5em;
  border-radius: 50%;
  background: var(--soft);
}
.voice-panel[data-state="asking"] .voice-state::before,
.voice-panel[data-state="connecting"] .voice-state::before { background: #f5b942; animation: voicePulse 1.2s ease-in-out infinite; }
.voice-panel[data-state="listening"] .voice-state::before { background: var(--ok); animation: voicePulse 1.6s ease-in-out infinite; }
.voice-panel[data-state="speaking"] .voice-state::before { background: var(--red-hot); animation: voicePulse 0.8s ease-in-out infinite; }
.voice-panel[data-state="error"] .voice-state::before { background: var(--red-hot); }
@keyframes voicePulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) {
  .voice-panel .voice-state::before { animation: none !important; }
  .voice-fab { transition: none; }
}

.voice-caps {
  margin-bottom: 10px;
  padding: 10px 12px;
  max-height: 9.5em;
  overflow-y: auto;
  background: var(--black);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 0.92rem;
}
.voice-caps p { margin: 0; }
.voice-caps p + p { margin-top: 6px; }
.voice-you { color: var(--muted); }
.voice-agent { color: var(--white); }
.voice-timer { margin-bottom: 8px; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.voice-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.voice-actions .btn { min-height: 44px; flex: 1 1 140px; padding: 11px 16px; white-space: nowrap; }

.voice-fine { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.voice-fine + .voice-fine { margin-top: 6px; }
.voice-fine strong { color: var(--silver); }
.voice-fine a { color: #ff8a9a; font-weight: 700; }

@media (max-width: 480px) {
  .voice-fab { padding: 0 18px 0 14px; font-size: 0.92rem; }
  .voice-panel { right: 12px; left: 12px; width: auto; padding: 16px 14px 14px; }
  .voice-actions .btn { flex-basis: 100%; }
}
