/* Use Lantern's semantic colors rather than baking a particular skin in. */
.voice-player {
  --voice-accent: var(--lantern-lamp);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .4rem;
  margin-block: .25rem;
  max-inline-size: 100%;
}
.bubble.person .voice-player { --voice-accent: var(--bubble-ink, var(--lantern-lamp)); }
/* Match the specificity of the generic Lantern button border rule. */
#pocket .voice-player > button:is(.voice-play, .voice-stop, .voice-speed),
body.lantern #pocket .voice-player > button[type="button"]:is(.voice-play, .voice-stop, .voice-speed) {
  border: 1px solid var(--lantern-edge);
  background: var(--lantern-raised);
  color: var(--lantern-ink);
  min-height: max(32px, var(--kit-target, 32px));
  padding-inline: .65rem;
}
.voice-speed { font-variant-numeric: tabular-nums; touch-action: none; user-select: none; }
.voice-timeline {
  flex: 1 0 min(100%, 12rem);
  min-inline-size: 0;
  max-inline-size: 22rem;
  color: var(--bubble-meta, var(--lantern-muted));
  font-size: calc(.8rem * var(--text-ratio, 1));
  font-variant-numeric: tabular-nums;
}
.voice-steps {
  display: grid;
  grid-template-columns: repeat(var(--voice-steps), minmax(24px, 1fr));
  gap: 2px;
  overflow-x: auto;
}
#pocket .voice-player button.voice-step,
body.lantern #pocket .voice-player button.voice-step[type="button"] {
  display: grid;
  align-items: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 4px;
}
.voice-step::before {
  content: '';
  display: block;
  height: 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--bubble-ink, var(--lantern-ink)) 28%, transparent);
}
.voice-step[data-past]::before { background: var(--bubble-meta, var(--lantern-muted)); }
.voice-step[aria-current]::before { height: 8px; background: var(--voice-accent); }
.voice-player :focus-visible, #pocket #voice-mini-bar button:focus-visible {
  outline: 2px solid var(--voice-accent);
  outline-offset: -2px;
}
.voice-waveform, .voice-range { position: relative; min-height: 32px; }
.voice-wave-bars {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(36, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
  pointer-events: none;
}
.voice-wave-bars i { height: var(--voice-peak); border-radius: 3px; background: var(--bubble-meta, var(--lantern-muted)); }
.voice-player .voice-scrubber {
  position: relative;
  width: 100%;
  height: 32px;
  margin: 0;
  padding: 0;
  accent-color: var(--voice-accent);
}
.voice-waveform .voice-scrubber {
  appearance: none;
  border: 0;
  background: linear-gradient(to right, color-mix(in srgb, var(--voice-accent) 29%, transparent) var(--voice-progress, 0%), transparent 0);
}
.voice-waveform .voice-scrubber::-webkit-slider-thumb {
  appearance: none;
  width: 4px;
  height: 27px;
  border-radius: 4px;
  background: var(--voice-accent);
}
.voice-waveform .voice-scrubber::-moz-range-thumb {
  width: 4px;
  height: 27px;
  border: 0;
  border-radius: 4px;
  background: var(--voice-accent);
}
#pocket, body.lantern #pocket { position: relative; }
#pocket #voice-mini-bar, body.lantern #pocket #voice-mini-bar {
  --voice-accent: var(--lantern-lamp);
  box-sizing: border-box;
  position: absolute;
  z-index: 4;
  inset-block-start: .5rem;
  inset-inline-end: max(.75rem, env(safe-area-inset-right));
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  width: max-content;
  max-width: calc(100% - max(.75rem, env(safe-area-inset-right)) - .75rem);
  height: 36px;
  padding: 0 .25rem;
  border: 1px solid var(--lantern-lamp);
  border-radius: 999px;
  background: var(--lantern-raised);
  color: var(--lantern-ink);
  box-shadow: 0 2px 10px #0003;
}
body.lantern.chat-open #pocket #voice-mini-bar { inset-block-start: calc(var(--kit-topBar, 4rem) + .5rem); }
#pocket #voice-mini-bar button, body.lantern #pocket #voice-mini-bar button {
  min-height: 0;
  min-width: 0;
  height: 30px;
  padding: 0 .5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  line-height: 1;
  box-shadow: none;
  white-space: nowrap;
}
#pocket #voice-mini-bar button.voice-mini-jump {
  overflow: hidden;
  text-overflow: ellipsis;
}
#pocket #voice-mini-bar button:is(.voice-mini-toggle, .voice-mini-stop) { flex: none; }
#pocket #voice-mini-bar[hidden], body.lantern #pocket #voice-mini-bar[hidden],
.voice-stop[hidden], .voice-timeline[hidden] { display: none; }
