/* ══════════════════════════════════════════════════════════════
   Web Player — misma identidad visual que el canal Roku / app
   Android: fondo #0B0E13, paneles #10141B, acento amarillo
   #F6D400, azul #00A8E1, texto #8A93A5 / blanco.
   ══════════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0B0E13;
  --panel: #10141B;
  --panel2: #161B24;
  --card: #1A2130;
  --accent: #F6D400;
  --blue: #00A8E1;
  --text: #FFFFFF;
  --dim: #8A93A5;
  --dim2: #B6BFCE;
  --danger: #E8484F;
  --sidebar-w: 68px;
  /* Estas las sobre-escribe applyBranding() con los valores del panel */
  --sidebar-text: #8A93A5;   /* sidebarTextColor */
  --content-text: #CCCCCC;   /* contentTextColor (títulos de pósters) */
  --focus: #E9EDF2;          /* tvFocusColor (foco de categorías/guía/pósters) */
  --focus-text: #000000;     /* tvFocusTextColor */
  --sidebar-bg: #10141B;     /* sidebarBgColor + sidebarBgOpacity */
  --sidebar-focus: #E9EDF2;  /* sidebarFocusColor (foco del menú) */
  --sidebar-focus-text: #000000; /* sidebarFocusTextColor */
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}
#app { height: 100vh; display: flex; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2A3344; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Arranque / spinner ── */
.boot {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
}
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid #2A3344; border-top-color: var(--blue);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot p { color: var(--dim); }
.boot-logo { width: 200px; max-width: 60vw; object-fit: contain; }

/* ══ LOGIN (misma composición que la app: cover + tarjeta) ══ */
.login-screen {
  flex: 1; display: flex; align-items: center; justify-content: flex-start;
  background-size: cover; background-position: center; position: relative;
  overflow: hidden;
}
/* Fondos TMDB en slideshow con zoom lento (Ken Burns) + crossfade */
.login-screen .bg-slide {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.4s ease; will-change: opacity, transform;
}
.login-screen .bg-slide.kb { animation: kenburns 11s linear forwards; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.09); } }
.login-screen::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(5,7,10,.92) 0%, rgba(5,7,10,.55) 55%, rgba(5,7,10,.25) 100%);
}
.login-card {
  position: relative; z-index: 2;
  width: 360px; margin: 0; padding: 34px 30px;
  background: rgba(10, 13, 19, 0.82); border-radius: 18px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
/* Posición del cuadro (loginPosition del panel: left | center | right) */
.login-screen.pos-left   { justify-content: flex-start; }
.login-screen.pos-center { justify-content: center; }
.login-screen.pos-right  { justify-content: flex-end; }
.login-screen.pos-left   .login-card { margin: 0 0 0 6vw; }
.login-screen.pos-right  .login-card { margin: 0 6vw 0 0; }
.login-screen.pos-left::before   { background: linear-gradient(90deg, rgba(5,7,10,.92), rgba(5,7,10,.55) 55%, rgba(5,7,10,.2)); }
.login-screen.pos-center::before { background: linear-gradient(180deg, rgba(5,7,10,.5), rgba(5,7,10,.72)); }
.login-screen.pos-right::before  { background: linear-gradient(270deg, rgba(5,7,10,.92), rgba(5,7,10,.55) 55%, rgba(5,7,10,.2)); }
/* Colores personalizados del login (loginCustom del panel) */
.login-screen.lc .login-card { background: var(--lc-bg); border-radius: var(--lc-radius); }
.login-screen.lc .login-card label { color: var(--lc-text); }
.login-screen.lc .login-card input { background: var(--lc-input); color: var(--lc-input-text); border-color: transparent; }
.login-screen.lc .login-card input:focus { border-color: var(--lc-input-focus); }
.login-screen.lc .login-card .btn-primary { background: var(--lc-btn); color: var(--lc-btn-text); }
.login-screen.lc .login-card .btn-primary:hover { background: var(--lc-btn-focus); color: var(--lc-btn-focus-text); filter: none; }
/* max-width:100% para nunca desbordar el cuadro; el tamaño real lo fija el
   panel (loginLogoW/H) vía estilo en línea */
.login-card img.logo { max-width: 100%; object-fit: contain; align-self: center; }
/* El formulario manual es un hijo flex de la tarjeta: hereda el mismo ritmo
   vertical que tenían los campos cuando la tarjeta era el propio <form>. */
.login-manual { display: flex; flex-direction: column; gap: 14px; }
/* Separador "o" entre usuario/contraseña y código (modo contlogin1) */
.login-sep { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 13px; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: #FFFFFF24; }
/* Bloque del código de activación (contlogin1 y contlogin3) */
.login-code { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.login-code .lc-title {
  color: var(--dim2); font-size: 13px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
}
.login-code .lc-code {
  font-size: 34px; font-weight: 800; letter-spacing: 6px; line-height: 1.2;
  color: var(--blue); word-break: break-all;
}
.login-code .lc-status { color: var(--dim); font-size: 13px; }
.login-code .lc-status.ok  { color: #6EE7B7; }
.login-code .lc-status.err { color: var(--danger); }
.login-code .lc-regen {
  background: none; border: 1px solid #FFFFFF2E; color: var(--dim2);
  border-radius: 9px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.login-code .lc-regen:hover:not(:disabled) { border-color: var(--blue); color: #fff; }
.login-code .lc-regen:disabled { opacity: .5; cursor: default; }
.login-screen.lc .login-code .lc-code { color: var(--lc-btn); }
.login-card label { color: var(--dim2); font-size: 13px; font-weight: 600; }
.login-card input {
  background: #232B3A; border: 1px solid #2E394D; color: #fff;
  border-radius: 9px; padding: 11px 12px; font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--blue); }
.login-card .btn-primary {
  margin-top: 6px; background: #5BA0E6; color: #fff; border: none;
  padding: 12px; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.login-card .btn-primary:hover { filter: brightness(1.1); }
/* Alineación del texto de los botones del login según el panel
   (Branding → Login → Alineación del texto en los botones). Los <button>
   centran por defecto, así que sin esto el ajuste no se notaría. */
.login-screen .login-card .btn-primary,
.login-screen .login-code .lc-regen { text-align: var(--lc-btn-align, center); }
.login-card .error { color: var(--danger); font-size: 13px; min-height: 17px; }

/* ══ LAYOUT PRINCIPAL: sidebar + contenido ══
   Rail del Roku (1920px→pantalla): colapsado 110px con logo arriba e íconos
   centrados verticalmente; al pasar el mouse se expande a 360px con textos,
   separador bajo el logo y "Cerrar sesión" anclado abajo (pill rojo). */
.sidebar {
  width: 66px; min-width: 66px; height: 100%; border-right: 1px solid #FFFFFF14;
  background: var(--sidebar-bg, var(--panel)); display: flex; flex-direction: column;
  align-items: stretch; padding: 10px 0; z-index: 30;
  transition: width .18s ease; overflow: hidden;
}
.sidebar:hover { width: 210px; }
/* Logo del rail: rellena la caja como en Android/Roku (FillBounds/scaleToFill).
   Colapsado ~ cuadro del rail; expandido crece proporcional al sidebar amplio. */
.sidebar .s-logo {
  width: 100%; height: 48px; object-fit: fill;
  padding: 0 4px; margin: 3px 0 6px; flex: none; transition: height .18s ease;
}
.sidebar:hover .s-logo { height: 118px; padding: 6px 16px 0; }
/* El logo local (sin logo en el panel) sí conserva su proporción: es cuadrado
   y estirarlo al rail lo deformaría. */
.sidebar .s-logo.local { object-fit: contain; }
/* Separador bajo el logo (sbExpSep del Roku, sólo expandido) */
.s-sep { height: 2px; margin: 10px 16px 8px; background: #FFFFFF30; opacity: 0; }
.sidebar:hover .s-sep { opacity: 1; }
/* Grupo de ítems: centrado vertical en rail, arriba al expandir */
.s-items {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: 7px; overflow: hidden;
}
.sidebar:hover .s-items { justify-content: flex-start; gap: 3px; margin-top: 6px; overflow-y: auto; }
.s-item {
  display: flex; align-items: center; gap: 14px;
  color: var(--sidebar-text); background: none; border: none; cursor: pointer;
  padding: 9px 0 9px 22px; font-size: 14px; border-radius: 10px; margin: 0 8px;
  white-space: nowrap;
}
/* Rail colapsado: ícono centrado (sin texto); al expandir vuelve el sangrado */
.sidebar:not(:hover) .s-item { padding: 9px 0; justify-content: center; }
.s-item svg { width: 21px; height: 21px; min-width: 21px; fill: currentColor; }
/* El texto no debe ocupar espacio en el rail colapsado (empujaba el ícono) */
.s-item span { opacity: 0; transition: opacity .15s; }
.sidebar:not(:hover) .s-item span { display: none; }
.sidebar:hover .s-item span { opacity: 1; }
/* Foco del sidebar = sidebarFocusColor del panel (distinto del de contenido) */
.s-item:hover { background: var(--sidebar-focus, var(--focus)); color: var(--sidebar-focus-text, var(--focus-text)); }
.s-item.active { color: var(--text); font-weight: 700; }
/* Cerrar sesión: footer anclado abajo con separador y color rojo */
.s-logout-sep { height: 2px; margin: 4px 12px; background: #FFFFFF22; flex: none; }
.s-item.logout { color: var(--danger); flex: none; }
.s-item.logout:hover { background: var(--danger); color: #fff; }

/* flex column para que el loader (.boot flex:1) quede centrado, no arriba */
.main { flex: 1; height: 100%; overflow-y: auto; position: relative; display: flex; flex-direction: column; }

/* ══ HOME (guía en vivo estilo TV) ══
   Medidas del Roku (pantalla 1920x1080): el video es EXACTAMENTE el cuarto
   superior derecho = 960x540px = mitad del ancho, 16:9. La guía arranca
   pegada al video y el hero (izquierda) ocupa el alto del video. */
.home { display: flex; flex-direction: column; height: 100%; }
/* Alto EXACTO del video (44vw de ancho, 16:9) → la guía se pega al borde
   inferior del mini reproductor, sin que el hero pueda empujarla */
.home-top { position: relative; display: flex; align-items: stretch; height: calc(44vw * 9 / 16); }
.hero { flex: 1; min-width: 0; min-height: 0; overflow: hidden; padding: 26px 14px 6px 30px; display: flex; gap: 20px; align-items: flex-start; }
/* Nombre de la categoría: overlay al pie del hero, alineado sobre la guía
   (como el guideHeader del Roku / catName de Android) — no ocupa alto entre
   el video y las filas */
.cat-name { position: absolute; left: 242px; bottom: 6px; margin: 0; z-index: 3;
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .3px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6); }
/* Tarjeta del programa/canal enfocado (heroPoster del Roku 180x256px) */
.hero-poster {
  width: 128px; min-width: 128px; height: 182px; border-radius: 12px;
  background: var(--card); display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex: none;
}
/* Logo del canal: centrado con aire alrededor */
.hero-poster img { max-width: 82%; max-height: 72%; object-fit: contain; }
/* Póster TMDB del programa al aire: llena la tarjeta (2:3), como el Roku */
.hero-poster img.art { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: cover; }
.hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; padding-top: 2px; }
.hero .h-channel { color: var(--blue); font-weight: 700; font-size: 15px; }
.hero .h-title { font-size: 25px; font-weight: 800; line-height: 1.15; max-height: 62px; overflow: hidden; }
.hero .h-times { display: flex; align-items: center; gap: 12px; }
.badge-live {
  background: var(--accent); color: #000; font-weight: 800; font-size: 12px;
  padding: 5px 10px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px;
}
.badge-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #E0332A; }
.hero .h-desc { color: var(--dim2); font-size: 13.5px; line-height: 1.5; max-height: 105px; overflow: hidden; }
/* Mini reproductor: mitad del ancho de pantalla, 16:9, rectangular (como el
   Roku), con la curva del borde izquierdo (curve_overlay) y reloj arriba-der */
.mini-wrap {
  width: 44vw; flex: none; aspect-ratio: 16 / 9; position: relative; overflow: hidden;
  background: #000 var(--player-bg, none) center/cover no-repeat;
}
.mini-wrap video { width: 100%; height: 100%; object-fit: cover; }
/* Imagen "canal no disponible" del panel (offlineImage), sobre el mini */
.mini-offline { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
/* Spinner mientras sintoniza */
.mini-spin { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1; pointer-events: none; }
.mini-spin .spinner { width: 34px; height: 34px; border-width: 3px; }
.mini-curve {
  position: absolute; left: 0; top: 0; height: 100%; aspect-ratio: 130 / 540;
  z-index: 1; pointer-events: none;
  background: url("../images/curve_overlay.png") left center / 100% 100% no-repeat;
}
.mini-clock {
  position: absolute; top: 12px; right: 16px; font-size: 20px; font-weight: 700;
  color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.8); z-index: 2;
}

/* La guía arranca pegada al borde inferior del video (Roku 540→552px) */
.home-bottom { flex: 1; display: flex; min-height: 0; padding: 8px 22px 14px 30px; }
.home-lists { flex: 1; display: flex; min-height: 0; gap: 22px; }
.cat-col { width: 190px; min-width: 190px; overflow-y: auto; }
.cat-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--home-cat-text, rgba(255,255,255,.75)); font-size: 14px; padding: 9px 12px; cursor: pointer;
  border-radius: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Colores de la guía del Home (panel: Branding → Home → Guía del Home).
   Heredan de los de TV en Vivo mientras el admin no los defina. */
.cat-item:hover { background: var(--home-guide-focus, var(--focus)); color: var(--home-guide-focus-text, var(--focus-text)); }
.cat-item.active { color: #fff; font-weight: 800; }
.guide-col { flex: 1; overflow-y: auto; min-width: 0; }
.guide-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: rgba(255,255,255,.06); border: none;
  color: var(--home-guide-text, #fff); cursor: pointer;
  border-radius: 10px; padding: 8px 14px; margin-bottom: 6px; text-align: left;
}
.guide-row:hover { background: var(--home-guide-focus, var(--focus)); color: var(--home-guide-focus-text, var(--focus-text)); }
.guide-row:hover .g-dim, .guide-row:hover .g-remain { color: var(--home-guide-focus-text, var(--focus-text)); opacity: .75; }
.guide-row .g-logo {
  width: 66px; height: 40px; min-width: 66px; background: var(--card); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.guide-row .g-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.guide-row .g-mid { flex: 1; min-width: 0; }
.guide-row .g-times { font-size: 12px; display: flex; gap: 12px; }
.g-dim { color: var(--dim); }
.g-remain { color: var(--accent); font-weight: 700; }
.guide-row .g-title { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide-row .g-next { width: 240px; min-width: 160px; font-size: 12px; border-left: 1px solid rgba(255,255,255,.15); padding-left: 12px; }
.guide-row .g-next .n-hdr { color: var(--dim); font-size: 10.5px; letter-spacing: .5px; }
.guide-row .g-next .n-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ══ PLAYER EN VIVO FULLSCREEN ══ */
.live-player {
  position: fixed; inset: 0; z-index: 100;
  background: #000 var(--player-bg, none) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
}
.live-player video { width: 100%; height: 100%; object-fit: contain; }
/* Imagen "canal no disponible" del panel (offlineImage) en pantalla completa */
.lp-offline { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1; background: #000; }
.lp-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 700; text-shadow: 0 1px 8px #000;
  pointer-events: none;
}
.lp-banner {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 34px 22px;
  background: linear-gradient(transparent, rgba(0,0,0,.92));
  display: flex; flex-direction: column; gap: 10px;
}
.lp-row { display: flex; align-items: center; gap: 16px; }
.lp-logo {
  width: 84px; height: 52px; min-width: 84px; border-radius: 8px; background: var(--card);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.lp-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lp-info { flex: 1; min-width: 0; }
.lp-name { font-size: 18px; font-weight: 800; }
.lp-prog { color: var(--dim2); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-time { color: var(--dim); font-size: 13px; }
.lp-btn {
  background: rgba(255,255,255,.14); color: #fff; border: none; cursor: pointer;
  width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.lp-btn:hover { background: #E9EDF2; color: #000; }
.lp-btn svg { width: 20px; height: 20px; fill: currentColor; }
.lp-progress { height: 4px; background: rgba(255,255,255,.2); border-radius: 2px; overflow: hidden; }
.lp-progress > div { height: 100%; background: var(--accent); }
.lp-next { color: var(--dim); font-size: 13px; }
.lp-back {
  position: absolute; top: 18px; left: 18px; z-index: 5;
  background: rgba(0,0,0,.45); border: none; color: #fff; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.lp-back:hover { background: #E9EDF2; color: #000; }
.lp-back svg { width: 22px; height: 22px; fill: currentColor; }

/* Panel de canales dentro del player */
.lp-channels {
  position: absolute; top: 0; left: 0; bottom: 0; width: 320px;
  background: rgba(11,14,19,.96); padding: 16px 0; overflow-y: auto; z-index: 6;
}
.lp-channels h3 { padding: 0 18px 10px; font-size: 15px; }
.lpc-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; color: #fff; cursor: pointer;
  padding: 8px 16px; text-align: left; font-size: 13.5px;
}
.lpc-item:hover { background: rgba(255,255,255,.1); }
.lpc-item.current { background: rgba(246,212,0,.15); color: var(--accent); }
.lpc-item .g-logo { width: 52px; height: 30px; min-width: 52px; }

/* ══ GRIDS (Películas / Series) ══ */
.grid-screen { display: flex; height: 100%; }
.grid-side {
  width: 250px; min-width: 210px; background: var(--panel);
  padding: 22px 14px; overflow-y: auto; border-radius: 0 14px 14px 0;
}
/* Caja de búsqueda. Se usa en DOS sitios: el lateral de Películas/Series
   (dentro de .grid-side) y la pantalla Buscar (dentro de .grid-main). Las
   reglas van sin anidar a .grid-side; anidadas, la pantalla Buscar se
   quedaba sin estilo y la lupa crecía hasta ocupar la pantalla. */
.search-box {
  display: flex; align-items: center; gap: 8px; background: #232B3A;
  border-radius: 10px; padding: 9px 12px; margin-bottom: 18px;
}
.search-box input {
  flex: 1; background: none; border: none; outline: none; color: #fff; font-size: 13.5px; min-width: 0;
}
/* min-width: sin él, flex encoge el svg y se deforma en pantallas estrechas */
.search-box svg { width: 16px; height: 16px; min-width: 16px; fill: var(--dim); }
/* Pantalla Buscar: misma caja, algo más grande y sin ocupar todo el ancho */
.search-box.search-top { max-width: 560px; padding: 12px 14px; margin-bottom: 0; }
.search-box.search-top input { font-size: 15px; }
.search-box.search-top svg { width: 18px; height: 18px; min-width: 18px; }
.search-box:focus-within { box-shadow: 0 0 0 1px var(--blue) inset; }
.grid-main { flex: 1; overflow-y: auto; padding: 24px 26px; }
.poster-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 16px;
}
.poster-card { background: none; border: none; cursor: pointer; color: #fff; text-align: left; }
.poster-card .p-img {
  aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; background: var(--card); margin-bottom: 8px;
}
.poster-card .p-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-card:hover .p-img { outline: 3px solid var(--focus); }
.poster-card .p-title { font-size: 13.5px; font-weight: 600; color: var(--content-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster-card .p-meta { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-count { color: var(--dim); font-size: 13px; text-align: right; padding: 14px 4px 0; }

/* ══ DETALLES ══ */
.details {
  position: fixed; inset: 0; z-index: 90; overflow-y: auto;
  background: rgba(5,7,10,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.det-card {
  width: min(980px, 94vw); max-height: 92vh; overflow-y: auto;
  background: var(--panel); border-radius: 18px; position: relative;
}
.det-backdrop { position: relative; height: 300px; background-size: cover; background-position: center top; border-radius: 18px 18px 0 0; }
.det-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, var(--panel)); }
.det-body { padding: 0 30px 28px; margin-top: -60px; position: relative; display: flex; gap: 24px; }
.det-poster { width: 150px; min-width: 150px; border-radius: 12px; overflow: hidden; background: var(--card); align-self: flex-start; }
.det-poster img { width: 100%; display: block; }
.det-info { flex: 1; min-width: 0; }
.det-info h2 { font-size: 24px; margin-bottom: 8px; }
.det-meta { color: var(--dim); font-size: 13.5px; margin-bottom: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.det-meta .stars { color: var(--accent); }
.det-actions { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.btn-play {
  background: #5BA0E6; border: none; color: #fff; font-weight: 800; font-size: 15px;
  padding: 12px 26px; border-radius: 24px; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.btn-play svg { width: 18px; height: 18px; fill: currentColor; }
.btn-sec {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff;
  font-size: 14px; padding: 12px 20px; border-radius: 24px; cursor: pointer;
}
.btn-sec:hover, .btn-play:hover { filter: brightness(1.15); }
.det-plot { color: var(--dim2); font-size: 14px; line-height: 1.6; }
.det-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  background: rgba(0,0,0,.5); border: none; color: #fff; cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%; font-size: 20px;
}
.det-genre { color: var(--dim); font-size: 13px; margin-bottom: 10px; }

/* Temporadas / episodios */
.seasons { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.season-chip {
  background: #232B3A; border: none; color: var(--dim2); padding: 8px 16px;
  border-radius: 16px; font-size: 13px; cursor: pointer;
}
.season-chip.active { background: var(--accent); color: #000; font-weight: 800; }
.ep-list { display: flex; flex-direction: column; gap: 8px; }
.ep-item {
  display: flex; gap: 12px; align-items: center; background: var(--panel2);
  border: none; color: #fff; border-radius: 12px; padding: 10px; cursor: pointer; text-align: left;
}
.ep-item:hover { background: #232B3A; }
.ep-thumb { width: 130px; min-width: 130px; aspect-ratio: 16/9; background: var(--card); border-radius: 8px; overflow: hidden; }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-t { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.ep-d { color: var(--dim); font-size: 12.5px; max-height: 34px; overflow: hidden; }

/* ══ VOD PLAYER ══ */
.vod-player { position: fixed; inset: 0; background: #000; z-index: 110; }
.vod-player video { width: 100%; height: 100%; }
.vod-title {
  position: absolute; top: 16px; left: 76px; right: 100px; color: #fff; font-weight: 700;
  font-size: 16px; text-shadow: 0 1px 6px #000; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ══ Toast ══ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); color: #fff; padding: 12px 22px; border-radius: 24px;
  font-size: 14px; z-index: 200; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ══ Mi Cuenta (modal) ══ */
.modal-back {
  position: fixed; inset: 0; z-index: 210; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px); animation: toastIn .18s ease;
}
/* Diálogo horizontal: logo lateral + detalles (como el AccountDialog del Roku/Android) */
.account-card {
  position: relative; width: 620px; max-width: 94vw; background: #0B0E13;
  border: 1px solid #FFFFFF14; border-radius: 18px; padding: 24px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); display: flex; gap: 24px; align-items: center;
}
.account-logo {
  width: 200px; min-width: 200px; height: 268px; border-radius: 12px; background: #0E1116;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.account-logo img { object-fit: contain; }
.account-body { flex: 1; min-width: 0; }
.modal-x {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%;
  background: #FFFFFF12; color: #fff; border: none; cursor: pointer; font-size: 14px; z-index: 1;
}
.modal-x:hover { background: var(--danger); }
.account-body h3 { font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.account-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.account-row { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.account-row span { color: var(--dim2); min-width: 150px; }
.account-row b { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-close { background: #0066FF; }

/* ══ Popup "Actualizando contenido" ══ */
.update-card {
  width: 360px; max-width: 92vw; background: var(--panel);
  border: 1px solid #FFFFFF14; border-radius: 16px; padding: 24px 26px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
}
.update-hd { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.update-hd .spinner { width: 22px; height: 22px; border-width: 3px; }
.update-hd h3 { font-size: 18px; font-weight: 800; }
.update-rows { display: flex; flex-direction: column; }
.update-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 2px; border-bottom: 1px solid #FFFFFF10; font-size: 15px;
}
.update-row:last-child { border-bottom: none; }
.update-row i {
  width: 20px; height: 20px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid #2A3344; border-top-color: var(--blue); animation: spin .9s linear infinite;
}
.update-row.done i { border-color: transparent; animation: none; position: relative; }
.update-row.done i::after {
  content: "✓"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: #4ADE80; font-size: 16px; font-weight: 800;
}

/* ══ Ajustes / Control Parental ══ */
.settings-screen { height: 100%; overflow-y: auto; }
.set-gate {
  max-width: 340px; margin: 8vh auto 0; text-align: center; display: flex;
  flex-direction: column; align-items: center; gap: 12px; padding: 0 20px;
}
.set-gate .set-lock svg { width: 54px; height: 54px; fill: var(--blue); }
.set-gate h2 { font-size: 22px; }
.set-gate .pin-input {
  width: 160px; text-align: center; letter-spacing: 8px; font-size: 22px;
  background: #232B3A; border: 1px solid #2E394D; color: #fff; border-radius: 10px; padding: 10px;
}
.set-gate .pin-err { color: var(--danger); font-size: 13px; min-height: 16px; }
.set-gate .btn-primary { background: #5BA0E6; color: #fff; border: none; padding: 11px 30px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.set-body { max-width: 720px; margin: 0 auto; padding: 30px 30px 40px; }
.set-title { font-size: 24px; margin-bottom: 20px; }
.set-card { background: var(--panel2); border: 1px solid #FFFFFF10; border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
.set-card h3 { font-size: 16px; margin-bottom: 12px; }
.set-row2 { display: flex; gap: 10px; flex-wrap: wrap; }
.set-row2 input { flex: 1; min-width: 120px; background: #232B3A; border: 1px solid #2E394D; color: #fff; border-radius: 9px; padding: 10px 12px; }
.btn-mini { background: #5BA0E6; color: #fff; border: none; border-radius: 9px; padding: 10px 18px; font-weight: 700; cursor: pointer; }
.btn-mini:hover { filter: brightness(1.1); }
.set-msg { font-size: 13px; min-height: 16px; margin-top: 8px; }
.set-opt { display: flex; align-items: center; gap: 10px; padding: 8px 2px; cursor: pointer; font-size: 15px; }
.set-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.set-tab { background: #1A2130; color: var(--dim2); border: none; border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 14px; }
.set-tab.active { background: var(--blue); color: #fff; font-weight: 700; }
.cat-check-list { max-height: 320px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.cat-check { display: flex; align-items: center; gap: 10px; padding: 7px 2px; cursor: pointer; font-size: 14px; }
.cat-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-version { text-align: center; color: #5A6478; font-size: 11px; margin-top: 20px; }

/* ══ EN VIVO (TimeGrid: Categorías | Canales | Preview) ══ */
.live-screen { display: flex; height: 100%; }
.live-cats { width: 28%; max-width: 320px; min-width: 190px; background: #0A0A0A; display: flex; flex-direction: column; padding-top: 14px; }
.live-chans { width: 30%; max-width: 380px; min-width: 220px; background: rgba(20,20,20,.95); display: flex; flex-direction: column; padding-top: 14px; }
.live-preview { flex: 1; min-width: 0; padding: 16px; display: flex; flex-direction: column; }
.live-cats h3, .live-chans h3 { color: var(--blue); font-size: 19px; font-weight: 700; padding: 0 18px 10px; }
.lc-list { flex: 1; overflow-y: auto; padding: 0 12px; display: flex; flex-direction: column; gap: 3px; }
.lc-item {
  text-align: left; background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 15px; padding: 11px 14px; border-radius: 8px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lc-item:hover { background: var(--focus); color: var(--focus-text); }
.lc-item.active { color: #fff; font-weight: 700; }
.lch-list { flex: 1; overflow-y: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.lch-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.lch-item:hover { background: var(--focus); }
.lch-item:hover .lch-name, .lch-item:hover .lch-prog { color: var(--focus-text); }
.lch-item.active { background: rgba(255,255,255,.10); }
.lch-logo { width: 52px; height: 32px; min-width: 52px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lch-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lch-mid { min-width: 0; }
.lch-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lch-prog { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-mini { width: 100%; aspect-ratio: 16/9; position: relative; border-radius: 6px; overflow: hidden; background: #1A1A1A var(--player-bg, none) center/cover no-repeat; }
.lv-mini video { width: 100%; height: 100%; object-fit: cover; }
.lv-info { flex: 1; margin-top: 14px; background: rgba(26,26,26,.8); border-radius: 6px; padding: 16px; overflow-y: auto; }
.lvi-head { display: flex; align-items: center; gap: 12px; }
.lvi-logo { width: 50px; height: 40px; min-width: 50px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lvi-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lvi-title { font-size: 16px; font-weight: 700; }
.lvi-range { font-size: 12px; margin-top: 2px; }
.lvi-progress { height: 4px; background: #444; border-radius: 2px; margin-top: 12px; overflow: hidden; }
.lvi-progress > div { height: 100%; background: #DB4D3A; }
.lvi-next { font-size: 12px; margin-top: 8px; }
.lvi-desc { font-size: 12px; color: var(--dim2); line-height: 1.5; margin-top: 10px; }

/* ══ Video overlay (Tutorial) ══ */
.video-overlay { position: fixed; inset: 0; z-index: 120; background: #000; display: flex; align-items: center; justify-content: center; }
.video-overlay video { width: 100%; height: 100%; }
.vo-close { position: absolute; top: 18px; left: 18px; }

/* ══ Deportes (schedule de eventos) ══ */
.sports-screen { display: flex; height: 100%; }
.sports-side { width: 220px; min-width: 220px; background: var(--panel); padding: 20px 14px; overflow-y: auto; }
.sports-side h3 { color: var(--dim); font-size: 12px; letter-spacing: 1.5px; margin-bottom: 12px; }
.league-list { display: flex; flex-direction: column; gap: 4px; }
.league-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: rgba(255,255,255,.8); font-size: 14px; padding: 10px 12px; border-radius: 9px;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.league-item:hover { background: var(--sports-focus, var(--focus)); color: var(--focus-text); }
.league-item.active { color: #fff; font-weight: 700; background: rgba(255,255,255,.08); }
.sports-main { flex: 1; overflow-y: auto; padding: 24px 30px; min-width: 0; }
.sp-title { color: var(--sports-title, #fff); font-size: 22px; margin-bottom: 18px; }
.events-list { display: flex; flex-direction: column; gap: 10px; }
.event-row { display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,.05); border-radius: 12px; padding: 14px 18px; }
.ev-team { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.ev-home { justify-content: flex-end; text-align: right; }
.ev-away { justify-content: flex-start; }
.ev-team img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.ev-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-mid { text-align: center; min-width: 118px; }
.ev-score { font-size: 20px; font-weight: 800; }
.ev-when { font-size: 12px; color: var(--dim); margin-top: 4px; }
.ev-live { color: var(--accent); font-weight: 700; }
/* Evento enlazado a un canal en vivo → clickable + botón "Ver" */
.event-row.has-channel { cursor: pointer; }
.event-row.has-channel:hover { background: rgba(255,255,255,.09); }
.ev-watch {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  background: var(--accent); color: #000; border: none; border-radius: 8px;
  padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.ev-watch svg { width: 16px; height: 16px; fill: currentColor; }
.ev-watch:hover { filter: brightness(1.08); }

/* ══ Responsive (celular) ══ */
@media (max-width: 860px) {
  .sports-screen { flex-direction: column; }
  .sports-side { width: 100%; min-width: 0; }
  .league-list { flex-direction: row; overflow-x: auto; }
  .league-item { width: auto; }
  .ev-team img { width: 30px; height: 30px; }
  .ev-mid { min-width: 90px; }
  .cat-check-list { grid-template-columns: 1fr; }
  .set-body { padding: 20px 16px 32px; }
  .account-card { flex-direction: column; width: 92vw; }
  .account-logo { display: none; }
  .account-row span { min-width: 120px; }
  /* En vivo: preview arriba, categorías y canales en fila abajo */
  .live-screen { flex-direction: column; }
  .live-preview { order: -1; padding: 12px; }
  .live-cats, .live-chans { width: 100%; max-width: none; flex-direction: row; overflow-x: auto; padding: 8px; }
  .live-cats h3, .live-chans h3 { display: none; }
  .lc-list, .lch-list { flex-direction: row; }
  .lc-item { width: auto; }
  .lch-item { min-width: 180px; }
  /* ══ Celular: misma composición que MobileHome.kt de Android ══
     barra superior (logo + iconos) → reproductor 16:9 a ancho completo →
     chips de categorías en fila → lista VERTICAL de canales. El rail lateral
     no cabe en un teléfono: se convierte en esa barra superior. */
  #app { flex-direction: column; }

  /* ── Barra superior ── */
  .sidebar, .sidebar:hover {
    width: 100%; height: auto; flex-direction: row; align-items: center;
    padding: 6px 8px; gap: 2px; flex: none;
    position: sticky; top: 0; z-index: 40; overflow: visible;
  }
  .sidebar .s-logo, .sidebar:hover .s-logo {
    width: auto; height: 36px; max-width: 46vw; object-fit: contain;
    padding: 0; margin: 0 6px 0 2px; flex: none;
  }
  .s-sep, .sidebar:hover .s-sep, .s-logout-sep { display: none; }
  /* Iconos: fila desplazable, sin etiquetas (como la top bar de Android) */
  .s-items, .sidebar:hover .s-items {
    flex: 1; flex-direction: row; justify-content: flex-end; align-items: center;
    gap: 0; margin: 0; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .s-items::-webkit-scrollbar { display: none; }
  .s-item {
    flex: none; width: 42px; height: 42px; padding: 0; gap: 0;
    justify-content: center; border-radius: 50%;
  }
  .s-item span { display: none; }          /* sólo iconos */
  .s-item svg { width: 22px; height: 22px; }
  .s-item.logout { margin-left: 2px; }

  /* ── Contenido ── */
  main { flex: 1; min-height: 0; }
  .home-top { flex-direction: column; height: auto; }
  .mini-wrap {
    width: 100%; aspect-ratio: 16/9; height: auto; order: -1;
    border-radius: 0; margin: 0;
  }
  .mini-curve, .hero-poster { display: none; }
  /* Ficha del programa bajo el vídeo, compacta */
  .hero { padding: 10px 14px 2px; }
  .h-desc { display: none; }
  .h-title { font-size: 16px; }
  .cat-name { margin: 6px 0 0 14px; font-size: 13px; }

  /* min-width:0 en toda la cadena: por defecto un flex item no encoge por
     debajo de su contenido (min-width:auto), así que las tiras horizontales
     con nowrap estiraban el layout y desbordaban la pantalla. */
  .home-bottom { padding: 6px 0 16px; min-width: 0; }
  .home-lists { flex-direction: column; gap: 8px; min-height: 0; min-width: 0; }
  /* Categorías: chips horizontales */
  .cat-col {
    width: 100%; min-width: 0; max-width: 100%; flex: none; display: flex;
    overflow-x: auto; overflow-y: hidden; white-space: nowrap;
    padding: 0 12px; scrollbar-width: none;
  }
  .cat-col::-webkit-scrollbar { display: none; }
  .cat-list { display: flex; gap: 8px; }
  .cat-item {
    width: auto; flex: none; padding: 7px 14px; border-radius: 999px;
    background: #FFFFFF14; font-size: 13px;
  }
  .cat-item.active { background: var(--home-guide-focus, var(--focus)); color: var(--home-guide-focus-text, var(--focus-text)); }
  /* Canales: lista vertical, cómoda para el dedo */
  .guide-col { flex: 1; min-height: 0; min-width: 0; max-width: 100%; overflow-y: auto; padding: 0 12px; }
  .guide-row { padding: 10px 8px; gap: 12px; }
  .guide-row .g-logo { width: 52px; height: 38px; flex: none; }
  .guide-row .g-title { font-size: 15px; }
  .guide-row .g-next { display: none; }
  .grid-screen { flex-direction: column; }
  .grid-side { width: 100%; border-radius: 0; padding: 12px 14px; }
  .det-body { flex-direction: column; }
  .det-poster { display: none; }
}
