
/* ══════════════════════════════════════════════════════════════════
   6 · VOICE MODE — the centerpiece
   Almost-empty space: a living presence, then language emerging as
   large, light typography. Tap anywhere to interrupt.
   ══════════════════════════════════════════════════════════════════ */
.ai-voice-view { display: none; }
/* Hide the chat composer that lives INSIDE the overlay while the voice view takes
   over — scoped to .ai-overlay so it never touches the same chat elements once
   they've been relocated into the Media tile's Chat tab (otherwise the ambient,
   see-through voice mode would blank that tab behind it). */
body.ai-voice-mode .ai-overlay .ai-chat,
body.ai-voice-mode .ai-overlay .ai-status,
body.ai-voice-mode .ai-overlay .ai-attach-preview,
body.ai-voice-mode .ai-overlay .ai-input-row { display: none !important; }

body.ai-voice-mode .ai-voice-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  gap: 22px;
  padding: 56px 30px 32px;
  cursor: pointer;
  text-align: center;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* ── The presence: Bit ───────────────────────────────────────────────
   Bit (shared engine, mounted by ai-bit-chat.js) listens, thinks and talks.
   Its mood colour (--bit-rgb, set with the mood) tints the halo and the
   bars under it. Tapping Bit listens again. Only transform and opacity
   animate, and both stop with reduced motion and the low-GPU choices. */
.ai-voice-view { --bit-rgb: 255, 215, 94; }
.ai-presence {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 18px;
  cursor: pointer;
}
.ai-voice-aura {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--bit-rgb), .16) 0%, rgba(var(--bit-rgb), 0) 68%);
  animation: vx-breathe 3.2s ease-in-out infinite;
  pointer-events: none;
}
.ai-voice-bit { position: relative; width: 132px; }
.ai-voice-bit .xbit { display: block; width: 100%; height: auto; }
.ai-voice-bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 26px;
  opacity: 0;
  transition: opacity .3s ease;
}
.ai-voice-bars span {
  width: 6px;
  height: 100%;
  background: rgb(var(--bit-rgb));
  transform-origin: 50% 100%;
  transform: scaleY(.25);
  animation: vx-bar .9s ease-in-out infinite;
}
.ai-voice-bars span:nth-child(1) { animation-delay: -.1s; }
.ai-voice-bars span:nth-child(2) { animation-delay: -.5s; }
.ai-voice-bars span:nth-child(3) { animation-delay: -.3s; }
.ai-voice-bars span:nth-child(4) { animation-delay: -.7s; }
.ai-voice-bars span:nth-child(5) { animation-delay: -.2s; }
.ai-voice-bars span:nth-child(6) { animation-delay: -.6s; }
.ai-voice-bars span:nth-child(7) { animation-delay: -.4s; }
/* The bars are a voice: there while someone speaks, gone while Bit thinks. */
body.voice-listening .ai-voice-bars,
body.voice-speaking .ai-voice-bars { opacity: 1; }
body.voice-listening .ai-voice-bars span { animation-duration: 1.6s; }

@keyframes vx-bar { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@keyframes vx-breathe { 0%, 100% { opacity: .55; } 50% { opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  .ai-voice-aura, .ai-voice-bars span { animation: none; }
  .ai-voice-bars span { transform: scaleY(.6); }
}
body.low-power-gpu .ai-voice-aura, body.low-power-gpu .ai-voice-bars span,
body.perf-mode .ai-voice-aura, body.perf-mode .ai-voice-bars span { animation: none; }
body.low-power-gpu .ai-voice-bars span, body.perf-mode .ai-voice-bars span { transform: scaleY(.6); }

.ai-voice-stage { display: contents; }
.ai-voice-words {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

/* A wide, short screen (the Xeneon Edge, a bar display): Bit on the left,
   the words beside it, the hint along the bottom. */
@media (min-aspect-ratio: 2/1) and (min-width: 700px) {
  body.ai-voice-mode:not(.ai-voice-ambient) .ai-voice-view {
    display: grid;
    grid-template-columns: minmax(200px, 34%) minmax(0, 1fr);
    align-items: center;
    align-content: center;
    gap: 0 24px;
    position: relative;
    padding: 16px 64px 44px 16px;
    text-align: left;
  }
  body.ai-voice-mode:not(.ai-voice-ambient) .ai-voice-words { align-items: flex-start; }
  body.ai-voice-mode:not(.ai-voice-ambient) .ai-voice-user,
  body.ai-voice-mode:not(.ai-voice-ambient) .ai-voice-reply { width: 100%; max-width: 900px; text-align: left; }
  body.ai-voice-mode:not(.ai-voice-ambient) .ai-voice-hint {
    position: absolute;
    left: 0; right: 0; bottom: 16px;
    text-align: center;
  }
}

/* ── Language emerging — large, light, expressive typography ──────── */
.ai-voice-user {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .01em;
  color: rgba(255,255,255,.52);
  max-width: min(720px, 88%);
  width: 88%;
  line-height: 1.4;
  text-align: center;
  word-break: normal;
  overflow-wrap: break-word;
  opacity: 1;
  visibility: visible;
}
.ai-voice-user:not(:empty) { animation: xn-emerge .5s cubic-bezier(.22,1,.36,1) both; }

.ai-voice-reply {
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 300;
  letter-spacing: -.018em;
  color: rgba(255,255,255,.97);
  max-width: min(900px, 92%);
  width: 92%;
  line-height: 1.4;
  text-align: center;
  word-break: normal;
  overflow-wrap: break-word;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: none;
  /* Belt-and-braces: ensure the element is always rendered visible, even on
     WebViews that mishandle :not(:empty) animation states (Xeneon Edge LCD). */
  opacity: 1;
  visibility: visible;
}
.ai-voice-reply::-webkit-scrollbar { display: none; }
.ai-voice-reply:not(:empty) { animation: xn-emerge .55s cubic-bezier(.22,1,.36,1) both; }
/* Long answers (capability rundowns, etc.): shrink, left-align and honour the
   line breaks between points so nothing overflows the compact voice view. */
.ai-voice-reply.ai-voice-reply-long {
  font-size: clamp(14px, 1.5vw, 18px);
  line-height: 1.5;
  font-weight: 400;
  text-align: left;
  white-space: pre-line;
  max-height: 52vh;
  padding: 0 6px;
}

.ai-voice-hint {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .04em;
  color: rgba(var(--accent-rgb), .82);
  min-height: 16px;
}
body.voice-listening .ai-voice-hint { animation: xn-pulse 1.6s ease-in-out infinite; }
