/* Ascolta — bottom sheet (#listenPop) + player (#voce) — solo angoli morbidi */
#listenPop.listen-sheet.bugpop.sheet {
  --listen-r: 20px;
  flex-direction: column;
  gap: 0;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top) - 12px));
  overflow: hidden;
  border-radius: 24px 24px 20px 20px;
}

#listenPop .handle {
  border-radius: 99px;
}

/* .sheet alone had display:none — must beat #listenPop…sheet (id+3 classes) when open */
#listenPop.listen-sheet.bugpop.sheet.on {
  display: flex;
}

#listenPop .listen-sheet-close {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  border-radius: 16px;
  flex-shrink: 0;
}

#voce.listen-panel {
  padding: 0;
  overflow: hidden;
  border-radius: var(--listen-r, 20px);
  border: 1px solid color-mix(in srgb, var(--gold, #d4b46a) 22%, transparent);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(212, 180, 106, 0.1) 0%, transparent 55%),
    linear-gradient(165deg, color-mix(in srgb, var(--pane, #323028) 96%, #1a1610) 0%, var(--pane, #323028) 100%);
  box-shadow: inset 0 1px 0 rgba(212, 180, 106, 0.06);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#listenPop .listen-read {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#listenPop .listen-read .expand-shell {
  flex: 1 1 auto;
  min-height: 6em;
  max-height: min(42dvh, 320px);
}

.listen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--card-ink, #eee6d4) 8%, transparent);
}

.listen-head h3 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--card-ink, #eee6d4);
}

.listen-meta {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted, #8a7d62);
  letter-spacing: 0.01em;
}

.listen-orb {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--gold, #d4b46a) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold, #d4b46a) 35%, transparent);
  color: var(--gold, #d4b46a);
  font-size: 15px;
}

.listen-orb-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--gold, #d4b46a) 25%, transparent);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

body.playing #voce .listen-orb-ring {
  opacity: 1;
  animation: listen-pulse 1.8s ease-in-out infinite;
}

@keyframes listen-pulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.35;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.85;
  }
}

.listen-read {
  padding: 0 12px 10px;
}

#voce .listen-read .expand-shell {
  min-height: 5.5em;
  max-height: min(38dvh, 280px);
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--card-ink, #eee6d4) 10%, transparent);
  background: color-mix(in srgb, #0e1812 28%, var(--pane, #323028));
  overflow: hidden;
}

#listenPop .expand-disk {
  border-radius: 50%;
}

#listenPop .expand-disk svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

#voce .expand-shell.is-expanded {
  border-radius: 18px;
}

#voce .listen-read .expand-shell:not(.is-expanded) {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#voce .voce-body {
  font-family: "Source Serif 4", serif;
  font-size: 16px;
  line-height: 1.58;
  padding: 12px 14px 14px;
  color: var(--card-ink, #eee6d4);
}

html[data-type="big"] #voce .voce-body {
  font-size: 18px;
}

html[data-type="huge"] #voce .voce-body {
  font-size: 20px;
}

#voce .expand-disk {
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
}

#voce .expand-shell.is-expanded {
  max-height: min(72dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 140px));
}

.listen-panel--empty .listen-read {
  opacity: 0.72;
}

.listen-panel--empty .voce-body {
  font-style: italic;
  color: var(--muted, #8a7d62);
}

.listen-transport {
  padding: 4px 12px 14px;
}

#voce .listen-progress {
  margin: 0 2px 12px;
}

#voce .listen-progress .bar {
  height: 5px;
  background: color-mix(in srgb, var(--card-ink, #eee6d4) 12%, transparent);
  border-radius: 99px;
}

#voce .listen-progress .bar i {
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #a88b4a, var(--gold, #d4b46a));
  transition: width 0.12s linear;
  animation: none !important;
}

body.playing #voce .listen-progress .bar i {
  animation: none !important;
}

#voce .listen-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 0;
}

#voce .listen-rewind {
  justify-self: start;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid color-mix(in srgb, var(--card-ink, #eee6d4) 22%, transparent);
  background: transparent;
  color: var(--card-ink, #eee6d4);
}

#voce .listen-stop {
  justify-self: end;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: color-mix(in srgb, #5a2420 75%, transparent);
  color: #f3ebe3;
  border: none;
}

#voce .listen-play {
  width: 58px;
  height: 58px;
  min-width: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e2cf98, #c9a85a);
  color: #1a1610;
  font-weight: 700;
  box-shadow:
    0 0 0 1px rgba(212, 180, 106, 0.35),
    0 8px 22px rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
}

#voce .listen-play:active {
  transform: scale(0.96);
}

#voce .listen-play__glyph {
  font-size: 20px;
  line-height: 1;
  margin-left: 2px;
}

#voce .listen-play[data-state="pause"] .listen-play__glyph {
  margin-left: 0;
  font-size: 16px;
  letter-spacing: -2px;
}

.listen-loop {
  margin: 0;
  border-top: 1px solid color-mix(in srgb, var(--card-ink, #eee6d4) 8%, transparent);
  padding: 0 12px 12px;
}

.listen-loop__sum {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #8a7d62);
  padding: 10px 0 8px;
  user-select: none;
}

.listen-loop__sum::-webkit-details-marker {
  display: none;
}

.listen-loop__sum::before {
  content: "▸ ";
  opacity: 0.7;
}

.listen-loop[open] .listen-loop__sum::before {
  content: "▾ ";
}

.listen-loop .micro-label {
  display: none;
}

#voce #microText {
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--card-ink, #eee6d4) 14%, transparent);
  background: color-mix(in srgb, #0e1812 22%, var(--pane, #323028));
  min-height: 72px;
  font-size: 14px;
}

#voce .micro-row {
  margin-top: 10px;
}

#voce .micro-row .ghost {
  flex: 1;
  min-height: 42px;
  border-radius: 16px;
}

#voce #microStop {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  font-size: 11px;
}

/* Day light in studio pane */
html[data-light="day"] #voce.listen-panel {
  border-color: color-mix(in srgb, #1a241e 14%, transparent);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(224, 194, 122, 0.14) 0%, transparent 55%),
    linear-gradient(165deg, #f3efe6 0%, #ece6da 100%);
  box-shadow: 0 8px 24px rgba(28, 40, 30, 0.1);
}

html[data-light="day"] .listen-head h3,
html[data-light="day"] #voce .voce-body {
  color: #1c1915;
}

html[data-light="day"] .listen-meta {
  color: #6b6254;
}

html[data-light="day"] #voce .listen-read .expand-shell {
  background: #fffdf8;
  border-color: color-mix(in srgb, #1a241e 12%, transparent);
}

html[data-light="day"] #voce .listen-rewind {
  color: #1a241e;
  border-color: color-mix(in srgb, #1a241e 22%, transparent);
}

html[data-light="day"] #voce #microText {
  background: #fffdf8;
  color: #1c1915;
}

@media (prefers-reduced-motion: reduce) {
  body.playing #voce .listen-orb-ring {
    animation: none;
    opacity: 0.5;
  }
  body.playing #voce .listen-progress .bar i {
    transition: none;
  }
}
