/* =========================================================
   SANSAT LIVE TV & PC ENGINE — MODERN HIGH-PERFORMANCE UI
   Calibrated 1rem = 16px @ 1920x1080 (120rem x 67.5rem stage).
   Supports Android TV Remote (D-Pad), PC Keyboard, Mouse, and Wheel.
   100% Isolated for TV & Desktop (Zero interference with Mobile).
========================================================= */

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./fonts/tajawal-regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/tajawal-bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./fonts/tajawal-bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('./fonts/tajawal-extrabold.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('./fonts/tajawal-black.ttf') format('truetype');
}

@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./fonts/tajawal-regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/tajawal-medium.ttf') format('truetype');
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./fonts/tajawal-bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('./fonts/tajawal-extrabold.ttf') format('truetype');
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('./fonts/tajawal-black.ttf') format('truetype');
}

html.tv-live-mode {
  font-size: calc(100vw / 120) !important;
}

@media (min-aspect-ratio: 16/9) {
  html.tv-live-mode {
    font-size: calc(100vh / 67.5) !important;
  }
}

#tv-live-app {
  --bg: #12070b;
  --bg2: #2a0b14;
  --panel: #1d0a11;
  --accent: #dc2626;
  --gold: #facc15;
  --text: #f6eef0;
  --muted: #b9a3aa;

  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(120deg, var(--bg2) 0%, var(--bg) 75%);
  color: var(--text);
  font-family: "Tajawal", "Noto Sans Arabic", "Segoe UI", Roboto, Arial, sans-serif !important;
  direction: ltr !important;
  user-select: none;
  -webkit-user-select: none;
  z-index: 1;
}

#tv-live-app,
#tv-live-app #stage,
#tv-live-app .col,
#tv-live-app #cats,
#tv-live-app #chs,
#tv-live-app #right,
#tv-live-app #epgf,
#tv-live-app #btns,
#tv-live-app .row,
#tv-live-app .ov,
#tv-live-app #rOv,
#tv-live-app #pmOv,
#tv-live-app #sOv,
#tv-live-app #fOv,
#tv-live-app #epgModal {
  direction: ltr !important;
}

#tv-live-app,
#tv-live-app *,
#tv-live-app h1,
#tv-live-app h2,
#tv-live-app h3,
#tv-live-app h4,
#tv-live-app h5,
#tv-live-app h6,
#tv-live-app p,
#tv-live-app span,
#tv-live-app div,
#tv-live-app button,
#tv-live-app input,
#tv-live-app #pmOv,
#tv-live-app #pmOv *,
#tv-live-app #pmT,
#tv-live-app #pmD,
#tv-live-app #pmCard,
#tv-live-app #epgf,
#tv-live-app #epgf * {
  font-family: "Tajawal", "Noto Sans Arabic", "Segoe UI", Roboto, Arial, sans-serif !important;
}

#tv-live-app *,
#tv-live-app *::before,
#tv-live-app *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#tv-live-app #stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120rem;
  height: 67.5rem;
  margin: -33.75rem 0 0 -60rem;
}

/* ====== COLUMNAS (se recolocan según el modo: n = normal, e = EPG completo) ====== */
#tv-live-app .col {
  position: absolute;
  top: 3rem;
  bottom: 3rem;
}

#tv-live-app #cats {
  left: 2.5rem;
  width: 25rem;
}

#tv-live-app #chs {
  left: 29rem;
  width: 42rem;
}

#tv-live-app #right {
  left: 73rem;
  width: 44.5rem;
  --ph: 25rem;
}

#tv-live-app #epgf {
  left: 85.5rem;
  width: 32rem;
  visibility: hidden;
}

#tv-live-app #stage[data-m="e"] #cats {
  visibility: hidden;
}

#tv-live-app #stage[data-m="e"] #chs {
  left: 2.5rem;
  width: 38rem;
}

#tv-live-app #stage[data-m="e"] #right {
  left: 42rem;
  width: 42rem;
  --ph: 23.6rem;
}

#tv-live-app #stage[data-m="e"] #epgf {
  visibility: visible;
}

#tv-live-app #cats .vp,
#tv-live-app #chs .vp {
  top: 0;
  bottom: 0;
}

#tv-live-app #epgf h3 {
  height: 5rem;
  font-size: 2.3rem;
  font-weight: 800;
  border-bottom: 0.2rem solid rgba(255, 255, 255, 0.14);
  line-height: 4rem;
  margin-right: 1.6rem;
}

#tv-live-app #epgf .vp {
  top: 5.6rem;
  bottom: 0;
}

/* Animación EPG: deslizamiento (ea = activa, et = transiciones) */
#tv-live-app #stage.ea #cats,
#tv-live-app #stage.ea #epgf {
  visibility: visible;
}

#tv-live-app #stage.ea .col {
  will-change: transform, opacity;
}

#tv-live-app #stage.et #cats,
#tv-live-app #stage.et #chs,
#tv-live-app #stage.et #right,
#tv-live-app #stage.et #epgf {
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
}

/* ====== LISTA VIRTUAL (filas reutilizadas, sin scrollbar nativo) ====== */
#tv-live-app .vp {
  position: absolute;
  left: 0;
  right: 0;
  overflow: hidden;
}

#tv-live-app .vbox {
  position: absolute;
  left: 0;
  top: 0;
  right: 1.6rem;
  will-change: transform;
  transition: transform 0.16s ease-out;
}

#tv-live-app .row {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 0.9rem;
  color: #eadde1;
  font-weight: 700;
  contain: layout paint;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

#tv-live-app .row .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tv-live-app .sb {
  position: absolute;
  right: 0.3rem;
  top: 0;
  bottom: 0;
  width: 0.4rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.12);
  display: none;
}

#tv-live-app .sb i {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.55);
  will-change: transform;
}

/* Estados: on = seleccionado/reproduciendo (rojo) · f = foco (blanco, solo en la zona activa) */
#tv-live-app .row.on {
  background: var(--accent);
  color: #fff;
}

#tv-live-app .row.on small,
#tv-live-app .row.on .no {
  color: #ffd6de;
}

#tv-live-app .vp.act .row.f {
  background: #fff;
  color: #111;
}

#tv-live-app .vp.act .row.f small,
#tv-live-app .vp.act .row.f .no {
  color: #555;
}

#tv-live-app .vp.act .row.f.on {
  color: var(--accent);
}

#tv-live-app .vp:not(.act) .row.f:not(.on) {
  background: rgba(255, 255, 255, 0.12);
}

/* Categorías */
#tv-live-app .ct {
  height: 4.4rem;
  padding: 0 1.4rem;
  justify-content: space-between;
  font-size: 1.55rem;
}

#tv-live-app .ct .nm {
  margin-right: 1rem;
}

#tv-live-app .ct small {
  flex: none;
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: 700;
}

#tv-live-app .ct.ra {
  border: 0.2rem solid var(--accent);
  color: #fff;
  background: rgba(225, 29, 72, 0.16);
}

#tv-live-app .vp.act .ct.ra.f {
  border-color: #fff;
}

#tv-live-app .ct.gr {
  outline: 0.3rem solid var(--gold);
  outline-offset: -0.3rem;
  background: #fff;
  color: #111;
}

#tv-live-app .ct.gr small {
  color: #555;
}

/* Canales */
#tv-live-app .ch {
  height: 4.6rem;
  padding: 0 1.2rem;
  font-size: 1.55rem;
}

#tv-live-app .ch .no {
  width: 3.4rem;
  flex: none;
  color: var(--muted);
  font-size: 1.4rem;
  text-align: center;
  margin-right: 1rem;
}

#tv-live-app .lg {
  width: 5.2rem;
  height: 3.4rem;
  flex: none;
  margin-right: 1.3rem;
  border-radius: 0.6rem;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#tv-live-app .lg img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

#tv-live-app .lg b {
  font-size: 1.3rem;
  color: #fff;
  font-weight: 800;
}

#tv-live-app .ch .st {
  visibility: hidden;
  color: var(--gold);
  font-style: normal;
  margin-left: 0.8rem;
  font-size: 1.6rem;
  flex: none;
}

#tv-live-app .ch.fv .st {
  visibility: visible;
}

#tv-live-app .vp.act .row.f .st {
  color: #d97706;
}

#tv-live-app .row.on .st {
  color: #fff;
}

/* EPG completo */
#tv-live-app .ep {
  height: 4.2rem;
  padding: 0 1.2rem;
  font-size: 1.5rem;
}

#tv-live-app .ep .tm {
  width: 6rem;
  flex: none;
  color: var(--muted);
  font-weight: 700;
}

#tv-live-app .ep em {
  display: none;
  flex: none;
  margin-left: 0.8rem;
  font-style: normal;
  font-size: 1.05rem;
  font-weight: 800;
  border: 0.15rem solid #fff;
  border-radius: 0.5rem;
  padding: 0.1rem 0.6rem;
  letter-spacing: 0.04em;
}

#tv-live-app .ep.on em {
  display: inline-block;
}

#tv-live-app .ep.past {
  opacity: 0.55;
}

#tv-live-app #empty {
  position: absolute;
  left: 0;
  right: 1.6rem;
  top: 10rem;
  text-align: center;
  font-size: 1.6rem;
  line-height: 2.5rem;
  color: var(--muted);
  white-space: pre-line;
  display: none;
}

/* ====== COLUMNA DERECHA: reproductor + info + botones + EPG ====== */
#tv-live-app #pv {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--ph);
  border-radius: 1.2rem;
  overflow: hidden;
  background: #000;
  transform-origin: 0 0;
  cursor: pointer;
}

#tv-live-app #pv.full {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  z-index: 1000;
}

#tv-live-app #pvSlot {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--ph);
  visibility: hidden;
  pointer-events: none;
}

#tv-live-app #pv.anim {
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#tv-live-app #pv.anim.out {
  transition-duration: 0.25s;
}

#tv-live-app #pvName,
#tv-live-app #pvTag {
  transition: opacity 0.2s;
}

#tv-live-app #pv.anim #pvName,
#tv-live-app #pv.anim #pvTag {
  opacity: 0;
}

#tv-live-app #pvBg {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

#tv-live-app .live-preview-poster-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: radial-gradient(ellipse 90% 80% at 50% 45%, #2a0b12 0%, #0f0508 60%, #040102 100%);
  z-index: 2;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

#tv-live-app .live-preview-poster-logo {
  width: 5.6rem;
  height: 5.6rem;
  object-fit: contain;
  filter: drop-shadow(0 0.4rem 1.2rem rgba(229, 9, 20, 0.5));
}

#tv-live-app .pv-ch-logo-wrap {
  width: 7.2rem;
  height: 4.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tv-live-app .pv-ch-logo-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0.2rem 0.6rem rgba(0, 0, 0, 0.6));
}

#tv-live-app .pv-ch-logo-wrap b {
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
}

#tv-live-app #pvName {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 800;
  padding: 0 2rem;
  opacity: 0.95;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

#tv-live-app #pv.full #pvName {
  font-size: 4.4rem;
}

#tv-live-app #vid {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: none;
}

#tv-live-app #pvTag {
  position: absolute;
  left: 1.2rem;
  top: 1.2rem;
  background: var(--accent);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 0.2rem 0.8rem;
  border-radius: 0.5rem;
  letter-spacing: 0.05em;
  z-index: 2;
}

#tv-live-app #pv.full #pvTag {
  left: 3rem;
  top: 2.6rem;
  font-size: 1.5rem;
}

#tv-live-app #info {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--ph) + 1.2rem);
  height: 4.4rem;
  display: flex;
  align-items: center;
}

#tv-live-app #info .lg {
  width: 6.4rem;
  height: 4.4rem;
  margin-right: 1.4rem;
}

#tv-live-app #iName {
  font-size: 2.3rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tv-live-app #btns {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--ph) + 6.8rem);
  height: 5rem;
  display: flex;
}

#tv-live-app .btn {
  flex: 1;
  margin-left: 0.9rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.14);
  border: 0.2rem solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
  cursor: pointer;
}

#tv-live-app .btn:first-child {
  margin-left: 0;
}

#tv-live-app .btn svg {
  width: 2.4rem;
  height: 2.4rem;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#tv-live-app .btn.on {
  background: var(--accent);
  border-color: var(--accent);
}

#tv-live-app .btn.on svg.s {
  fill: #fff;
}

#tv-live-app .btn:hover,
#tv-live-app #stage[data-z="btns"] .btn.f,
#tv-live-app .btn.f {
  border-color: #fff !important;
  transform: scale(1.1);
}

#tv-live-app .btn:hover:not(.on),
#tv-live-app #stage[data-z="btns"] .btn.f:not(.on),
#tv-live-app .btn.f:not(.on) {
  background: rgba(0, 0, 0, 0.55);
}

#tv-live-app #mini {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--ph) + 13rem);
  bottom: 0;
  padding-top: 0.4rem;
}

#tv-live-app #mNow {
  height: 2.8rem;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 2.6rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

#tv-live-app #mBar,
#tv-live-app .obar {
  display: flex;
  align-items: center;
  height: 2.8rem;
  margin-bottom: 0.6rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: #e8dde0;
}

#tv-live-app .bar {
  flex: 1;
  height: 0.4rem;
  margin: 0 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

#tv-live-app .bar i {
  display: block;
  height: 100%;
  background: #fff;
  transform-origin: left;
  transform: scaleX(0);
}

#tv-live-app .mr {
  display: flex;
  align-items: center;
  height: 2.9rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: #e6dadd;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}

#tv-live-app .mr b {
  width: 5.6rem;
  flex: none;
  font-weight: 700;
  color: var(--muted);
}

#tv-live-app .mr span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* OSD en pantalla completa */
#tv-live-app #osd {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

#tv-live-app #pv.full #osd {
  display: block;
}

#tv-live-app #pv.full #osd.show {
  opacity: 1;
}

#tv-live-app #oBar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6rem 6rem 4.5rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
}

#tv-live-app #oN {
  font-size: 3.2rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

#tv-live-app #oT {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

#tv-live-app #oNx {
  font-size: 1.5rem;
  color: var(--muted);
  height: 2.2rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#tv-live-app #oH {
  position: absolute;
  right: 6rem;
  bottom: 1.6rem;
  font-size: 1.2rem;
  color: var(--muted);
}

#tv-live-app #oX {
  position: absolute;
  right: 3rem;
  top: 2.6rem;
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 0.2rem solid rgba(255, 255, 255, 0.3);
  text-align: center;
  line-height: 4rem;
  font-size: 2rem;
  cursor: pointer;
  color: #fff;
}

#tv-live-app #osd.show #oX {
  pointer-events: auto;
}

/* ====== OVERLAYS (modal programa, búsqueda, filtro, reordenar) ====== */
#tv-live-app .ov,
.ov {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(5, 2, 4, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s, visibility 0s 0.15s;
}

#tv-live-app .ov.show,
.ov.show {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.15s;
}

#tv-live-app .mcard,
.mcard {
  position: relative;
  border-radius: 2rem;
  border: 0.15rem solid #070204;
  padding: 3rem 3.4rem;
  background: linear-gradient(120deg, #2a0b14 0%, #12070b 75%);
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.92);
  transform: scale(0.96);
  transition: transform 0.15s;
}

#tv-live-app .ov.show .mcard,
.ov.show .mcard {
  transform: none;
}

#tv-live-app .chip {
  display: inline-block;
  background: var(--accent);
  padding: 0.3rem 1.1rem;
  border-radius: 0.6rem;
  font-size: 1.3rem;
  font-weight: 800;
}

#tv-live-app .badge {
  display: inline-block;
  background: var(--accent);
  padding: 0.2rem 0.9rem;
  border-radius: 0.5rem;
  font-size: 1.15rem;
  font-weight: 800;
}

#tv-live-app .pill {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  padding: 0.2rem 0.9rem;
  border-radius: 0.5rem;
  font-size: 1.3rem;
  font-weight: 700;
}

#tv-live-app .pmx {
  position: absolute;
  right: 2.4rem;
  top: 2.4rem;
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 0.2rem solid rgba(255, 255, 255, 0.45);
  text-align: center;
  line-height: 4rem;
  font-size: 2rem;
  cursor: pointer;
  color: #fff;
}

#tv-live-app .pmx.f,
#tv-live-app .pmb.f {
  background: #fff;
  color: #111;
  border-color: #fff;
}

#tv-live-app #pmCard {
  width: 62rem;
}

#tv-live-app #pmT {
  font-family: "Tajawal", "Noto Sans Arabic", sans-serif !important;
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 1.4rem 0 1rem;
  padding-right: 5rem;
}

#tv-live-app .pmm {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.6rem;
}

#tv-live-app .pmm > * {
  margin-right: 1.2rem;
}

#tv-live-app #pmD {
  font-family: "Tajawal", "Noto Sans Arabic", sans-serif !important;
  font-size: 1.7rem;
  line-height: 1.55;
  color: #f1e6e9;
  border: 0.15rem solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.18);
  padding: 1.4rem 1.6rem;
  min-height: 9rem;
  max-height: 17rem;
  overflow-y: auto;
}

#tv-live-app .pmb {
  display: inline-block;
  margin-top: 2rem;
  padding: 1.1rem 3.4rem;
  border-radius: 0.9rem;
  border: 0.2rem solid rgba(255, 255, 255, 0.5);
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: transform 0.12s, background 0.12s, color 0.12s, border-color 0.12s;
}

#tv-live-app #pmAct {
  text-align: right;
}

/* Búsqueda */
#tv-live-app #sCard {
  width: 104rem;
  height: 58rem;
}

#tv-live-app #sL {
  position: absolute;
  left: 3.4rem;
  top: 3rem;
  width: 53.6rem;
}

#tv-live-app #sQ {
  display: flex;
  align-items: center;
  height: 5.4rem;
  padding: 0 1.6rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  background: rgba(0, 0, 0, 0.3);
  border: 0.2rem solid rgba(255, 255, 255, 0.3);
  font-size: 2.4rem;
  font-weight: 700;
}

#tv-live-app #sQ svg {
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  margin-right: 1.2rem;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

#tv-live-app #sQt {
  white-space: nowrap;
  overflow: hidden;
}

#tv-live-app #sOv.show #sQt:after {
  content: "";
  display: inline-block;
  width: 0.2rem;
  height: 2.6rem;
  background: #fff;
  margin-left: 0.3rem;
  vertical-align: middle;
  animation: blink 1s steps(2) infinite;
}

#tv-live-app #sPh {
  color: rgba(255, 255, 255, 0.45);
  font-size: 2rem;
  margin-left: -0.2rem;
}

#tv-live-app #kb {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-gap: 0.8rem;
  gap: 0.8rem;
}

#tv-live-app .key {
  height: 5.4rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s, background 0.12s, color 0.12s;
}

#tv-live-app .key.f {
  background: #fff;
  color: #111;
  transform: scale(1.04);
}

#tv-live-app #sR {
  position: absolute;
  right: 3.4rem;
  top: 3rem;
  width: 40rem;
  height: 52rem;
}

#tv-live-app #sCnt {
  height: 5.4rem;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 5.4rem;
}

#tv-live-app #sR .vp {
  top: 7.4rem;
  height: 41rem;
}

#tv-live-app #sEmpty {
  position: absolute;
  left: 0;
  right: 0;
  top: 14rem;
  text-align: center;
  font-size: 1.7rem;
  color: var(--muted);
  display: none;
}

/* Filtro (panel derecho) */
#tv-live-app .dr {
  justify-content: flex-end;
  align-items: stretch;
  background: rgba(5, 2, 4, 0.5);
}

#tv-live-app #fPanel {
  width: 38rem;
  background: var(--panel);
  padding: 2.6rem 2rem;
  border-left: 0.2rem solid rgba(255, 255, 255, 0.1);
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

#tv-live-app .dr.show #fPanel {
  transform: none;
}

#tv-live-app #fPanel h3 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

#tv-live-app #fPanel h4 {
  font-size: 1.3rem;
  color: var(--muted);
  margin: 1.2rem 0 0.5rem 0.4rem;
  font-weight: 700;
}

#tv-live-app .opt {
  height: 4.2rem;
  display: flex;
  align-items: center;
  padding: 0 1.3rem;
  border-radius: 0.9rem;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

#tv-live-app .opt i {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: 0.2rem solid rgba(255, 255, 255, 0.5);
  margin-right: 1.2rem;
  flex: none;
}

#tv-live-app .opt.on i {
  background: var(--accent);
  border-color: var(--accent);
}

#tv-live-app .opt.f {
  background: #fff;
  color: #111;
}

#tv-live-app .opt.f.on i {
  border-color: var(--accent);
}

/* Modal reordenar categorías */
#tv-live-app #rCard,
#rCard {
  width: 92rem;
  max-width: 94vw;
  height: 58rem;
  max-height: 92vh;
  box-sizing: border-box;
}

#tv-live-app #rT,
#rT {
  position: absolute;
  left: 3.4rem;
  top: 2.6rem;
  font-size: 2.4rem;
  font-weight: 800;
  color: #f6eef0;
  letter-spacing: 0.03em;
}

#tv-live-app #rL,
#rL {
  position: absolute;
  left: 3.4rem;
  top: 7.4rem;
  width: 70rem;
  max-width: calc(100% - 18rem);
  height: 40rem;
  overflow: hidden;
}

#rL-vp {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.8rem;
}

#rL-vp::-webkit-scrollbar {
  width: 0.6rem;
}
#rL-vp::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.3rem;
}
#rL-vp::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 0.3rem;
}

#tv-live-app #rS,
#rS {
  position: absolute;
  right: 3.4rem;
  top: 7.4rem;
  width: 11rem;
  height: 40rem;
  border-radius: 1.4rem;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

#tv-live-app .rb,
.rb {
  width: 7rem;
  height: 6rem;
  margin: 0.7rem 0;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.14);
  border: 0.2rem solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s, background 0.12s, border-color 0.12s, color 0.12s;
}

#tv-live-app .rb svg,
.rb svg {
  width: 2.8rem;
  height: 2.8rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#tv-live-app .rb.f,
.rb.f {
  background: #fff !important;
  color: #111 !important;
  border-color: #fff !important;
  transform: scale(1.08);
}

#tv-live-app #rF,
#rF {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tv-live-app #rF .pmb,
.pmb {
  display: inline-block;
  margin: 0 1.2rem;
  width: 20rem;
  padding: 1.1rem 0;
  text-align: center;
  border-radius: 0.9rem;
  border: 0.2rem solid rgba(255, 255, 255, 0.5);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  color: #ffffff;
  background: transparent;
  outline: none;
  transition: transform 0.12s, background 0.12s, color 0.12s, border-color 0.12s;
}

.pmb.f {
  background: #ffffff !important;
  color: #111111 !important;
  border-color: #ffffff !important;
  transform: scale(1.05);
}

#tv-live-app #rF #rOk,
#rOk {
  background: var(--accent, #dc2626);
  border-color: var(--accent, #dc2626);
  color: #fff;
}

#tv-live-app #rF #rOk.f,
#rOk.f {
  background: #fff !important;
  color: var(--accent, #dc2626) !important;
  border-color: #fff !important;
}

#rOv,
#rOv *,
#rCard,
#rCard *,
.ro,
.ro * {
  direction: ltr !important;
}

#tv-live-app .ro,
.ro {
  height: 4.4rem;
  padding: 0 1.6rem;
  font-size: 1.55rem;
  font-weight: 600;
  justify-content: space-between !important;
  background: rgba(255, 255, 255, 0.1);
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  cursor: pointer;
  border-radius: 0.9rem;
  margin-bottom: 0.6rem;
  color: #f6eef0;
  transition: background 0.12s, color 0.12s, transform 0.12s;
  box-sizing: border-box;
}

#tv-live-app .ro .nm,
.ro .nm {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  text-align: left !important;
  margin-right: 1.2rem !important;
  margin-left: 0 !important;
  direction: ltr !important;
}

#tv-live-app .ro small,
.ro small {
  flex: 0 0 auto !important;
  color: var(--muted, #b9a3aa);
  font-size: 1.25rem;
  font-weight: 700;
  margin-right: 1.4rem !important;
  margin-left: 0 !important;
  direction: ltr !important;
}

#tv-live-app .ro i,
.ro i {
  flex: 0 0 auto !important;
  width: 2.4rem !important;
  height: 2.4rem !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  border: 0.25rem solid rgba(255, 255, 255, 0.7) !important;
  background: rgba(0, 0, 0, 0.25) !important;
  border-radius: 0.6rem !important;
  font-style: normal;
  text-align: center;
  line-height: 2rem;
  font-size: 1.8rem;
  font-weight: 800;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: transparent;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  box-sizing: border-box !important;
}

#tv-live-app .ro.sel i,
.ro.sel i {
  background: var(--accent, #dc2626) !important;
  border-color: var(--accent, #dc2626) !important;
  color: #fff !important;
}

#tv-live-app .ro.sel i:after,
.ro.sel i:after {
  content: "\2713";
}

.ro.f,
#tv-live-app .vp.act .row.ro.f {
  background: #fff !important;
  color: #111 !important;
  transform: scale(1.01);
}

.ro.f small,
#tv-live-app .vp.act .row.ro.f small {
  color: #555 !important;
}

.ro.f i,
#tv-live-app .vp.act .row.ro.f i {
  border-color: #333 !important;
  background: transparent;
}

.ro.f.sel i,
#tv-live-app .vp.act .row.ro.f.sel i {
  background: var(--accent, #dc2626) !important;
  border-color: var(--accent, #dc2626) !important;
  color: #fff !important;
}

/* Toast */
#tv-live-app #toast {
  position: fixed;
  left: 50%;
  bottom: 3rem;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  padding: 0.8rem 1.8rem;
  border-radius: 2rem;
  font-size: 1.3rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10001;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
  color: #fff;
}

#tv-live-app #toast.show {
  opacity: 1;
}

@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

/* ========================================================
   INITIAL BRANDED LOADING SCREEN (KIDS STYLE)
   ======================================================== */

#tvLiveLoadingScreen {
  position: absolute;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at center, #2b0a15 0%, #12070b 85%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#tvLiveLoadingScreen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tv-live-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tv-live-loading-logo {
  width: 14rem;
  height: auto;
  margin-bottom: 2rem;
  filter: drop-shadow(0 0.8rem 2.4rem rgba(225, 29, 72, 0.45));
}

.tv-live-loading-title {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #ffffff;
  margin-bottom: 0.8rem;
  text-shadow: 0 0.4rem 1.6rem rgba(0, 0, 0, 0.8);
}

.tv-live-loading-sub {
  font-size: 1.6rem;
  font-weight: 700;
  color: #b9a3aa;
  margin-bottom: 3.2rem;
}

.tv-live-loading-bar-wrap {
  width: 28rem;
  height: 0.6rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tv-live-loading-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #e11d48 0%, #facc15 100%);
  border-radius: 9999px;
  animation: tvLiveLoadingShimmer 1.4s ease-in-out infinite;
}

@keyframes tvLiveLoadingShimmer {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}
