body.radio-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #000000;
  color: var(--text-white);
  display: flex;
  flex-direction: column;
}

/* Contenedor principal: centrado en PC y pantalla completa sin scroll */
.radio-main {
  flex: 1;
  margin-top: 82px;
  min-height: calc(100vh - 82px);
  min-height: calc(100dvh - 82px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem clamp(74px, 11vh, 90px);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

.radio-screen {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(0.75rem, 1.8vh, 1.25rem);
}

/* 1. CABECERA DEL PROGRAMA: Logo 3D compacto + Título y estado */
.live-top {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.4rem);
  flex-shrink: 0;
}

/* Visualizador preparado para la animación 3D (más compacto) */
.visual-placeholder-3d {
  position: relative;
  width: clamp(62px, 7vw, 76px);
  height: clamp(62px, 7vw, 76px);
  flex-shrink: 0;
  background: #060606;
  border: 1px solid #1c1c1c;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.visual-logo-etc {
  font-family: var(--font-helvetica);
  font-size: clamp(1.6rem, 2.2vw, 2rem);
  color: var(--text-white);
  letter-spacing: -0.035em;
  transition: transform 0.6s ease, opacity 0.4s ease;
}

.radio-page.is-live-playing .visual-logo-etc {
  animation: logoBreath 3.6s ease-in-out infinite alternate;
}

@keyframes logoBreath {
  0% {
    transform: scale(1);
    opacity: 0.88;
  }

  100% {
    transform: scale(1.06);
    opacity: 1;
  }
}



.live-header-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.live-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-family: var(--font-helvetica);
  font-size: 0.72rem;
  gap: 0.5rem;
}

.live-status-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  white-space: nowrap;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-white);
  text-transform: lowercase;
}

.live-clock {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Contador de oyentes de la señal en vivo */
.live-listeners {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-transform: lowercase;
  animation: listenersIn 0.45s ease both;
}

.live-listeners[hidden] {
  display: none;
}

.live-listeners-num {
  display: inline-block;
  color: var(--text-white);
}

.live-listeners-num.is-bump {
  animation: listenersBump 0.5s ease;
}

body.is-archive-mode .live-listeners {
  display: none;
}

@keyframes listenersIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}

@keyframes listenersBump {
  0% { transform: translateY(0); opacity: 1; }
  35% { transform: translateY(-3px); opacity: 0.4; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Botón radioteca integrado con holgura */
.drawer-trigger-btn {
  background: #ffffff;
  border: 1px solid #ffffff;
  color: #111111;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  position: relative;
  z-index: 230;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.drawer-trigger-btn:hover {
  color: #000000;
  border-color: #e2e2e2;
  background: #e9e9e9;
}

.drawer-trigger-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.drawer-trigger-btn:active {
  transform: scale(0.96);
}

.btn-return-live-pill {
  display: none;
  background: #141414;
  border: 1px solid #2e2e2e;
  color: var(--text-white);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  margin-left: auto;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-return-live-pill:hover {
  background: #1a1a1a;
  border-color: var(--media-red);
}

.btn-return-live-pill:active {
  transform: scale(0.96);
}

body.is-archive-mode .btn-return-live-pill {
  display: inline-flex;
}

.radioteca-chip {
  display: inline-block;
  font-size: 0.62rem;
  font-family: var(--font-helvetica);
  background: #ececec;
  color: #111111;
  padding: 0 5px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.live-title-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

.live-title-wrap.has-overflow {
  mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
}

.live-title-track {
  display: inline-block;
  white-space: nowrap;
  font-family: var(--font-helvetica);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin: 0;
  will-change: transform;
}

.live-title-track.is-changing {
  animation: titleSwap 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.live-title-track.is-scrolling {
  animation: liveTitleMarquee var(--scroll-duration, 8s) ease-in-out 1.8s infinite alternate;
}

@keyframes liveTitleMarquee {

  0%,
  20% {
    transform: translateX(0);
  }

  80%,
  100% {
    transform: translateX(var(--scroll-distance, 0px));
  }
}

.live-title {
  font-family: var(--font-helvetica);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.live-title.is-changing {
  animation: titleSwap 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes titleSwap {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* 2. LO PRINCIPAL: LA PLAYLIST (SCROLLEABLE Y CENTRADA) */
.live-tracklist-section {
  flex: 1;
  min-height: 110px;
  max-height: clamp(130px, 22vh, 180px);
  display: flex;
  flex-direction: column;
}

.tracklist-box {
  flex: 1;
  height: 100%;
  border: 1px solid #1a1a1a;
  background: #040404;
  position: relative;
  overflow: hidden;
}

.tracklist-scroll {
  width: 100%;
  height: 100%;
  max-height: 180px;
  overflow-y: auto;
  padding: 0.55rem clamp(0.75rem, 1.6vw, 1.1rem);
  scrollbar-width: thin;
  scrollbar-color: #282828 transparent;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 1) 18%, rgba(0, 0, 0, 1) 82%, rgba(0, 0, 0, 0.18) 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 1) 18%, rgba(0, 0, 0, 1) 82%, rgba(0, 0, 0, 0.18) 100%);
}

.tracklist-scroll:focus-visible {
  outline: 1px solid #444;
}

.tracklist-scroll::-webkit-scrollbar {
  width: 3px;
}

.tracklist-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.tracklist-scroll::-webkit-scrollbar-thumb {
  background: #282828;
}

/* Cada fila distribuida simétricamente: número | canción | artista a la derecha */
.track-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.42rem 0;
  font-size: 0.8rem;
  line-height: 1.25;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.track-row:last-child {
  border-bottom: none;
}

.track-num {
  font-family: var(--font-helvetica);
  font-size: 0.68rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.track-title {
  color: var(--text-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-artist {
  color: var(--text-muted);
  font-size: 0.74rem;
  text-align: right;
  white-space: nowrap;
  padding-left: 0.4rem;
}

/* 3. ABAJO: DESCRIPCIÓN Y QUIÉN LA CURÓ */
.live-meta-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

.live-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
  max-width: 62ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.live-desc:empty {
  display: none;
}

.live-curator {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
}

.live-curator strong {
  color: var(--text-white);
  font-weight: 400;
}

/* 4. ABAJO: LÍNEA DEL TIEMPO Y CONTROLES (PLAY + VOLUMEN) */
.live-playback-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Progreso del programa al aire */
.live-progress {
  width: 100%;
  position: relative;
  touch-action: none;
}

.live-progress-track {
  position: relative;
  height: 2px;
  background: #1c1c1c;
  cursor: default;
  transition: height 0.15s ease, background-color 0.15s ease;
}

/* Área de toque/clic ampliada verticalmente */
.live-progress-track::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  bottom: -12px;
}

body.is-archive-mode .live-progress-track {
  cursor: pointer;
}

body.is-archive-mode .live-progress:hover .live-progress-track,
body.is-archive-mode .live-progress.is-seeking .live-progress-track {
  height: 4px;
  background: #2c2c2c;
}

.live-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--text-white);
  transition: width 0.2s linear;
}

body.is-live-mode .live-progress-fill {
  transition: width 1s linear;
}

.live-progress.is-seeking .live-progress-fill {
  transition: none !important;
}

.live-progress-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--media-red);
  box-shadow: 0 0 6px rgba(255, 43, 28, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body.is-archive-mode .live-progress:hover .live-progress-fill::after,
body.is-archive-mode .live-progress.is-seeking .live-progress-fill::after {
  transform: translateY(-50%) scale(1.35);
  box-shadow: 0 0 10px rgba(255, 43, 28, 0.8);
}

.live-times {
  display: none;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-helvetica);
}

body.is-archive-mode .live-times {
  display: flex;
}

/* Controles de reproducción */
.live-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.play-btn {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--text-white);
  background: transparent;
  color: var(--text-white);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.play-btn:hover {
  background: var(--text-white);
  color: #000;
  transform: scale(1.04);
}

.play-btn:active {
  transform: scale(0.97);
}

.play-icon {
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent currentColor;
  margin-left: 3px;
}

.play-btn.is-playing .play-icon {
  width: 13px;
  height: 13px;
  border: none;
  background: currentColor;
  margin-left: 0;
}

.play-btn.is-loading::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: var(--media-red);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.live-controls-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.live-controls-text strong {
  font-weight: 400;
  font-size: 0.88rem;
}

.live-controls-text span {
  font-size: 0.66rem;
  color: var(--text-muted);
}

.radio-page.has-error .live-controls-text span {
  color: var(--media-red);
}

.volume {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.66rem;
  color: var(--text-muted);
}

.volume input {
  width: 76px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: #333;
}

input[type="range"]::-moz-range-track {
  height: 1px;
  background: #333;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-white);
  margin-top: -4.5px;
  transition: transform 0.15s ease;
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.25);
}

/* =================================================================
   RADIOTECA: DRAWER LATERAL OCULTO A PRIORI
   ================================================================= */
.radioteca-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100vh;
  height: 100dvh;
  background: #080808;
  border-left: 1px solid #1f1f1f;
  z-index: 350;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  /* La sombra viaja con la capa transformada (no se repinta al animar). */
  box-shadow: -14px 0 36px rgba(0, 0, 0, 0.85);
  /* Aísla el cálculo de layout; el repintado de la lista no afecta al resto. */
  contain: layout style;
  /* Se promueve a su propia capa GPU para animar solo con el compositor. */
  will-change: transform;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  backface-visibility: hidden;
}

.radioteca-drawer.is-open {
  transform: translateX(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 340;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

/* El desenfoque es muy costoso de animar en móviles: se limita a pantallas con
   puntero fino y suficiente espacio, donde el compositor lo maneja bien. */
@media (hover: hover) and (pointer: fine) and (min-width: 720px) {
  .drawer-backdrop {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.72);
  }
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  padding: 1.4rem 1.25rem;
  border-bottom: 1px solid #181818;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.drawer-title {
  font-family: var(--font-helvetica);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  margin: 0;
}

.drawer-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.drawer-close-btn {
  background: #111;
  border: 1px solid #262626;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.2s, border-color 0.2s;
}

.drawer-close-btn:hover {
  color: var(--text-white);
  border-color: #555;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem 1rem 5rem;
}

.radioteca-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rt-item {
  border-bottom: 1px solid #141414;
}

.rt-row {
  width: 100%;
  padding: 0.7rem 0.5rem;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 30px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.2s ease;
}

.rt-row:hover,
.rt-row:focus-visible {
  background: #101010;
  outline: none;
}

.rt-play {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #2e2e2e;
  display: grid;
  place-items: center;
  color: var(--text-white);
}

.rt-play .play-icon {
  border-width: 4px 0 4px 7px;
  margin-left: 2px;
}

.rt-item.is-active .rt-play {
  background: var(--media-blue);
  border-color: var(--media-blue);
}

.rt-item-live {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid #202020;
}

.rt-row-live .rt-play {
  border-color: rgba(230, 48, 34, 0.5);
  color: var(--media-red);
}

.rt-item-live.is-active .rt-play {
  background: var(--media-red);
  border-color: var(--media-red);
  color: var(--text-white);
}

.rt-row-live .onair-dot {
  margin-right: 0;
}

.rt-thumb-live {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d0d;
  border: 1px solid #222;
  font-size: 0.85rem;
  color: var(--text-white);
  user-select: none;
}

.rt-dur-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--media-red);
  font-size: 0.68rem;
  font-family: var(--font-helvetica);
  white-space: nowrap;
  margin-left: auto;
}

.rt-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  background: #111;
  filter: grayscale(0.6);
}

.rt-row:hover .rt-thumb,
.rt-item.is-active .rt-thumb {
  filter: none;
}

.rt-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.rt-title {
  font-family: var(--font-helvetica);
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rt-author {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.rt-dur {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-helvetica);
}

/* =================================================================
   ADAPTACIÓN MÓVIL
   ================================================================= */
@media (max-width: 760px) {
  body.radio-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .radio-main {
    margin-top: 64px;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    min-height: 0;
    padding: 0.4rem 1.1rem clamp(64px, 9vh, 76px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* CENTRADA VERTICALMENTE */
    align-items: center;
    box-sizing: border-box;
  }

  .radio-screen {
    height: auto;
    max-height: calc(100dvh - 64px - 76px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(0.55rem, 1.8vh, 0.85rem);
    width: 100%;
  }

  .live-top {
    gap: 0.85rem;
  }

  .visual-placeholder-3d {
    width: 58px;
    height: 58px;
  }

  .visual-logo-etc {
    font-size: 1.5rem;
  }

  .live-title-track {
    font-size: clamp(1.3rem, 5.5vw, 1.65rem);
    line-height: 1.12;
  }

  .live-status-row {
    font-size: 0.7rem;
    gap: 0.5rem;
  }

  .live-status-left {
    gap: 0.55rem;
  }

  /* En móvil el contador baja a su propia línea, debajo del botón radioteca.
     "display: contents" deja que badge/reloj/contador se acomoden en la fila
     principal para poder reordenarlos sin tocar el HTML. */
  .live-status-row {
    flex-wrap: wrap;
    row-gap: 0.3rem;
  }

  .live-status-left {
    display: contents;
  }

  .live-badge { order: 1; }
  .live-clock { order: 2; }

  .live-status-row .drawer-trigger-btn {
    order: 3;
    margin-left: auto;
  }

  .live-listeners {
    order: 4;
    flex-basis: 100%;
    justify-content: flex-end;
    font-size: 0.66rem;
    padding-right: 0.15rem;
  }

  .btn-return-live-pill {
    font-size: 0.68rem;
    padding: 0.28rem 0.55rem;
    margin-left: auto;
  }

  .drawer-trigger-btn {
    padding: 0.3rem 0.65rem;
    font-size: 0.7rem;
    flex-shrink: 0;
  }

  .live-tracklist-section {
    min-height: 120px;
    max-height: clamp(125px, 22vh, 165px);
    flex: none;
  }

  .tracklist-box {
    height: 100%;
  }

  .tracklist-scroll {
    max-height: clamp(125px, 22vh, 165px);
    padding: 0.45rem 0.75rem;
  }

  .track-row {
    grid-template-columns: 1.6rem minmax(0, 1fr) auto;
    font-size: 0.76rem;
    gap: 0.5rem;
    padding: 0.4rem 0;
  }

  .track-artist {
    font-size: 0.68rem;
  }

  .live-meta-section {
    gap: 0.2rem;
  }

  .live-desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.74rem;
    line-height: 1.35;
  }

  .live-curator {
    font-size: 0.75rem;
  }

  .live-playback-section {
    gap: 0.65rem;
    margin-top: 0.25rem;
  }

  .live-controls {
    gap: 0.85rem;
  }

  .play-btn {
    width: 48px;
    height: 48px;
  }

  .live-controls-text strong {
    font-size: 0.86rem;
  }

  .live-controls-text span {
    font-size: 0.68rem;
  }

  .volume {
    display: none;
  }
}