/* Aurora Móvil — interfaz táctil oscura para iPhone */
:root {
  --bg: #000;
  --bg2: #0d0d12;
  --card: #16161d;
  --card2: #1f1f28;
  --line: rgba(255, 255, 255, .08);
  --text: #f5f5f7;
  --muted: #9b9ba6;
  --dim: #63636e;
  --a1: #45e0bd;
  --a2: #6a7dff;
  --accent: linear-gradient(120deg, var(--a1), var(--a2));
  --red: #ff453a;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --left: env(safe-area-inset-left, 0px);
  --right: env(safe-area-inset-right, 0px);
  --pad: 16px;
  --tabbar: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
img { display: block; }
.ico { width: 22px; height: 22px; flex: none; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }
.view { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ---------- Cabeceras ---------- */
.header { padding: calc(var(--top) + 10px) calc(var(--pad) + var(--right)) 8px calc(var(--pad) + var(--left)); }
.large-title { font-size: 32px; font-weight: 800; letter-spacing: -.5px; }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 2px; }
.navbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; min-height: 44px;
  padding: calc(var(--top) + 4px) calc(8px + var(--right)) 6px calc(8px + var(--left));
  background: rgba(0, 0, 0, .72); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
.navbar.clear { position: absolute; left: 0; right: 0; background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0)); -webkit-backdrop-filter: none; backdrop-filter: none; }
.navbar h1 { flex: 1; font-size: 17px; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.navbar.clear .icon-btn { background: rgba(0, 0, 0, .45); }
.icon-btn:active { background: rgba(255, 255, 255, .12); }

/* ---------- Barra de pestañas ---------- */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; padding: 4px var(--right) var(--bottom) var(--left);
  background: rgba(14, 14, 18, .82); border-top: 1px solid var(--line); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); }
.tab { flex: 1; height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--dim); }
.tab .ico { width: 25px; height: 25px; }
.tab.on { color: var(--text); }
.tab.on .ico { color: var(--a1); }
.panes { position: absolute; inset: 0; }
.pane { position: absolute; inset: 0; display: flex; flex-direction: column; }
.pane .scroll { padding-bottom: calc(var(--tabbar) + var(--bottom) + 24px); }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px calc(var(--pad) + var(--right)) 10px calc(var(--pad) + var(--left)); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card2); color: #d6d6de; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--text); color: #000; }
.chip .n { color: var(--dim); font-weight: 500; margin-left: 5px; font-size: 12px; }
.chip.on .n { color: #555; }

/* ---------- Lista de canales ---------- */
.vlist { position: relative; }
.ch { position: absolute; left: 0; right: 0; height: 68px; display: flex; align-items: center; gap: 12px; padding: 0 calc(8px + var(--right)) 0 calc(var(--pad) + var(--left)); }
.ch:active { background: rgba(255, 255, 255, .06); }
.ch + .ch::before, .ch::after { content: none; }
.ch-logo { position: relative; width: 72px; height: 44px; border-radius: 8px; background: var(--card2); flex: none; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ch-logo img { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); object-fit: contain; }
.ch-logo b { font-size: 13px; color: var(--dim); }
.ch-text { flex: 1; min-width: 0; border-bottom: 1px solid var(--line); height: 100%; display: flex; flex-direction: column; justify-content: center; }
.ch-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-now { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-num { color: var(--dim); font-size: 12px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.star { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--dim); flex: none; }
.star.on { color: #ff6b81; }

/* ---------- Portada (hero) ---------- */
.hero { position: relative; margin: 6px calc(var(--pad) + var(--right)) 8px calc(var(--pad) + var(--left)); border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 10; background: var(--card); }
.hero-img { position: absolute; inset: 0; background-size: cover; background-position: center 25%; }
.hero-img.blur { filter: blur(26px) saturate(1.5) brightness(.75); transform: scale(1.3); }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.92) 8%, rgba(0,0,0,.25) 55%, rgba(0,0,0,0)); }
.hero-info { position: absolute; left: 16px; right: 16px; bottom: 14px; }
.hero-kicker { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; color: var(--a1); text-transform: uppercase; }
.hero-title { font-size: 24px; font-weight: 800; letter-spacing: -.3px; line-height: 1.1; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-meta { font-size: 13px; color: #cfcfd6; margin-top: 6px; }
.hero-poster { position: absolute; right: 16px; bottom: 14px; width: 74px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.6); }

/* ---------- Estantes (filas horizontales) ---------- */
.shelf { margin-top: 18px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 calc(var(--pad) + var(--right)) 8px calc(var(--pad) + var(--left)); }
.shelf-title { font-size: 19px; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-more { font-size: 14px; color: var(--a1); font-weight: 600; flex: none; margin-left: 12px; }
.shelf-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 calc(var(--pad) + var(--right)) 4px calc(var(--pad) + var(--left)); scroll-padding-left: calc(var(--pad) + var(--left)); scrollbar-width: none; min-height: 60px; }
.shelf-row::-webkit-scrollbar { display: none; }

.poster { flex: none; width: 118px; scroll-snap-align: start; }
.poster-art, .wide-art { position: relative; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: var(--card2); }
.poster-art img, .wide-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster:active .poster-art { transform: scale(.96); }
.poster-name { font-size: 12.5px; color: #d6d6de; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
.fb { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 10px; font-size: 13px; font-weight: 700; line-height: 1.2;
  background: linear-gradient(160deg, hsl(var(--h), 42%, 30%), hsl(calc(var(--h) + 40), 46%, 12%)); }
.fb span { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
img.broken { display: none !important; }
.prog { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); overflow: hidden; }
.prog i { display: block; height: 100%; background: #fff; }
.badge { position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.7); font-size: 11px; font-weight: 700; }
.favdot { position: absolute; right: 6px; top: 6px; color: #ff6b81; }
.favdot .ico { width: 16px; height: 16px; }

/* ---------- Cuadrícula ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; padding: 8px calc(var(--pad) + var(--right)) 0 calc(var(--pad) + var(--left)); }
.grid .poster { width: auto; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(7, 1fr); } }
.sentinel { height: 1px; }

/* ---------- Mensajes ---------- */
.empty { padding: 60px 32px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.5; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.18); border-top-color: #fff; animation: spin .9s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
#loading { position: fixed; inset: 0; z-index: 200; display: none; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,.7); font-size: 15px; }
#loading.show { display: flex; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--bottom) + 20px); z-index: 210; transform: translate(-50%, 20px); opacity: 0; max-width: calc(100% - 32px);
  padding: 11px 18px; border-radius: 14px; background: rgba(44,44,52,.96); font-size: 14px; text-align: center; transition: opacity .2s, transform .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 12px; background: var(--card2); font-size: 16px; font-weight: 700; }
.btn.primary { background: var(--text); color: #000; }
.btn.block { width: 100%; }
.btn:active { opacity: .75; }
.btn .ico { width: 20px; height: 20px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- Detalle ---------- */
.detail-top { position: relative; aspect-ratio: 16 / 11; background: var(--card); }
.detail-top .hero-img { position: absolute; inset: 0; }
.detail-top .hero-shade { background: linear-gradient(0deg, var(--bg) 2%, rgba(0,0,0,.35) 55%, rgba(0,0,0,.2)); }
.detail-body { padding: 0 calc(var(--pad) + var(--right)) 30px calc(var(--pad) + var(--left)); margin-top: -64px; position: relative; }
.detail-title { font-size: 28px; font-weight: 800; letter-spacing: -.4px; line-height: 1.1; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-size: 14px; margin: 8px 0 16px; align-items: center; }
.tag { border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; color: #ddd; }
.detail-plot { color: #d0d0d8; font-size: 15px; line-height: 1.5; margin-top: 16px; }
.detail-extra { color: var(--muted); font-size: 13px; margin-top: 10px; }
.detail-extra b { color: var(--text); }
.resume-bar { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.resume-bar .prog { position: static; flex: 1; }

.ep { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ep:active { opacity: .7; }
.ep-art { position: relative; width: 132px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--card2); flex: none; }
.ep-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ep-text { flex: 1; min-width: 0; }
.ep-title { font-size: 15px; font-weight: 600; }
.ep-plot { font-size: 13px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ep-dur { font-size: 12px; color: var(--dim); margin-top: 4px; }

/* ---------- Formularios y ajustes ---------- */
.group-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 26px calc(var(--pad) + var(--right) + 4px) 8px calc(var(--pad) + var(--left) + 4px); }
.group { margin: 0 calc(var(--pad) + var(--right)) 0 calc(var(--pad) + var(--left)); border-radius: 14px; background: var(--card); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 16px; }
.row:last-child { border-bottom: 0; }
.row .label { flex: 1; min-width: 0; }
.row .label small { display: block; color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.row .value { color: var(--muted); text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.tap:active { background: rgba(255,255,255,.06); }
.row.danger { color: var(--red); }
.row select { background: transparent; border: 0; color: var(--muted); text-align: right; direction: rtl; font-size: 16px; max-width: 55%; -webkit-appearance: none; appearance: none; }
.row input[type=text], .row input[type=password], .row input[type=url], .row input[type=search] { flex: 1.4; min-width: 0; background: transparent; border: 0; outline: 0; text-align: right; color: var(--text); font-size: 16px; }
.row input::placeholder { color: var(--dim); }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; z-index: 1; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #39393d; transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.switch input:checked + span { background: #30d158; }
.switch input:checked + span::after { transform: translateX(20px); }
.note { color: var(--dim); font-size: 12.5px; line-height: 1.45; margin: 8px calc(var(--pad) + var(--right) + 4px) 0 calc(var(--pad) + var(--left) + 4px); }

.searchbox { display: flex; align-items: center; gap: 8px; margin: 2px calc(var(--pad) + var(--right)) 10px calc(var(--pad) + var(--left)); height: 40px; padding: 0 12px; border-radius: 11px; background: var(--card2); color: var(--muted); }
.searchbox input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 16px; color: var(--text); }
.searchbox .ico { width: 18px; height: 18px; }

/* ---------- Perfiles ---------- */
.profiles { padding: calc(var(--top) + 40px) 24px 40px; text-align: center; }
.brand { font-size: 30px; font-weight: 800; letter-spacing: -1px; background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand span { color: var(--text); -webkit-text-fill-color: var(--text); font-weight: 300; }
.who { font-size: 24px; font-weight: 800; margin: 28px 0 22px; }
.prof-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 16px; max-width: 360px; margin: 0 auto; }
.prof { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.avatar { width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800;
  background: linear-gradient(140deg, hsl(var(--h), 70%, 58%), hsl(calc(var(--h) + 50), 70%, 38%)); }
.prof.add .avatar { background: var(--card2); color: var(--muted); }
.prof.add .avatar .ico { width: 36px; height: 36px; }
.prof:active .avatar { transform: scale(.94); }
.prof-name { font-size: 15px; font-weight: 600; }
.prof-type { font-size: 12px; color: var(--dim); margin-top: -4px; }
.prof-edit { margin-top: 30px; color: var(--a1); font-weight: 600; font-size: 15px; }

/* ---------- Hoja inferior ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 150; }
.sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.5); animation: fade .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 78%; display: flex; flex-direction: column; border-radius: 16px 16px 0 0; background: #1c1c22;
  padding: 8px 0 calc(var(--bottom) + 10px); animation: up .25s cubic-bezier(.2,.8,.2,1); }
@media (orientation: landscape) { .sheet { left: auto; width: min(420px, 60%); right: var(--right); } }
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: #4a4a52; margin: 0 auto 8px; }
.sheet h3 { font-size: 17px; font-weight: 700; padding: 4px 20px 2px; }
.sheet .sheet-sub { font-size: 13px; color: var(--muted); padding: 0 20px 6px; }
.sheet-list { overflow-y: auto; padding: 4px 0; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 8px 20px; font-size: 16px; }
.opt:active { background: rgba(255,255,255,.07); }
.opt .grow { flex: 1; min-width: 0; }
.opt small { display: block; color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.opt .check { color: var(--a1); font-weight: 800; }
.opt.disabled { color: var(--dim); }
.opt .stepper { display: flex; gap: 6px; }
.opt .stepper button { width: 38px; height: 34px; border-radius: 9px; background: var(--card2); font-size: 18px; font-weight: 700; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Reproductor ---------- */
#pv { position: fixed; inset: 0; z-index: 100; background: #000; display: none; touch-action: manipulation; }
#pv.show { display: block; }
#pv video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#subs { position: absolute; left: 5%; right: 5%; bottom: 8%; z-index: 3; text-align: center; pointer-events: none; display: none; transition: bottom .25s; }
#subs.raise { bottom: calc(132px + var(--bottom)); }
#subs span { background: rgba(0,0,0,.6); padding: 2px 8px; line-height: 1.4; font-size: var(--subsize, 20px); font-weight: 600; color: #fff;
  text-shadow: 0 1px 3px #000; border-radius: 5px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (orientation: landscape) { #subs span { font-size: calc(var(--subsize, 20px) * 1.2); } }
.pv-spinner { position: absolute; left: 50%; top: 50%; margin: -22px 0 0 -22px; width: 44px; height: 44px; z-index: 4; display: none; }
.pv-spinner.show { display: block; }
.pv-ui { position: absolute; inset: 0; z-index: 5; opacity: 0; pointer-events: none; transition: opacity .25s; }
.pv-ui.show { opacity: 1; pointer-events: auto; }
.pv-shade { position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.65), rgba(0,0,0,0) 26%, rgba(0,0,0,0) 62%, rgba(0,0,0,.8)); pointer-events: none; }
.pv-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px;
  padding: calc(var(--top) + 6px) calc(10px + var(--right)) 0 calc(10px + var(--left)); }
.pv-title { flex: 1; min-width: 0; }
.pv-title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-title small { display: block; font-size: 12.5px; color: #cfcfd6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-live { padding: 2px 7px; border-radius: 5px; background: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .8px; }
.pv-center { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; gap: 46px; }
.pv-center .icon-btn { width: 56px; height: 56px; background: rgba(0,0,0,.35); }
.pv-center .icon-btn .ico { width: 30px; height: 30px; }
.pv-center .big { width: 74px; height: 74px; }
.pv-center .big .ico { width: 38px; height: 38px; }
.pv-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 calc(16px + var(--right)) calc(var(--bottom) + 12px) calc(16px + var(--left)); }
.pv-bar { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #e0e0e6; font-variant-numeric: tabular-nums; }
.pv-bar input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 28px; background: transparent; }
.pv-bar input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, #fff var(--p, 0%), rgba(255,255,255,.3) var(--p, 0%)); }
.pv-bar input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; margin-top: -6px; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.pv-actions { display: flex; justify-content: space-around; margin-top: 4px; }
.pv-actions button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: #e6e6ec; padding: 6px 10px; border-radius: 10px; }
.pv-actions button:active { background: rgba(255,255,255,.12); }
.pv-status { position: absolute; left: 50%; top: calc(var(--top) + 62px); transform: translateX(-50%); z-index: 6; padding: 8px 14px; border-radius: 12px; background: rgba(20,20,26,.9); font-size: 13.5px; display: none; text-align: center; max-width: 86%; }
.pv-status.show { display: block; }
.pv-seek { position: absolute; top: 50%; z-index: 6; transform: translateY(-50%); padding: 10px 14px; border-radius: 30px; background: rgba(0,0,0,.55); font-weight: 700; display: none; }
.pv-seek.show { display: block; }
.pv-seek.l { left: 12%; } .pv-seek.r { right: 12%; }
