/* ============================================================================
   BETTIX — "En Vivo" v3
   Rediseño profesional del apartado de TV (escritorio + móvil).
   Se carga DESPUÉS de styles.css, por lo que sus reglas tienen prioridad.
   ========================================================================== */

.live-page {
  --ch-radius: 14px;
  --ch-gap: 14px;
}

/* ---------------------------------------------------------------------------
   1. Encabezado de la página
   ------------------------------------------------------------------------ */
.live-page .page-heading {
  align-items: flex-end;
  margin: 6px 0 20px;
}

.live-page .page-heading h1 {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Indicador "al aire" junto al título */
.live-onair {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(255, 43, 76, .12);
  border: 1px solid rgba(255, 43, 76, .32);
  color: #ff6b83;
  font: 800 10px/1 Inter, sans-serif;
  letter-spacing: .14em;
  vertical-align: middle;
  flex: none;
}

.live-onair i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff2b4c;
  box-shadow: 0 0 8px rgba(255, 43, 76, .9);
  animation: liveBlink 1.9s ease-in-out infinite;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .25; }
}

.live-page .heading-actions { display: flex; gap: 10px; }

/* Botón "Solo en línea" */
.live-page #liveOnlineOnly {
  height: 42px;
  border-radius: 10px;
  font-size: 13px;
  gap: 8px;
}

.live-page #liveOnlineOnly.active {
  background: rgba(43, 217, 127, .14);
  border-color: rgba(43, 217, 127, .42);
  color: #4ef0a3;
}

.live-page #liveOnlineOnly.active i { color: #2bd97f; }

/* ---------------------------------------------------------------------------
   2. Rejilla principal (barra lateral + contenido)
   ------------------------------------------------------------------------ */
.live-layout-v2 {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.live-main-v2 { min-width: 0; }

/* ---------------------------------------------------------------------------
   3. Barra lateral de categorías
   ------------------------------------------------------------------------ */
.live-sidebar-v2 {
  position: sticky;
  top: calc(var(--topbar) + 16px);
  max-height: calc(100dvh - var(--topbar) - 34px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(21, 24, 30, .92), rgba(12, 13, 17, .92));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}

.live-sidebar-v2::-webkit-scrollbar { width: 6px; }
.live-sidebar-v2::-webkit-scrollbar-track { background: transparent; }
.live-sidebar-v2::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .14);
  border-radius: 99px;
}
.live-sidebar-v2::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .26); }

.live-side-label {
  padding: 8px 11px 9px;
  font: 800 10px/1 Inter, sans-serif;
  letter-spacing: .16em;
  color: #61677180;
  color: #6b7280;
}

.live-side-btn {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: none;
  color: #9aa0aa;
  padding: 9px 11px;
  border-radius: 10px;
  text-align: left;
  font: 600 13.5px/1.2 Inter, sans-serif;
  transition: background .16s, color .16s;
}

.live-side-btn .side-ico {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: rgba(255, 255, 255, .05);
  color: #878d97;
  transition: background .16s, color .16s;
}

.live-side-btn .side-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-side-btn small {
  flex: none;
  font: 700 10.5px/1 Inter, sans-serif;
  color: #6e747f;
  background: rgba(255, 255, 255, .055);
  padding: 4px 7px;
  border-radius: 99px;
}

.live-side-btn:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.live-side-btn:hover .side-ico { color: #fff; }

.live-side-btn.active {
  background: rgba(8, 223, 245, .1);
  color: #fff;
}

.live-side-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 19px;
  border-radius: 0 3px 3px 0;
  background: var(--cyan);
}

.live-side-btn.active .side-ico {
  background: linear-gradient(145deg, #08dff5, #1e9dff);
  color: #04222a;
  box-shadow: 0 3px 12px rgba(8, 223, 245, .3);
}

.live-side-btn.active small {
  background: rgba(8, 223, 245, .16);
  color: var(--cyan);
}

/* ---------------------------------------------------------------------------
   4. Reproductor
   ------------------------------------------------------------------------ */

/* Estado por defecto (sin canal): tarjeta compacta en vez de un vacío 16:9.
   Así la rejilla de canales queda visible sin necesidad de desplazarse. */
.live-player-card {
  position: relative;
  aspect-ratio: auto;
  min-height: 188px;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(760px 200px at 50% -10%, rgba(8, 223, 245, .1), transparent 72%),
    linear-gradient(180deg, #111419, #0a0b0e);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .4);
}

/* Con canal en reproducción: formato 16:9 real y fijo al desplazarse */
.live-player-card.is-playing {
  aspect-ratio: 16 / 9;
  min-height: 0;
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

@media (min-width: 1101px) {
  /* El elemento fijo es el CONTENEDOR, no el vídeo.
     Al fijar el vídeo directamente y centrarlo quedaban huecos a los lados por
     los que se veían las tarjetas pasando por detrás: parecía una ventana
     flotante suelta sobre la rejilla. El contenedor ocupa todo el ancho de la
     columna y es opaco, así los canales se desplazan limpiamente por debajo. */
  .live-player-dock.is-playing {
    position: sticky;
    top: var(--topbar);
    z-index: 40;
    padding: 14px 0 16px;
    background: var(--bg);
    box-shadow: 0 14px 26px -6px rgba(5, 5, 5, .95);
  }

  /* El vídeo se limita a partir del alto disponible para conservar el 16:9
     exacto y dejar siempre visibles un par de filas de canales debajo. */
  .live-player-card.is-playing {
    max-width: calc(52dvh * 16 / 9);
    margin-inline: auto;
  }

  /* Ventanas muy bajas: mejor que el reproductor se desplace con la página. */
  @media (max-height: 560px) {
    .live-player-dock.is-playing {
      position: relative;
      top: auto;
      padding: 0;
      box-shadow: none;
    }
    .live-player-card.is-playing { max-width: none; }
  }
}

.live-player-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Estado vacío / error */
.live-player-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 26px 20px;
  text-align: center;
  background: none;
  color: var(--muted);
}

.live-player-empty i {
  font-size: 26px;
  color: var(--cyan);
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(8, 223, 245, .08);
  border: 1px solid rgba(8, 223, 245, .2);
  margin-bottom: 2px;
}

.live-player-empty strong {
  color: #fff;
  font: 700 19px/1.2 Outfit, sans-serif;
}

.live-player-empty span {
  font-size: 13px;
  color: #868c96;
  max-width: 42ch;
}

.live-player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, .82);
  backdrop-filter: blur(3px);
  color: #cfd3da;
  font-size: 13px;
  font-weight: 600;
  z-index: 4;
}

/* Barra superior del reproductor */
.live-player-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .8), rgba(0, 0, 0, .34) 62%, transparent);
  opacity: 1;
  transition: opacity .25s;
}

.live-player-top h2 {
  font: 700 20px/1.2 Outfit, sans-serif;
  margin: 9px 0 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 43, 76, .9);
  color: #fff;
  font: 800 9.5px/1 Inter, sans-serif;
  letter-spacing: .12em;
}

.live-pill i {
  font-size: 6px;
  color: #fff;
  animation: liveBlink 1.9s ease-in-out infinite;
}

/* Controles inferiores */
.live-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(0deg, rgba(0, 0, 0, .88), rgba(0, 0, 0, .35) 60%, transparent);
}

.live-controls .icon-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, .1);
  backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, .14);
}

.live-controls .icon-btn:hover { background: rgba(255, 255, 255, .2); }

.live-control-title b {
  font: 700 14px/1.2 Inter, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-control-title span { font-size: 11px; color: #a8adb6; }

/* Oculta los controles cuando no hay reproducción */
.live-player-card:not(.is-playing) .live-player-top,
.live-player-card:not(.is-playing) .live-controls { display: none !important; }

/* ---------------------------------------------------------------------------
   5. Barra de herramientas (buscador + contador)
   ------------------------------------------------------------------------ */
.live-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 22px 0 15px;
}

.live-toolbar-copy { min-width: 0; margin-right: auto; }

.live-toolbar-copy h2 {
  font: 700 21px/1.2 Outfit, sans-serif;
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-toolbar-copy span { color: var(--muted); font-size: 12.5px; }

.live-search {
  position: relative;
  flex: 0 1 340px;
  min-width: 190px;
}

.live-search > i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #6d737e;
  font-size: 12px;
  pointer-events: none;
}

.live-search input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: #fff;
  padding: 0 38px 0 35px;
  outline: none;
  font-size: 13.5px;
  transition: border-color .16s, background .16s, box-shadow .16s;
}

.live-search input::placeholder { color: #6d737e; }

.live-search input:focus {
  border-color: rgba(8, 223, 245, .5);
  background: rgba(8, 223, 245, .045);
  box-shadow: 0 0 0 3px rgba(8, 223, 245, .09);
}

.live-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #7c828d;
  display: none;
  place-items: center;
  font-size: 12px;
}

.live-search.has-value .live-search-clear { display: grid; }
.live-search-clear:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------------------------------------------------------------------------
   6. Tarjetas de canal
   ------------------------------------------------------------------------ */
.channel-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  gap: var(--ch-gap);
}

.channel-card-v2 {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: #fff;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--ch-radius);
  background: linear-gradient(180deg, #14171d, #0e1014);
  transition: transform .18s cubic-bezier(.2, .7, .3, 1), border-color .18s, box-shadow .18s;
}

.channel-card-v2:hover {
  transform: translateY(-4px);
  border-color: rgba(8, 223, 245, .42);
  box-shadow: 0 18px 38px rgba(0, 0, 0, .5), 0 0 0 1px rgba(8, 223, 245, .1);
}

.channel-card-v2:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* Canal que se está reproduciendo */
.channel-card-v2.is-live-now {
  border-color: rgba(8, 223, 245, .6);
  box-shadow: 0 0 0 1px rgba(8, 223, 245, .3), 0 12px 30px rgba(8, 223, 245, .12);
}

/* -- Zona del logotipo -- */
.ch-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(125% 125% at 50% 0%, #232830 0%, #161a20 58%, #0f1116 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.ch-logo {
  position: relative;
  z-index: 1;
  max-width: 64%;
  max-height: 58%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .6));
  transition: transform .22s cubic-bezier(.2, .7, .3, 1);
}

.channel-card-v2:hover .ch-logo { transform: scale(1.07); }

/* Iniciales de respaldo (visibles solo si no hay logotipo o si este falla).
   En cuanto el logotipo real carga se ocultan, para que el fondo de color no
   asome alrededor de la imagen y la rejilla mantenga un aspecto uniforme. */
.ch-thumb.has-logo .ch-mono { display: none; }

.ch-mono {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 800 26px/1 Outfit, sans-serif;
  letter-spacing: .01em;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .45);
  transition: transform .22s cubic-bezier(.2, .7, .3, 1);
}

.channel-card-v2:hover .ch-mono { transform: scale(1.05); }

/* Insignia de latencia */
.ch-ping {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 7px;
  border-radius: 6px;
  font: 800 10px/1 Inter, sans-serif;
  background: rgba(6, 10, 12, .8);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .1);
  color: #cfd4dc;
}

.ch-ping em { font-style: normal; font-weight: 700; opacity: .7; }
.ch-ping i { font-size: 9px; }

.ch-ping.ultra {
  color: #35e8a4;
  border-color: rgba(53, 232, 164, .34);
  background: rgba(5, 26, 20, .82);
}

.ch-ping.stable {
  color: #ffc94a;
  border-color: rgba(255, 201, 74, .3);
  background: rgba(30, 24, 6, .82);
}

/* Insignia de servidores espejo */
.ch-mirrors {
  position: absolute;
  left: 8px;
  top: 34px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font: 800 9.5px/1 Inter, sans-serif;
  background: rgba(8, 223, 245, .12);
  border: 1px solid rgba(8, 223, 245, .34);
  color: var(--cyan);
  backdrop-filter: blur(6px);
}

.ch-mirrors i { font-size: 8px; }

/* Etiqueta EN VIVO */
.ch-live {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 5px;
  background: rgba(255, 43, 76, .92);
  color: #fff;
  font: 800 9px/1 Inter, sans-serif;
  letter-spacing: .1em;
}

.ch-live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: liveBlink 1.9s ease-in-out infinite;
}

/* Botón de favorito */
.ch-fav {
  position: absolute;
  right: 7px;
  top: 7px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(6, 8, 11, .7);
  backdrop-filter: blur(6px);
  color: #c9ced6;
  font-size: 11px;
  opacity: 0;
  transform: scale(.85);
  transition: opacity .18s, transform .18s, background .18s, color .18s;
}

.channel-card-v2:hover .ch-fav,
.channel-card-v2:focus-within .ch-fav,
.ch-fav.active { opacity: 1; transform: none; }

.ch-fav:hover { background: rgba(255, 255, 255, .18); color: #fff; }

.ch-fav.active {
  color: #ff5470;
  border-color: rgba(255, 84, 112, .42);
  background: rgba(40, 8, 14, .8);
}

/* Superposición de reproducción */
.ch-play {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 9, .52);
  opacity: 0;
  transition: opacity .18s;
}

.channel-card-v2:hover .ch-play { opacity: 1; }

.ch-play i {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--cyan);
  color: #04222a;
  font-size: 14px;
  padding-left: 3px;
  box-shadow: 0 8px 22px rgba(8, 223, 245, .42);
  transform: scale(.85);
  transition: transform .2s cubic-bezier(.2, .7, .3, 1);
}

.channel-card-v2:hover .ch-play i { transform: none; }

/* -- Texto -- */
.ch-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px 12px;
  min-width: 0;
}

.ch-body h3 {
  margin: 0;
  font: 700 13px/1.3 Inter, sans-serif;
  color: #f1f3f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 10.5px;
  font-weight: 600;
  color: #767c87;
}

.ch-cat {
  flex: 0 1 auto;
  min-width: 0;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(8, 223, 245, .09);
  border: 1px solid rgba(8, 223, 245, .17);
  color: var(--cyan);
  font: 800 9.5px/1.35 Inter, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-viewers {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------------------
   7. "Cargar más" y estado vacío
   ------------------------------------------------------------------------ */
.live-loadmore {
  display: flex;
  justify-content: center;
  padding: 28px 0 6px;
}

.live-loadmore button {
  min-height: 46px;
  padding: 0 26px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .045);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background .16s, border-color .16s;
}

.live-loadmore button:hover {
  background: rgba(8, 223, 245, .1);
  border-color: rgba(8, 223, 245, .4);
}

.live-empty {
  grid-column: 1 / -1;
  padding: 58px 20px;
  text-align: center;
  color: var(--muted);
}

.live-empty i { font-size: 34px; color: #454b55; margin-bottom: 12px; display: block; }
.live-empty h3 { color: #fff; margin: 0 0 6px; font: 700 18px Outfit, sans-serif; }
.live-empty p { margin: 0; font-size: 13px; }

/* Esqueletos de carga */
.ch-skeleton {
  border-radius: var(--ch-radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #14171d, #0e1014);
  overflow: hidden;
}

.ch-skeleton .sk-thumb {
  aspect-ratio: 16 / 10;
  background: linear-gradient(100deg, #171a20 30%, #1f242c 50%, #171a20 70%);
  background-size: 220% 100%;
  animation: skShimmer 1.3s linear infinite;
}

.ch-skeleton .sk-line {
  height: 10px;
  margin: 12px 11px 0;
  border-radius: 4px;
  background: linear-gradient(100deg, #171a20 30%, #1f242c 50%, #171a20 70%);
  background-size: 220% 100%;
  animation: skShimmer 1.3s linear infinite;
}

.ch-skeleton .sk-line.short { width: 55%; margin-bottom: 14px; }

@keyframes skShimmer {
  from { background-position: 140% 0; }
  to   { background-position: -40% 0; }
}

/* ---------------------------------------------------------------------------
   8. Tabletas (≤1100px) — sin barra lateral, con tiras de categorías
   ------------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .live-layout-v2 { grid-template-columns: 1fr; gap: 0; }
  .live-sidebar-v2 { display: none; }

  .live-category-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 4px;
    margin-bottom: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .live-category-strip::-webkit-scrollbar { display: none; }

  .live-category-strip .chip {
    flex: 0 0 auto;
    height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 15px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    background: rgba(255, 255, 255, .045);
    border: 1px solid var(--line);
    color: #a9aeb7;
    white-space: nowrap;
    transition: background .16s, color .16s, border-color .16s;
  }

  .live-category-strip .chip i { font-size: 11px; opacity: .85; }

  .live-category-strip .chip small {
    font-size: 10.5px;
    font-weight: 700;
    opacity: .6;
  }

  .live-category-strip .chip.active {
    background: linear-gradient(145deg, #08dff5, #1e9dff);
    border-color: transparent;
    color: #04222a;
  }

  .live-category-strip .chip.active small { opacity: .75; }
}

/* ---------------------------------------------------------------------------
   9. Móvil (≤768px)
   ------------------------------------------------------------------------ */
@media (max-width: 768px) {
  .live-page { --ch-gap: 10px; --ch-radius: 12px; }

  .live-page .page-heading { margin: 4px 0 14px; display: block; }
  .live-page .page-heading h1 { font-size: 27px; gap: 10px; }
  .live-page .page-heading p { display: none; }
  .live-page .eyebrow { font-size: 10px; }

  /* styles.css oculta las acciones en móvil; aquí se recupera el filtro
     "Solo en línea" en formato compacto, sin ocupar todo el ancho. */
  .live-page .heading-actions { display: flex; margin-top: 11px; }
  .live-page #liveOnlineOnly {
    width: auto;
    height: 36px;
    padding: 0 14px;
    font-size: 12.5px;
    border-radius: 999px;
  }

  .live-onair { height: 23px; padding: 0 9px; font-size: 9px; }

  /* Buscador siempre visible y a lo ancho */
  .live-toolbar {
    margin: 16px 0 12px;
    gap: 10px;
    align-items: stretch;
    flex-direction: column;
  }

  .live-search { flex: 1 1 auto; min-width: 0; max-width: none; order: -1; }
  .live-search input { height: 44px; font-size: 14px; }

  .live-toolbar-copy h2 { font-size: 17px; }
  .live-toolbar-copy span { font-size: 11.5px; }

  /* Reproductor a sangre completa; fijo arriba mientras se navega */
  .live-player-card {
    margin: 0 -14px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    min-height: 150px;
  }

  /* Igual que en escritorio: se fija el contenedor, no el vídeo. */
  .live-player-dock.is-playing {
    position: sticky;
    top: var(--topbar);
    z-index: 60;
    background: var(--bg);
    box-shadow: 0 14px 28px -6px rgba(0, 0, 0, .8);
  }

  /* Evita que en horizontal el reproductor fijo ocupe toda la pantalla
     y deje sin acceso a la rejilla de canales. */
  .live-player-card.is-playing { max-height: 46dvh; }

  .live-player-empty i { width: 50px; height: 50px; font-size: 22px; }
  .live-player-empty strong { font-size: 16px; }
  .live-player-empty span { font-size: 12px; }

  .live-player-top { padding: 12px 14px; }
  .live-player-top h2 { font-size: 16px; margin-top: 7px; }
  .live-controls { padding: 12px 14px; gap: 9px; }
  .live-controls .icon-btn { width: 36px; height: 36px; font-size: 12px; }
  .live-control-title b { font-size: 13px; }

  /* Columnas fluidas: 2 en teléfono, 4 en tableta pequeña.
     Fijar 2 columnas hasta 768px dejaba tarjetas enormes en tabletas. */
  .channel-grid-v2 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  .ch-body { padding: 8px 9px 10px; gap: 5px; }
  .ch-body h3 { font-size: 12px; }
  .ch-meta { font-size: 9.5px; gap: 5px; }
  .ch-cat { font-size: 8.5px; padding: 2px 5px; }

  .ch-ping { height: 19px; padding: 0 6px; font-size: 9px; left: 6px; top: 6px; }
  .ch-mirrors { top: 30px; left: 6px; height: 18px; font-size: 8.5px; }
  .ch-live { height: 18px; padding: 0 6px; font-size: 8px; left: 6px; bottom: 6px; }

  /* En táctil no hay hover: favorito y play siempre visibles/ocultos */
  .ch-fav { opacity: 1; transform: none; width: 26px; height: 26px; right: 6px; top: 6px; }
  .ch-play { display: none; }

  .live-loadmore { padding: 20px 0 4px; }
  .live-loadmore button { width: 100%; }
}

/* Pantallas muy estrechas */
@media (max-width: 360px) {
  .channel-grid-v2 { gap: 8px; }
  .ch-body h3 { font-size: 11.5px; }
}

/* ---------------------------------------------------------------------------
   10. Rellenar bordes negros (alternar ajustar / rellenar)
   ------------------------------------------------------------------------ */
/* La regla base (styles.css) y la de pantalla-completa-pseudo (con
   !important, para TVs sin Fullscreen API) fuerzan object-fit:contain.
   Este selector anclado al ID + !important es más específico que ambas,
   así que gana sin importar en qué otras clases coincida el elemento. */
#livePlayerCard.live-fill-mode video {
  object-fit: cover !important;
}

#liveFillToggle.active {
  background: rgba(8, 223, 245, .18);
  border-color: rgba(8, 223, 245, .45);
  color: var(--cyan);
}

/* ---------------------------------------------------------------------------
   11. Pantalla completa: nombre de canal y controles con auto-ocultado
   ------------------------------------------------------------------------ */
#livePlayerCard.is-fullscreen .live-player-top,
#livePlayerCard.is-fullscreen .live-controls {
  transition: opacity .3s ease;
}

/* .fs-idle se añade unos segundos después de la última actividad (ver
   showLiveFsControls en app.js) — solo mientras se está en pantalla
   completa; fuera de ella el overlay siempre es visible como antes. */
#livePlayerCard.is-fullscreen.fs-idle .live-player-top,
#livePlayerCard.is-fullscreen.fs-idle .live-controls {
  opacity: 0;
  pointer-events: none;
}

#livePlayerCard.is-fullscreen.fs-idle {
  cursor: none;
}

/* ---------------------------------------------------------------------------
   12. Accesibilidad / movimiento reducido
   ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .live-onair i,
  .live-pill i,
  .ch-live i,
  .ch-skeleton .sk-thumb,
  .ch-skeleton .sk-line { animation: none !important; }

  .channel-card-v2:hover { transform: none; }
}


/* === LIVE TV FULLSCREEN & PSEUDO-FULLSCREEN ENGINE === */
#livePlayerCard:fullscreen,
#livePlayerCard:-webkit-full-screen,
#livePlayerCard:-moz-full-screen,
#livePlayerCard:-ms-fullscreen,
#livePlayerCard.tv-pseudo-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  border: 0 !important;
  z-index: 99999999 !important;
  background: #000 !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#livePlayerCard:fullscreen video,
#livePlayerCard:-webkit-full-screen video,
#livePlayerCard.tv-pseudo-fullscreen video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  background: #000 !important;
}

#livePlayerCard:fullscreen.live-fill-mode video,
#livePlayerCard:-webkit-full-screen.live-fill-mode video,
#livePlayerCard.tv-pseudo-fullscreen.live-fill-mode video {
  object-fit: cover !important;
}

#livePlayerCard:fullscreen .live-player-top,
#livePlayerCard:-webkit-full-screen .live-player-top,
#livePlayerCard.tv-pseudo-fullscreen .live-player-top {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 50 !important;
}

#livePlayerCard:fullscreen .live-controls,
#livePlayerCard:-webkit-full-screen .live-controls,
#livePlayerCard.tv-pseudo-fullscreen .live-controls {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 50 !important;
}

#liveFullscreen.active,
#liveFsBottom.active {
  background: rgba(8, 223, 245, 0.22) !important;
  border-color: rgba(8, 223, 245, 0.55) !important;
  color: #08dff5 !important;
}


/* === REDISEÑO PREMIUM DE CONTROLES EN VIVO === */
.live-controls {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 14px 18px !important;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%) !important;
  z-index: 10 !important;
}

.live-control-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-right: 12px;
}

.live-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.live-controls .icon-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.live-controls .icon-btn:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-1px);
}

.live-controls .icon-btn:active {
  transform: scale(0.95);
}

#liveFillToggle.active,
#liveFsBottom.active,
#livePipBtn.active {
  background: rgba(8, 223, 245, 0.22) !important;
  border-color: rgba(8, 223, 245, 0.55) !important;
  color: #08dff5 !important;
}


/* === UNIVERSAL LIVE FULLSCREEN & MOBILE OVERRIDES === */
#livePlayerCard:fullscreen,
#livePlayerCard:-webkit-full-screen,
#livePlayerCard:-moz-full-screen,
#livePlayerCard:-ms-fullscreen,
#livePlayerCard.tv-pseudo-fullscreen,
.live-player-card:fullscreen,
.live-player-card:-webkit-full-screen,
.live-player-card:-moz-full-screen,
.live-player-card:-ms-fullscreen,
.live-player-card.tv-pseudo-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  width: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  z-index: 999999999 !important;
  background: #000 !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#livePlayerCard:fullscreen video,
#livePlayerCard:-webkit-full-screen video,
#livePlayerCard:-moz-full-screen video,
#livePlayerCard:-ms-fullscreen video,
#livePlayerCard.tv-pseudo-fullscreen video,
.live-player-card:fullscreen video,
.live-player-card:-webkit-full-screen video,
.live-player-card:-moz-full-screen video,
.live-player-card:-ms-fullscreen video,
.live-player-card.tv-pseudo-fullscreen video {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  background: #000 !important;
}

#livePlayerCard:fullscreen.live-fill-mode video,
#livePlayerCard:-webkit-full-screen.live-fill-mode video,
#livePlayerCard.tv-pseudo-fullscreen.live-fill-mode video,
.live-player-card:fullscreen.live-fill-mode video,
.live-player-card:-webkit-full-screen.live-fill-mode video,
.live-player-card.tv-pseudo-fullscreen.live-fill-mode video {
  object-fit: cover !important;
}

body.body-live-fullscreen {
  overflow: hidden !important;
}

body.body-live-fullscreen .live-player-dock {
  position: static !important;
  z-index: 999999998 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* ============================================================================
   BETTIX LIVE — capa v4
   Se añade al final de live-v3.css. Arregla que el buscador quedara escondido
   detrás del reproductor, ordena las tarjetas y trae las animaciones.
   ============================================================================ */

/* --- 1. La barra de búsqueda viaja con el reproductor -------------------- */
/* Antes la barra (título + buscador) se quedaba arriba y el reproductor fijo
   la tapaba: con un canal puesto no había forma de buscar otro sin subir. */
.live-player-dock .live-toolbar {
  margin-top: 14px;
  margin-bottom: 0;
}
@media (min-width: 1101px) {
  .live-player-dock.is-playing {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
  .live-player-dock.is-playing .live-toolbar {
    margin-top: 12px;
  }
}
.channel-grid-v2 { margin-top: 16px; }

/* --- 2. Categorías propias del usuario ---------------------------------- */
.live-side-sep {
  height: 1px;
  margin: 10px 10px 12px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}
.live-side-btn.es-propia .side-ico { color: var(--cyan, #00D9FF); }
.live-side-btn.es-propia.active .side-ico,
.chip.es-propia.active i { color: inherit; }
.chip.es-propia i { color: var(--cyan, #00D9FF); }
.chip.es-propia.active i { color: inherit; }

/* --- 3. Tarjetas: entrada escalonada ------------------------------------ */
@keyframes chEntra {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.channel-card-v2 {
  animation: chEntra .38s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 14ms);
}
/* El máximo evita que la fila veinte tarde un segundo en aparecer. */
.channel-card-v2 { animation-delay: min(calc(var(--i, 0) * 14ms), 420ms); }

.channel-card-v2 .ch-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 120%, rgba(0, 217, 255, .16), transparent 70%);
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
}
.channel-card-v2:hover .ch-thumb::after { opacity: 1; }

/* --- 4. Etiquetas honestas del cuerpo ----------------------------------- */
.ch-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #A7B0BE);
  white-space: nowrap;
}
.ch-tag i { font-size: 9.5px; opacity: .8; }
.ch-tag.apagado { color: #ff8a9b; }

/* Canal sin señal: se ve, pero se nota que no está al aire. */
.channel-card-v2.is-offline .ch-thumb { filter: grayscale(.75) brightness(.72); }
.channel-card-v2.is-offline:hover .ch-thumb { filter: grayscale(.35) brightness(.88); }

/* --- 5. El canal que está sonando --------------------------------------- */
.ch-nowbar {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(4, 8, 13, .72);
  backdrop-filter: blur(4px);
}
.ch-nowbar i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--cyan, #00D9FF);
  animation: chEq .9s ease-in-out infinite;
}
.ch-nowbar i:nth-child(2) { animation-delay: .18s; }
.ch-nowbar i:nth-child(3) { animation-delay: .36s; }
@keyframes chEq {
  0%, 100% { height: 4px; }
  50%      { height: 12px; }
}
.channel-card-v2.is-live-now .ch-nowbar { display: flex; }
.channel-card-v2.is-live-now .ch-live { display: none; }
.channel-card-v2.is-live-now {
  animation: chEntra .38s cubic-bezier(.22, .61, .36, 1) both, chLatido 2.6s ease-in-out infinite .5s;
}
@keyframes chLatido {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0, 217, 255, .3), 0 12px 30px rgba(0, 217, 255, .12); }
  50%      { box-shadow: 0 0 0 1px rgba(0, 217, 255, .55), 0 12px 38px rgba(0, 217, 255, .22); }
}

/* El punto de EN VIVO late, como en la portada. */
.ch-live i {
  animation: chPunto 1.8s ease-out infinite;
}
@keyframes chPunto {
  0%   { box-shadow: 0 0 0 0 rgba(255, 68, 95, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 68, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 68, 95, 0); }
}

/* --- 6. Reproductor ------------------------------------------------------ */
/* Al cambiar de canal la imagen entra con un fundido en vez de dar un salto. */
@keyframes liveEntra {
  from { opacity: .25; }
  to   { opacity: 1; }
}
.live-player-card.is-playing video { animation: liveEntra .5s ease both; }

.live-player-card.is-playing { box-shadow: 0 24px 60px -18px rgba(0, 217, 255, .28), 0 18px 44px rgba(0, 0, 0, .6); }

/* Línea de carga mientras engancha la señal. */
.live-player-loading { position: relative; }
.live-player-loading::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cyan, #00D9FF), transparent);
  animation: liveBarrido 1.15s linear infinite;
}
@keyframes liveBarrido {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* Botones de canal anterior y siguiente */
.live-zap {
  display: inline-grid;
  place-items: center;
}
.live-zap i { font-size: 13px; }
@media (max-width: 620px) {
  .live-control-title span { display: none; }
}

/* --- 7. Esqueletos mientras llega la lista ------------------------------- */
.ch-sk {
  border: 1px solid var(--line);
  border-radius: var(--ch-radius, 14px);
  overflow: hidden;
  background: linear-gradient(180deg, #14171d, #0e1014);
}
.ch-sk .sk-b {
  background: linear-gradient(100deg, rgba(255,255,255,.04) 30%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.04) 70%);
  background-size: 280% 100%;
  animation: chSk 1.4s linear infinite;
}
.ch-sk .sk-thumb { aspect-ratio: 16 / 10; }
.ch-sk .sk-line { height: 11px; border-radius: 6px; margin: 12px 12px 0; }
.ch-sk .sk-line.corta { width: 45%; margin-bottom: 14px; }
@keyframes chSk {
  from { background-position: 180% 0; }
  to   { background-position: -80% 0; }
}

/* --- 8. Accesibilidad y movimiento reducido ----------------------------- */
@media (prefers-reduced-motion: reduce) {
  .channel-card-v2,
  .channel-card-v2.is-live-now,
  .live-player-card.is-playing video,
  .ch-nowbar i,
  .ch-live i,
  .live-player-loading::after,
  .ch-sk .sk-b {
    animation: none !important;
  }
}

/* ============================================================================
   BETTIX LIVE — capa v5
   Se añade al final de live-v3.css. Encierra el vídeo dentro del reproductor,
   suaviza el aviso de reconexión y ordena los botones del aviso de caída.
   ============================================================================ */

/* --- 1. El vídeo ya no manda sobre el tamaño del reproductor ------------- */
/* El <video> iba en el flujo normal con height:100%. Cuando esa altura no se
   resolvía contra la caja (pasa en cuanto el canal no viene en 16:9, y en
   navegadores de televisor que no entienden aspect-ratio), el vídeo se
   quedaba con su alto natural y ESTIRABA la tarjeta: un canal en 4:3 pasaba
   el reproductor de 521 a 728 px de alto y se salía del hueco previsto.
   Sacándolo del flujo, su tamaño natural deja de importar. */
.live-player-card video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}

/* Navegadores viejos (televisores, WebView antiguo) que no soportan
   aspect-ratio: se les da la proporción con el truco del relleno. */
@supports not (aspect-ratio: 16 / 9) {
  .live-player-card.is-playing {
    height: 0;
    padding-top: 56.25%;
  }
}

/* --- 2. Aviso de reconexión ---------------------------------------------- */
/* Mientras rebufea se veía un rectángulo negro opaco encima de una imagen que
   seguía ahí: parecía que el canal se había caído. Ahora se transparenta y se
   sigue viendo el último fotograma por detrás. */
.live-player-loading.is-rebuffer {
  background: rgba(4, 7, 11, .55);
  backdrop-filter: blur(2px);
}

/* --- 3. Aviso de señal caída --------------------------------------------- */
.live-error-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.live-error-acciones .primary-btn,
.live-error-acciones .secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .live-error-acciones { width: 100%; }
  .live-error-acciones button { flex: 1 1 auto; justify-content: center; }
}
