:root {
  --bg: #000;
  --panel: #001942;
  --panel-soft: #07152d;
  --text: #fff;
  --muted: #aab4c5;
  --line: rgba(255,255,255,.12);
  --ok: #27d95a;
  --bad: #ff4b4b;
  --accent: #66ccff;
  --row-h: 28px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 20px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
}

button, audio { font-family: inherit; }
button { cursor: pointer; }

.site-header {
  width: 100%;
  max-width: 920px;
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.site-logo {
  width: min(240px, 60vw);
  height: auto;
}

.app-shell {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.players {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
}

.player-card {
  width: min(100%, 280px);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 14px;
  position: relative;
  box-shadow: 0 14px 34px rgba(0,0,0,.24);
}

.player-head {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #ffee99;
  font-size: .72rem;
  letter-spacing: .08em;
  font-weight: 700;
}

.player-head h2 {
  margin: 0;
  font-size: .95rem;
  line-height: 1.25;
  font-weight: 600;
}

.stream-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: .68rem;
  white-space: nowrap;
}

.stream-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.stream-status.online { background: rgba(0,77,0,.85); color: #aaffaa; }
.stream-status.online span { background: var(--ok); box-shadow: 0 0 8px rgba(39,217,90,.6); }
.stream-status.offline { background: rgba(77,0,0,.85); color: #ffaaaa; }
.stream-status.offline span { background: var(--bad); box-shadow: 0 0 8px rgba(255,75,75,.55); }

.cover-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 240px;
  overflow: hidden;
  border-radius: 8px;
  background: #050914;
  margin-bottom: 10px;
}

.cover-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: grayscale(1) blur(2px);
  opacity: .62;
  transition: filter .45s ease, opacity .45s ease;
}

.player-card.is-playing .cover-art {
  filter: none;
  opacity: 1;
}

.cover-source {
  position: absolute;
  right: 6px;
  bottom: 5px;
  background: rgba(0,0,0,.54);
  color: #fff;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  pointer-events: none;
}

.led-meter {
  position: absolute;
  left: 6px;
  bottom: 6px;
  height: 18px;
  display: flex;
  gap: 4px;
  visibility: hidden;
  align-items: flex-end;
}

.player-card.is-playing .led-meter { visibility: visible; }

.led-meter i {
  display: block;
  width: 4px;
  height: 4px;
  background: var(--ok);
  border-radius: 2px;
  animation: ledPulse 1s infinite ease-in-out;
}
.led-meter i:nth-child(2) { animation-delay: .15s; }
.led-meter i:nth-child(3) { animation-delay: .3s; }
.led-meter i:nth-child(4) { animation-delay: .45s; }
.led-meter i:nth-child(5) { animation-delay: .6s; }

@keyframes ledPulse {
  0%, 100% { height: 4px; }
  50% { height: 18px; }
}

.roller {
  width: 100%;
  height: 26px;
  overflow: hidden;
  background: #0A021F;
  color: #E6E1F2;
  font-size: 13px;
  line-height: 26px;
  white-space: nowrap;
  padding: 0 8px;
  margin-bottom: 10px;
}

.roller-track {
  display: inline-flex;
  animation: scrollLoop 30s linear infinite;
  will-change: transform;
}
.roller-track span { padding-right: 50px; }
@keyframes scrollLoop { to { transform: translateX(-50%); } }

.track-meta {
  font-size: .85rem;
  line-height: 1.35;
  margin-bottom: 12px;
}
.track-meta p { margin: 4px 0; }
.track-meta strong { color: #dce8ff; }

audio { display: none; }

/* ===== V70.4 amber compact player A02 ===== */
.amber-player {
  --amber: #ffb000;
  --amber-dim: rgba(255,176,0,.58);
  width: 100%;
  min-height: 34px;
  margin-top: 7px;
  padding: 3px 6px;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
  background: #090600;
  border: 1px solid rgba(255,176,0,.35);
  border-radius: 7px;
  box-shadow: inset 0 0 12px rgba(255,176,0,.07), 0 0 8px rgba(255,176,0,.06);
  color: var(--amber);
  font-family: 'Courier New', ui-monospace, monospace;
}

.amber-control {
  min-width: 38px;
  height: 25px;
  padding: 0 6px;
  border: 1px solid rgba(255,176,0,.38);
  border-radius: 5px;
  background: rgba(255,176,0,.06);
  color: var(--amber);
  font: 700 .80rem/1 'Courier New', ui-monospace, monospace;
  text-shadow: 0 0 7px rgba(255,176,0,.72);
  box-shadow: inset 0 0 7px rgba(255,176,0,.05);
}
.amber-control:hover,
.amber-control:focus-visible {
  background: rgba(255,176,0,.13);
  border-color: rgba(255,176,0,.72);
  outline: none;
}
.amber-control:active { transform: translateY(1px); }

.amber-time {
  display: block;
  text-align: center;
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: .11em;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255,176,0,.72);
}

.player-card:not(.is-playing) .amber-player {
  color: var(--amber-dim);
  border-color: rgba(255,176,0,.2);
  box-shadow: inset 0 0 10px rgba(255,176,0,.035);
}
.player-card:not(.is-playing) .amber-control,
.player-card:not(.is-playing) .amber-time {
  color: var(--amber-dim);
  text-shadow: 0 0 5px rgba(255,176,0,.28);
}

.info-panel {
  width: 100%;
  max-width: 900px;
  border-top: 1px solid #222;
  padding: 18px 10px 0;
  text-align: center;
  color: #ccc;
}
.info-panel p { margin: 6px 0; }
#slogan-fixed { color: #aaa; }

.floating-btn {
  position: fixed;
  right: 0;
  top: 42%;
  z-index: 900;
  border: 0;
  border-radius: 8px 0 0 8px;
  background: #00c853;
  color: #fff;
  padding: 10px 14px;
  font-size: .9rem;
}

#schedule-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 360px;
  max-width: 90%;
  height: 100vh;
  padding: 20px;
  z-index: 1000;
  background: #001020;
  color: #fff;
  box-shadow: -4px 0 12px rgba(0,0,0,.6);
  transition: right .35s ease;
  overflow-y: auto;
}
#schedule-panel.open { right: 0; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
#close-schedule {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.5rem;
}

.clock-line { color: #cfe3ff; font-size: .88rem; }
.roller-header,
.roll-item {
  display: grid;
  grid-template-columns: 70px 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.roller-header {
  background: #223;
  color: #fff;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 10px 10px 0 0;
}
.schedule-roller {
  height: calc(var(--row-h) * 10);
  overflow: hidden;
  background: #1b2e4a;
  border-radius: 0 0 10px 10px;
}
.roll-track { animation: rollY 18s linear infinite; }
.roll-item {
  height: var(--row-h);
  padding: 0 10px;
  border-bottom: 1px solid #223;
  font-size: .82rem;
  white-space: nowrap;
}
.roll-item span { overflow: hidden; text-overflow: ellipsis; }
.roll-item.current {
  background: #004d00;
  color: #aaffaa;
  font-weight: 700;
  border-left: 4px solid #00ff88;
}
@keyframes rollY { to { transform: translateY(-50%); } }

#cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: #1b2e4a;
  color: #fff;
  text-align: center;
  padding: 12px 10px;
  font-size: 14px;
}
#cookie-banner button {
  margin-left: 10px;
  background: #0f0;
  color: #000;
  border: 0;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
}

@media (max-width: 640px) {
  body { padding: 16px; }
  .players { gap: 22px; }
  .player-card { width: 100%; }
  .site-logo { width: min(190px, 62vw); }
}

/* === V70.1 stability states === */
.stream-status.degraded {
  background: rgba(95, 79, 12, 0.92);
  color: #ffe8a3;
}

.stream-status.degraded span {
  background: #f4c542;
  box-shadow: 0 0 8px rgba(244, 197, 66, 0.7);
}

/* ===== V70.3 fixed four-line LED metadata rollers A05 ===== */
.led-display {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 86px;
  margin-bottom: 7px;
  padding: 5px 10px;
  overflow: hidden;
  border: 1px solid rgba(23, 113, 181, 0.48);
  border-radius: 6px;
  background-color: #a9eaff;
  background-image: radial-gradient(circle, rgba(0, 74, 145, 0.16) 0 1px, transparent 1.25px);
  background-size: 4px 4px;
  box-shadow:
    inset 0 0 13px rgba(0, 73, 125, 0.22),
    inset 0 0 4px rgba(255, 255, 255, 0.72),
    0 0 8px rgba(91, 207, 255, 0.12);
}

.led-display::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.32), transparent 24%, transparent 78%, rgba(0,66,122,0.10)),
    repeating-linear-gradient(180deg, transparent 0 2px, rgba(0,55,108,0.07) 2px 3px);
}

.led-display-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  column-gap: 5px;
  height: 18px;
  overflow: hidden;
  font-family: "Courier New", "DejaVu Sans Mono", monospace;
  font-size: 12px;
  line-height: 18px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  text-shadow:
    0 0 1px rgba(0, 62, 134, 0.95),
    0 0 4px rgba(0, 91, 190, 0.34);
}

.led-icon {
  display: block;
  width: 22px;
  overflow: hidden;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  text-shadow: none;
  filter: saturate(0.82) contrast(1.04);
}

.led-label { display: none; }

.led-value {
  display: block;
  min-width: 0;
  height: 18px;
  overflow: hidden;
  color: #004a9f;
  font-weight: 700;
  white-space: nowrap;
}

.led-scroll-track {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-width: 100%;
  height: 18px;
  will-change: transform;
}

.led-scroll-copy {
  flex: 0 0 auto;
  white-space: nowrap;
}

.led-scroll-track.is-scrolling {
  animation: ledMetadataRoll var(--led-roll-duration, 12s) linear infinite;
}

.led-scroll-track.is-scrolling .led-scroll-copy {
  padding-right: 42px;
}

@keyframes ledMetadataRoll {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-1 * var(--led-roll-distance, 0px))); }
}

.led-display.is-degraded .led-value {
  color: #376f9f;
  opacity: 0.82;
}

@media (prefers-reduced-motion: reduce) {
  .led-scroll-track.is-scrolling { animation: none; }
}

@media (max-width: 600px) {
  .led-display {
    height: 78px;
    padding: 4px 8px;
  }
  .led-display-row {
    grid-template-columns: 20px minmax(0, 1fr);
    column-gap: 4px;
    height: 16.5px;
    font-size: 10.2px;
    line-height: 16.5px;
    letter-spacing: 0.025em;
  }
  .led-icon {
    width: 20px;
    font-size: 12.5px;
    line-height: 16.5px;
  }
  .led-value,
  .led-scroll-track { height: 16.5px; }
}



/* ===== V70.2 compact cover status refinement ===== */
/* El nombre del programa ya vive dentro del display de cuatro líneas. */
.player-head {
  display: none !important;
}

/* Estado de la señal sobre el origen de la carátula. */
.cover-frame .stream-status {
  position: absolute;
  right: 6px;
  bottom: 27px;
  z-index: 4;
  pointer-events: none;
  background: rgba(0, 77, 0, 0.78);
  backdrop-filter: blur(2px);
}

.cover-frame .stream-status.offline {
  background: rgba(77, 0, 0, 0.78);
}

.cover-frame .stream-status.degraded {
  background: rgba(95, 79, 12, 0.82);
}

/* El LED de la señal inactiva queda tenue y sin halo; al reproducir recupera brillo. */
.player-card:not(.is-playing) .stream-status > span {
  opacity: 0.28;
  box-shadow: none !important;
}

.player-card.is-playing .stream-status > span {
  opacity: 1;
}

/* ===== V70.2 inactive LED display attenuation ===== */
.led-display {
  transition: opacity 0.28s ease, filter 0.28s ease, box-shadow 0.28s ease;
}

.player-card:not(.is-playing) .led-display {
  opacity: 0.42;
  filter: saturate(0.48) brightness(0.72);
  box-shadow:
    inset 0 0 10px rgba(0, 73, 125, 0.12),
    inset 0 0 3px rgba(255, 255, 255, 0.35);
}

.player-card.is-playing .led-display {
  opacity: 1;
  filter: none;
}

/* ===== V70.3 real audio level meter TEST A01 ===== */
.led-meter {
  z-index: 4;
  height: 18px;
  gap: 2px;
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(0, 8, 12, 0.68);
  box-shadow: inset 0 0 0 1px rgba(104, 233, 255, 0.10);
}

.led-meter i {
  width: 3px;
  height: 12px;
  border-radius: 1px;
  animation: none !important;
  background: rgba(31, 133, 145, 0.20);
  box-shadow: none;
  transition: background-color 45ms linear, opacity 45ms linear, box-shadow 45ms linear;
  opacity: 0.52;
}

.led-meter i.is-lit,
.led-meter i.is-peak {
  opacity: 1;
  background: #24e6f2;
  box-shadow: 0 0 5px rgba(36, 230, 242, 0.78);
}

.led-meter i:nth-child(n+8).is-lit,
.led-meter i:nth-child(n+8).is-peak {
  background: #ffd84a;
  box-shadow: 0 0 5px rgba(255, 216, 74, 0.78);
}

.led-meter i:nth-child(n+11).is-lit,
.led-meter i:nth-child(n+11).is-peak {
  background: #ff5b57;
  box-shadow: 0 0 6px rgba(255, 91, 87, 0.82);
}

.led-meter.is-unavailable {
  display: none !important;
}


/* ===== V70.4 status + schedule display refinement A04 ===== */
.stream-status.standby {
  background: rgba(104, 72, 0, 0.88);
  color: #ffe29a;
}
.stream-status.standby span {
  background: #ffc400;
  box-shadow: 0 0 8px rgba(255, 196, 0, 0.72);
}
.cover-frame .stream-status.standby {
  background: rgba(104, 72, 0, 0.82);
}

#schedule-panel {
  right: -480px;
  width: 440px;
  max-width: 96vw;
  padding: 18px;
  background: linear-gradient(180deg, #001426 0%, #000b16 100%);
  border-left: 1px solid rgba(102, 204, 255, 0.18);
}

.panel-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.clock-line {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  color: #d7ebff;
  font-size: .8rem;
}
.clock-line strong { color: #72d5ff; }

.roller-header,
.roll-item {
  grid-template-columns: 66px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.roller-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 10px;
  background: #182b45;
  border-radius: 8px 8px 0 0;
  font-size: .8rem;
  letter-spacing: .02em;
}

.schedule-roller {
  height: auto;
  max-height: calc(100vh - 145px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #0d2038;
  border: 1px solid rgba(255,255,255,.08);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: #2b5b80 #0d2038;
}

.schedule-list { display: block; }

.roll-item {
  min-height: 46px;
  height: auto;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: .78rem;
  line-height: 1.25;
  white-space: normal;
}
.roll-item:nth-child(even) { background: rgba(255,255,255,.025); }
.roll-item:last-child { border-bottom: 0; }
.roll-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-program {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.schedule-time {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  color: #bcd9f2;
}
.schedule-time small {
  padding: 1px 4px;
  border-radius: 3px;
  background: #00a64d;
  color: #fff;
  font-size: .55rem;
  letter-spacing: .05em;
}
.roll-item.current {
  background: linear-gradient(90deg, rgba(0, 113, 52, .82), rgba(0, 75, 42, .72));
  color: #eaffef;
  border-left: 4px solid #19ef82;
  box-shadow: inset 0 0 14px rgba(0, 255, 136, .08);
}
.roll-item.current .schedule-time { color: #cffff0; }
.roll-track { animation: none; }

@media (max-width: 520px) {
  #schedule-panel {
    width: 100vw;
    max-width: 100vw;
    right: -100vw;
    padding: 14px 10px;
  }
  .roller-header,
  .roll-item {
    grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }
  .roll-item { padding: 7px 7px; font-size: .72rem; }
}

/* v70.4 A05 — pie editorial + servicio local */
.info-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.info-panel p { margin: 0; }
.station-line {
  max-width: 100%;
  color: #cfcfcf;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#slogan-fixed {
  color: #aaa;
  font-weight: 500;
}
#slogan-rotator {
  color: #e3e3e3;
  transition: opacity .25s ease;
}
.local-service-line {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 22px;
  color: #8f9eaa;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.local-service-line .service-separator { color: #46515a; }
.local-service-line.has-weather-alert #local-weather {
  color: #ffd166;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 209, 102, .3);
  animation: weather-alert-pulse 1.8s ease-in-out infinite;
}
@keyframes weather-alert-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .72; }
}
@media (max-width: 620px) {
  .station-line {
    white-space: normal;
    line-height: 1.35;
  }
  .local-service-line {
    gap: 5px;
    font-size: .76rem;
  }
}
