/* Magis · diseño Nuvio (CSS unificado, sin conflictos) */

@font-face {
  font-family: "Nuvio";
  src: url("fonts/jetbrains_sans_regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Nuvio";
  src: url("fonts/jetbrains_sans_bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #080a0d;
  --bg2: #0e1116;
  --bg3: #161b22;
  --panel: #14181e;
  --text: #f5f7f8;
  --muted: #8d97a2;
  --line: #292f36;
  --accent: #ffd45c;
  --accent-2: #e8a91c;
  --accent-ink: #111111;
  --danger: #e53935;
  --rail-w: 84px;
  --nav-h: 72px;
  --bot-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --poster-r: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Nuvio", Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }

/* ========== SIDE RAIL (desktop) ========== */
.side-rail {
  display: none;
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 10px;
  background: var(--bg);
}
.rail-brand {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, #8a5700, #e8a91c, #fff1a8, #ffd45c);
  color: #111;
  display: grid; place-items: center;
  margin-bottom: 16px;
}
.rail-btn {
  width: 52px; height: 52px;
  border-radius: 17px;
  display: grid; place-items: center;
  color: #8d97a2;
  transition: .15s;
}
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { color: #fff; background: #1a1f26; }
.rail-btn.active { background: #252a30; color: #fff; }

/* ========== TOPBAR ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(var(--bg) 60%, transparent);
}
.topbar .nav-links { display: none !important; }
.topbar .brand.mobile-only {
  display: none;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  flex-shrink: 0;
}
.topbar .brand.mobile-only .logo {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: linear-gradient(145deg, #8a5700, #e8a91c, #ffd45c);
  color: #111;
  display: grid; place-items: center;
}
.search-wrap {
  position: relative;
  width: min(600px, 72vw);
}
.search-wrap input {
  width: 100%;
  height: 48px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0 16px 0 44px;
  outline: none;
  color: var(--text);
}
.search-wrap input:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.search-wrap .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #7c8894;
  display: grid;
}

/* ========== MAIN ========== */
.main {
  min-height: calc(100vh - var(--nav-h));
  padding-bottom: calc(var(--bot-h) + var(--safe-b) + 16px);
}
.view { display: none !important; }
.view.active { display: block !important; }

/* ========== HERO ========== */
.hero {
  position: relative;
  height: min(52vh, 440px);
  background: var(--bg2);
  overflow: hidden;
  margin-bottom: 8px;
}
.hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .5;
}
.hero .shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(8,10,13,.97) 6%, transparent 58%),
    linear-gradient(0deg, var(--bg), transparent 48%);
}
.hero .content {
  position: absolute;
  left: 20px; right: 20px; bottom: 28px;
  max-width: 560px;
}
.hero h1 {
  font-size: clamp(1.55rem, 4.2vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.hero p {
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.45;
  max-width: 42ch;
}
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
}
.btn.primary {
  background: linear-gradient(145deg, #e8a91c, #ffd45c);
  color: #111;
}
.btn.ghost { background: rgba(255,255,255,.1); color: #fff; }

/* ========== SECTIONS / RAILS ========== */
.section { padding: 10px 18px 26px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-head span { color: #7f8994; font-size: 13px; }

.rail-wrap { position: relative; }
.rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 6px 2px 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.rail::-webkit-scrollbar { display: none; width: 0; height: 0; }

.rail-arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-70%);
  z-index: 5;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(8,10,13,.85);
  border: 1px solid var(--line);
  color: #fff;
  place-items: center;
}
.rail-arrow svg { width: 18px; height: 18px; fill: currentColor; }
.rail-arrow.prev { left: 4px; }
.rail-arrow.next { right: 4px; }
.rail-arrow:hover { background: var(--accent); color: #111; border-color: transparent; }

/* ========== CARDS ========== */
.card {
  flex: 0 0 140px;
  width: 140px;
  min-width: 140px;
  background: transparent;
  border: 0;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform .15s ease;
}
.card:hover { transform: translateY(-4px) scale(1.02); }
.card .poster {
  aspect-ratio: 2/3;
  border-radius: var(--poster-r);
  overflow: hidden;
  background: #181c21;
  border: 1px solid #293039;
  position: relative;
}
.card .poster img { width: 100%; height: 100%; object-fit: cover; }
.card .badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 3px 7px;
  border-radius: 8px;
}
.card .fav {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px;
}
.card .fav.on { color: #ff6b8a; }
.card .meta { padding: 9px 2px 0; }
.card .title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card .sub {
  color: #77818c;
  font-size: 12px;
  margin-top: 3px;
}
.rail.live .poster { aspect-ratio: 16/10; }

/* ========== GRID / FILTERS ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  padding: 12px 18px 28px;
}
.grid .card {
  width: auto;
  min-width: 0;
  flex: unset;
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 18px 4px;
}
.chip {
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--panel);
  color: #a7b0ba;
  font-weight: 600;
  font-size: .85rem;
  border: 1px solid var(--line);
}
.chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

/* Descubrir: selects Tipo + Categoría lado a lado */
.disc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
  padding: 4px 16px 14px;
}
.disc-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 140px;
  max-width: 220px;
}
.disc-filter-q {
  flex: 1 1 180px;
  max-width: 320px;
}
.disc-filter-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.disc-select,
.disc-input {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  font-size: .9rem;
  font-weight: 600;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a7b0ba' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.disc-input {
  background-image: none;
  padding-right: 12px;
  font-weight: 500;
  cursor: text;
  border-radius: 999px;
}
.disc-select:focus,
.disc-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.disc-select option {
  background: var(--bg2, #1a1a24);
  color: var(--text);
}
@media (max-width: 520px) {
  .disc-filter {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
  }
  .disc-filter-q {
    flex: 1 1 100%;
  }
}

/* ========== STATES ========== */
.state {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}
.spin {
  width: 28px; height: 28px;
  border: 3px solid #333;
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== BOTTOM NAV ========== */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--bot-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: rgba(8,10,13,.94);
  border-top: 1px solid #1a1f26;
  backdrop-filter: blur(16px);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.bottom-nav a.active { color: #fff; }
.bottom-nav a.active svg { stroke: var(--accent); }
.bottom-nav svg { width: 22px; height: 22px; }

/* ========== TOAST ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.88);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 300;
  opacity: 0;
  transition: .2s;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
  font-size: .9rem;
}
.toast.show, .toast.on { opacity: 1; }

/* ========== SALAS ========== */
.salas-hero {
  padding: 20px 18px 8px;
}
.salas-hero h2 { font-size: 1.4rem; margin-bottom: 6px; }
.salas-hero p { color: var(--muted); margin-bottom: 14px; }
.salas-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.salas-row input {
  flex: 1;
  min-width: 120px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: #fff;
}
.salas-row button, .salas-row .btn {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 700;
}
.salas-row .btn.primary, .salas-row button:not(.ghost) {
  background: linear-gradient(145deg, #e8a91c, #ffd45c);
  color: #111;
  border: 0;
}
.salas-row .ghost { background: rgba(255,255,255,.08); color: #fff; }
.salas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 12px 18px 28px;
}
.sala-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
}
.sala-card .ph {
  aspect-ratio: 16/10;
  background: #181c21 center/cover no-repeat;
  position: relative;
}
.sala-card .badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.7);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.sala-card .body { padding: 10px 12px 12px; }
.sala-card .t { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sala-card .m { color: var(--muted); font-size: .75rem; margin-top: 2px; }

/* ========== LIVE ========== */
.live-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px 16px;
}
.live-cats {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 8px 0;
  scrollbar-width: none;
}
.live-cats::-webkit-scrollbar { display: none; }

/* ========== FOCUS / TV ========== */
:focus { outline: none; }
:focus-visible,
.card:focus,
.card.focused,
.bottom-nav a:focus,
.rail-btn:focus,
.p-btn:focus,
.rail-arrow:focus {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}


/* ===== PLAYER / MODAL / PARTY (funcional) ===== */
.modal-bg {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.72);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-bg.open { display: flex; }
.modal {
  width: min(920px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--bg2);
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--line);
}
@media (min-width: 700px) {
  .modal-bg { align-items: center; padding: 20px; }
  .modal { border-radius: 16px; }
}
.modal-hero { height: 200px; background: #111; position: relative; }
.modal-hero img { width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.modal-hero .close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.6); display: grid; place-items: center;
}
.modal-body { padding: 16px 18px 24px; }
.modal-body h2 { font-size: 1.4rem; margin-bottom: 6px; }
.modal-body .overview { color: var(--muted); line-height: 1.45; margin: 10px 0 14px; }
.season-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.season-tabs button {
  padding: 8px 12px; border-radius: 8px; background: var(--bg3); color: var(--muted); font-weight: 600;
}
.season-tabs button.active { background: #fff; color: #111; }
.ep-list { display: flex; flex-direction: column; gap: 8px; }
.ep {
  display: flex; gap: 12px; align-items: center;
  padding: 10px; border-radius: 10px; background: var(--bg3); cursor: pointer;
}
.ep .n {
  width: 36px; height: 36px; border-radius: 8px; background: var(--bg);
  display: grid; place-items: center; font-weight: 700; color: var(--muted);
}
.ep .t strong { display: block; font-size: .92rem; }
.ep .t span { color: var(--muted); font-size: .78rem; }

.toast {
  position: fixed; bottom: calc(var(--bot-h) + 16px); left: 50%;
  transform: translateX(-50%);
  background: #222; border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 999px; font-size: .85rem;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ===== PLAYER (rediseño) ===== */
.player-page-root {
  position: fixed; inset: 0;
  background: #000;
  display: flex; flex-direction: column;
}
.player-page-root video {
  flex: 1; width: 100%; height: 100%;
  object-fit: contain; background: #000;
}
.subs-box {
  position: absolute; left: 5%; right: 5%;
  bottom: var(--sub-bottom, 12%);
  z-index: 25; pointer-events: none; text-align: center;
  font-size: var(--sub-size, 1.35rem);
  font-weight: 800; line-height: 1.35;
  color: var(--sub-color, #fff);
  white-space: pre-line; padding: 0 8px;
}
.subs-box span {
  display: inline-block;
  background: var(--sub-bg, rgba(0,0,0,.45));
  padding: 4px 12px;
  border-radius: 6px;
  max-width: 100%;
  /* borde negro POR LETRA (stroke), no caja */
  -webkit-text-stroke: var(--sub-border, 2px) #000;
  paint-order: stroke fill;
  text-shadow: none;
}
.sub-style-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center;
}
.sub-style-row label { font-size: .78rem; color: var(--muted); width: 100%; margin-top: 4px; }
.sub-style-row select, .sub-style-row input[type=range] {
  flex: 1; min-width: 120px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15); color: #fff;
  border-radius: 8px; padding: 8px 10px; font-size: .85rem;
}
.sub-style-row input[type=color] {
  width: 42px; height: 36px; border: none; background: transparent; cursor: pointer;
}
.p-spinner {
  position: absolute; inset: 0; z-index: 7;
  display: none; place-items: center;
  background: rgba(0,0,0,.25);
}
.p-spinner.on { display: grid; }
.p-spinner .spin {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: #e50914;
  animation: pspin .7s linear infinite;
}
@keyframes pspin { to { transform: rotate(360deg); } }
.player-ui {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    linear-gradient(180deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.35) 18%, transparent 32%),
    linear-gradient(0deg, rgba(0,0,0,.88) 0%, rgba(0,0,0,.45) 22%, transparent 40%);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.player-page-root.show-ui .player-ui { opacity: 1; pointer-events: auto; }
.p-top, .p-bottom {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 14px;
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
}
.p-top { padding-top: max(12px, env(safe-area-inset-top)); gap: 8px; }
.p-bottom {
  flex-wrap: wrap;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  gap: 10px 8px;
}
.p-title {
  flex: 1; min-width: 0;
  font-weight: 700; font-size: .95rem; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.p-btn {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff; cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background .15s, transform .12s;
}
.p-btn:hover { background: rgba(255,255,255,.22); }
.p-btn:active { transform: scale(.94); }
.p-btn svg { width: 22px; height: 22px; display: block; pointer-events: none; }
.p-btn.lg { width: 52px; height: 52px; }
.p-btn.lg svg { width: 26px; height: 26px; }
.p-seek-wrap {
  flex: 1 1 100%;
  display: flex; align-items: center; gap: 10px;
  order: -1; width: 100%;
}
.p-seek {
  flex: 1; height: 6px; border-radius: 99px;
  background: rgba(255,255,255,.22);
  position: relative; cursor: pointer;
  touch-action: none;
}
.p-seek:hover { height: 8px; }
.p-seek.live { opacity: .4; cursor: default; pointer-events: none; }
.p-seek .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, #e50914, #ff4d4d);
}
.p-seek .knob {
  position: absolute; top: 50%; width: 14px; height: 14px;
  margin-top: -7px; margin-left: -7px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.5);
  left: 0%; pointer-events: none;
  opacity: 0; transition: opacity .15s;
}
.player-page-root.show-ui .p-seek .knob { opacity: 1; }
.p-time {
  color: rgba(255,255,255,.85);
  font-size: .8rem; font-variant-numeric: tabular-nums;
  white-space: nowrap; min-width: 9.5ch; text-align: right;
}
.p-controls-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
}
.p-controls-row .spacer { flex: 1; }
.p-panel {
  position: absolute; right: 12px; top: 64px; bottom: 90px;
  width: min(360px, 92vw);
  z-index: 30;
  background: rgba(16,16,22,.96);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 14px 14px 14px;
  overflow: auto;
  display: none;
  box-shadow: 0 16px 48px rgba(0,0,0,.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.p-panel.open { display: block; animation: panelIn .18s ease; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.p-panel h3 {
  margin: 0 0 12px; font-size: .9rem; font-weight: 700; color: #fff;
  padding-right: 36px;
}
.p-panel .season-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.p-panel .season-tabs button {
  border: 0; cursor: pointer; width: auto;
  padding: 7px 14px; border-radius: 999px; margin: 0;
  background: rgba(255,255,255,.08); color: #aaa;
  font-weight: 700; font-size: .8rem;
}
.p-panel .season-tabs button.active { background: #fff; color: #111; }
.p-panel .list-btn,
.p-panel > div > button,
.p-panel #eps-list button,
.p-panel #audio-list button,
.p-panel #subs-list button {
  display: block; width: 100%; text-align: left;
  border: 0; cursor: pointer;
  padding: 12px 14px; border-radius: 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,.06); color: #e8e8ef;
  font-weight: 600; font-size: .9rem;
}
.p-panel .list-btn:hover,
.p-panel #eps-list button:hover,
.p-panel #audio-list button:hover,
.p-panel #subs-list button:hover { background: rgba(255,255,255,.12); }
.p-panel .list-btn.active,
.p-panel #eps-list button.active,
.p-panel #audio-list button.active,
.p-panel #subs-list button.active { background: #fff; color: #111; }
.p-panel .lang { opacity: .65; font-weight: 500; font-size: .82em; }
.p-panel .hint { color: #888; font-size: .82rem; margin-top: 8px; line-height: 1.4; }
.p-panel-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.1); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.p-panel-close svg { width: 16px; height: 16px; }
.p-backdrop {
  position: absolute; inset: 0; z-index: 25;
  background: rgba(0,0,0,.35);
  display: none;
}
.p-backdrop.on { display: block; }
@media (max-width: 520px) {
  .p-btn { width: 40px; height: 40px; }
  .p-btn svg { width: 20px; height: 20px; }
  .p-btn.lg { width: 48px; height: 48px; }
}

.card .poster .progress-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; background: rgba(255,255,255,.2);
}
.card .poster .progress-bar > div { height: 100%; background: #e50914; }
/* SPA view isolation */
.view { display: none !important; }
.view.active { display: block !important; }
#view-player.active {
  display: flex !important;
  position: fixed; inset: 0; z-index: 200;
  background: #000; flex-direction: column;
}
#view-player .player-page-root { position: absolute; inset: 0; }
body.player-on .topbar,
body.player-on .bottom-nav { display: none !important; }
body.player-on .main { padding: 0; min-height: 0; }

/* Salas / Party */
.salas-hero { padding: 16px 16px 8px; }
.salas-hero h2 { font-size: 1.35rem; margin-bottom: 6px; }
.salas-hero p { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.salas-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.salas-row input, .salas-row select {
  flex: 1; min-width: 120px; background: var(--bg3); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: .95rem;
}
.salas-row button {
  background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: 10px 16px; font-weight: 700; cursor: pointer;
}
.salas-row button.ghost { background: var(--bg3); border: 1px solid var(--line); color: var(--text); }
.salas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 8px 16px 24px; }
.sala-card {
  background: var(--card); border-radius: 14px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); transition: transform .15s;
}
.sala-card:hover { transform: translateY(-2px); }
.sala-card .ph {
  aspect-ratio: 2/3; background: #111 center/cover no-repeat; position: relative;
}
.sala-card .ph .badge {
  position: absolute; top: 8px; left: 8px; background: rgba(229,9,20,.9);
  color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 6px;
}
.sala-card .body { padding: 10px; }
.sala-card .body .t { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sala-card .body .m { color: var(--muted); font-size: .75rem; margin-top: 4px; }
.party-banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 12; background: linear-gradient(135deg,#7c5cff,#e50914);
  color: #fff; font-size: .78rem; font-weight: 700; padding: 6px 14px; border-radius: 999px;
  pointer-events: none; white-space: nowrap;
}


.party-bar {
  position: absolute; top: max(52px, env(safe-area-inset-top)); right: 10px; z-index: 30;
  display: none; flex-direction: column; gap: 8px;
}
.party-bar.on { display: flex; }
.party-bar button {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(20,20,34,.85); color: #fff; cursor: pointer; backdrop-filter: blur(8px);
}
.party-side {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 92vw);
  z-index: 40; background: rgba(12,12,20,.96); transform: translateX(105%);
  transition: transform .25s ease; display: flex; flex-direction: column;
  border-left: 1px solid rgba(255,255,255,.1);
}
.party-side.open { transform: translateX(0); }
.party-side .ps-head {
  display: flex; align-items: center; gap: 8px; padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.party-side .ps-head h3 { flex: 1; font-size: .95rem; margin: 0; }
.party-side .ps-tabs { display: flex; gap: 4px; padding: 8px; }
.party-side .ps-tabs button {
  flex: 1; padding: 8px; border-radius: 8px; border: 0; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.party-side .ps-tabs button.on { background: rgba(255,255,255,.1); color: #fff; }
.party-side .ps-body { flex: 1; overflow: auto; padding: 10px 12px; font-size: .9rem; }
.party-side .ps-msg { margin-bottom: 8px; }
.party-side .ps-msg b { color: #a78bfa; }
.party-side .ps-foot { display: flex; gap: 6px; padding: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.party-side .ps-foot input {
  flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; color: #fff; padding: 10px;
}
.party-side .ps-foot button {
  background: var(--accent); border: 0; color: #fff; border-radius: 8px; padding: 0 14px; font-weight: 700; cursor: pointer;
}
.party-member { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.party-member .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }

/* Ajustes player sobre tema Nuvio */
.modal {
  background: #10141a !important;
  border: 1px solid var(--line) !important;
}
.p-bottom .p-controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

/* ========== DESKTOP ≥900px ========== */
@media (min-width: 900px) {
  .side-rail { display: flex; }
  .topbar {
    margin-left: var(--rail-w);
    width: calc(100% - var(--rail-w));
    justify-content: center;
  }
  .topbar .brand.mobile-only { display: none !important; }
  .bottom-nav { display: none !important; }
  .main {
    margin-left: var(--rail-w);
    padding-bottom: 40px;
  }
  .rail-arrow { display: grid; }
  .card { flex-basis: 160px; width: 160px; min-width: 160px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .hero .content { left: 32px; }
  .live-layout { grid-template-columns: 220px 1fr; }
  body.player-on .side-rail { display: none !important; }
  body.player-on .main { margin-left: 0 !important; }
  body.player-on .topbar { margin-left: 0; width: 100%; }
}

/* ========== MÓVIL ========== */
@media (max-width: 899.98px) {
  .side-rail { display: none !important; }
  .topbar { justify-content: flex-start; }
  .topbar .brand.mobile-only { display: flex !important; }
  .topbar .search-wrap { flex: 1; width: auto; min-width: 0; }
  .topbar .nav-links { display: none !important; }
  .bottom-nav { display: grid !important; }
  .rail-arrow { display: none !important; }
  .main { margin-left: 0 !important; }
}

body.player-on .topbar,
body.player-on .bottom-nav { display: none !important; }

body.player-fs #view-player,
body.player-fs #player-root {
  width: 100vw;
  height: 100vh;
}

/* ========== DETAIL PAGE (Nuvio) ========== */
.detail-page { min-height: 60vh; }
.detail-view { position: relative; }
.detail-back.circle-button,
.circle-button {
  position: fixed;
  z-index: 45;
  top: max(16px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid #2a3036;
  background: rgba(21,25,29,.92);
  color: #fff;
  display: grid; place-items: center;
  backdrop-filter: blur(10px);
}
@media (min-width: 900px) {
  .detail-back.circle-button { left: calc(var(--rail-w) + 18px); }
}
.detail-hero {
  position: relative;
  isolation: isolate;
  min-height: min(72vh, 560px);
  display: flex;
  align-items: flex-end;
  gap: 28px;
  padding: 100px 18px 36px;
  background:
    linear-gradient(90deg, rgba(8,10,13,.96) 10%, rgba(8,10,13,.35) 55%, rgba(8,10,13,.7)),
    linear-gradient(0deg, var(--bg) 0%, transparent 55%),
    var(--detail-backdrop, none);
  background-size: cover;
  background-position: center top;
}
.detail-copy { max-width: 640px; flex: 1; min-width: 0; }
.detail-copy h1 {
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #aeb5bd;
  font-size: .92rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.detail-meta span + span::before {
  content: "·";
  margin-right: 14px;
  opacity: .5;
}
.detail-overview {
  color: #c5cbd1;
  line-height: 1.5;
  margin-bottom: 18px;
  max-width: 54ch;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.detail-poster-side {
  display: none;
  width: min(220px, 28vw);
  flex-shrink: 0;
}
.detail-poster-side img {
  width: 100%;
  border-radius: 16px;
  border: 1px solid #293039;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
@media (min-width: 900px) {
  .detail-poster-side { display: block; }
  .detail-hero { padding: 120px 40px 48px; min-height: min(78vh, 640px); }
}

.detail-sections { padding: 8px 0 40px; }
.detail-episodes-block,
.detail-movie-block { padding: 8px 18px 24px; }
.detail-eps-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-eps-head h2 { font-size: 1.35rem; font-weight: 700; }

.season-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.season-tabs::-webkit-scrollbar { display: none; }
.season-tabs button {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: #a7b0ba;
  font-weight: 600;
  white-space: nowrap;
}
.season-tabs button.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

.nuvio-eps, .ep-list.nuvio-eps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ep-row {
  display: grid;
  grid-template-columns: 36px 96px minmax(0,1fr) 40px;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid transparent;
  color: inherit;
}
.ep-row:hover { border-color: var(--line); background: #1a1f26; }
.ep-code {
  display: grid; place-items: center;
  height: 28px;
  padding: 0 6px;
  border-radius: 8px;
  background: #090b0edb;
  font-size: 12px;
  font-weight: 800;
  color: #f6f7f8;
}
.ep-art {
  width: 96px; height: 54px;
  border-radius: 10px;
  overflow: hidden;
  background: #181c21;
}
.ep-art img { width: 100%; height: 100%; object-fit: cover; }
.ep-info { min-width: 0; }
.ep-info strong {
  display: block;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-info small {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  margin-top: 3px;
  line-height: 1.35;
}
.ep-play {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  display: grid; place-items: center;
  color: var(--accent);
}

.detail-movie-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  align-items: start;
}
.detail-movie-card img {
  width: 120px;
  border-radius: 12px;
  border: 1px solid #293039;
}
.detail-movie-card h2 { font-size: 1.2rem; margin-bottom: 8px; }
.detail-movie-card p { color: var(--muted); margin-bottom: 14px; line-height: 1.45; }
@media (max-width: 520px) {
  .ep-row { grid-template-columns: 32px 72px minmax(0,1fr) 32px; gap: 8px; }
  .ep-art { width: 72px; height: 42px; }
  .detail-movie-card { grid-template-columns: 90px 1fr; }
  .detail-movie-card img { width: 90px; }
}

/* Hide chrome slightly on detail for cinematic feel on mobile */
body[data-active="home"] .detail-view ~ * { }

/* ========== BOTTOM NAV estilo Nuvio ========== */
.bottom-nav {
  background: rgba(8,10,13,.92) !important;
  border-top: 1px solid #151a20 !important;
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  height: calc(58px + var(--safe-b)) !important;
  padding-bottom: var(--safe-b);
}
.bottom-nav a {
  gap: 3px !important;
  font-size: 9px !important;
  letter-spacing: 0.02em;
  color: #7a8490 !important;
  font-weight: 600 !important;
}
.bottom-nav a svg {
  width: 22px !important;
  height: 22px !important;
  stroke-width: 1.8;
}
.bottom-nav a.active {
  color: #f5f7f8 !important;
}
.bottom-nav a.active svg {
  stroke: var(--accent) !important;
  color: var(--accent);
}

/* ========== PLAYER estilo Nuvio ========== */
.player-page-root {
  background: #000 !important;
}
.player-ui .p-btn {
  background: rgba(255,255,255,.1) !important;
  border-radius: 14px !important;
  backdrop-filter: blur(8px);
}
.player-ui .p-btn.lg {
  background: linear-gradient(145deg, #e8a91c, #ffd45c) !important;
  color: #111 !important;
}
.player-ui .p-seek .fill {
  background: linear-gradient(90deg, #e8a91c, #ffd45c) !important;
}
.player-ui .p-title {
  font-family: "Nuvio", Inter, sans-serif;
  font-weight: 700;
}
.p-bottom {
  background: linear-gradient(transparent, rgba(0,0,0,.85)) !important;
}
.p-top {
  background: linear-gradient(rgba(0,0,0,.75), transparent) !important;
}

/* detail page: soft-hide bottom labels crowding */
@media (max-width: 899.98px) {
  body .main:has(#view-detail.active) {
    padding-bottom: calc(58px + var(--safe-b) + 8px);
  }
}

/* ===== PLAYER NUVIO FORCE ===== */
#player-root.player-page-root,
.player-page-root {
  background: #000 !important;
}
#player-ui.player-ui,
.player-ui {
  background: transparent !important;
}
#player-ui .p-btn,
.player-ui .p-btn {
  background: rgba(255,255,255,.12) !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}
#player-ui .p-btn.lg,
.player-ui .p-btn.lg,
#btn-pp.p-btn.lg {
  background: linear-gradient(145deg, #e8a91c, #ffd45c) !important;
  color: #111 !important;
  border: 0 !important;
  box-shadow: 0 4px 18px rgba(232,169,28,.35) !important;
}
#player-ui .p-btn.lg svg,
#btn-pp svg {
  fill: #111 !important;
}
#seek-fill,
.p-seek .fill,
#player-ui .p-seek .fill {
  background: linear-gradient(90deg, #e8a91c, #ffd45c) !important;
  border-radius: 4px !important;
}
.p-seek {
  background: rgba(255,255,255,.18) !important;
  border-radius: 4px !important;
  height: 6px !important;
}
.p-seek .knob {
  background: #ffd45c !important;
  border: 2px solid #fff !important;
}
.p-top {
  background: linear-gradient(rgba(0,0,0,.8), transparent) !important;
}
.p-bottom {
  background: linear-gradient(transparent, rgba(0,0,0,.9)) !important;
}
#player-title {
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}

/* Detail page full-bleed on mobile */
@media (max-width: 899.98px) {
  #view-detail.active .detail-hero {
    margin-left: -0px;
    min-height: 58vh;
    padding-top: 88px;
  }
  #view-detail.active .detail-copy h1 {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
  }
}

/* ========== BOTTOM NAV estilo Nuvio (cápsula flotante) ========== */
:root {
  --nav-bottom: max(10px, env(safe-area-inset-bottom));
  --nav-height: 66px;
  --nav-clearance: calc(var(--nav-bottom) + var(--nav-height) + 16px);
}

.bottom-nav {
  display: none;
}

@media (max-width: 899.98px) {
  .bottom-nav {
    display: flex !important;
    position: fixed;
    z-index: 60;
    left: 12px;
    right: 12px;
    bottom: var(--nav-bottom);
    height: var(--nav-height);
    padding: 0 4px;
    align-items: center;
    justify-content: space-around;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: rgba(20, 24, 29, 0.62) !important;
    -webkit-backdrop-filter: blur(26px) saturate(200%);
    backdrop-filter: blur(26px) saturate(200%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      inset 0 -1px 0 rgba(0, 0, 0, 0.32),
      0 10px 30px rgba(0, 0, 0, 0.45);
    border-top: 0 !important;
    grid-template-columns: none !important;
  }
  .bottom-nav a {
    position: relative;
    flex: 1;
    height: 54px;
    border-radius: 19px;
    display: grid !important;
    justify-items: center;
    align-content: center;
    gap: 3px;
    font-size: 10px !important;
    font-weight: 600 !important;
    color: #737e89 !important;
    background: transparent !important;
    transition: color .16s, background .16s;
  }
  .bottom-nav a.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.13) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  }
  .bottom-nav a.active svg {
    stroke: var(--accent) !important;
  }
  .bottom-nav svg {
    width: 20px !important;
    height: 20px !important;
  }
  .main {
    padding-bottom: var(--nav-clearance) !important;
  }
  body.player-on .bottom-nav {
    display: none !important;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (max-width: 899.98px) {
    .bottom-nav {
      background: #161a1f !important;
    }
  }
}

/* Anti-selección visual (inputs siguen usables) */
body.magis-page {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.magis-page input,
body.magis-page textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* ========== TV LIVE 3 columnas ========== */
.live-layout.live-3col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px 14px 20px;
  min-height: calc(100vh - var(--nav-h) - 80px);
}
.live-col-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7f8994;
  padding: 4px 6px 10px;
}
.live-cats {
  display: flex;
  flex-direction: row;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.live-cats::-webkit-scrollbar { display: none; }
.live-cats button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: #a7b0ba;
  font-weight: 600;
  white-space: nowrap;
}
.live-cats button small { opacity: .55; font-weight: 600; }
.live-cats button.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.live-channels {
  min-height: 120px;
}
.live-channel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 42vh;
  overflow-y: auto;
  padding-right: 4px;
}
.live-ch {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid transparent;
  color: inherit;
}
.live-ch:hover, .live-ch.active {
  border-color: var(--line);
  background: #1a1f26;
}
.live-ch.active {
  outline: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.live-ch-logo {
  width: 44px; height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: #181c21;
  display: grid; place-items: center;
}
.live-ch-logo img { width: 100%; height: 100%; object-fit: cover; }
.live-ch-name {
  font-size: .92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-preview-frame {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  cursor: pointer;
}
.live-preview-frame video {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}
.live-preview-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted);
  font-size: .9rem;
  padding: 16px;
  text-align: center;
  pointer-events: none;
}
.live-preview-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
}
.live-preview-title {
  font-weight: 700;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-preview-actions { display: flex; gap: 8px; flex-shrink: 0; }
#live-preview-fav.on { color: #ff6b8a; }
.live-preview-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: .78rem;
}

@media (min-width: 900px) {
  .live-layout.live-3col {
    grid-template-columns: 220px minmax(200px, 280px) 1fr;
    gap: 14px;
    padding: 16px 20px 28px;
    min-height: calc(100vh - 100px);
  }
  .live-cats {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: calc(100vh - 140px);
  }
  .live-cats button {
    width: 100%;
    justify-content: space-between;
  }
  .live-channel-list {
    max-height: calc(100vh - 160px);
  }
  .live-preview-frame {
    min-height: 320px;
    aspect-ratio: auto;
    height: min(56vh, 480px);
  }
}

/* bottom nav 5 items (sin buscar) */
@media (max-width: 899.98px) {
  .bottom-nav {
    display: flex !important;
  }
  .bottom-nav a { flex: 1; }
}

/* Detail TMDB extras */
.detail-logo {
  max-width: min(420px, 70vw);
  max-height: 120px;
  object-fit: contain;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.5));
}
.detail-title-sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
}
.detail-cast-block { padding: 8px 18px 24px; }
.cast-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: none;
}
.cast-rail::-webkit-scrollbar { display: none; }
.cast-card {
  flex: 0 0 110px;
  text-align: center;
}
.cast-photo {
  width: 110px; height: 140px;
  border-radius: 12px;
  overflow: hidden;
  background: #181c21;
  border: 1px solid #293039;
  margin-bottom: 8px;
}
.cast-photo img { width: 100%; height: 100%; object-fit: cover; }
.cast-ph {
  display: grid; place-items: center;
  height: 100%; font-size: 2rem; color: #555;
}
.cast-card strong {
  display: block;
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cast-card small {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-movie-stats { color: var(--accent); font-weight: 700; margin-bottom: 8px; }

/* Player logo */
.player-logo {
  max-height: 36px;
  max-width: 140px;
  object-fit: contain;
  margin-right: 10px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
}
.p-top { align-items: center; }
.ep-art {
  width: 120px !important;
  height: 68px !important;
}


/* ========== Episodios estilo Nuvio ========== */
.detail-episodes-block {
  padding: 8px 16px 32px;
}
.detail-eps-head {
  margin-bottom: 14px;
}
.ep-list.nuvio-eps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ep-row {
  display: grid !important;
  grid-template-columns: 148px minmax(0, 1fr) !important;
  gap: 14px !important;
  align-items: stretch !important;
  width: 100%;
  text-align: left;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 14px !important;
  background: transparent !important;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
}
.ep-row:hover {
  background: transparent !important;
}
.ep-row:hover .ep-thumb img {
  transform: scale(1.04);
}
.ep-thumb {
  position: relative;
  width: 148px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #14181e;
  border: 1px solid #252b33;
  flex-shrink: 0;
}
.ep-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.ep-thumb-ph {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1f26, #0e1218);
}
.ep-badge {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(9, 11, 14, 0.86);
  color: #f6f7f8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  pointer-events: none;
}
.ep-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 4px 4px 4px 0;
  overflow: hidden;
}
.ep-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: #f5f7f8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-sub {
  display: block;
  font-size: 12px;
  color: #8d97a2;
  font-weight: 600;
}
.ep-syn {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  color: #a7b0ba;
  margin-top: 2px;
}

/* Móvil: estilo Nuvio compacto como la captura */
@media (max-width: 899.98px) {
  .detail-episodes-block {
    padding: 6px 12px 28px;
  }
  .ep-row {
    grid-template-columns: 112px minmax(0, 1fr) !important;
    gap: 12px !important;
  }
  .ep-thumb {
    width: 112px;
    border-radius: 10px;
  }
  .ep-badge {
    top: 6px;
    left: 6px;
    height: 20px;
    padding: 0 6px;
    font-size: 10px;
  }
  .ep-title {
    font-size: .95rem;
  }
  .ep-sub {
    font-size: 11px;
  }
  .ep-syn {
    font-size: 12px;
    -webkit-line-clamp: 3;
  }
}

@media (min-width: 900px) {
  .ep-row {
    grid-template-columns: 200px minmax(0, 1fr) !important;
    gap: 18px !important;
  }
  .ep-thumb {
    width: 200px;
    border-radius: 14px;
  }
  .ep-syn {
    -webkit-line-clamp: 3;
  }
}

/* Player meta bar (logo + ep sobre progreso) */
.player-meta-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 0 4px 10px;
  max-width: 100%;
}
.player-meta-bar .player-logo {
  max-height: 48px;
  max-width: 160px;
  object-fit: contain;
  margin: 0;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.65));
}
.player-meta-text {
  min-width: 0;
  flex: 1;
}
.player-ep-line {
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-meta-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vol-panel-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px 8px;
}
#vol-range {
  flex: 1;
  accent-color: var(--accent, #ffd45c);
  height: 6px;
}
.vol-panel-val {
  min-width: 3em;
  font-weight: 700;
  color: var(--accent, #ffd45c);
}
@media (max-width: 600px) {
  .player-meta-bar .player-logo { max-height: 36px; max-width: 120px; }
  .player-ep-line { font-size: .78rem; }
  .player-meta-title { font-size: .9rem; }
}
