.mitra-microphone {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.mitra-microphone .mitra-microphone__cancel {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  height: 36px;
  margin-left: 6px;
  padding: 0 10px;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.mitra-microphone .mitra-microphone__cancel[hidden] {
  display: none;
}

.mitra-microphone .mitra-microphone__cancel:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.mitra-microphone__button {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.18), transparent 36%),
    rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font: inherit;
  touch-action: none;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.mitra-microphone__button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.mitra-microphone__button:focus-visible {
  outline: 2px solid rgba(128, 176, 255, 0.95);
  outline-offset: 3px;
}

.mitra-microphone__button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.mitra-microphone__pulse {
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
}

.mitra-microphone__icon,
.mitra-microphone__spinner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mitra-microphone__icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.mitra-microphone__spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.mitra-microphone__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.mitra-microphone[data-state="recording"] .mitra-microphone__button {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.96);
  color: #000;
  transform: scale(1.03);
  box-shadow: 0 14px 34px rgba(217, 56, 56, 0.18);
}

.mitra-microphone[data-state="recording"] .mitra-microphone__pulse {
  border-color: rgba(217, 56, 56, 0.7);
  opacity: 1;
  animation: mitra-mic-pulse 1s ease-in-out infinite;
}

.mitra-microphone[data-state="uploading"] .mitra-microphone__icon,
.mitra-microphone[data-state="stopping"] .mitra-microphone__icon,
.mitra-microphone[data-state="requesting"] .mitra-microphone__icon {
  display: none;
}

.mitra-microphone[data-state="uploading"] .mitra-microphone__spinner,
.mitra-microphone[data-state="stopping"] .mitra-microphone__spinner,
.mitra-microphone[data-state="requesting"] .mitra-microphone__spinner {
  display: inline-flex;
  animation: mitra-mic-spin 0.75s linear infinite;
}

.mitra-microphone[data-state="uploading"] .mitra-microphone__button,
.mitra-microphone[data-state="stopping"] .mitra-microphone__button,
.mitra-microphone[data-state="requesting"] .mitra-microphone__button {
  border-color: rgba(128, 176, 255, 0.45);
  color: rgba(222, 234, 255, 0.96);
}

.mitra-microphone[data-state="error"] .mitra-microphone__button {
  border-color: rgba(220, 78, 78, 0.56);
  color: #ffb8b8;
}

.mitra-microphone[data-state="disabled"] .mitra-microphone__button,
.mitra-microphone[data-state="unsupported"] .mitra-microphone__button {
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.44);
}

.mitra-microphone__status {
  color: rgba(255, 255, 255, 0.64);
}

.mitra-microphone__error {
  color: #ffb8b8;
}

.chatgpt__composer .mitra-microphone {
  grid-column: 2;
  align-self: end;
  gap: 0;
}

.chatgpt__composer .mitra-microphone__button.chat-mic-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

.chatgpt__composer .mitra-microphone__button.chat-mic-btn::before {
  content: none;
}

.chatgpt__composer .mitra-microphone__button.chat-mic-btn .mitra-microphone__icon svg {
  width: 16px;
  height: 16px;
}

.chatgpt__composer .mitra-microphone__button.chat-mic-btn .mitra-microphone__spinner {
  width: 15px;
  height: 15px;
}

.chatgpt__composer .mitra-microphone__status,
.chatgpt__composer .mitra-microphone__error {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  max-width: min(240px, calc(100vw - 48px));
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #000;
  font-size: 12px;
  line-height: 1.1;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.chatgpt__composer .mitra-microphone__error {
  color: #8d1f1f;
}

.chatgpt__composer .mitra-microphone:not([data-state="idle"]):not([data-state="transcribed"]) .mitra-microphone__status:not(:empty),
.chatgpt__composer .mitra-microphone[data-state="error"] .mitra-microphone__error:not(:empty) {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes mitra-mic-pulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.78;
  }

  50% {
    transform: scale(1.18);
    opacity: 0;
  }
}

@keyframes mitra-mic-spin {
  to {
    transform: rotate(360deg);
  }
}
