/* Hamrah Voice Core 4.4.2 — cached real waveform with deterministic fallback */
.v4-voice-shell,
.voice-player > .voice-play,
.voice-player > .voice-wave,
.voice-player > .voice-speed,
.voice-player > .voice-duration,
.voice-player audio[controls] {
  display: none !important;
}

.voice-player.voice-core-host,
.voice-player[data-audio-player] {
  width: min(100%, 390px) !important;
  min-width: 250px;
  margin: 2px 0 0;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.voice-core-audio {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.voice-core-ui {
  --voice-accent: var(--primary, #28aee4);
  --voice-progress: 0%;
  direction: ltr;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 66px;
  padding: 8px 6px 7px;
  border-radius: 18px;
  color: var(--text, #f4f8ff);
  isolation: isolate;
}

.message.mine .voice-core-ui { --voice-accent: #35d7b2; }

/* Keep the 46px message-actions touch target below the player instead of over Play. */
.voice-core-bubble > .message-actions-trigger {
  top: auto !important;
  bottom: 8px !important;
}

.voice-core-play {
  position: relative;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--voice-accent) 88%, white 12%), var(--voice-accent));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--voice-accent) 30%, transparent), inset 0 1px rgba(255,255,255,.2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.voice-core-play:active { transform: scale(.94); }
.voice-core-play-icon { font-size: 20px; line-height: 1; transform: translateX(1px); }
.voice-core-play.playing .voice-core-play-icon { font-size: 17px; transform: none; letter-spacing: -3px; }
.voice-core-spinner { display: none; }

.voice-core-main { min-width: 0; display: grid; gap: 7px; }
.voice-core-wave {
  position: relative;
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 2.5px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.voice-core-wave i {
  display: block;
  flex: 1 1 2px;
  min-width: 2px;
  max-width: 4px;
  height: var(--voice-bar, 12px);
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-muted, #8d9bad) 72%, transparent);
  transform-origin: center;
  transition: background .12s ease, opacity .12s ease, transform .12s ease;
}

.voice-core-wave i.played {
  background: var(--voice-accent);
  opacity: 1;
}
.voice-core-wave i:not(.played) { opacity: .58; }
.voice-core-wave.waveform-fallback i { opacity: .45; }
.voice-core-wave.waveform-fallback i.played { opacity: .9; }
.voice-core-wave:active i { transform: scaleY(.92); }

.voice-core-meta {
  direction: rtl;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: var(--text-muted, #9aa8ba);
  font-size: 12px;
  line-height: 1;
}
.voice-core-time { direction: ltr; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--voice-accent) 76%, white 24%); }
.voice-core-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.voice-core-rate {
  min-width: 38px;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--voice-accent) 16%, transparent);
  color: var(--voice-accent);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.voice-core-rate:active { transform: scale(.94); }

.voice-core-recorder {
  direction: rtl;
  display: grid;
  grid-template-columns: 40px 12px auto minmax(70px, 1fr) auto 40px 46px;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  margin: 0 10px 7px;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--primary, #25b5e9) 28%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface, #132235) 94%, transparent);
  box-shadow: 0 12px 34px rgba(0,0,0,.24);
  animation: voiceRecorderIn .18s ease-out;
}
.voice-core-recorder.hidden { display: none !important; }
.voice-core-recorder.requesting { opacity: .72; }
.voice-core-recorder.locked .voice-core-hint { color: var(--primary, #25b5e9); }
@keyframes voiceRecorderIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.voice-core-cancel,.voice-core-lock,.voice-core-send {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  font: inherit;
}
.voice-core-cancel { color: #ff6f79; background: rgba(255,75,92,.11); font-size: 24px; }
.voice-core-lock { color: var(--text-muted, #98a7b9); background: rgba(255,255,255,.06); }
.voice-core-send { width: 46px; color: #fff; background: linear-gradient(145deg, #1bc9a5, #139bd9); font-size: 18px; }
.voice-core-record-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff5362; box-shadow: 0 0 0 5px rgba(255,83,98,.12); animation: voicePulse 1.15s infinite; }
@keyframes voicePulse { 50% { transform: scale(.78); opacity: .58; } }
.voice-core-record-time { direction: ltr; font-variant-numeric: tabular-nums; font-weight: 800; color: #ff7b84; }
.voice-core-live-wave { height: 28px; display: flex; align-items: center; justify-content: center; gap: 2px; overflow: hidden; }
.voice-core-live-wave i { width: 2px; height: var(--voice-live, 6px); border-radius: 99px; background: var(--primary, #23b9e9); opacity: .8; }
.voice-core-hint { font-size: 11px; color: var(--text-muted, #96a4b6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.voice-permission-backdrop {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(8px);
}
.voice-permission-card {
  direction: rtl;
  width: min(100%, 430px);
  padding: 22px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 26px;
  background: var(--surface, #142337);
  color: var(--text, #f5f8fc);
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
  animation: voicePermissionIn .22s ease-out;
}
@keyframes voicePermissionIn { from { transform: translateY(24px); opacity: 0; } }
.voice-permission-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 18px; background: rgba(40,185,225,.14); font-size: 25px; }
.voice-permission-card h3 { margin: 0 0 8px; font-size: 19px; }
.voice-permission-card p,.voice-permission-card ol { color: var(--text-muted, #a5b0bf); line-height: 1.75; font-size: 13px; }
.voice-permission-card ol { padding-right: 22px; }
.voice-permission-card small { display: block; direction: ltr; text-align: left; opacity: .55; }
.voice-permission-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 18px; }
.voice-permission-actions button { min-height: 46px; border: 0; border-radius: 15px; font: inherit; font-weight: 800; }
.voice-permission-close { background: rgba(255,255,255,.07); color: var(--text, white); }
.voice-permission-retry { background: linear-gradient(135deg, #1cc9a3, #178ddf); color: white; }

@media (max-width: 420px) {
  .voice-core-ui { grid-template-columns: 47px minmax(0,1fr) auto; gap: 8px; }
  .voice-core-play { width: 46px; height: 46px; }
  .voice-player.voice-core-host,.voice-player[data-audio-player] { min-width: 225px; }
  .voice-core-recorder { grid-template-columns: 38px 10px auto minmax(52px,1fr) 38px 44px; }
  .voice-core-hint { display: none; }
}
