/* 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 > :not(.lp-film):not(.lp-ui):not(.lp-teaser):not(.lp-sr) { transition: opacity .7s ease, visibility 0s linear 0s; }
.lp.is-film > :not(.lp-film):not(.lp-ui):not(.lp-teaser):not(.lp-sr):not(.lp-keep) { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 1.1s ease, visibility 0s linear 1.1s; }

/* Ambient mode can keep some of it on screen, dimmed (mark it .lp-keep). */
.lp.is-film > .lp-keep { opacity: var(--lp-keep, .5); transition: opacity 1.1s ease; }

.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); }

/* ---------- Ambient mode (data-ambient): the film plays as the background, page stays free ---------- */
.lp--ambient.is-film .lp-film { object-fit: var(--lp-fit); }
.lp--ambient::before { display: none; }
.lp--ambient .lp-ui { display: none; }
.lp--ambient.is-film .lp-film { cursor: pointer; }

/* Docked "now playing" bar */
.lp-dock {
  --lp-accent: var(--lp-dock-accent, #006bff);
  position: fixed; z-index: 60;
  left: 50%; bottom: max(12px, env(safe-area-inset-bottom));
  width: min(560px, calc(100vw - 24px));
  transform: translate(-50%, calc(100% + 24px));
  opacity: 0;
  padding: 0 8px 8px;
  border-radius: 18px;
  background: rgba(18, 18, 22, .9);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 12px 40px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.1);
  color: #fff;
  font-family: var(--lp-font, inherit);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s;
}
.lp-dock[hidden] { display: none; }
.lp-dock.is-shown { transform: translate(-50%, 0); opacity: 1; }
.lp-dock-seek {
  --p: 0%;
  display: block; width: calc(100% + 16px); margin: 0 -8px; height: 22px;
  background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.lp-dock-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 18px 18px 0 0; background: linear-gradient(to right, var(--lp-accent) var(--p), rgba(255,255,255,.18) var(--p)); }
.lp-dock-seek::-moz-range-track { height: 4px; background: rgba(255,255,255,.18); }
.lp-dock-seek::-moz-range-progress { height: 4px; background: var(--lp-accent); }
.lp-dock-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px rgba(0,0,0,.25); }
.lp-dock-seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.lp-dock-seek:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.lp-dock-row { display: flex; align-items: center; gap: 4px; margin-top: -4px; }
.lp-dock-watch {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 48px;
  padding: 2px 6px 2px 2px; border: 0; border-radius: 12px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.lp-dock-watch:hover { background: rgba(255,255,255,.08); }
.lp-dock.is-film-visible .lp-dock-watch { cursor: default; background: none; }
.lp-dock-art { width: 44px; height: 44px; flex: none; border-radius: 9px; object-fit: cover; }
.lp-dock-text { display: grid; min-width: 0; line-height: 1.25; }
.lp-dock-text strong { font-size: 1rem; }
.lp-dock-time { font-size: .82rem; opacity: .7; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lp-dock-text strong::after { content: " · now playing"; font-weight: 500; font-size: .82rem; opacity: .6; }
.lp-dock.is-paused .lp-dock-text strong::after { content: " · paused"; }
.lp-dock.is-muted .lp-dock-text strong::after { content: " · muted"; }
.lp-dock .lp-btn { width: 44px; height: 44px; color: #fff; }
.lp-dock .lp-dock-toggle { background: #fff; color: #000; }
.lp-dock .lp-dock-toggle:hover { background: var(--lp-accent); }
.lp-dock .lp-dock-close svg { width: 18px; height: 18px; opacity: .75; }
@media (max-width: 380px) { .lp-dock-text strong::after { content: none; } }

/* Ambient: no hard cut. The loop cross-fades into the film while the titles fade out. */
.lp--ambient .lp-teaser { transition: opacity 1.2s ease; }
.lp--ambient .lp-film { transition: opacity 1.2s ease, visibility 0s 1.2s; }
.lp--ambient.is-film .lp-film { transition: opacity 1.2s ease; }
