/*!
 * Sticky Player — estilos. Personalizable mediante las variables --sp-*.
 */
.sp-root {
  --sp-accent: #ff1f4b;
  --sp-accent-soft: #ff7d97;
  --sp-bg: #222224;
  --sp-bg-2: #1a1a1b;
  --sp-bg-3: #2a2a2c;
  --sp-ink: #0b0b0c;
  --sp-line: #343437;
  --sp-text: #d6d6d9;
  --sp-muted: #9b9ba1;
  --sp-bar-h: 92px;
  --sp-drawer-h: min(460px, 58vh);

  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--sp-text);
  pointer-events: none;
}
.sp-root > * { pointer-events: auto; }
.sp-root [hidden] { display: none !important; }
.sp-root *, .sp-root *::before, .sp-root *::after { box-sizing: border-box; }
.sp-root button { font-family: inherit; line-height: inherit; color: inherit; }

body.sp-reserve-space { padding-bottom: var(--sp-height, 92px); }

.sp-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sp-icon { width: 1em; height: 1em; display: block; flex: none; }

/* ------------------------------------------------------------------ botones */

.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  transition: color .15s, background-color .15s, transform .1s;
}
.sp-btn:disabled { opacity: .3; cursor: default; }
.sp-btn:not(:disabled):active { transform: scale(.94); }

.sp-root :focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(255, 31, 75, .55);
}
.sp-root :focus:not(:focus-visible) { outline: none; }

/* ------------------------------------------------------------------ video */

.sp-video {
  position: relative;
  align-self: flex-end;
  width: min(480px, calc(100vw - 32px), calc(34vh * 16 / 9));
  aspect-ratio: 16 / 9;
  margin: 0 16px 54px;
  background: #000;
  border: 1px solid var(--sp-line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
.sp-media { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; cursor: pointer; }
.sp-yt, .sp-yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ------------------------------------------------------------------ barra */

.sp-shell {
  position: relative;
  background: var(--sp-bg);
  border-top: 1px solid var(--sp-line);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .35);
}

.sp-collapse {
  position: absolute;
  right: 0;
  top: -30px;
  width: 30px;
  height: 30px;
  font-size: 16px;
  border-radius: 3px 0 0 0;
  background: var(--sp-ink);
  color: var(--sp-accent);
}
.sp-collapse:hover { color: #fff; background: var(--sp-accent); }

.sp-bar {
  display: grid;
  grid-template-columns: var(--sp-bar-h) auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: var(--sp-bar-h);
}

.sp-cover {
  position: relative;
  width: var(--sp-bar-h);
  height: var(--sp-bar-h);
  overflow: hidden;
  background: linear-gradient(135deg, #3a0d1c, #1b1b1d);
}
.sp-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-cover:not(.has-img) img { display: none; }
.sp-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: var(--sp-accent);
}
.sp-cover.has-img .sp-cover-fallback { display: none; }

.sp-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 14px;
}
.sp-controls .sp-btn { color: var(--sp-accent); }
.sp-controls .sp-btn:not(:disabled):hover { color: #fff; }
.sp-prev, .sp-next { font-size: 24px; }
.sp-play { position: relative; width: 50px; height: 50px; font-size: 36px; }

.sp-spinner {
  position: absolute;
  inset: 8px;
  border: 3px solid rgba(255, 31, 75, .25);
  border-top-color: var(--sp-accent);
  border-radius: 50%;
  animation: sp-spin .8s linear infinite;
  display: none;
}
.sp-root.is-loading .sp-play .sp-spinner { display: block; }
.sp-root.is-loading .sp-play .sp-icon { transform: scale(.45); }
@keyframes sp-spin { to { transform: rotate(360deg); } }

.sp-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 16px;
  border-left: 1px solid var(--sp-line);
  align-self: stretch;
}

.sp-title { min-width: 0; }
.sp-title-text {
  display: block;
  padding: 5px 10px;
  background: var(--sp-ink);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-status {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--sp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-root.is-error .sp-status { color: var(--sp-accent-soft); }

.sp-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sp-time {
  flex: none;
  min-width: 38px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--sp-muted);
}
.sp-time-duration { text-align: right; }

/* Rangos (progreso y volumen) */
.sp-range {
  --sp-fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.sp-range:disabled { cursor: default; opacity: .5; }
.sp-range::-webkit-slider-runnable-track {
  height: 8px;
  background: linear-gradient(to right, var(--sp-accent) var(--sp-fill), var(--sp-ink) var(--sp-fill));
}
.sp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 4px;
  height: 14px;
  margin-top: -3px;
  border: 0;
  border-radius: 1px;
  background: #fff;
}
.sp-range::-moz-range-track { height: 8px; background: var(--sp-ink); border: 0; }
.sp-range::-moz-range-progress { height: 8px; background: var(--sp-accent); }
.sp-range::-moz-range-thumb { width: 4px; height: 14px; border: 0; border-radius: 1px; background: #fff; }
.sp-range:focus-visible { box-shadow: none; outline-offset: 0; }

.sp-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-left: 1px solid var(--sp-line);
  align-self: stretch;
}
.sp-actions, .sp-actions-main, .sp-actions-extra { display: flex; gap: 4px; }
.sp-actions .sp-btn, .sp-mute, .sp-mute-alt { color: var(--sp-muted); }
.sp-actions .sp-btn:not(:disabled):hover, .sp-mute:hover, .sp-mute-alt:hover { color: #fff; }
.sp-actions .sp-btn.is-on, .sp-actions .sp-btn.is-open { color: var(--sp-accent); }
.sp-timer { position: relative; }
.sp-badge {
  position: absolute;
  top: -1px;
  right: -5px;
  min-width: 18px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--sp-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  pointer-events: none;
}
.sp-volume { position: relative; display: flex; align-items: center; gap: 6px; }
.sp-vol-pop { display: flex; align-items: center; gap: 6px; }
.sp-mute, .sp-mute-alt { width: 30px; height: 30px; font-size: 20px; }
.sp-mute-alt { display: none; }
.sp-vol { width: 200px; flex: none; }

/* ------------------------------------------------------------------ visualizador */

.sp-viz {
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 100%;
  height: 46px;
  pointer-events: none;
}

/* ------------------------------------------------------------------ menús emergentes */

.sp-pop {
  position: absolute;
  right: 40px;
  bottom: calc(100% + 8px);
  z-index: 2;
  width: 300px;
  max-width: calc(100vw - 16px);
  padding: 12px;
  background: var(--sp-ink);
  border: 1px solid var(--sp-line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .6);
  font-size: 13px;
}
.sp-pop.sp-pop-below { bottom: auto; }
.sp-pop-title { margin: 0 0 10px; color: #fff; font-weight: 700; }
.sp-pop-note { margin: 8px 0 0; color: var(--sp-muted); font-size: 12px; }
.sp-pop-note:empty { display: none; }
.sp-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sp-pop-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 3px;
  background: #262628;
  color: var(--sp-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.sp-pop-item .sp-icon { font-size: 15px; }
.sp-pop-item:hover { background: var(--sp-accent); color: #fff; }
.sp-pop-wide { width: 100%; margin-top: 6px; }
.sp-pop-cancel { background: transparent; border: 1px solid var(--sp-accent); color: var(--sp-accent-soft); }
.sp-share-url {
  width: 100%;
  height: 32px;
  margin-bottom: 8px;
  padding: 0 8px;
  border: 1px solid var(--sp-line);
  border-radius: 2px;
  background: #18181a;
  color: #fff;
  font: inherit;
  font-size: 12px;
}
.sp-share-at { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--sp-text); cursor: pointer; }
.sp-share-at input { accent-color: var(--sp-accent); }

/* ------------------------------------------------------------------ cajón (pistas / listas) */

.sp-drawer {
  background: var(--sp-bg-2);
  border-top: 1px solid var(--sp-line);
}
.sp-view { display: flex; flex-direction: column; max-height: var(--sp-drawer-h); }
.sp-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--sp-line);
  background: var(--sp-bg);
}
.sp-view-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-close-view { color: var(--sp-accent); font-size: 22px; }
.sp-close-view:hover { color: #fff; }
.sp-view-msg { margin: 0; padding: 18px 16px; color: var(--sp-muted); list-style: none; }

.sp-tracklist,
.sp-cards {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--sp-accent) var(--sp-bg-3);
}
.sp-tracklist::-webkit-scrollbar, .sp-cards::-webkit-scrollbar { width: 8px; }
.sp-tracklist::-webkit-scrollbar-track, .sp-cards::-webkit-scrollbar-track { background: var(--sp-bg-3); }
.sp-tracklist::-webkit-scrollbar-thumb, .sp-cards::-webkit-scrollbar-thumb { background: var(--sp-accent); }

.sp-track {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 16px 8px 10px;
  border: 0;
  border-bottom: 1px solid #262628;
  background: transparent;
  text-align: left;
  color: var(--sp-muted);
  cursor: pointer;
}
.sp-tracklist li:nth-child(even) .sp-track { background: rgba(255, 255, 255, .018); }
.sp-track:hover { background: var(--sp-bg-3) !important; color: var(--sp-text); }
.sp-track strong { color: var(--sp-text); font-weight: 700; }
.sp-track-mark { font-size: 14px; color: #6f6f75; }
.sp-track-num { flex: none; font-variant-numeric: tabular-nums; }
.sp-track-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-track-badge, .sp-track-err { font-size: 15px; color: #7b7b82; }
.sp-track-err { color: var(--sp-accent-soft); }
.sp-track-tag {
  flex: none;
  padding: 1px 5px;
  border: 1px solid #45454b;
  border-radius: 2px;
  color: #a6a6ae;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.sp-view-msg.is-error { color: var(--sp-accent-soft); }
.sp-retry {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 4px 10px;
  border: 0;
  border-radius: 3px;
  background: #2c2c2e;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.sp-retry:hover { background: var(--sp-accent); }

.sp-addbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 22px 0; }
.sp-addform { display: flex; flex: 1 1 420px; gap: 6px; min-width: 0; }
.sp-add-url, .sp-add-type {
  height: 34px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--sp-line);
  border-radius: 2px;
  background: var(--sp-ink);
  color: #fff;
  font: inherit;
}
.sp-add-url { flex: 1 1 200px; }
.sp-add-type { flex: 0 1 190px; }
.sp-addbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 2px;
  background: #2c2c2e;
  color: #fff;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.sp-addbtn:hover { background: var(--sp-accent); }
.sp-addbtn .sp-icon { font-size: 16px; }
.sp-add-msg { flex-basis: 100%; min-height: 1.2em; margin: 0; font-size: 12px; color: var(--sp-muted); }
.sp-view-playlists.is-drop { outline: 2px dashed var(--sp-accent); outline-offset: -6px; }
.sp-track-dur { flex: none; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.sp-track.is-active { background: var(--sp-ink) !important; color: #fff; }
.sp-track.is-active strong { color: #fff; }
.sp-track.is-active .sp-track-mark { color: var(--sp-accent); }
.sp-track.is-error .sp-track-name { text-decoration: line-through; text-decoration-color: rgba(255, 125, 151, .6); }

.sp-view-foot {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--sp-line);
  background: var(--sp-bg);
}
.sp-search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(350px, 100%);
}
.sp-search input {
  width: 100%;
  height: 32px;
  padding: 0 34px 0 10px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: var(--sp-ink);
  color: #fff;
  font: inherit;
}
.sp-search input::placeholder { color: #8a8a90; }
.sp-search input:focus-visible { box-shadow: none; outline: 2px solid var(--sp-accent); outline-offset: 0; }
.sp-search .sp-icon { position: absolute; right: 10px; font-size: 16px; color: #8a8a90; pointer-events: none; }

.sp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
  padding: 22px;
  align-content: start;
}
.sp-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 2px solid transparent;
  background: var(--sp-ink);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.sp-card:hover { border-color: #555; transform: translateY(-2px); }
.sp-card.is-active { border-color: var(--sp-accent); }
.sp-card-media { position: relative; display: block; aspect-ratio: 5 / 3; background: var(--sp-bg-3); }
.sp-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-card-ph { display: flex; height: 100%; align-items: center; justify-content: center; font-size: 40px; color: var(--sp-accent); }
.sp-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 2px;
  background: var(--sp-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.sp-card-info {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  margin-top: -34px;
  padding: 10px 12px 12px;
  background: rgba(8, 8, 9, .86);
  color: var(--sp-muted);
  font-size: 13px;
}
.sp-card-info b { color: #fff; font-weight: 600; }
.sp-card-title { color: #fff; font-weight: 700; }

/* ------------------------------------------------------------------ contraído */

.sp-mini {
  position: fixed;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 2px;
}
.sp-mini .sp-btn {
  width: 34px;
  height: 34px;
  font-size: 18px;
  border-radius: 0;
  background: var(--sp-ink);
  color: var(--sp-accent);
}
.sp-mini .sp-btn:hover { background: var(--sp-accent); color: #fff; }
.sp-root.sp-collapsed .sp-video { display: none; }
/* Botón para ocultar la ventana de video (siempre visible y accesible). */
.sp-root .sp-video { display: flex; flex-direction: column; aspect-ratio: auto; }
.sp-video-head { display: flex; justify-content: flex-end; flex: none; height: 30px; background: var(--sp-ink); border-bottom: 1px solid var(--sp-line); }
.sp-video-box { position: relative; flex: none; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.sp-hide-video {
  width: 30px;
  height: 29px;
  font-size: 18px;
  border-radius: 0;
  color: #fff;
}
.sp-hide-video:hover { background: var(--sp-accent); }
.sp-actions .sp-show-video { color: var(--sp-accent); }

/* Video reducido: la misma ventana, recolocada sobre la miniatura de la barra (sigue visible y sonando). */
.sp-root .sp-video.is-mini {
  position: fixed;
  z-index: 3;
  margin: 0;
  border: 0;
  box-shadow: none;
  cursor: pointer;
}
.sp-video.is-mini .sp-video-head { display: none; }
.sp-video.is-mini .sp-video-box { width: 100%; height: 100%; aspect-ratio: auto; }
.sp-video.is-mini .sp-media { object-fit: cover; }
/* En miniatura el clic amplía el video: el iframe de YouTube no lo recibe (no se superpone nada sobre él). */
.sp-video.is-mini .sp-yt iframe { pointer-events: none; }

/* Directo: sin tiempo transcurrido ni barra de avance simulados. */
.sp-root.sp-live .sp-time-current { visibility: hidden; }
.sp-root.sp-live .sp-seek { opacity: .35; }
.sp-root.sp-live .sp-seek::-webkit-slider-thumb { opacity: 0; }
.sp-root.sp-live .sp-seek::-moz-range-thumb { opacity: 0; }
.sp-root.sp-live .sp-time-duration {
  min-width: 0;
  padding: 1px 8px;
  border-radius: 2px;
  background: var(--sp-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sp-root.sp-live .sp-time-duration::before { content: "● "; }
.sp-pop-item:disabled { opacity: .45; cursor: not-allowed; }
.sp-pop-item:disabled:hover { background: #262628; color: var(--sp-text); }

/* ------------------------------------------------------------------ móvil */

@media (max-width: 760px) {
  .sp-root { --sp-bar-h: 64px; --sp-drawer-h: 56vh; }
  .sp-bar {
    grid-template-columns: var(--sp-bar-h) auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "cover title title main"
      "cover progress progress progress"
      "controls controls extra volume";
  }
  .sp-cover { grid-area: cover; align-self: start; }
  .sp-main, .sp-side { display: contents; }
  .sp-title { grid-area: title; padding: 6px 0 0 10px; }
  .sp-progress { grid-area: progress; padding: 2px 12px 4px 10px; }
  .sp-actions { display: contents; }
  .sp-actions-main { grid-area: main; padding: 4px 6px 0 4px; gap: 2px; }
  .sp-actions-extra { grid-area: extra; justify-content: center; align-items: center; gap: 0; border-top: 1px solid var(--sp-line); align-self: stretch; }
  .sp-actions-extra .sp-btn { width: 34px; }
  .sp-controls { grid-area: controls; padding: 4px 6px; border-top: 1px solid var(--sp-line); }
  .sp-volume { grid-area: volume; justify-content: flex-end; padding: 4px 10px 4px 0; border-top: 1px solid var(--sp-line); align-self: stretch; }
  .sp-vol-pop {
    display: none;
    position: absolute;
    right: 4px;
    bottom: calc(100% + 8px);
    z-index: 2;
    width: min(240px, calc(100vw - 16px));
    padding: 10px;
    background: var(--sp-ink);
    border: 1px solid var(--sp-line);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .6);
  }
  .sp-volume.is-open .sp-vol-pop { display: flex; }
  .sp-mute-alt { display: inline-flex; }
  .sp-vol { width: auto; flex: 1; }
  .sp-pop { left: 8px; right: 8px; width: auto; }
  .sp-addbar { padding: 12px 12px 0; }
  .sp-addform { flex-wrap: wrap; }
  .sp-add-type { flex: 1 1 140px; }
  .sp-title-text { padding: 3px 8px; font-size: 13px; }
  .sp-time { font-size: 12px; min-width: 34px; }
  .sp-progress { gap: 6px; }
  .sp-play { width: 46px; height: 46px; font-size: 32px; }
  .sp-video { width: min(calc(100vw - 16px), calc(30vh * 16 / 9)); margin: 0 8px 38px; }
  .sp-cards { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 12px; padding: 12px; }
  .sp-track { padding-left: 6px; padding-right: 10px; font-size: 13px; gap: 6px; }
  .sp-track-mark { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-spinner { animation-duration: 2.4s; }
  .sp-btn, .sp-card { transition: none; }
  .sp-card:hover { transform: none; }
}

/* YouTube: sus condiciones exigen un reproductor de al menos 200 × 200 px. No se reduce a la miniatura y su
   ventana nunca baja de 200 px de alto ni de ese ancho (16:9 hasta 356 px si cabe), también en móviles. */
.sp-root.sp-provider-youtube .sp-video { min-width: min(356px, calc(100vw - 16px)); }
.sp-root.sp-provider-youtube .sp-video-box { min-height: 200px; }
