/* Compact messenger-style audio UI. The native audio element stays as the playback engine. */
.message-audio {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: min(270px, 72vw);
  max-width: min(350px, 80vw);
  padding: 4px 5px 2px;
  border-radius: 0;
  background: transparent;
}

.message-audio-play {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #7489f4, #7457dd);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 3px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  touch-action: manipulation;
}

.chat[data-platform="telegram"] .message-audio-play {
  background: linear-gradient(145deg, #7894f7, #7457df);
}

.chat[data-platform="whatsapp"] .message-audio-play {
  background: linear-gradient(145deg, #52c98e, #329d70);
}

.message-audio-play svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.message-audio-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.message-audio-seek {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: block;
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.message-audio-wave {
  position: absolute;
  inset: 4px 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
  pointer-events: none;
}

.message-audio-wave > span {
  flex: 1 1 0;
  min-width: 1px;
  max-width: 3px;
  height: var(--audio-bar-height, 50%);
  border-radius: 999px;
  background: rgba(235, 241, 248, 0.28);
}

.message-audio-wave-active {
  clip-path: inset(0 100% 0 0);
  will-change: clip-path;
}

.message-audio-wave-active > span {
  background: var(--chat-accent, #72bcff);
}

.message-audio-duration {
  min-height: 14px;
  color: rgba(232, 239, 246, 0.66);
  font-size: 12px;
  line-height: 14px;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
}

.message-audio-engine {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.message-audio.playing .message-audio-play {
  filter: brightness(1.04);
}

@media (max-width: 760px) {
  .message-audio {
    min-width: min(250px, 76vw);
    max-width: min(330px, 82vw);
    gap: 9px;
    padding-right: 3px;
  }

  .message-audio-play {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
  }

  .message-audio-wave {
    gap: 1.5px;
  }
}
