.speech-transcription-field {
  position: relative;
  width: 100%;
}

.speech-transcription-field textarea {
  width: 100%;
  padding-right: 46px;
}

.speech-transcription-field.is-listening textarea {
  padding-right: 116px;
}

.speech-transcription-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #d7e0ec;
  border-radius: 50%;
  color: #475569;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 4px rgb(15 23 42 / 10%);
  cursor: pointer;
  z-index: 2;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.speech-transcription-button:hover:not(:disabled) {
  color: #0f6fdb;
  border-color: #9fc5f4;
  background: #f7fbff;
  transform: translateY(-1px);
}

.speech-transcription-button:focus-visible {
  outline: 2px solid rgb(15 111 219 / 28%);
  outline-offset: 2px;
}

.speech-transcription-button:disabled {
  color: #9ca3af;
  background: #f3f4f6;
  cursor: not-allowed;
  opacity: 0.72;
}

.speech-transcription-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.speech-transcription-button.is-listening {
  color: #fff;
  border-color: #dc2626;
  background: #dc2626;
  box-shadow: 0 0 0 5px rgb(220 38 38 / 12%);
  animation: speech-transcription-pulse 1.2s ease-in-out infinite;
}

.speech-transcription-status {
  position: absolute;
  top: 13px;
  right: 48px;
  display: none;
  padding: 3px 7px;
  border-radius: 999px;
  color: #991b1b;
  background: #fee2e2;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
  z-index: 2;
}

.speech-transcription-field.is-listening .speech-transcription-status {
  display: inline-flex;
}

@keyframes speech-transcription-pulse {
  50% { box-shadow: 0 0 0 8px rgb(220 38 38 / 7%); }
}

@media (max-width: 767px) {
  .speech-transcription-button {
    width: 36px;
    height: 36px;
  }

  .speech-transcription-status {
    top: 15px;
    right: 52px;
  }
}
