/* Positioning before the script runs, so nothing jumps on load. */
[data-listen] { position: relative; overflow: hidden; }

/* Listen player — base styles. Concepts theme it via these variables:
   --lp-accent, --lp-fg, --lp-bg, --lp-radius, --lp-font, --lp-fit (cover|contain) */
.lp {
  --lp-accent: #006bff;
  --lp-fg: #fff;
  --lp-bg: #000;
  --lp-radius: 0px;
  --lp-fit: cover;
  position: relative;
  overflow: hidden;
  background: var(--lp-bg);
  color: var(--lp-fg);
  border-radius: var(--lp-radius);
  isolation: isolate;
}
.lp video { display: block; }
.lp-teaser,
.lp-film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: var(--lp-fit);
}
.lp-teaser { z-index: 0; transition: opacity .5s ease; }
.lp::before {
  content: "";
  position: absolute; inset: -60px; z-index: 0;
  background: var(--lp-backdrop, none) center / cover no-repeat;
  filter: blur(34px) brightness(.38) saturate(1.2);
  opacity: 0; transition: opacity .6s ease;
  pointer-events: none;
}
.lp.is-film::before { opacity: 1; }
.lp-film {
  z-index: 1;
  object-fit: contain;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s ease, visibility 0s .45s;
}
.lp.is-film .lp-film { opacity: 1; visibility: visible; transition: opacity .45s ease; }
.lp.is-film .lp-teaser { opacity: 0; }
/* Anything the concept puts inside the player (titles, play button) hides in film mode. */
.lp.is-film > :not(.lp-film):not(.lp-ui):not(.lp-teaser):not(.lp-sr) { opacity: 0; visibility: hidden; pointer-events: none; }

.lp-ui { position: absolute; inset: 0; z-index: 3; pointer-events: none; font-family: var(--lp-font, inherit); }
.lp:not(.is-film) .lp-ui { display: none; }

.lp-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 28px max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0));
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s, transform .3s;
}
.lp.is-paused .lp-bar,
.lp.is-awake .lp-bar,
.lp:focus-within .lp-bar { opacity: 1; transform: none; }
@media (hover: none) { .lp.is-film .lp-bar { opacity: 1; transform: none; } }

.lp-btn {
  flex: none;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.lp-btn:hover { background: rgba(255,255,255,.14); }
.lp-btn svg { width: 22px; height: 22px; }
.lp-btn:focus-visible, .lp-end-btn:focus-visible, .lp-seek:focus-visible { outline: 2px solid var(--lp-fg); outline-offset: 2px; }

.lp-time { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: .9; }
.lp-seek {
  --p: 0%;
  flex: 1;
  min-width: 60px;
  height: 24px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.lp-seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--lp-accent) var(--p), rgba(255,255,255,.3) var(--p));
}
.lp-seek::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); }
.lp-seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--lp-accent); }
.lp-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; }
.lp-seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }

.lp-close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  background: rgba(0,0,0,.45);
  pointer-events: auto;
  opacity: 0;
  transition: opacity .3s;
}
.lp.is-paused .lp-close, .lp.is-awake .lp-close, .lp.is-ended .lp-close, .lp:focus-within .lp-close { opacity: 1; }
@media (hover: none) { .lp.is-film .lp-close { opacity: 1; } }

.lp-end {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: rgba(0,0,0,.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  text-align: center;
  pointer-events: auto;
}
.lp-end[hidden] { display: none; }
.lp-end-title { margin: 0; font-size: clamp(1.3rem, 3vw, 2.2rem); font-weight: 600; letter-spacing: -.01em; }
.lp-end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.lp-end-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid rgba(255,255,255,.7);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.lp-end-btn svg { width: 18px; height: 18px; }
.lp-end-btn:hover { background: #fff; color: #000; }
.lp-end-btn--primary { background: var(--lp-accent); border-color: var(--lp-accent); color: #000; }

.lp-spinner {
  position: absolute;
  left: 50%; top: 50%;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  opacity: 0;
  transition: opacity .2s;
  animation: lp-spin .9s linear infinite;
}
.lp.is-waiting .lp-spinner { opacity: 1; }
@keyframes lp-spin { to { transform: rotate(360deg); } }

.lp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }

.lp:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.lp:fullscreen .lp-film { object-fit: contain; background: #000; }

@media (max-width: 480px) {
  .lp-time { display: none; }
  .lp-btn { width: 44px; height: 44px; }
}

.lp-rotate {
  position: absolute; left: 50%; top: 18%; transform: translate(-50%, -8px);
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 14px;
  border-radius: 999px; background: rgba(0,0,0,.6); font-size: 13px; font-weight: 600; white-space: nowrap;
  opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none;
}
.lp-rotate svg { width: 18px; height: 18px; }
.lp.show-rotate .lp-rotate { opacity: 1; transform: translate(-50%, 0); }
