.cjb-voice-thread {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  width: 100%;
}

.cjb-voice-message {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
}

.cjb-voice-bubble {
  --voice-bubble-width: 96px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(var(--voice-bubble-width), 82%);
  min-width: 88px;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid rgb(69 130 46 / 38%);
  border-radius: 12px 4px 12px 12px;
  background: linear-gradient(145deg, #9aee70, #83d75c);
  color: #17350e;
  box-shadow: 0 8px 18px rgb(24 63 12 / 15%);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.cjb-voice-bubble::after {
  position: absolute;
  top: 0;
  right: -7px;
  width: 14px;
  height: 14px;
  background: #90e568;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  content: "";
}

.cjb-voice-bubble:hover {
  filter: brightness(1.02);
}

.cjb-voice-bubble:focus-visible {
  outline: 3px solid #fff2bd;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgb(77 126 52 / 44%);
}

.cjb-voice-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 24px;
}

.cjb-voice-wave i {
  display: block;
  width: 3px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.75;
  transform-origin: center;
}

.cjb-voice-wave i:nth-child(2) {
  height: 17px;
}

.cjb-voice-wave i:nth-child(3) {
  height: 13px;
}

.cjb-voice-wave i:nth-child(4) {
  height: 20px;
}

.cjb-voice-bubble.is-playing .cjb-voice-wave i {
  animation: cjb-voice-wave 720ms ease-in-out infinite alternate;
}

.cjb-voice-bubble.is-playing .cjb-voice-wave i:nth-child(2) {
  animation-delay: 120ms;
}

.cjb-voice-bubble.is-playing .cjb-voice-wave i:nth-child(3) {
  animation-delay: 240ms;
}

.cjb-voice-bubble.is-playing .cjb-voice-wave i:nth-child(4) {
  animation-delay: 360ms;
}

.cjb-voice-seconds {
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 650;
  line-height: 1;
}

.cjb-voice-menu {
  z-index: 20;
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid rgb(196 165 110 / 48%);
  border-radius: 12px;
  background: #fff9ea;
  box-shadow: 0 14px 32px rgb(32 21 12 / 23%);
}

.cjb-voice-menu[hidden] {
  display: none;
}

.cjb-voice-menu button {
  min-height: 42px;
  padding: 8px 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #412d1d;
  font: inherit;
  cursor: pointer;
}

.cjb-voice-menu button:hover,
.cjb-voice-menu button:focus-visible {
  background: #f0dfb8;
  outline: none;
}

.cjb-voice-transcript {
  width: min(520px, 88%);
  margin-top: 8px;
  padding: 14px 16px;
  border: 1px solid rgb(177 144 94 / 28%);
  border-radius: 14px 4px 14px 14px;
  background: rgb(255 250 233 / 94%);
  color: #453426;
  font-size: 16px;
  line-height: 1.72;
  overflow: visible;
}

.cjb-voice-transcript[hidden] {
  display: none;
}

.cjb-voice-transcript p {
  margin: 0;
  white-space: pre-wrap;
}

.cjb-voice-transcript button {
  min-height: 40px;
  margin-top: 10px;
  padding: 7px 14px;
  border: 1px solid #b88642;
  border-radius: 999px;
  background: #fff7de;
  color: #593c1f;
  font: inherit;
  cursor: pointer;
}

@keyframes cjb-voice-wave {
  from {
    transform: scaleY(0.56);
  }

  to {
    transform: scaleY(1.08);
  }
}

@media (max-width: 640px) {
  .cjb-voice-bubble {
    min-width: 88px;
    min-height: 52px;
    padding-inline: 16px;
  }

  .cjb-voice-menu {
    flex-wrap: wrap;
    max-width: min(92%, 340px);
  }

  .cjb-voice-menu button {
    flex: 1 1 auto;
    min-width: 88px;
  }

  .cjb-voice-transcript {
    width: 88%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cjb-voice-bubble.is-playing .cjb-voice-wave i {
    animation: none;
  }
}
