:root {
  color-scheme: dark;
  --bg: #161616;
  --text: #ffffff;
  --muted: #b8b8b8;
  --eyebrow: #a3a3a3;
  --icon-muted: #8e8e8e;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* Fondo: el arte actual con blur, así toma el color de cada carátula. */
.backdrop {
  position: fixed;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  object-fit: cover;
  filter: blur(80px) saturate(1.8);
  opacity: 0.6;
  z-index: -2;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg,
    rgba(16, 16, 16, 0.94) 0%,
    rgba(16, 16, 16, 0.55) 38%,
    rgba(16, 16, 16, 0.65) 70%,
    rgba(16, 16, 16, 0.95) 100%);
}

img:not([src]) { visibility: hidden; }

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1080px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* El header crece con el ancho en desktop; en móvil se queda en 11px / 17px. */
.top {
  min-height: 56px;
  padding-top: clamp(0px, calc(2vw - 8px), 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.eyebrow {
  margin: 0;
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 500;
  letter-spacing: 0.27em;
  color: var(--eyebrow);
}

.header-name {
  max-width: 100%;
  margin: 0.25em 0 0;
  font-size: clamp(17px, 1.9vw, 28px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sin media queries: en móvil se apila, en desktop quedan dos columnas. */
.stage {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 28px 64px;
  padding: 12px 0 4px;
}

.art,
.info {
  flex: 1 1 300px;
  max-width: 460px;
}

.art {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #232323;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.art > img,
.art-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s;
}

.art > img.is-visible,
.art-video.is-visible { opacity: 1; }

/* Sponsor flotante: cubre el arte completo, como en el app. */
.sponsor {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s, visibility 0s 0.6s;
}

.sponsor.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s;
}

.sponsor img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Botones invisibles sobre el arte: sponsor flotante y arte de un comercial con sponsor. */
.sponsor-open,
.art-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.art-open {
  position: absolute;
  inset: 0;
}

.sponsor-open:disabled { cursor: default; }

.sponsor-open:focus-visible,
.art-open:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; }

/* Panel de acciones del sponsor (como el popover del app). js/actions.js lo posiciona. */
.actions {
  position: fixed;
  z-index: 10;
  width: min(260px, calc(100vw - 32px));
  padding: 20px 16px 16px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(64, 58, 66, 0.9);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.actions.has-arrow::before {
  content: '';
  position: absolute;
  top: -10px;
  left: var(--arrow-x, 50%);
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top: 0;
  border-bottom-color: rgba(64, 58, 66, 0.9);
}

.actions-title {
  margin: 0 8px 14px;
  font-size: 17px;
  line-height: 1.3;
}

.actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actions-btn {
  display: block;
  padding: 13px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 17px;
  text-align: center;
  text-decoration: none;
}

.actions-btn:hover { background: rgba(255, 255, 255, 0.2); }
.actions-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.sponsor-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sponsor-close svg {
  fill: rgba(0, 0, 0, 0.65);
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
}

.sponsor-close:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; }

.info {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Nombre de la emisora sobre el título: solo se ve en la barra compacta. */
.now-station { display: none; }

.title {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 700;
  line-height: 1.2;
}

.subtitle {
  margin: 6px 0 0;
  font-size: clamp(17px, 1.7vw, 22px);
  line-height: 1.3;
  color: var(--muted);
}

.transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn svg { fill: currentColor; }
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

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

.btn-play .icon-pause,
.btn-play.is-playing .icon-play { display: none; }
.btn-play.is-playing .icon-pause { display: block; }

.volume {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--icon-muted);
}

.volume svg { flex: none; }

.volume input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  margin: 0;
  accent-color: #d0d0d0;
  cursor: pointer;
}

/* Barra compacta: el player en un iframe bajito, como la barra de 80 px al fondo de
   azrockradio.com. Arte chico, emisora/título/artista y controles en una fila. */
@media (max-height: 160px) {
  body { overflow: hidden; }
  .scrim { background: rgba(16, 16, 16, 0.6); }

  .shell {
    min-height: 0;
    height: 100vh;
    max-width: none;
    padding: 8px 16px;
    flex-direction: row;
    align-items: center;
  }

  /* El header no cabe y el sponsor sería ilegible a este tamaño. */
  .top,
  .sponsor { display: none; }

  .stage {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 0;
  }

  .art {
    flex: none;
    height: calc(100vh - 16px);
    max-width: none;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  }

  .info {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

  /* Textos y volumen se reparten el ancho por igual, así los controles quedan al centro. */
  .now {
    flex: 1 1 0;
    min-width: 0;
  }

  .now-station,
  .title,
  .subtitle {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .now-station {
    margin: 0 0 2px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--eyebrow);
  }

  .title { font-size: 15px; line-height: 1.25; }
  .subtitle { margin-top: 2px; font-size: 13px; }

  .transport { flex: none; gap: 4px; }
  .transport .btn svg { width: 26px; height: 26px; }
  .btn-play { width: 52px; height: 52px; }
  .transport .btn-play svg { width: 34px; height: 34px; }

  .volume {
    flex: 1 1 0;
    justify-content: flex-end;
  }

  .volume input { flex: 0 1 140px; }
}

/* En una barra angosta (celular) solo quedan arte, textos y controles. */
@media (max-height: 160px) and (max-width: 720px) {
  .volume { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .art > img,
  .art-video,
  .sponsor,
  .sponsor.is-visible { transition: none; }
}
