/*
 * En Onda: estilos.
 * Compatibles con Safari 12: sin "gap" en flex, sin aspect-ratio,
 * sin backdrop-filter.
 *
 * Diseño «Radio clásica»: azul noche y dorado, con mucho contraste.
 *
 * Modo claro por defecto (el iPad con iOS 12 no tiene modo oscuro y
 * siempre lo verá así). Al final está el modo oscuro, que solo se aplica
 * si el aparato lo tiene activado (iPhone con iOS 13 o posterior).
 */

* {
  box-sizing: border-box;
}

/* Que "hidden" gane siempre, aunque la clase diga otra cosa. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #eef1f6;
  color: #14213d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 22px;
  line-height: 1.4;
}

.pagina {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 8px;
}

.marca {
  margin: 8px 0 24px;
  font-size: 36px;
  font-weight: 800;
  color: #14213d;
}

/* Raya dorada bajo el nombre */
.marca::after {
  content: "";
  display: block;
  width: 64px;
  height: 6px;
  margin-top: 8px;
  border-radius: 3px;
  background: #f5b82e;
}

.tarjeta {
  background: #fff;
  border-radius: 24px;
  padding: 24px 24px 28px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

/* La tarjeta del reproductor va en azul noche */
.reproductor {
  border-radius: 28px;
  background: #14213d;
  color: #fff;
  box-shadow: 0 14px 30px rgba(20, 33, 61, 0.28);
}

.reproductor .etiqueta {
  color: #f5c955;
}

.etiqueta {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a5468;
}

.emisora {
  margin: 2px 0 0;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
}

.boton {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  width: 100%;
  min-height: 96px;
  margin: 0;
  padding: 16px 24px;
  border: 0;
  border-radius: 22px;
  background: #f5b82e;
  color: #14213d;
  font-family: inherit;
  font-size: 30px;
  font-weight: 700;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.boton:active {
  background: #e0a51c;
}

.boton:focus {
  outline: 4px solid #8ab8ff;
  outline-offset: 4px;
}

.boton-activo {
  background: #f5b82e;
}

.boton-activo:active {
  background: #e0a51c;
}

/* Iconos dibujados con bordes: no dependen de fuentes ni imágenes. */
.icono {
  display: inline-block;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  margin-right: 16px;
}

.icono-play {
  width: 0;
  height: 0;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 30px solid #14213d;
}

.icono-pausa {
  width: 30px;
  height: 36px;
  border-left: 10px solid #14213d;
  border-right: 10px solid #14213d;
}

/* «Ahora suena» */
.ahora {
  margin: 20px 0 24px;
  padding: 18px 20px 20px;
  border-radius: 18px;
  border-left: 6px solid #f5b82e;
  background: #1f3058;
}

.ahora-titulo {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.ahora-horario {
  margin: 6px 0 0;
  font-size: 22px;
  color: #dfe6f3;
}

.progreso {
  height: 12px;
  margin: 12px 0 0;
  border-radius: 6px;
  background: #34477a;
  overflow: hidden;
}

.progreso-barra {
  width: 0;
  height: 100%;
  border-radius: 6px;
  background: #f5b82e;
}

.ahora-descripcion {
  margin: 12px 0 0;
  font-size: 20px;
  color: #dfe6f3;
}

.despues {
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 2px solid #34477a;
  font-size: 20px;
  color: #dfe6f3;
}

.despues strong {
  color: #fff;
}

.estado {
  min-height: 2.8em;
  margin: 20px 0 0;
  text-align: center;
  font-size: 22px;
  color: #fff;
}

.estado-error {
  font-weight: 700;
  color: #ff9b94;
}

.pie {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 20px 40px;
  font-size: 18px;
  color: #4a5468;
}

.pie p {
  margin: 0 0 6px;
}

.pie a {
  color: #1d4ed8;
}

/* ---------- Reproductor ---------- */

.cabecera-emisora {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 24px;
}

.cabecera-texto {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
}

/* Logo con la inicial detrás por si la imagen no carga. */
.logo {
  position: relative;
  display: inline-block;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 50%;
  background: #e3e8f2;
  color: #14213d;
  font-size: 30px;
  font-weight: 800;
  line-height: 64px;
  text-align: center;
}

.logo img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.logo-grande {
  width: 88px;
  height: 88px;
  margin-right: 20px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #f5b82e;
  font-size: 42px;
  line-height: 88px;
}

.boton-secundario {
  display: block;
  width: 100%;
  min-height: 64px;
  margin: 12px 0 0;
  padding: 12px 20px;
  border: 2px solid #34477a;
  border-radius: 18px;
  background: #1f3058;
  color: #fff;
  font-family: inherit;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.boton-secundario:active {
  background: #2a3d6b;
}

.boton-secundario:focus,
.boton-volver:focus,
.boton-favorita:focus,
.fila-elegir:focus,
.fila-estrella:focus,
.grupo-cabecera:focus {
  outline: 4px solid #1f5fbf;
  outline-offset: 2px;
}

/* En la tarjeta azul, el borde de foco se ve mejor en azul claro */
.boton-secundario:focus {
  outline-color: #8ab8ff;
}

/* La estrella grande está en la tarjeta azul */
.estrella {
  margin-right: 10px;
  font-size: 28px;
  color: #dfe6f3;
}

.estrella-marcada {
  color: #f5b82e;
}

/* ---------- Secciones ---------- */

.seccion {
  margin-top: 36px;
}

.titulo-seccion {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 800;
  color: #14213d;
}

.aviso {
  margin: 0;
  padding: 20px;
  border-radius: 18px;
  background: #fff;
  color: #4a5468;
}

.boton-claro {
  margin-top: 28px;
  background: #14213d;
  color: #fff;
  border: 3px solid #14213d;
}

.boton-claro:active {
  background: #1f3058;
}

/* ---------- Favoritas (2 columnas en iPhone, 3 en iPad) ---------- */

.favoritas {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: 0 -8px;
  padding: 0;
  list-style: none;
}

.favorita {
  width: 50%;
  padding: 8px;
}

@media (min-width: 600px) {
  .favorita {
    width: 33.333%;
  }
}

.boton-favorita {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 150px;
  margin: 0;
  padding: 18px 10px 14px;
  border: 3px solid transparent;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(20, 33, 61, 0.1);
  color: #14213d;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.boton-favorita:active {
  background: #e3e8f2;
}

.boton-favorita .logo {
  width: 80px;
  height: 80px;
  line-height: 80px;
}

.favorita-actual {
  border-color: #14213d;
  background: #fff8e6;
}

.nombre-favorita {
  display: block;
  margin-top: 10px;
  word-wrap: break-word;
}

/* ---------- Todas las emisoras ---------- */

.boton-volver {
  min-height: 60px;
  margin: 0 0 16px;
  padding: 8px 20px 8px 12px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: #14213d;
  font-family: inherit;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.flecha {
  margin-right: 6px;
  font-size: 34px;
  line-height: 1;
  vertical-align: -3px;
}

.etiqueta-buscador {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
  color: #4a5468;
}

/* 16px o más evita que el iPhone amplíe la página al escribir. */
.buscador {
  display: block;
  width: 100%;
  min-height: 64px;
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 2px solid #8e8e93;
  border-radius: 16px;
  background: #fff;
  color: #14213d;
  font-family: inherit;
  font-size: 22px;
  -webkit-appearance: none;
}

.buscador:focus {
  border-color: #1f5fbf;
  outline: 3px solid #1f5fbf;
}

.resumen-busqueda {
  margin: 0 0 12px;
  font-size: 20px;
  color: #4a5468;
}

.titulo-comunidades {
  margin: 28px 0 12px;
  font-size: 24px;
  font-weight: 800;
}

.grupo {
  margin-bottom: 12px;
}

.grupo-cabecera {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  width: 100%;
  min-height: 68px;
  margin: 0;
  padding: 12px 18px;
  border: 0;
  border-radius: 18px;
  background: #14213d;
  box-shadow: 0 2px 10px rgba(20, 33, 61, 0.15);
  color: #fff;
  font-family: inherit;
  font-size: 23px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.grupo-cabecera:active {
  background: #1f3058;
}

.grupo-flecha {
  width: 28px;
  margin-right: 8px;
  color: #f5b82e;
}

.grupo-nombre {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
}

.grupo-cuenta {
  margin-left: 12px;
  font-size: 18px;
  font-weight: 500;
  color: #c9d3e6;
  white-space: nowrap;
}

.filas {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.fila {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  align-items: stretch;
  margin-bottom: 8px;
  border-radius: 18px;
  background: #fff;
}

.fila-elegir {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 80px;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #14213d;
  font-family: inherit;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.fila-elegir:active {
  background: #e3e8f2;
}

.fila-elegir .logo {
  margin-right: 14px;
}

.fila-textos {
  min-width: 0;
}

.fila-nombre {
  display: block;
  word-wrap: break-word;
}

.fila-lugar {
  display: block;
  font-size: 17px;
  font-weight: 500;
  color: #4a5468;
}

.fila-estrella {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  width: 72px;
  min-height: 80px;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid #e3e8f2;
  border-radius: 0 18px 18px 0;
  background: transparent;
  color: #6b6b70;
  font-family: inherit;
  font-size: 36px;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.fila-estrella:active {
  background: #e3e8f2;
}

.fila-estrella.estrella-marcada {
  color: #c48a00;
}

/* ---------- Modo oscuro automático ----------
 * Safari 12 no entiende esta consulta y la ignora entera, así que
 * el iPad sigue en modo claro sin ningún cambio.
 * Contraste comprobado: texto principal y secundario por encima de 7:1,
 * botones y enlaces por encima de 4,5:1.
 */
@media (prefers-color-scheme: dark) {
  body {
    background: #0b1120;
    color: #eef1f6;
  }

  .marca,
  .titulo-seccion,
  .titulo-comunidades {
    color: #eef1f6;
  }

  .reproductor {
    background: #17223f;
    box-shadow: none;
  }

  .aviso,
  .boton-favorita,
  .boton-volver,
  .grupo-cabecera,
  .buscador {
    background: #17223f;
    color: #eef1f6;
  }

  .boton-favorita {
    box-shadow: none;
  }

  .fila {
    background: #121a31;
  }

  .fila-elegir {
    color: #eef1f6;
  }

  .fila-lugar,
  .etiqueta-buscador,
  .resumen-busqueda,
  .pie,
  .aviso {
    color: #c4cbe0;
  }

  .grupo-cabecera {
    box-shadow: none;
  }

  .boton-claro {
    border-color: #f5b82e;
    background: #f5b82e;
    color: #0b1120;
  }

  .boton-favorita:active,
  .grupo-cabecera:active,
  .fila-elegir:active,
  .fila-estrella:active {
    background: #26365f;
  }

  .boton-claro:active {
    background: #e0a51c;
  }

  .fila-estrella {
    border-left-color: #26365f;
    color: #a9b3cc;
  }

  .fila-estrella.estrella-marcada {
    color: #f5b82e;
  }

  .favorita-actual {
    border-color: #f5b82e;
    background: #1f2c52;
  }

  .logo {
    background: #26365f;
    color: #f5c955;
  }

  .buscador {
    border-color: #6b7899;
  }

  .boton-volver {
    color: #f5c955;
  }

  .pie a {
    color: #8ab8ff;
  }

  .buscador:focus {
    border-color: #8ab8ff;
    outline-color: #8ab8ff;
  }

  .boton-volver:focus,
  .boton-favorita:focus,
  .fila-elegir:focus,
  .fila-estrella:focus,
  .grupo-cabecera:focus {
    outline-color: #8ab8ff;
  }
}
