.talk { max-width: 38rem; padding-block: 1.25rem; }
.talk h1 { font-size: clamp(2.4rem, 9vw, 4rem); margin: .55rem 0 1rem; }
.talk-panel { padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); }
.talk-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.talk-mic {
  min-height: 4.25rem;
  padding: .65rem .4rem;
  border: 1px solid var(--gold);
  border-radius: .75rem;
  color: var(--bg);
  background: var(--gold);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
}
.talk-mic[aria-pressed="true"] { background: #a13236; color: white; border-color: #ff8c85; }
.talk-mic:disabled { opacity: .55; }
#mic-caption, #talk-status { margin: .65rem 0 0; text-align: center; overflow-wrap: anywhere; }
#mic-caption:empty, #talk-status:empty { display: none; }
#talk-result { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--line); }
#translation, #original { white-space: pre-wrap; overflow-wrap: anywhere; }
#translation, #original { font-size: clamp(1.35rem, 5vw, 1.8rem); line-height: 1.3; color: var(--text); margin-bottom: .3rem; }

#talk-typing { margin-top: .65rem; }
#talk-typing summary { cursor: pointer; padding-block: .3rem; }
#talk-form { display: grid; gap: .55rem; margin-top: .5rem; }
.talk-typing-language { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem; }
#typing-language { min-height: 44px; padding: .35rem .55rem; color: var(--text); background: var(--bg); border: 1px solid var(--gold); border-radius: .5rem; font: inherit; }
#talk-form textarea { width: 100%; padding: .65rem; color: var(--text); background: var(--bg); border: 1px solid var(--gold); border-radius: .5rem; }
.talk-note { margin: .75rem 0 0; font-size: .875rem; }

.audio-modes { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.audio-modes button {
  min-height: 44px;
  padding: .35rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}
.audio-modes [aria-pressed="true"] { border-color: #d4af37; color: #d4af37; }
.audio-modes button:focus-visible { outline: 2px solid #d4af37; outline-offset: 2px; }

.audio-waveform {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  min-height: 54px;
  margin-top: .65rem;
  padding: .4rem .85rem .4rem .4rem;
  color: #d4af37;
  background: var(--bg);
  border: 1px solid #d4af37;
  border-radius: 999px;
  cursor: pointer;
}
.audio-waveform:hover { background: #111c29; }
.audio-waveform:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.audio-waveform-control {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #d4af37;
  color: var(--bg);
}
.audio-icon-pause, .audio-waveform[data-pausing] .audio-icon-play { display: none; }
.audio-waveform[data-pausing] .audio-icon-pause { display: initial; }
.audio-waveform-bars {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(22, minmax(0, 1fr));
  justify-items: center;
  align-items: center;
  gap: 3px;
}
.audio-waveform-bars i {
  width: min(100%, 4px);
  height: 1.65rem;
  transform: scaleY(.16);
  transition: transform 230ms ease-out;
}
.audio-waveform-bars i::before {
  content: '';
  display: block;
  height: 100%;
  border-radius: 999px;
  background: currentColor;
  animation: ace-wave var(--tempo, 620ms) var(--offset, 0ms) ease-in-out infinite alternate paused;
}
.audio-waveform-bars i:nth-child(3n) { --tempo: 440ms; --offset: -310ms; }
.audio-waveform-bars i:nth-child(3n + 1) { --tempo: 510ms; --offset: -120ms; }
.audio-waveform-bars i:nth-child(5n) { --tempo: 710ms; --offset: -480ms; --peak: .62; }
.audio-waveform-bars i:nth-child(5n + 2) { --tempo: 550ms; --offset: -390ms; --peak: .78; }
.audio-waveform.is-playing i { transform: scaleY(1); }
.audio-waveform.is-playing i::before { animation-play-state: running; }

@keyframes ace-wave {
  from { transform: scaleY(.23); }
  to { transform: scaleY(var(--peak, 1)); }
}

@media (prefers-reduced-motion: reduce) {
  .audio-waveform-bars i { transition: none; }
  .audio-waveform-bars i::before { animation: none; }
  .audio-waveform.is-playing i { transform: scaleY(.48); }
}

#talk-voice { margin: .4rem 0 0; font-size: .8125rem; color: var(--muted); }
#talk-voice:empty { display: none; }
