/* ── Voice input ──────────────────────────────────────────────────────────── */

.voice-wave-wrap {
  position: relative;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.2s ease;
}

.voice-wave-wrap.active {
  max-height: 48px;
}

.voice-wave-canvas {
  display: block;
  width: 100%;
  height: 48px;
  border-radius: var(--radius-sm);
  background: oklch(var(--b1));
}

#mic-btn.recording {
  color: oklch(var(--er));
  border-color: oklch(var(--er) / 40%);
  animation: mic-pulse 1.4s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 oklch(var(--er) / 0%); }
  50%       { box-shadow: 0 0 0 6px oklch(var(--er) / 25%); }
}

#mic-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#input.voice-streaming {
  opacity: 0.55;
  pointer-events: none;
}

.voice-wave-canvas.cleaning {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.voice-cleaning-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: oklch(var(--bc) / 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.voice-cleaning-state.active { opacity: 1; }

.voice-cleaning-timer {
  font-variant-numeric: tabular-nums;
  font-family: monospace;
  color: oklch(var(--p));
}

/* ── TTS playback bar ────────────────────────────────────────────────────── */

.tts-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0 0.5rem;
  transition: max-height 0.22s ease, opacity 0.18s ease, padding 0.22s ease;
  pointer-events: none;
}

.tts-bar.active {
  max-height: 36px;
  opacity: 1;
  padding: 0.2rem 0.5rem;
  pointer-events: auto;
}

.tts-bar-icon {
  color: oklch(var(--p) / 70%);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.tts-time {
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: oklch(var(--bc) / 85%);
  flex-shrink: 0;
  transition: opacity 0.4s ease;
}

.tts-time-faint {
  opacity: 0.3;
}

.tts-wave {
  flex: 1;
  min-width: 0;
  height: 28px;
  display: block;
  cursor: grab;
}
.tts-wave:active {
  cursor: grabbing;
}

.tts-bar-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid oklch(var(--bc) / 20%);
  background: transparent;
  color: oklch(var(--bc) / 55%);
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1;
}

.tts-bar-btn:hover {
  background: oklch(var(--bc) / 8%);
  color: oklch(var(--bc) / 85%);
  border-color: oklch(var(--bc) / 35%);
}

.tts-stop-btn:hover {
  background: oklch(var(--er) / 12%);
  color: oklch(var(--er));
  border-color: oklch(var(--er) / 35%);
}

/* ── TTS icon button (replaces decorative span) ─────────────────────────── */

.tts-icon-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: oklch(var(--p) / 70%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;   /* anchor for radial picker */
  transition: color 0.12s;
  padding: 0;
  touch-action: none;   /* needed for setPointerCapture */
}

.tts-icon-btn:hover {
  color: oklch(var(--p));
}

.tts-icon-btn svg {
  width: 13px;
  height: 13px;
}

/* ── Speed display ───────────────────────────────────────────────────────── */

.tts-speed-display {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: oklch(var(--p) / 80%);
  flex-shrink: 0;
  min-width: 2.2ch;
}

/* ── "Set as default" affordance ────────────────────────────────────────── */

.tts-set-default {
  font-size: 0.68rem;
  color: oklch(var(--bc) / 40%);
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.12s;
  white-space: nowrap;
}

.tts-set-default:hover {
  color: oklch(var(--bc) / 70%);
}

/* ── Radial arc speed picker ─────────────────────────────────────────────── */

.tts-radial-picker {
  position: absolute;
  /* Positioned relative to the TTS bar; the icon button will be the visual anchor.
     JS sets individual node transforms. */
  left: 0.5rem;
  bottom: 100%;
  pointer-events: none;
  z-index: 50;
}

.tts-radial-picker.open {
  pointer-events: auto;
}

.tts-radial-node {
  position: absolute;
  /* Base position: centred on the icon button (JS overrides transform) */
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid oklch(var(--bc) / 25%);
  background: oklch(var(--b1));
  color: oklch(var(--bc) / 65%);
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.1s, color 0.1s, border-color 0.1s;
  box-shadow: 0 2px 8px oklch(var(--b1) / 80%);
}

.tts-radial-picker.open .tts-radial-node {
  opacity: 1;
}

.tts-radial-node.active {
  border-color: oklch(var(--p));
  color: oklch(var(--p));
  background: oklch(var(--p) / 10%);
}

.tts-radial-node.hover {
  background: oklch(var(--p) / 18%);
  color: oklch(var(--p));
  border-color: oklch(var(--p) / 60%);
}

/* ── Floating TTS settings card ──────────────────────────────────────────── */

.tts-settings-card {
  position: fixed;   /* positioned by FloatingUI */
  z-index: 200;
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--bc) / 15%);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 16px oklch(var(--b1) / 60%);
  min-width: 200px;
}

.tts-settings-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.tts-settings-row:last-child {
  margin-bottom: 0;
}

.tts-settings-label {
  font-size: 0.72rem;
  color: oklch(var(--bc) / 55%);
  flex-shrink: 0;
  min-width: 4rem;
}

/* ── Speed step buttons (card + settings panel) ──────────────────────────── */

.tts-speed-steps {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.tts-speed-step {
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid oklch(var(--bc) / 20%);
  background: transparent;
  color: oklch(var(--bc) / 60%);
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.tts-speed-step:hover {
  background: oklch(var(--bc) / 8%);
  color: oklch(var(--bc) / 85%);
}

.tts-speed-step.active {
  border-color: oklch(var(--p));
  color: oklch(var(--p));
  background: oklch(var(--p) / 10%);
}

/* ── Voice select ────────────────────────────────────────────────────────── */

.tts-voice-select {
  font-size: 0.75rem;
  background: oklch(var(--b2));
  border: 1px solid oklch(var(--bc) / 20%);
  border-radius: 6px;
  color: oklch(var(--bc) / 80%);
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  flex: 1;
}

/* ── Voice trace (cleanup metrics + raw/cleaned transcript) ──────────────── */

.msg-voice-trace {
  border-left: 2px solid oklch(var(--p) / 35%);
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  color: oklch(var(--bc) / 55%);
  font-variant-numeric: tabular-nums;
}

.voice-trace-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.voice-trace-section-label {
  font-weight: 600;
  color: oklch(var(--bc) / 65%);
  margin-bottom: 0.1rem;
}

.voice-trace-text {
  white-space: pre-wrap;
  word-break: break-word;
  color: oklch(var(--bc) / 50%);
  font-size: 0.72rem;
  margin: 0;
}

.voice-trace-cleaned {
  color: oklch(var(--bc) / 70%);
}
