:root {
  --accent: #E42528;
  --accent-glow: rgba(228, 37, 40, 0.35);
  --accent-soft: rgba(228, 37, 40, 0.15);
  --bg: #0a0b10;
  --bg-2: #14151c;
  --bg-3: #1e1f28;
  --text: #ffffff;
  --text-dim: rgba(255,255,255,0.65);
  --text-faint: rgba(255,255,255,0.4);
  --border: rgba(255,255,255,0.08);
  --font: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  -webkit-tap-highlight-color: transparent; 
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  overflow-x: hidden;
  overflow-y: auto;
}

.hidden { display: none !important; }

/* ================= APP SHELL ================= */
#app {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-inner {
  position: relative;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: transparent;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.app-inner.is-loaded { opacity: 1; }

/* ================= BACKGROUND ================= */
.bg-layer {
  position: fixed;
  inset: -60px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(50px) saturate(1.25);
  opacity: 0.5;
  transform: scale(1.15);
  transition: background-image 0.6s ease, opacity 0.6s ease;
  z-index: 0;
  pointer-events: none;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(10,11,16,0.55) 0%,
    rgba(10,11,16,0.78) 45%,
    rgba(10,11,16,0.95) 100%);
  z-index: 1;
  pointer-events: none;
}

/* ================= TOP BAR ================= */
.top-bar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(12px, 2.5vw, 20px) clamp(14px, 3vw, 28px);
  padding-top: calc(clamp(12px, 2.5vw, 20px) + env(safe-area-inset-top));
  gap: 10px;
}
.top-bar-left,
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
}
.top-bar-right { justify-content: flex-end; }
.top-bar-center {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn {
  width: clamp(42px, 5vw, 46px);
  height: clamp(42px, 5vw, 46px);
  border: none;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}
.icon-btn:hover { background: rgba(255,255,255,0.15); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 55%; height: 55%; }

.top-logo {
  height: clamp(42px, 8vh, 72px);
  max-width: min(60vw, 260px);
  object-fit: contain;
  opacity: 1;
  margin-top: clamp(4px, 1vh, 10px);
}

/* ================= LAYOUT ================= */
.content-grid {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(8px, 1.5vh, 16px);
  padding: clamp(4px, 1vh, 10px) clamp(12px, 2.5vw, 24px) clamp(6px, 1vh, 14px);
  flex: 1;
}

@media (min-width: 900px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    justify-items: center;
  }
  .player-col { position: static; }
}

/* ================= PLAYER ================= */
.player-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  width: 100%;
  padding-top: clamp(4px, 1vh, 10px);
  padding-bottom: clamp(4px, 1vh, 10px);
  gap: clamp(2px, 0.5vh, 6px);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 18px;
  background: #e42528;
  color: #fff;
  font-size: clamp(9px, 1.8vw, 10px);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: clamp(4px, 1vw, 8px);
  margin-bottom: clamp(8px, 1.6vw, 12px);
  box-shadow: 0 3px 14px var(--accent-glow);
  opacity: 0.92;
}
.live-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.cover-wrap {
  width: min(65vw, 28vh, 300px);
  max-width: 80vw;
  aspect-ratio: 1;
  border-radius: clamp(18px, 3vw, 26px);
  overflow: hidden;
  background: var(--bg-3);
  box-shadow: 
    0 25px 60px rgba(0,0,0,0.55),
    0 0 0 1px rgba(255,255,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 0 40px rgba(255,255,255,0.04);
  position: relative;
  margin-bottom: clamp(10px, 2vw, 14px);
  transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}
.cover-wrap:hover {
  box-shadow: 
    0 30px 70px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.14),
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 0 60px rgba(255,255,255,0.09);
}
.cover-wrap.is-fading { opacity: 0; transform: scale(0.97); }

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
}

.cover-itunes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 2;
  pointer-events: none;
}
.cover-itunes.active { opacity: 1; }

.program-title,
.program-hosts {
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.program-title.is-fading,
.program-hosts.is-fading {
  opacity: 0;
  transform: translateY(8px);
}
.bg-layer { transition: opacity 0.5s ease, background-image 0s; }
.bg-layer.is-fading { opacity: 0; }

.program-title {
  font-size: clamp(14px, 3vw, 20px);
  font-weight: 700;
  text-align: center;
  margin-bottom: 0;
  line-height: 1.05;
  letter-spacing: -0.01em;
  width: 100%;
  max-width: min(360px, 80vw);
  margin-left: auto;
  margin-right: auto;
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.program-hosts {
  font-size: clamp(10px, 2vw, 12px);
  font-weight: 400;
  color: var(--text-dim);
  text-align: center;
  margin-top: 1px;
  margin-bottom: clamp(6px, 1.2vw, 10px);
  line-height: 1.1;
  width: 100%;
  max-width: min(360px, 80vw);
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-sep {
  width: min(60%, 240px);
  height: 1px;
  background: linear-gradient(90deg, 
    rgba(255,255,255,0) 0%, 
    rgba(255,255,255,0.14) 50%, 
    rgba(255,255,255,0) 100%);
  margin: clamp(4px, 1vw, 8px) auto clamp(10px, 2vw, 14px);
}

.social-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: auto;
  padding-top: clamp(24px, 6vw, 40px);
  flex-wrap: wrap;
}
.social-row:empty { display: none; }
.social-link {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  color: rgba(255,255,255,0.7);
  transition: all 0.2s;
  text-decoration: none;
}
.social-link:hover { background: var(--accent); color: white; transform: translateY(-2px); }
.social-link svg { width: 16px; height: 16px; }

.rds-ticker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: clamp(11px, 2.3vw, 13px);
  color: var(--text);
  margin-bottom: clamp(10px, 2vw, 16px);
  width: 100%;
  max-width: 340px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rds-ticker svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--accent);
}
.rds-ticker-text { 
  overflow: hidden; 
  text-overflow: ellipsis; 
  white-space: nowrap;
  width: 100%;
}

/* ================= CONTROLS ROW ================= */
/* FIX: Contenedores laterales de tamaño fijo para que los iconos no se desplacen nunca */
.controls-row {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 380px;
  padding: clamp(18px, 4vw, 30px) 0 clamp(12px, 2vw, 18px);
  gap: 20px;
  margin-top: clamp(10px, 3vw, 24px);
}

.volume-wrap {
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vol-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vol-icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  display: flex;
  border-radius: 50%;
  transition: background 0.18s, color 0.18s;
}
.vol-icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.vol-icon-btn svg { width: 24px; height: 24px; }
.vol-icon-btn.is-muted { color: var(--accent); }

.vol-slider-popup {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 0;
  background: rgba(20,20,24,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: height 0.25s ease, opacity 0.2s ease;
  z-index: 20;
}
.vol-slider-popup::after {
  content: '';
  position: absolute;
  left: -8px;
  right: -8px;
  bottom: -10px;
  height: 12px;
  background: transparent;
}
.vol-wrap:hover .vol-slider-popup,
.vol-wrap:focus-within .vol-slider-popup {
  height: 120px;
  opacity: 1;
  pointer-events: auto;
  padding: 10px 0;
}

input[type="range"].vol-slider {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: bt-lr;
  width: 4px;
  height: 100%;
  background: rgba(255,255,255,0.18);
  border-radius: 3px;
  outline: none;
  margin: 0;
  accent-color: var(--accent);
}
input[type="range"].vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

@keyframes btn-play-ripple {
  0%   { box-shadow: 0 10px 30px var(--accent-glow), 0 0 0 0 var(--accent-glow); }
  70%  { box-shadow: 0 10px 30px var(--accent-glow), 0 0 0 18px var(--accent-soft); }
  100% { box-shadow: 0 10px 30px var(--accent-glow), 0 0 0 0 rgba(0,0,0,0); }
}

.btn-play-main {
  position: relative;
  width: clamp(52px, min(9vw, 9vh), 72px);
  height: clamp(52px, min(9vw, 9vh), 72px);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, rgba(0,0,0,0.35) 160%);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 10px 30px var(--accent-glow),
    inset 0 2px 8px rgba(255,255,255,0.18),
    inset 0 -6px 14px rgba(0,0,0,0.25);
  transition: transform 0.18s cubic-bezier(0.2,0.8,0.2,1), box-shadow 0.25s;
  flex-shrink: 0;
  overflow: visible;
}
.btn-play-main:hover { transform: scale(1.08); }
.btn-play-main:active { transform: scale(0.95); }
.btn-play-main.is-playing { animation: btn-play-ripple 2s ease-out infinite; }
.btn-play-main svg {
  width: 40%;
  height: 40%;
  fill: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2,0.8,0.2,1);
}
.btn-play-main svg.hidden {
  display: block !important;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6) rotate(-20deg);
  pointer-events: none;
}

.right-action {
  flex: 0 0 54px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* ================= SCHEDULE / PROGRAM MODAL ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  position: fixed;
  left: 50%;
  top: 0;
  transform: translate(-50%, -100%);
  width: 100%;
  max-width: 520px;
  height: 85vh;
  height: 85dvh;
  background: var(--bg-2);
  border-radius: 0 0 24px 24px;
  z-index: 101;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-top: env(safe-area-inset-top);
  overflow: hidden;
}
.modal.open { transform: translate(-50%, 0); }

.modal-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  margin: 10px auto 4px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 10px;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close svg { width: 16px; height: 16px; }

.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
}
.date-nav-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.day-pills {
  display: flex;
  gap: 6px;
  padding: 4px 20px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.day-pill {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.day-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.program-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 20px;
}

/* Scroll Estilizado y Limpio */
.custom-scroll::-webkit-scrollbar {
  width: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}
.custom-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  transition: background 0.2s;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.program-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.02);
}
.program-card:hover { background: rgba(255,255,255,0.05); }
.program-card.is-current {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}
.program-thumb {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: var(--bg-3);
  object-fit: cover;
  flex-shrink: 0;
  overflow: hidden;
}
.program-thumb img { width: 100%; height: 100%; object-fit: cover; }
.program-meta { flex: 1; min-width: 0; }
.program-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.program-hosts-small {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.program-time {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 3px;
}
.program-now-chip {
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.program-empty {
  padding: 30px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
}

@media (min-width: 900px) {
  .modal {
    max-width: 480px;
    top: 40px;
    transform: translate(-50%, calc(-100% - 80px));
    border-radius: 24px;
    max-height: 80vh;
  }
  .modal.open { transform: translate(-50%, 0); }
}

/* ================= MENÚ CONTEXTUAL (CLIC DERECHO) ================= */
.ctx {
  position: fixed;
  z-index: 9999;
  background: rgba(20, 21, 28, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 6px;
  min-width: 215px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
  display: none;
}
.ctx.open {
  display: block;
}
.ctx a {
  display: block;
  white-space: nowrap;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim, #a8a8b4);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.ctx a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #fff);
}


/* ================= RDS TICKER (MARQUEE CORREGIDO) ================= */
.rds-ticker {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: clamp(11px, 2.3vw, 13px);
  color: var(--text);
  margin-bottom: clamp(10px, 2vw, 16px);
  width: 230px;       
  max-width: 90vw;    
  overflow: hidden; 
  position: relative;
}

.rds-ticker-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  overflow: hidden; 
  position: relative;
}

.rds-ticker svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--accent);
  z-index: 2;
}

.rds-ticker-text { 
  display: inline-block;
  white-space: nowrap;
}


.rds-ticker-text.is-marquee {
  padding-left: 100%;
  animation: rds-marquee 12s linear infinite;
}

@keyframes rds-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}



.history-youtube-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  color: var(--text-dim, rgba(255, 255, 255, 0.65));
  text-decoration: none;
  flex-shrink: 0;
  margin-left: 8px;
  transition: all 0.2s ease;
}

.history-youtube-btn:hover {
  background: #ff0000; 
  color: #ffffff;
  transform: scale(1.08);
}

.history-youtube-btn svg {
  width: 18px;
  height: 18px;
}



/* ================= ESTADOS DEL LIVE BADGE ================= */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 18px;
  background: #e42528;
  color: #fff;
  font-size: clamp(9px, 1.8vw, 10px);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: clamp(4px, 1vw, 8px);
  margin-bottom: clamp(8px, 1.6vw, 12px);
  box-shadow: 0 3px 14px var(--accent-glow);
  opacity: 0.92;
}


.live-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-dot 1.6s ease-in-out infinite;
}


.live-badge.is-paused {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  box-shadow: none;
}
.live-badge.is-paused::before {
  background: var(--text-dim);
  animation: none; 
}


.live-badge.is-offline {
  background: #1e1f28;
  color: #ff5c5c;
  box-shadow: 0 3px 14px rgba(255, 92, 92, 0.15);
}
.live-badge.is-offline::before {
  background: #ff5c5c;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}



.live-badge.is-offline-stream {
  background: rgba(228, 37, 40, 0.15); 
  border: 1px solid #E42528;          
  color: #ff8082;
  box-shadow: 0 3px 14px rgba(228, 37, 40, 0.25);
}
.live-badge.is-offline-stream::before {
  background: #E42528;
  animation: none;
}
