:root {
  --bg: #000;
  --panel: #141518;
  --panel2: #1c1d21;
  --line: #2b2d32;
  --text: #f2f2f3;
  --muted: #9a9ca3;
  --accent: #e5101c;          /* color de marca: cámbialo aquí */
  --accent-soft: rgba(229, 16, 28, .35);
  --gold: #f5c518;
  --radius: 14px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Ubuntu, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; }
svg.i { width: 1.2em; height: 1.2em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

#app { height: 100vh; height: 100dvh; overflow: auto; }

/* ---------- foco estilo TV ---------- */
.f { outline: none; transition: border-color .12s, box-shadow .12s, transform .12s, background .12s; }
.f:focus-visible, .f.sel { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent), 0 0 18px var(--accent-soft); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; gap: .5em; padding: .7em 1.2em; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; white-space: nowrap; }
.btn:hover { background: #26282d; }
.btn.primary { background: #d9dfe8; color: #111; border-color: transparent; }
.btn.primary:hover { background: #fff; }
.btn.accent { background: var(--accent); border-color: transparent; color: #fff; }
.btn.ghost { background: rgba(20, 21, 24, .8); }
.btn.sm { padding: .45em .8em; font-size: .9em; }
.icon-btn { width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); display: inline-grid; place-items: center; }
.icon-btn:hover { background: #26282d; }
.icon-btn svg.i { width: 22px; height: 22px; }

/* ---------- centro (idioma / login) ---------- */
.center { min-height: 100%; display: grid; place-items: center; padding: 24px; position: relative; }
.glass { width: min(700px, 100%); padding: 36px 40px 44px; border-radius: 22px; border: 1px solid #2c2d30;
  background: radial-gradient(120% 90% at 85% 0%, rgba(120,120,110,.28), transparent 55%), linear-gradient(160deg, #1a1a1a, #0d0d0d 70%); text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.glass.narrow { width: min(490px, 100%); }
.logo { width: 76px; height: 76px; border-radius: 18px; display: block; margin: 0 auto 18px; box-shadow: 0 0 0 1px #3a3b3f; }
.glass h1 { margin: 0 0 26px; font-size: 30px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.choice { padding: 26px; border-radius: 12px; border: 1.5px solid #3a3b40; background: #1b1b1d; font-weight: 700; font-size: 18px; }
.choice:hover { background: #232427; }
.field { position: relative; margin-bottom: 12px; }
.input { width: 100%; padding: 14px 14px; border-radius: 10px; border: 1.5px solid #34363b; background: #0e0e0f; font-size: 17px; }
.input::placeholder { color: #80838a; }
.field .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 6px; color: #aaa; }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; font-weight: 600; font-size: 14px; color: #cfd1d6; cursor: pointer; text-align: left; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.glass .btn.primary { width: 100%; justify-content: center; padding: 14px; font-size: 17px; }
.err { color: #ff6b73; min-height: 1.3em; margin: 10px 0 0; font-size: 14px; }
.corner-l { position: fixed; left: 28px; bottom: 26px; }
.corner-r { position: fixed; right: 30px; bottom: 26px; color: #8f9196; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; }
.demo-note { margin-top: 14px; font-size: 13px; color: var(--muted); }

/* ---------- perfiles ---------- */
.profiles { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; padding: 30px; }
.profiles h1 { font-size: 34px; margin: 0; }
.plist { display: flex; flex-wrap: wrap; gap: 34px; justify-content: center; }
.pcard { display: flex; flex-direction: column; align-items: center; gap: 12px; font-weight: 700; position: relative; }
.avatar { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 74px; background: #2a2b2f; border: 3px solid transparent; position: relative; }
.pcard.f { border: 0; }
.pcard.f:focus-visible .avatar, .pcard:hover .avatar { border-color: var(--accent); box-shadow: 0 0 22px var(--accent-soft); }
.pcard.f:focus-visible { box-shadow: none; }
.avatar .crown { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); font-size: 26px; }
.avatar .kids { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; background: #3b3d42; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.avatar .edit { position: absolute; top: 4px; right: 0; width: 32px; height: 32px; border-radius: 50%; background: #3a3c41; display: grid; place-items: center; font-size: 14px; }
.avatar.add { background: #17181b; border: 2px solid #3a3c41; font-size: 60px; color: #bbb; font-weight: 300; }
.edit-mode .avatar { opacity: .8; }

/* ---------- inicio ---------- */
.home { max-width: 1060px; margin: 0 auto; padding: 26px 26px 60px; min-height: 100%; display: flex; flex-direction: column; }
.home-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; }
.home-top .right { display: flex; justify-content: flex-end; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-weight: 700; }
.chip .em { width: 36px; height: 36px; display: grid; place-items: center; font-size: 26px; }
.clock { text-align: center; }
.clock img { width: 40px; height: 40px; border-radius: 9px; }
.clock .t { font-size: 40px; font-weight: 800; margin-top: 4px; letter-spacing: .5px; }
.clock .d { color: #cfd1d6; font-weight: 600; margin-top: 2px; }
.tiles { margin-top: 22px; display: grid; grid-template-columns: 1.15fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 14px; flex: 1; min-height: 340px; }
.tile { border-radius: var(--radius); background: var(--panel); border: 1.5px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 18px; }
.tile:hover { background: #1a1b1f; }
.tile.big { grid-row: span 2; background: #222326; }
.tile svg.i { width: 44px; height: 44px; stroke-width: 1.6; margin-bottom: 8px; }
.tile.big svg.i { width: 64px; height: 64px; }
.tile h3 { margin: 0; font-size: 24px; }
.tile.big h3 { font-size: 30px; }
.tile .c { color: #cfd1d6; font-weight: 600; font-size: 16px; }
.tile .c.sm { font-size: 13px; line-height: 1.35; }
.home-foot { display: flex; justify-content: space-between; margin-top: 18px; font-weight: 700; }
.home-foot .v { color: var(--muted); font-weight: 600; }

/* ---------- navegación con barra lateral ---------- */
.browse { display: grid; grid-template-columns: 300px 1fr; gap: 22px; height: 100vh; height: 100dvh; padding: 20px 26px 0; }
.side { display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.side-head b { font-size: 17px; line-height: 1.2; }
.side-head .n { color: var(--muted); font-weight: 600; font-size: 14px; margin-left: 4px; }
.side-list { overflow: auto; flex: 1; padding: 4px 6px 30px 2px; display: flex; flex-direction: column; gap: 9px; scrollbar-width: thin; }
.cat { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #17181b; border: 1.5px solid #26282c; text-align: left; font-weight: 700; font-size: 15px; min-height: 56px; }
.cat:hover { background: #1e1f23; }
.cat .ic { width: 32px; height: 32px; display: grid; place-items: center; flex: none; }
.cat .ic svg.i { width: 26px; height: 26px; }
.cat .ic img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; }
.cat .lbl { flex: 1; min-width: 0; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cat .cnt { color: #c9cbd0; font-size: 13px; font-weight: 600; }
.cat .chev { color: #777; }
.cat.on { background: linear-gradient(90deg, #8d0d14, #3a0a0d); border-color: #b3121c; }
.cat.playing .lbl { color: #ff5a63; }
.main { min-height: 0; display: flex; flex-direction: column; }
.main-head { text-align: center; font-size: 20px; font-weight: 800; margin: 10px 0 14px; }
.main-head .n { color: var(--muted); font-weight: 600; font-size: 15px; margin-left: 6px; }
.search { width: 100%; margin-bottom: 14px; }
.scroll { overflow: auto; flex: 1; padding: 4px 6px 40px; scrollbar-width: thin; }

/* ---------- pósters ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
.poster { text-align: left; border: 0; padding: 0; }
.poster .pi { position: relative; aspect-ratio: 2/3; border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: #1a1b1f; }
.poster.f:focus-visible { box-shadow: none; }
.poster.f:focus-visible .pi, .poster:hover .pi { border-color: var(--accent); box-shadow: 0 0 18px var(--accent-soft); }
.poster img, .ph-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 12px 12px 38px; font-weight: 800; font-size: 17px; line-height: 1.15; }
.poster .fav { position: absolute; top: 7px; left: 7px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.6); display: grid; place-items: center; }
.poster .fav svg.i { width: 16px; height: 16px; }
.poster .fav.on svg.i { fill: var(--accent); stroke: var(--accent); }
.poster .rt { position: absolute; bottom: 7px; right: 7px; background: rgba(0,0,0,.72); border-radius: 6px; padding: 2px 6px; font-size: 12px; font-weight: 700; }
.poster .rt b { color: var(--gold); }
.poster .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.2); }
.poster .bar i { display: block; height: 100%; background: var(--accent); }
.poster .tt { margin-top: 7px; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster .yy { color: var(--muted); font-size: 12px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 60px 10px; }
.loader { width: 34px; height: 34px; border: 3px solid #333; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- TV en vivo ---------- */
.live-main { display: flex; flex-direction: column; gap: 14px; padding-top: 52px; min-height: 0; overflow: auto; padding-bottom: 30px; }
.live-top { display: flex; justify-content: space-between; align-items: center; margin-top: -42px; }
.live-top b { font-size: 17px; }
.preview { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #0b0b0c; border: 1px solid var(--line); }
.preview video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.preview .ov { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; pointer-events: none; }
.preview .fsbtn { position: absolute; right: 10px; bottom: 10px; }
.epg { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.epg .now { display: flex; gap: 12px; align-items: baseline; }
.epg .now b { font-size: 18px; }
.epg .tm { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.epg .prog { height: 4px; background: #2c2e33; border-radius: 4px; margin: 10px 0; overflow: hidden; }
.epg .prog i { display: block; height: 100%; background: var(--accent); }
.epg p { margin: 0 0 10px; color: #c4c6cb; font-size: 14px; line-height: 1.45; }
.epg .next { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 6px; font-size: 14px; }
.epg .next div { display: flex; gap: 12px; }
.ch-logo { width: 34px; height: 34px; border-radius: 6px; background: #222; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #aaa; overflow: hidden; }
.ch-logo img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- detalle ---------- */
.detail { position: relative; min-height: 100%; }
.backdrop { position: fixed; inset: 0; background-size: cover; background-position: center right; z-index: 0; }
.backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #000 0%, rgba(0,0,0,.92) 32%, rgba(0,0,0,.45) 65%, rgba(0,0,0,.2)), linear-gradient(0deg, #000 2%, transparent 45%); }
.detail-in { position: relative; z-index: 1; padding: 22px 34px 60px; }
.detail h1 { font-size: 46px; margin: 24px 0 8px; max-width: 760px; line-height: 1.05; }
.meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: #d3d5da; font-weight: 600; font-size: 15px; }
.meta .g { color: #ff6b73; }
.meta .star { color: var(--gold); }
.plot { max-width: 640px; color: #d0d2d6; line-height: 1.55; margin: 14px 0 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.sec-t { text-transform: uppercase; letter-spacing: .06em; color: #c3c5ca; font-weight: 800; font-size: 13px; margin: 18px 0 12px; }
.cast { display: flex; gap: 18px; overflow-x: auto; padding: 4px 2px 10px; }
.person { width: 86px; flex: none; text-align: center; font-size: 12px; font-weight: 600; }
.person .ph2 { width: 76px; height: 76px; margin: 0 auto 6px; border-radius: 50%; background: linear-gradient(135deg, #3a3c42, #222327); display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #ddd; }
.seasons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.seasons .btn { min-width: 52px; justify-content: center; padding: .5em .8em; }
.seasons .btn.on { background: #6d0a10; border-color: var(--accent); }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.ep { display: grid; grid-template-columns: 160px 1fr; gap: 14px; text-align: left; padding: 10px; border-radius: 12px; background: rgba(20,21,24,.9); border: 1.5px solid var(--line); }
.ep:hover { background: #1c1d21; }
.ep .th { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: #26282d; }
.ep .th img { width: 100%; height: 100%; object-fit: cover; }
.ep .th .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.25); }
.ep .th .bar i { display: block; height: 100%; background: var(--accent); }
.ep .hd { display: flex; gap: 10px; align-items: baseline; }
.ep .hd b { flex: 1; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep .hd span { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.ep .seen { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #777; flex: none; display: grid; place-items: center; font-size: 11px; }
.ep .seen.on { background: var(--accent); border-color: var(--accent); }
.ep p { margin: 6px 0 0; color: #b9bbc1; font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- ajustes ---------- */
.settings { max-width: 760px; margin: 0 auto; padding: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; font-size: 15px; }
.kv span:nth-child(odd) { color: var(--muted); }
.seg { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.seg .btn.on { border-color: var(--accent); background: #3d0a0e; }

/* ---------- reproductor ---------- */
#player { position: fixed; inset: 0; background: #000; z-index: 50; }
#player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.p-ui { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; transition: opacity .25s; background: linear-gradient(180deg, rgba(0,0,0,.75), transparent 22%, transparent 70%, rgba(0,0,0,.85)); }
#player.idle .p-ui { opacity: 0; cursor: none; }
.p-top { display: flex; align-items: center; gap: 18px; padding: 20px 26px; }
.p-title { flex: 1; min-width: 0; }
.p-title div:first-child { font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-badge { background: var(--accent); padding: 5px 10px; border-radius: 6px; font-weight: 800; font-size: 13px; }
.p-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.75); padding: 18px 26px; border-radius: 12px; text-align: center; max-width: 80%; }
.p-bottom { padding: 18px 26px 26px; }
.p-seek { display: flex; align-items: center; gap: 14px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.p-seek input { flex: 1; accent-color: var(--accent); height: 6px; }
.p-ctrls { display: flex; align-items: center; gap: 12px; }
.icon-btn.big { width: 58px; height: 58px; }

/* ---------- modal / toast ---------- */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 80; padding: 20px; }
.dlg { width: min(440px, 100%); background: #151619; border: 1px solid #2f3136; border-radius: 18px; padding: 26px; }
.dlg h2 { margin: 0 0 16px; font-size: 22px; }
.dlg .btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 12px 0; }
.emojis button { font-size: 30px; padding: 6px; border-radius: 10px; border: 1.5px solid transparent; background: #1f2024; }
.emojis button.on { border-color: var(--accent); }
.pin-in { letter-spacing: .6em; text-align: center; font-size: 26px; }
#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #222327; border: 1px solid #36383d; padding: 12px 20px; border-radius: 10px; z-index: 90; font-weight: 600; }

/* ---------- responsivo ---------- */
@media (max-width: 860px) {
  body { overflow: auto; }
  .browse { grid-template-columns: 1fr; height: auto; min-height: 100dvh; padding: 14px; }
  .side-list { max-height: 34vh; }
  .live-main { padding-top: 0; }
  .live-top { margin-top: 0; }
  .tiles { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .tile.big { grid-row: auto; grid-column: span 2; min-height: 160px; }
  .tile { min-height: 130px; }
  .home-top { grid-template-columns: 1fr auto; }
  .home-top .clock { grid-column: 1 / -1; grid-row: 2; margin-top: 10px; }
  .clock .t { font-size: 32px; }
  .eps { grid-template-columns: 1fr; }
  .ep { grid-template-columns: 120px 1fr; }
  .detail h1 { font-size: 32px; }
  .detail-in { padding: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .avatar { width: 90px; height: 90px; font-size: 54px; }
  .kv { grid-template-columns: 1fr; }
  .glass { padding: 26px 20px 30px; }
}
