/* Visor Pro — negro profundo, acento ámbar, tipografía condensada para títulos. */
:root {
  --bg: #0b0b0c;
  --bg-2: #111113;
  --surface: #161618;
  --surface-2: #1e1e21;
  --surface-3: #2a2a2e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f4;
  --muted: #a1a1a8;
  --accent: #f5b00b;
  --accent-hover: #ffc63d;
  --accent-ink: #151103;
  --accent-soft: rgba(245, 176, 11, 0.14);
  --live: #ff3b3b;
  --ok: #3ddc84;
  --warn: #f5b00b;
  --danger: #ff5c5c;
  --radius: 8px;
  --radius-sm: 6px;
  --gutter: clamp(16px, 4vw, 60px);
  --nav-h: 68px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  --focus: 0 0 0 3px var(--bg), 0 0 0 5px #fff;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
code, .mono { font-family: ui-monospace, 'Cascadia Code', Menlo, monospace; font-size: 0.86em; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); }
.display { font-stretch: 72%; font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; }

.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon.fill svg { fill: currentColor; }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.brand-mark { display: inline-flex; width: 36px; height: 36px; color: var(--accent); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-word { font-size: 26px; font-weight: 900; font-stretch: 68%; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; }
.brand-tag {
  font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1;
  color: var(--accent-ink); background: var(--accent); padding: 4px 5px 3px; border-radius: 3px; transform: translateY(-1px);
}

/* ---------- Botones e inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--radius-sm); border: 0;
  background: var(--surface-3); font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:hover { background: #36363b; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn.primary, .btn.play { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover, .btn.play:hover { background: var(--accent-hover); }
.btn.secondary { background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); }
.btn.secondary:hover { background: rgba(255, 255, 255, 0.24); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #1a0606; }
.btn.block { width: 100%; height: 48px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.25); border-top-color: var(--accent-ink); animation: spin 0.7s linear infinite;
}
.btn.loading .icon { opacity: 0; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(255, 92, 92, 0.1); }

.input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border-strong); transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: #cfcfd4; }
.hint { color: var(--muted); font-size: 12px; }
.check { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check .hint { grid-column: 2; }
.form-error { color: #ffb4b4; background: rgba(255, 92, 92, 0.1); border-left: 3px solid var(--danger); padding: 10px 12px; border-radius: 4px; margin: 0; font-size: 14px; }

.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { position: fixed; inset: 0; display: grid; place-items: center; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; padding: 4px 8px 3px; border-radius: 3px; line-height: 1.2; }
.badge.live { background: var(--live); color: #fff; }
.badge.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.badge.vod { background: rgba(255, 255, 255, 0.16); color: #fff; }
.badge.admin { background: var(--accent-soft); color: var(--accent); }
.badge.sm { font-size: 9px; padding: 3px 6px 2px; }
@keyframes pulse { 50% { opacity: 0.3; } }
.chip { font-size: 12px; font-weight: 700; padding: 2px 6px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 3px; }

/* ---------- Auth ---------- */
.auth { position: fixed; inset: 0; overflow: auto; display: grid; grid-template-rows: auto 1fr; background: radial-gradient(1200px 700px at 85% 110%, rgba(245, 176, 11, 0.16), transparent 60%), var(--bg); }
.auth-mark {
  position: fixed; right: -12vw; top: 50%; width: 70vw; max-width: 1000px; aspect-ratio: 48 / 30; transform: translateY(-50%) rotate(-8deg); pointer-events: none; opacity: 0.06;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='3 11 42 26'%3E%3Cpath d='M3 24C11 11.5 37 11.5 45 24 37 36.5 11 36.5 3 24Z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='3 11 42 26'%3E%3Cpath d='M3 24C11 11.5 37 11.5 45 24 37 36.5 11 36.5 3 24Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth-top { padding: 24px var(--gutter); position: relative; }
.auth-top .brand-mark { width: 44px; height: 44px; }
.auth-top .brand-word { font-size: 32px; }
.auth-card { position: relative; align-self: center; justify-self: center; width: min(420px, calc(100% - 32px)); display: grid; gap: 16px; padding: 40px 36px; margin-bottom: 8vh; background: rgba(0, 0, 0, 0.72); border-radius: var(--radius); }
.auth-card h1 { font-size: 34px; font-weight: 900; font-stretch: 75%; text-transform: uppercase; letter-spacing: 0.01em; line-height: 1; }
.auth-card p { margin: -6px 0 6px; }

/* ---------- Navegación ---------- */
.app, .admin-view { position: fixed; inset: 0; display: flex; flex-direction: column; }
.nav {
  position: absolute; inset: 0 0 auto; z-index: 20; height: var(--nav-h); display: flex; align-items: center; gap: 28px; padding: 0 var(--gutter);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent); transition: background 0.3s;
}
.nav.solid { background: rgba(11, 11, 12, 0.97); box-shadow: 0 1px 0 var(--border); }
.nav-links { display: flex; gap: 4px; }
.nav-links button { border: 0; background: none; padding: 8px 10px; font-size: 15px; font-weight: 600; color: #d6d6da; border-radius: 4px; position: relative; transition: color 0.15s; }
.nav-links button:hover { color: #fff; }
.nav-links button.active { color: #fff; }
.nav-links button.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; background: var(--accent); border-radius: 2px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 40px; width: 230px; padding: 0 12px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.22); transition: width 0.25s, border-color 0.15s;
}
.search:focus-within { width: 300px; border-color: #fff; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; }
.search input::placeholder { color: #8d8d95; }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(0.6); }
.search-icon { color: #c9c9cf; }
.profile { position: relative; }
.avatar {
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 0; font-weight: 900; font-size: 17px; color: #111;
  background: hsl(var(--hue, 40) 85% 62%);
}
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 210px; padding: 8px; display: grid;
  background: rgba(14, 14, 16, 0.98); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-user { padding: 8px 10px 10px; font-weight: 700; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu a, .menu button { display: block; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 4px; font-size: 14px; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

/* ---------- Contenido ---------- */
.main { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 64px; scroll-padding-top: calc(var(--nav-h) + 12px); }
.sentinel { height: 1px; }

/* Hero */
.hero { position: relative; height: min(82vh, 780px); min-height: 460px; overflow: hidden; background: hsl(var(--hue) 30% 8%); }
.hero-bg {
  position: absolute; inset: -15%; background-size: cover; background-position: center;
  filter: blur(70px) saturate(1.6) brightness(0.55); transform: scale(1.1);
}
.hero-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(70% 90% at 75% 40%, hsl(var(--hue) 70% 35% / 0.55), transparent 70%); }
.hero-art {
  position: absolute; right: 8vw; top: 46%; transform: translateY(-50%); width: min(34vw, 520px); aspect-ratio: 16 / 10;
  display: grid; place-items: center; transition: opacity 0.8s;
}
.hero-art img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.6)); }
.hero-initials { font-size: clamp(80px, 14vw, 200px); font-weight: 900; font-stretch: 65%; color: rgba(255, 255, 255, 0.9); line-height: 1; }
#hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s; background: transparent; }
.hero.previewing #hero-video { opacity: 1; }
.hero.previewing .hero-art { opacity: 0; }
.hero-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(11, 11, 12, 0.94) 0%, rgba(11, 11, 12, 0.6) 32%, transparent 62%),
    linear-gradient(0deg, var(--bg) 0%, rgba(11, 11, 12, 0.6) 14%, transparent 40%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 22%);
}
.hero-content { position: absolute; left: var(--gutter); bottom: 22%; width: min(560px, 80vw); display: grid; gap: 14px; }
.hero-kicker { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: #e7e7ea; }
.hero-title {
  font-size: clamp(44px, 6.4vw, 96px); line-height: 0.9; font-weight: 900; font-stretch: 70%; text-transform: uppercase;
  letter-spacing: 0.005em; text-wrap: balance; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-sub { margin: 0; font-size: 17px; color: #e2e2e6; max-width: 460px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.hero-actions { display: flex; gap: 12px; margin-top: 6px; }
.hero-actions .btn { height: 48px; padding: 0 26px; font-size: 16px; }
.hero-mute {
  position: absolute; right: var(--gutter); bottom: 24%; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.7); background: rgba(0, 0, 0, 0.3); color: #fff;
}
.hero-mute:hover { background: rgba(255, 255, 255, 0.15); }

/* Filas */
.rows { position: relative; z-index: 2; margin-top: -9vh; display: grid; gap: 34px; }
.hero[hidden] + .rows, .main > .rows:first-child { margin-top: calc(var(--nav-h) + 24px); }
.row { --cols: 6; --gap: 10px; }
.row-head { display: flex; align-items: baseline; gap: 14px; padding: 0 var(--gutter); margin-bottom: 4px; }
.row-head h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.row-more { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; padding: 2px 4px; font-size: 13px; font-weight: 700; color: var(--accent); opacity: 0; transform: translateX(-6px); transition: opacity 0.2s, transform 0.2s; }
.row:hover .row-more, .row-more:focus-visible { opacity: 1; transform: none; }
.row-more .icon { width: 16px; height: 16px; }
.row-body { position: relative; }
.row-track {
  display: grid; grid-auto-flow: column; gap: var(--gap);
  grid-auto-columns: calc((100% - 2 * var(--gutter) - (var(--cols) - 1) * var(--gap)) / var(--cols));
  overflow-x: auto; overflow-y: hidden; padding: 12px var(--gutter) 6px; scroll-padding-inline: var(--gutter);
  scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain;
}
.row-track::-webkit-scrollbar { display: none; }
.row-arrow {
  /* Cubre solo la imagen de la tarjeta (deja libre el nombre de abajo). */
  position: absolute; top: 12px; bottom: 52px; z-index: 3; width: calc(var(--gutter) - 6px); min-width: 36px;
  display: grid; place-items: center; border: 0; color: #fff; opacity: 0; transition: opacity 0.2s, background 0.2s;
}
.row-arrow.left { left: 0; background: linear-gradient(90deg, rgba(11, 11, 12, 0.9), transparent); }
.row-arrow.right { right: 0; background: linear-gradient(270deg, rgba(11, 11, 12, 0.9), transparent); }
.row-arrow .icon { width: 30px; height: 30px; }
.row-body:hover .row-arrow:not(.off) { opacity: 1; }
.row-arrow.off { pointer-events: none; }

/* Tarjetas */
.tile { display: block; min-width: 0; padding: 0; border: 0; background: none; text-align: left; scroll-snap-align: start; border-radius: var(--radius-sm); }
.tile:focus-visible { box-shadow: none; }
.tile-frame { position: relative; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); transition: transform 0.25s cubic-bezier(.2, .8, .2, 1), box-shadow 0.25s; }
.tile:hover .tile-frame, .tile:focus-visible .tile-frame { transform: scale(1.05); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.7); z-index: 2; }
.tile:focus-visible .tile-frame { box-shadow: 0 0 0 3px #fff, 0 14px 34px rgba(0, 0, 0, 0.7); }
.tile.playing .tile-frame { box-shadow: 0 0 0 3px var(--accent); }
.tile-art {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 14% 18%;
  background: linear-gradient(150deg, hsl(var(--hue) 45% 26%), hsl(calc(var(--hue) + 25) 40% 9%));
}
.tile-art.has-logo { background: radial-gradient(130% 120% at 50% 0%, hsl(var(--hue) 12% 22%), hsl(var(--hue) 10% 9%)); }
.tile-art img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45)); }
.initials { font-size: clamp(26px, 3vw, 44px); font-weight: 900; font-stretch: 65%; letter-spacing: 0.01em; color: rgba(255, 255, 255, 0.92); }
.tile-live, .tile-vod { position: absolute; left: 8px; bottom: 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; padding: 3px 6px 2px; border-radius: 3px; line-height: 1.2; }
.tile-live { background: var(--live); color: #fff; }
.tile-vod { background: rgba(0, 0, 0, 0.6); color: #fff; }
.tile-fav {
  position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10, 10, 12, 0.7); border: 1.5px solid rgba(255, 255, 255, 0.6); color: #fff; opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.tile-fav .icon { width: 16px; height: 16px; }
.tile-fav:hover { background: #fff; color: #000; }
.tile-fav.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tile:hover .tile-fav, .tile:focus-visible .tile-fav, .tile-fav.on { opacity: 1; }
.tile-play {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity 0.2s; pointer-events: none;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.5), transparent 60%);
}
.tile-play .icon { width: 46px; height: 46px; padding: 13px; border-radius: 50%; background: rgba(255, 255, 255, 0.95); color: #000; box-sizing: border-box; }
.tile-play svg { fill: currentColor; }
.tile:hover .tile-play, .tile:focus-visible .tile-play { opacity: 1; }
.tile-name { margin-top: 8px; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.skeleton .tile-frame { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 200% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton-text { width: 180px; height: 20px; border-radius: 4px; background: var(--surface-2); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Tarjetas de película: escena desenfocada + título tipográfico */
.mc-bg { position: absolute; inset: -8%; background-size: cover; background-position: center; filter: blur(3px) saturate(1.15) brightness(0.62); transform: scale(1.06); }
.mc-shade { position: absolute; inset: 0; background: linear-gradient(200deg, transparent 20%, rgba(0, 0, 0, 0.75) 85%), linear-gradient(0deg, hsl(var(--hue) 50% 12% / 0.55), transparent 60%); }
.mc-title {
  position: absolute; left: 10px; right: 10px; bottom: 9px; font-size: clamp(15px, 1.35vw, 22px); line-height: 0.95; font-weight: 900; font-stretch: 68%;
  text-transform: uppercase; letter-spacing: 0.01em; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.mc-year { position: absolute; left: 10px; top: 9px; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.55); color: #e9e9ec; }
.tile.movie .tile-play { background: linear-gradient(0deg, rgba(0, 0, 0, 0.35), transparent 70%); }
.tile-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.25); }
.tile-progress span { display: block; height: 100%; background: var(--accent); }
.hero.movie .hero-art { display: none; }
.hero.movie .hero-bg { filter: blur(26px) saturate(1.3) brightness(0.6); }
.hero.movie .hero-sub { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 16px; }

/* Ficha de película */
.detail {
  width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 10px; overflow: auto;
  background: #141416; color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
}
.detail::backdrop { background: rgba(0, 0, 0, 0.78); }
.detail-hero { position: relative; aspect-ratio: 16 / 8; min-height: 300px; overflow: hidden; background: hsl(var(--hue) 30% 10%); }
.detail-bg { position: absolute; inset: -6%; background-size: cover; background-position: center; filter: blur(8px) brightness(0.7) saturate(1.2); transform: scale(1.05); }
.detail-shade { position: absolute; inset: 0; background: linear-gradient(0deg, #141416 4%, rgba(20, 20, 22, 0.55) 45%, transparent 75%); }
.detail-close { position: absolute; right: 14px; top: 14px; background: rgba(0, 0, 0, 0.55); z-index: 2; }
.detail-head { position: absolute; left: 36px; right: 36px; bottom: 26px; display: grid; gap: 16px; }
.detail-title { font-size: clamp(32px, 5vw, 60px); line-height: 0.92; font-weight: 900; font-stretch: 70%; text-transform: uppercase; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-actions .btn { height: 46px; padding: 0 22px; }
.detail-progress { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #d4d4d8; }
.detail-progress .tile-progress { position: relative; flex: 0 1 240px; border-radius: 2px; overflow: hidden; }
.detail-body { padding: 8px 36px 32px; display: grid; gap: 14px; }
.detail-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: #dcdce0; }
.detail-desc { margin: 0; font-size: 16px; line-height: 1.6; color: #e4e4e7; max-width: 70ch; }
.detail-note { margin: 0; font-size: 12px; }

/* Cuadrícula (categoría, búsqueda, Mi lista) */
.grid-view { padding: calc(var(--nav-h) + 28px) var(--gutter) 0; }
.grid-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.grid-head h1 { font-size: clamp(30px, 4vw, 48px); font-weight: 900; font-stretch: 72%; text-transform: uppercase; line-height: 1; }
.grid-count { color: var(--muted); font-size: 14px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--surface-2); padding: 7px 12px 7px 8px; border-radius: 4px; font-weight: 700; font-size: 13px; }
.back-link:hover { background: var(--surface-3); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 26px 10px; }

.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 120px 16px 40px; }
.empty.small { padding: 40px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty h3 { font-size: 22px; }
.empty p { margin: 0 0 8px; max-width: 420px; }
.empty-icon { width: 34px; height: 34px; color: var(--accent); }

/* ---------- Reproductor ---------- */
.player { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player.idle { cursor: none; }
.pl-top, .pl-bottom { position: absolute; left: 0; right: 0; padding: 20px var(--gutter); transition: opacity 0.35s; z-index: 2; }
.pl-top { top: 0; display: flex; align-items: center; gap: 16px; background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent); padding-bottom: 60px; }
.pl-bottom { bottom: 0; display: grid; gap: 10px; background: linear-gradient(0deg, rgba(0, 0, 0, 0.88), transparent); padding-top: 70px; }
.player.idle .pl-top, .player.idle .pl-bottom { opacity: 0; pointer-events: none; }
.pl-heading { min-width: 0; }
.pl-kicker { font-size: 13px; color: #cfcfd4; font-weight: 600; }
.pl-name { font-size: clamp(22px, 2.6vw, 34px); font-weight: 900; font-stretch: 72%; text-transform: uppercase; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-btn { display: inline-grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: transparent; color: #fff; transition: background 0.15s, transform 0.1s; }
.pl-btn:hover { background: rgba(255, 255, 255, 0.14); }
.pl-btn:active { transform: scale(0.92); }
.pl-btn .icon { width: 26px; height: 26px; }
.pl-btn.big .icon { width: 30px; height: 30px; }
.pl-btn.on { color: var(--accent); }
.pl-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pl-group { display: flex; align-items: center; gap: 6px; }
.pl-volume { width: 110px; accent-color: var(--accent); }
.pl-group .badge { margin-left: 10px; }
.pl-select { height: 38px; padding: 0 10px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(0, 0, 0, 0.5); font-size: 14px; font-weight: 600; }
.pl-progress { display: flex; align-items: center; gap: 14px; }
.pl-bar { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); cursor: pointer; position: relative; transition: height 0.15s; }
.pl-bar:hover { height: 8px; }
.pl-fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent); }
.pl-time { font-size: 13px; font-variant-numeric: tabular-nums; color: #ddd; white-space: nowrap; }
.player-status {
  position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 16px;
  text-align: center; pointer-events: none;
}
.player-status.error { background: rgba(0, 0, 0, 0.85); pointer-events: auto; }
.player-status p { margin: 0; max-width: 460px; color: #e3e3e6; font-size: 16px; }
.status-icon { width: 44px; height: 44px; color: var(--accent); }
.status-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- Toast y diálogos ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100;
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: var(--radius-sm); background: #f5f5f4; color: #111;
  box-shadow: var(--shadow); font-size: 14px; font-weight: 600; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { box-shadow: inset 4px 0 0 var(--ok), var(--shadow); }
.toast.error { box-shadow: inset 4px 0 0 var(--danger), var(--shadow); }

.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.dialog.small { width: min(420px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.75); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 0 22px; }
.dialog-head h3 { font-size: 19px; font-weight: 800; }
.dialog-body { display: grid; gap: 16px; padding: 20px 22px; }
.dialog-body p { margin: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }

/* ---------- Admin ---------- */
.topbar { height: 64px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter); border-bottom: 1px solid var(--border); background: var(--bg); }
.topbar .brand-mark { width: 30px; height: 30px; }
.topbar .brand-word { font-size: 22px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.admin-pill { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 4px; }
.admin { flex: 1; overflow-y: auto; padding: 28px var(--gutter) 64px; width: 100%; max-width: 1240px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; min-height: 92px; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border-top: 3px solid var(--surface-3); }
.stat:first-child { border-top-color: var(--accent); }
.stat-value { font-size: 30px; font-weight: 900; font-stretch: 75%; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-sub { font-size: 12px; color: var(--muted); opacity: 0.75; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; position: relative; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; background: var(--accent); border-radius: 2px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar h2 { font-size: 26px; font-weight: 900; font-stretch: 75%; text-transform: uppercase; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.intro { margin: 0 0 18px; font-size: 14px; }
.loader { display: grid; place-items: center; padding: 40px; }

.source-list { display: grid; gap: 10px; }
.source-card { display: flex; gap: 20px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); }
.source-card.disabled { opacity: 0.55; }
.source-main { flex: 1; min-width: 0; display: grid; gap: 4px; align-content: start; }
.source-main h3 { font-size: 18px; font-weight: 800; }
.source-main p { margin: 0; }
.source-stats { display: flex; gap: 16px; font-size: 13px; margin-top: 6px; flex-wrap: wrap; }
.source-error { display: flex; gap: 8px; align-items: flex-start; color: #ffb4b4; font-size: 13px; margin-top: 6px !important; }
.source-error .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--danger); }
.source-side { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; gap: 12px; }
.source-toggles { display: grid; gap: 8px; }
.toggle-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; font-size: 13px; color: var(--muted); }
.source-actions { display: flex; align-items: center; gap: 4px; }
.type-badge { justify-self: start; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 7px; border-radius: 3px; background: var(--surface-3); color: #d4d4d8; margin-bottom: 4px; }
.type-badge.t-m3u { background: rgba(96, 165, 250, 0.15); color: #93c5fd; }
.type-badge.t-xtream { background: var(--accent-soft); color: var(--accent); }
.type-badge.t-r2 { background: rgba(249, 115, 22, 0.15); color: #fdba74; }
.type-badge.t-stream { background: rgba(61, 220, 132, 0.13); color: #86efac; }

.source-health { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-top: 4px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-size: 13px; font-weight: 700; }
.link-btn:hover { text-decoration: underline; }
.check-progress { display: grid; gap: 6px; font-size: 13px; color: #d4d4d8; margin-top: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); }
.dot.down { background: var(--danger); }

.dialog.wide { width: min(640px, calc(100vw - 32px)); }
.dialog.busy .catalog-list { opacity: 0.4; pointer-events: none; }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: var(--radius-sm); }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 4px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.active { background: var(--surface-3); color: var(--text); }
.catalog-list { display: grid; max-height: 46vh; overflow-y: auto; border-radius: var(--radius-sm); background: var(--bg-2); }
.catalog-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; font-size: 15px; }
.catalog-item:hover, .catalog-item:focus-visible { background: var(--surface-2); }
.catalog-flag { font-size: 20px; line-height: 1; width: 24px; text-align: center; }
.catalog-label { flex: 1; font-weight: 600; }
.catalog-add { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--accent); opacity: 0; }
.catalog-add .icon { width: 16px; height: 16px; }
.catalog-item:hover .catalog-add, .catalog-item:focus-visible .catalog-add { opacity: 1; }

.movie-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.movie-admin { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; border-radius: var(--radius); background: var(--surface); min-width: 0; }
.movie-admin.disabled { opacity: 0.5; }
.movie-admin-img { width: 72px; aspect-ratio: 16 / 10; border-radius: 4px; flex: none; background: var(--surface-3) center / cover; }
.movie-admin-info { flex: 1; min-width: 0; font-size: 13px; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.slider { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); transition: background 0.15s; }
.slider::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + .slider { box-shadow: var(--focus); }
.switch input:disabled + .slider { opacity: 0.5; }

.filters { display: flex; gap: 10px; margin: 12px 0 16px; flex-wrap: wrap; }
.filters .input { flex: 1; min-width: 200px; }
.filters select.input { flex: 0 1 220px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.row-off td { opacity: 0.5; }
.row-off td:nth-last-child(-n + 2) { opacity: 1; }
.cell-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.cell-url { font-size: 12px; max-width: 360px; }
.logo-cell { width: 64px; }
.mini-logo { width: 48px; height: 30px; border-radius: 4px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; }
.mini-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 14px; }
.pager > div { display: flex; gap: 8px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.off { color: var(--muted); }

.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; }
.crumb { border: 0; background: var(--surface); padding: 4px 10px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 13px; }
.crumb:hover { background: var(--surface-3); }
.file-list { border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.file-list > .empty.small { border: 0; }
.file-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.file-row:last-child { border-bottom: 0; }
.file-name { display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: none; padding: 6px 0; text-align: left; }
button.file-name:hover { color: var(--accent); }
.folder-icon { color: var(--accent); }
.upload-progress { display: grid; gap: 8px; padding: 14px 16px; margin-bottom: 12px; border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.track { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* ---------- Responsive ---------- */
@media (min-width: 1500px) { .row { --cols: 7; } }
@media (max-width: 1200px) { .row { --cols: 5; } }
@media (max-width: 980px) {
  .row { --cols: 4; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .source-card { flex-direction: column; }
  .source-side { flex-direction: row; flex-wrap: wrap; align-items: center; width: 100%; }
  .admin { overflow-x: hidden; }
  .source-toggles { display: flex; gap: 16px; }
  .nav { gap: 16px; }
  .search { width: 170px; }
  .search:focus-within { width: 220px; }
}

@media (max-width: 760px) {
  :root { --nav-h: 104px; }
  body { font-size: 14px; }
  .nav { flex-wrap: wrap; height: auto; padding: 10px var(--gutter) 0; gap: 4px 12px; align-content: flex-start; min-height: var(--nav-h); }
  .nav .brand-word { font-size: 22px; }
  .nav .brand-mark { width: 30px; height: 30px; }
  .nav-right { gap: 10px; }
  .search, .search:focus-within { width: auto; flex: 1; min-width: 0; }
  .nav-right { flex: 1; min-width: 0; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 6px; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links button { flex: none; font-size: 14px; padding: 6px 12px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, 0.3); }
  .nav-links button.active { background: #fff; color: #000; border-color: #fff; }
  .nav-links button.active::after { display: none; }
  .hide-sm { display: none !important; }
  .hero { height: 74vh; min-height: 440px; }
  .hero-art { right: 50%; transform: translate(50%, -50%); top: 36%; width: 62vw; }
  .hero-content { bottom: 15%; width: calc(100% - 2 * var(--gutter)); gap: 10px; }
  .hero-sub { font-size: 15px; }
  .hero-actions .btn { flex: 1; height: 46px; padding: 0 12px; }
  .hero-mute { bottom: auto; top: calc(var(--nav-h) + 12px); width: 38px; height: 38px; }
  .detail-hero { aspect-ratio: auto; min-height: 340px; }
  .detail-head { left: 18px; right: 18px; bottom: 18px; }
  .detail-actions .btn { flex: 1; padding: 0 12px; }
  .detail-body { padding: 4px 18px 24px; }
  .rows { margin-top: -4vh; gap: 26px; }
  .row { --cols: 2.3; --gap: 8px; }
  .row-head h2 { font-size: 17px; }
  .row-more { opacity: 1; transform: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 18px 8px; }
  .pl-volume, #quality { display: none; }
  .pl-btn { width: 42px; height: 42px; }
  .topbar { padding: 0 16px; }
  .admin-pill { display: none; }
  .admin { padding: 18px 16px 48px; }
  .file-row { grid-template-columns: 1fr auto; }
  .auth-card { padding: 28px 20px; }
}

@media (hover: none) { .row-arrow { display: none; } }

/* Pantallas de TV: más grande y con foco bien visible a distancia */
@media (min-width: 1800px) {
  body { font-size: 17px; }
  :root { --nav-h: 84px; }
  .nav-links button { font-size: 18px; }
  .row-head h2 { font-size: 26px; }
  .tile-name { font-size: 17px; }
  .tile:focus-visible .tile-frame { transform: scale(1.09); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}
