/* ============================================================
   PadreTV — estilos
   Tipografías: Clash Display (títulos) + Satoshi (UI), Fontshare
   Paleta: fondo #0b0d12 · superficies #141821/#1a1f2b · acento #ff4d3d
   ============================================================ */

:root {
  --bg: #0b0d12;
  --surface: #141821;
  --surface-2: #1a1f2b;
  --text: #f2f4f8;
  --text-dim: #9aa3b5;
  --accent: #ff4d3d;
  --accent-hover: #ff6b5c;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .5);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, .35);
  --font-display: 'Clash Display', system-ui, sans-serif;
  --font-ui: 'Satoshi', system-ui, sans-serif;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

/* hidden SIEMPRE gana: evita que display:grid/flex de .help-backdrop o .toast lo pise */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
}

img { display: block; max-width: 100%; }

button {
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: rgba(255, 77, 61, .4); }

/* ------------------------------------------------------------ topbar */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 clamp(14px, 3vw, 32px);
  background: rgba(11, 13, 18, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  z-index: 20;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .06em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.logo-dot { color: var(--accent); }

.seg {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07);
}
.seg-item {
  padding: 7px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg-item:hover { color: var(--text); }
.seg-item[aria-pressed="true"] { background: rgba(255, 255, 255, .1); color: var(--text); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 13.5px;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  white-space: nowrap;
}
.chip:hover { background: #232a3a; color: var(--text); transform: translateY(-1px); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 18px rgba(255, 77, 61, .35);
}
.chip[aria-pressed="true"]:hover { background: var(--accent-hover); }
.chip .ic, .chip .disc { width: 12px; height: 12px; display: block; }
.chip .disc { color: currentColor; }

.chip-cache { margin-left: auto; }
#cache-label { font-variant-numeric: tabular-nums; }

.search {
  width: min(240px, 26vw);
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  transition: border-color .15s ease, width .22s ease;
}
.search::placeholder { color: var(--text-dim); }
.search:focus { border-color: var(--accent); outline: none; width: min(320px, 32vw); }

/* ------------------------------------------------------------ home */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 24px) 32px 60px;
}

.hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 62vh;
  display: flex;
  align-items: flex-end;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* doble scrim: lateral + fundido inferior al fondo */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(5, 6, 10, .92), rgba(5, 6, 10, 0) 55%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, var(--bg) 0%, rgba(11, 13, 18, .5) 24%, rgba(11, 13, 18, 0) 58%);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  padding: 0 24px 44px clamp(24px, 5vw, 64px);
}
.hero-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
  margin: 0 0 8px;
}
.hero-meta {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: .05em;
  margin: 0 0 10px;
}
.hero-desc {
  color: var(--text-dim);
  font-size: 15px;
  margin: 0 0 18px;
  max-width: 560px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* botones del hero (estilo tvOS) */
.btn-hero-play {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 26px;
  border-radius: 23px;
  background: #fff;
  color: #0b0d12;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-hero-play:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45);
}
.btn-hero-play:active { transform: scale(.99); }
.btn-hero-play .ic { width: 18px; height: 18px; }
.btn-hero-ghost {
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 22px;
  border-radius: 23px;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  transition: background .15s ease, transform .15s ease;
}
.btn-hero-ghost:hover { background: rgba(255, 255, 255, .16); transform: scale(1.03); }
.btn-hero-round {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--text);
  transition: background .15s ease, transform .15s ease;
}
.btn-hero-round:hover { background: rgba(255, 255, 255, .16); transform: scale(1.06); }
.btn-hero-round .ic { width: 20px; height: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 24px rgba(255, 77, 61, .35);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: rgba(26, 31, 43, .82);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .12);
}
.btn-ghost:hover { background: rgba(35, 42, 58, .9); }

.hero-info {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(20, 24, 33, .85);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 14px;
  max-width: 560px;
}

/* secciones */

.section { margin-top: 36px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}
.section-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .09em;
  text-transform: uppercase;
  margin: 0;
}
.section-note { color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.season-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

/* popover de biblioteca (chip "Más") */
.lib-pop {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 16;
  width: min(360px, 92vw);
  background: rgba(18, 21, 29, .96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
  padding: 14px 16px;
}
.lib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.lib-title { font-weight: 700; font-size: 14px; }
.lib-copy { color: var(--text-dim); font-size: 12px; margin: 3px 0 10px; }
.lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 250px;
  overflow: auto;
}
.lib-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.lib-item:hover { background: rgba(255, 255, 255, .09); }
.lib-item input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* fila horizontal "Continuar viendo" */

.row-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 264px;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: #2a3143 transparent;
}
.row-scroll .card { scroll-snap-align: start; }

/* grid de cards */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px 16px;
}

.card {
  position: relative;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .18s ease;
}
.card:hover {
  transform: translateY(-3px) scale(1.02);
  z-index: 2;
}
.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: var(--surface-2);
  transition: box-shadow .18s ease;
}
.card:hover .card-thumb { box-shadow: 0 18px 44px rgba(0, 0, 0, .55); }
/* inner border sutil sobre la miniatura */
.card-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  pointer-events: none;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 6, 10, .28);
  opacity: 0;
  transition: opacity .18s ease;
}
.card:hover .card-play { opacity: 1; }
.play-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #0b0d12;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .4);
}
.play-circle .ic { width: 26px; height: 26px; margin-left: 3px; }
.badge-watched {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(11, 13, 18, .74);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #8fe3ab;
}
.badge-watched .ic { width: 12px; height: 12px; }
.progress-track {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .18);
}
.progress-fill {
  height: 100%;
  background: var(--accent);
}
.card-meta { padding: 10px 2px 0; }
.card-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.empty {
  color: var(--text-dim);
  padding: 30px 6px;
  text-align: center;
}

/* ------------------------------------------------------------ player */

.player {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  display: flex;
  flex-direction: column;
}
.player video {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.player.iframe-mode video { display: none; }
.player-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(to bottom, rgba(0,0,0,.82), transparent);
  z-index: 3;
  transition: opacity .35s cubic-bezier(.2,.8,.2,1), transform .35s cubic-bezier(.2,.8,.2,1);
}
.player-top .chip-mini { margin-left: auto; }
.p-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(15px, 2.2vw, 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-mini {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---- iconos SVG ---- */
.ic {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

.pbtn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: transparent;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: .85;
  transition: background .15s ease, opacity .15s ease, transform .12s ease;
  flex-shrink: 0;
}
.pbtn:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.pbtn:active { transform: scale(.94); }
.pbtn:focus-visible { outline: 2px solid rgba(255, 255, 255, .35); outline-offset: 2px; border-radius: 12px; }
.pbtn-big { width: 46px; height: 46px; }
.pbtn-big .ic { width: 24px; height: 24px; }
.pbtn-sm { width: 30px; height: 30px; border-radius: 9px; }
.pbtn-sm .ic { width: 16px; height: 16px; }

.controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0 0 14px;
  background: linear-gradient(180deg, transparent, rgba(5, 6, 10, .55) 40%, rgba(5, 6, 10, .85));
  z-index: 3;
  transition: opacity .35s cubic-bezier(.2,.8,.2,1), transform .35s cubic-bezier(.2,.8,.2,1);
}
.player.hide-ui .controls { opacity: 0; transform: translateY(10px); pointer-events: none; }
.player.hide-ui .player-top { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.player.hide-ui { cursor: none; }

.seek {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 10px;
  padding: 0 16px;
}
.seek-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .22);
  overflow: hidden;
  transition: height .15s ease;
}
.seek:hover .seek-track, .seek.dragging .seek-track { height: 6px; }
.seek-buffer, .seek-played {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  border-radius: 4px;
  width: 0%;
}
.seek-buffer { background: rgba(255, 255, 255, .35); }
.seek-played { background: var(--accent); }
.seek-knob {
  position: absolute;
  top: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(1);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .45);
  transition: transform .15s ease;
  pointer-events: none;
}
.seek:hover .seek-knob, .seek.dragging .seek-knob { transform: translate(-50%, -50%) scale(1.35); }
.seek-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  background: rgba(10, 11, 16, .9);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  padding: 4px 8px;
  font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.time {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: rgba(255, 255, 255, .75);
  white-space: nowrap;
  padding: 0 4px;
}
.time-sep { opacity: .4; }
.controls-spacer { flex: 1; }

.volume-wrap { display: flex; align-items: center; gap: 6px; }
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .25);
  outline: none;
  cursor: pointer;
  transition: width .2s ease;
}
.volume-wrap:hover .volume-slider { width: 112px; }
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .4);
}
.volume-slider::-moz-range-thumb {
  width: 12px; height: 12px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .4);
}
.speed-select {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .15s ease;
}
.speed-select:hover { background: rgba(255, 255, 255, .08); }
.speed-select option { background: var(--surface-2); color: var(--text); }

/* ---- omitir intro ---- */

.skip-intro {
  position: absolute;
  right: 24px;
  bottom: 104px;
  z-index: 4;
  background: rgba(255, 255, 255, .94);
  color: #0b0d12;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
  transition: transform .2s ease, background .2s ease;
}
.skip-intro:hover { transform: translateY(-1px); background: #fff; }
.skip-intro:active { transform: translateY(0) scale(.98); }

.intro-pop,
.sleep-pop {
  position: absolute;
  top: 64px;
  right: 20px;
  width: 300px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(18, 21, 29, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
}
.intro-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.intro-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}
.intro-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
}
.intro-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px; height: 15px;
  cursor: pointer;
}
.intro-val {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 12.5px;
  min-width: 38px;
  text-align: right;
}
.intro-set {
  justify-content: center;
  font-size: 13px;
  padding: 9px 12px;
}
.intro-set .ic { width: 16px; height: 16px; }
.intro-btns { display: flex; flex-direction: column; gap: 8px; }
.intro-reset {
  align-self: flex-start;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}
.intro-reset:hover { color: var(--text); }

/* ---- modo sueño (apagar el equipo) ---- */

.sleep-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.sleep-opt {
  justify-content: center;
  font-size: 13px;
  padding: 9px 4px;
}
.sleep-now { justify-content: center; font-size: 13.5px; }
.sleep-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 99, 71, .08);
  border: 1px solid rgba(255, 120, 100, .28);
  border-radius: 10px;
  padding: 10px 12px;
}
.sleep-warn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--text);
}
.sleep-warn .ic { width: 15px; height: 15px; flex-shrink: 0; color: #ff6b5c; }
.sleep-warn strong { font-variant-numeric: tabular-nums; }
.sleep-cancel { justify-content: center; font-size: 12.5px; padding: 7px 10px; }
.sleep-cancel:hover { color: #ff6b5c; }
#btn-sleep.sleep-on { color: var(--accent); }
.intro-note {
  margin: 0;
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.5;
}
#intro-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .25);
  outline: none;
  cursor: pointer;
}
#intro-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
}
#intro-slider::-moz-range-thumb {
  width: 12px; height: 12px;
  border: none;
  border-radius: 50%;
  background: #fff;
}

/* overlays del reproductor */

/* ---- tarjeta "A continuación" ---- */

.next-card {
  position: absolute;
  right: 24px;
  bottom: 96px;
  width: 340px;
  z-index: 7;
  display: flex;
  gap: 12px;
  background: rgba(18, 21, 29, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
  padding: 14px;
}
.next-thumb {
  width: 112px;
  height: 63px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  transition: transform .2s ease;
}
.next-card:hover .next-thumb { transform: scale(1.03); }
.next-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}
.next-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.next-title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.next-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.next-ring { flex-shrink: 0; }
.next-count {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--text-dim);
  min-width: 16px;
}
.next-static { font-size: 12.5px; color: var(--text-dim); }
.next-spacer { flex: 1; }
.next-card .btn {
  padding: 8px 12px;
  font-size: 12.5px;
  border-radius: 10px;
  gap: 6px;
  white-space: nowrap;
}
.next-card .btn .ic { width: 14px; height: 14px; }
.next-card .btn-ghost { padding: 8px 10px; }

.error-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(5, 6, 10, .86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.error-card {
  width: min(460px, 92vw);
  background: rgba(18, 21, 29, .92);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow);
  text-align: center;
}
.error-icon {
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  color: var(--accent);
}
.error-icon .ic { width: 22px; height: 22px; }
.error-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 8px;
}
.error-card p { color: var(--text-dim); font-size: 14px; margin: 0 0 18px; }
.error-actions { display: flex; flex-direction: column; gap: 9px; }

.embed-warning {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 77, 61, .16);
  border-bottom: 1px solid rgba(255, 77, 61, .4);
  color: #ffd9d4;
  font-size: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.embed-ic { display: grid; place-items: center; flex-shrink: 0; }
.embed-ic .ic { width: 22px; height: 22px; }
.embed-warning .btn {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 999px;
  margin-left: auto;
}
.embed-warning .btn .ic { width: 15px; height: 15px; }

/* ------------------------------------------------------------ help / toast */

.help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(5, 6, 10, .7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.help-panel {
  width: min(480px, 92vw);
  max-height: 84vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.help-panel h2 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 16px;
}
.help-keys { margin: 0 0 18px; }
.help-keys > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.help-keys dt { font-size: 13.5px; }
.help-keys dd { margin: 0; color: var(--text-dim); font-size: 13.5px; }
kbd {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, .12);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 7px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 100;
  padding: 12px 20px;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .chip-cache #cache-label { max-width: 130px; }
}

@media (max-width: 720px) {
  :root { --topbar-h: 56px; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; height: auto; }
  .search { order: 5; width: 100%; }
  .search:focus { width: 100%; }
  main { padding-left: 16px; padding-right: 16px; }
  .hero { min-height: 48vh; }
  .hero-content { padding: 0 16px 30px 20px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 16px 10px; }
  .row-scroll { grid-auto-columns: 220px; }
  .play-circle { width: 52px; height: 52px; }
  .play-circle .ic { width: 22px; height: 22px; }
  .volume-slider, .volume-wrap:hover .volume-slider { width: 60px; }
  .btn { padding: 10px 16px; font-size: 14px; }
  .controls-row { gap: 6px; }
  .time { font-size: 11.5px; }
  .speed-select { padding: 6px 6px; }
  .skip-intro { right: 14px; bottom: 96px; }
  .intro-pop, .sleep-pop { top: 58px; right: 12px; width: calc(100vw - 24px); max-width: 300px; }
  .next-card { width: calc(100vw - 24px); right: 12px; bottom: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---- panel Servidor (Ajustes de intro) ---- */

.src-sep { height: 1px; margin: 12px 0; background: rgba(255,255,255,.14); }
.src-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .65; margin: 0 0 8px; }
.src-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.src-label { font-size: 12px; opacity: .7; }
.src-val { font-size: 13px; font-weight: 600; }
.src-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.src-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; opacity: .8; }
.src-item.is-active { opacity: 1; font-weight: 600; }
.src-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.25); flex: none; }
.src-dot.is-on { background: #22c55e; }
.src-detail { opacity: .65; font-size: 11.5px; margin-left: auto; text-align: right; }
.src-btn { justify-content: center; }
/* ---- galería (home HBO-style) ---- */
.gallery-head{padding:6px 0 16px}
.gallery-title{margin:0;font-size:30px;font-weight:800;letter-spacing:.4px}
.gallery-sub{margin:4px 0 0;color:#8ea0b5;font-size:13px}
.shelf-posters{display:flex;gap:14px;overflow-x:auto;padding:4px 2px 12px}
.poster{flex:0 0 auto;width:clamp(130px,15vw,185px);cursor:pointer}
.poster-box{position:relative;aspect-ratio:2/3;border-radius:14px;overflow:hidden;background:#0f1720;box-shadow:0 6px 18px rgba(0,0,0,.35);transition:transform .18s ease,box-shadow .18s ease}
.poster:hover .poster-box,.poster:focus-visible .poster-box{transform:scale(1.045);box-shadow:0 10px 26px rgba(0,0,0,.5);outline:2px solid rgba(255,255,255,.14);outline-offset:2px}
.poster-box img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:1}
.poster-box img.poster-missing{display:none}
.poster-fallback{position:absolute;inset:0;display:grid;place-items:center;font-size:44px;font-weight:800;color:#26384b;background:linear-gradient(160deg,#17222e,#0d141b)}
.poster-play{position:absolute;inset:0;z-index:2;display:grid;place-items:center;opacity:0;transition:opacity .18s ease;background:linear-gradient(180deg,transparent 45%,rgba(0,0,0,.55))}
.poster:hover .poster-play,.poster:focus-visible .poster-play{opacity:1}
.poster-meta{padding:8px 2px 0}
.poster-title{font-size:13.5px;font-weight:600;line-height:1.25}
.poster-sub{display:block;font-size:11.5px;color:#8ea0b5;margin-top:2px}
.show-hero{position:relative;border-radius:18px;overflow:hidden;margin:4px 0 14px;background:linear-gradient(180deg,rgba(13,20,27,.2),rgba(13,20,27,.75));min-height:210px}
.show-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:.28}
.show-hero-content{position:relative;padding:16px 20px 20px}
.back-link{display:inline-flex;align-items:center;gap:6px;background:none;border:0;color:#9fb4c9;cursor:pointer;font-size:13px;padding:4px 0}
.back-link:hover{color:#fff}
.show-title{margin:8px 0 4px;font-size:34px;font-weight:800}
.show-meta{margin:0 0 8px;color:#8ea0b5;font-size:13.5px}
.show-desc{max-width:72ch;color:#c9d6e2;font-size:14.5px;line-height:1.5;margin:0 0 14px}

/* ============================================================
   PREMIUM v3 (HBO Max style) — overrides al final del archivo
   full-bleed hero · rail lateral · anillo hover · tipografía grande
   ============================================================ */
:root {
  --bg: #0a0c10;
  --text: #f2f5f9;
  --muted: #98a4b6;
  --accent: #ff4d3d;
  --card: #141a23;
  --ring: rgba(255, 255, 255, .55);
}

body { background: var(--bg); color: var(--text); font-family: 'Satoshi', system-ui, sans-serif; }
h1, .hero-title, .show-title, .gallery-title, .section-title, .poster-title {
  font-family: 'Clash Display', 'Satoshi', sans-serif; letter-spacing: .2px;
}

/* topbar viejo oculto (safety net si quedara markup antiguo) */
.topbar { display: none !important; }

/* ---------- RAIL lateral de iconos ---------- */
.rail {
  position: fixed; left: 0; top: 0; bottom: 0; width: 64px; z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0;
  background: linear-gradient(90deg, rgba(10,12,16,.92), rgba(10,12,16,.55) 70%, transparent);
  pointer-events: auto; transition: opacity .3s ease;
}
.rail-logo {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  background: rgba(255,255,255,.06); color: #fff; font-weight: 800;
  font-family: 'Clash Display', sans-serif; font-size: 15px; text-decoration: none;
}
.rail-logo .rail-dot { color: var(--accent); }
.rail-btn {
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent;
  color: #8b98ab; display: grid; place-items: center; cursor: pointer;
  transition: background .15s, color .15s;
}
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-btn.is-active { color: #fff; background: rgba(255,255,255,.1); }

/* ---------- FLOAT TOP (chips flotantes) ---------- */
.float-top {
  position: fixed; top: 14px; right: 16px; z-index: 45;
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px;
  background: rgba(12,15,20,.42); border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: opacity .25s;
}
body[data-route="watch"] .float-top { opacity: 0; pointer-events: none; }
.float-top .search {
  width: 230px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px; padding: 7px 14px; color: var(--text); font-size: 13px;
}
.float-top .search:focus { outline: 1px solid rgba(255,255,255,.25); width: 230px; border-color: rgba(255,255,255,.14); }
.float-top .seg { display: flex; gap: 4px; background: transparent; border: 0; padding: 0; }
.float-top .seg-item {
  border: 0; background: transparent; color: #aeb9c9; padding: 6px 10px;
  border-radius: 999px; font-size: 12.5px; cursor: pointer;
}
.float-top .seg-item:hover { color: #fff; }
.float-top .seg-item[aria-pressed="true"] { background: var(--accent); color: #fff; }
.float-top .chip-cache {
  border: 1px solid rgba(255,255,255,.1); background: transparent; color: #aeb9c9;
  border-radius: 999px; padding: 6px 10px; font-size: 12.5px;
  display: flex; align-items: center; gap: 6px; cursor: pointer; margin-left: 0;
}
.float-top .chip-cache:hover { background: rgba(255,255,255,.08); color: #fff; transform: none; }
.float-top .chip-cache[aria-pressed="true"] { background: rgba(255,255,255,.12); color: #fff; }
.float-top .chip-cache[aria-pressed="true"]:hover { background: rgba(255,255,255,.16); }
.float-top .chip-cache .disc { width: 15px; height: 15px; }

/* ---------- LAYOUT: full-bleed + MUCHO aire ----------
   El rail flota SOBRE el contenido (como HBO): main no lleva padding-left;
   cada sección lleva su propio padding-left:90px. */
main { max-width: none; margin: 0; padding: 0 0 60px; }
body[data-route="watch"] main { padding: 0; }
.section { padding: 0 30px 0 90px; margin: 26px 0 0; }
.gallery-head { padding: 18px 30px 4px 90px; }
.show-hero { margin: 0 30px 10px 90px; }
.empty { padding: 60px 30px 60px 90px; text-align: left; }

/* ---------- HERO full-bleed ---------- */
.hero {
  position: relative; min-height: 62vh; display: flex; align-items: flex-end;
  margin: 0 0 10px; padding: 0 30px 34px 90px; border-radius: 0; overflow: hidden;
  background: #0a0c10; box-shadow: none;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10,12,16,.94) 0%, rgba(10,12,16,.55) 34%, rgba(10,12,16,.18) 62%, rgba(10,12,16,.05) 100%),
    linear-gradient(0deg, var(--bg) 0%, rgba(10,12,16,.25) 34%, transparent 62%);
}
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; opacity: .85; }
.hero-content { position: relative; z-index: 2; max-width: 640px; padding: 0; }
.hero-kicker { text-transform: uppercase; letter-spacing: .28em; font-size: 12px; font-weight: 700; color: #b9c4d4; margin: 0 0 6px; }
.hero-title { font-size: clamp(38px, 5.2vw, 68px); line-height: 1.02; margin: 0 0 10px; font-weight: 700; text-shadow: 0 2px 24px rgba(0,0,0,.45); }
.hero-meta { color: #c6cfdb; font-size: 14px; margin: 0 0 8px; }
.hero-progress { width: 290px; max-width: 60vw; height: 4px; border-radius: 4px; background: rgba(255,255,255,.22); overflow: hidden; margin: 0 0 6px; }
.hero-progress > div { height: 100%; background: var(--accent); }
.hero-desc {
  color: #cdd6e0; font-size: 14.5px; line-height: 1.5; margin: 0 0 16px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px;
}
.hero-actions { display: flex; gap: 10px; align-items: center; }
.btn-hero-play { display: inline-flex; align-items: center; gap: 9px; background: #fff; color: #0b0d10; border: 0; border-radius: 999px; padding: 12px 26px; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .15s; }
.btn-hero-play:hover { transform: scale(1.04); }
.btn-hero-play .ic { width: 18px; height: 18px; }
.btn-hero-ghost { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600; cursor: pointer; }
.btn-hero-round { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(20,26,35,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }

/* ---------- SECTIONS ---------- */
.section-title { font-size: 21px; font-weight: 700; margin: 0 0 12px; }

/* ---------- CARDS paisaje (anillo blanco al hover) ---------- */
.card { border-radius: 12px; background: transparent; }
.card:hover { transform: none; }
.card .card-thumb { border-radius: 12px; overflow: hidden; position: relative; transition: transform .18s ease, box-shadow .18s ease; }
.card:hover .card-thumb { transform: scale(1.035); box-shadow: 0 0 0 2px var(--ring), 0 18px 40px rgba(0,0,0,.45); }
.card:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 12px; }
.card-meta .card-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.card-meta .card-sub { font-size: 11.5px; color: var(--muted); }

/* ---------- POSTERS (anillo blanco al hover) ---------- */
.poster { border-radius: 12px; }
.poster-box { border-radius: 12px; transition: transform .18s ease, box-shadow .18s ease; }
.poster:hover .poster-box { transform: scale(1.035); box-shadow: 0 0 0 2px var(--ring), 0 14px 30px rgba(0,0,0,.45); outline: none; }
.poster:focus-visible .poster-box { transform: scale(1.035); box-shadow: 0 0 0 2px var(--ring), 0 14px 30px rgba(0,0,0,.45); outline: 2px solid #fff; outline-offset: 3px; }
.poster-title { font-size: 13px; font-weight: 600; }
.poster-sub { font-size: 11px; }

/* ---------- SHOW page ---------- */
.show-hero { border-radius: 16px; min-height: 280px; position: relative; }
.show-hero-content { padding: 26px 28px 24px; }
.show-title { font-size: clamp(34px, 4.6vw, 60px); }

/* ---------- GRID ---------- */
.grid { gap: 16px; }

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- WATCH pulido ---------- */
.player-top { background: linear-gradient(180deg, rgba(5,7,10,.65), transparent); padding: 14px 18px; }
.p-title { font-family: 'Clash Display', sans-serif; font-size: 17px; font-weight: 600; }
.pbtn { border-radius: 50%; transition: background .15s; }
.pbtn:hover { background: rgba(255,255,255,.1); }
.controls { background: linear-gradient(0deg, rgba(5,7,10,.82), rgba(5,7,10,.35) 70%, transparent); padding: 16px 22px 12px; }
.intro-pop, .sleep-pop {
  background: rgba(13,17,23,.78); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.08); border-radius: 16px; box-shadow: 0 22px 60px rgba(0,0,0,.5);
}
.skip-intro { border-radius: 999px; background: rgba(255,255,255,.9); color: #0b0d10; font-weight: 700; }
#next-card { border-radius: 16px; }
/* watch inmersivo: rail casi invisible y sin interacción */
body[data-route="watch"] .rail { opacity: .15; pointer-events: none; }

/* ---------- galería head ---------- */
.gallery-title { font-size: 34px; }
.gallery-sub { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .section { padding: 0 16px 0 76px; }
  .gallery-head { padding: 16px 16px 4px 76px; }
  .show-hero { margin: 0 16px 10px 76px; }
  .hero { padding: 0 16px 30px 76px; }
  .float-top { top: 10px; right: 10px; gap: 4px; padding: 4px 6px; }
  .float-top .search, .float-top .search:focus { width: 150px; }
  .float-top #cache-label { display: none; }
}

/* ===== PREMIUM v3.1 ===== */
/* hero más contenido */
.hero-title { font-size: clamp(34px, 4vw, 54px); max-width: 760px; }
.hero { min-height: 58vh; padding-bottom: 30px; }
.hero-desc { -webkit-line-clamp: 2; max-width: 500px; margin-bottom: 14px; }
.hero-meta { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #b9c4d4; margin: 0 0 10px; }
.hero-meta .meta-dot { width: 3px; height: 3px; border-radius: 50%; background: #5c6a7d; display: inline-block; }
.hero-meta .meta-badge { border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: 1px 6px; font-size: 11px; color: #cdd6e0; }
/* rail logo rojo sólido */
.rail-logo { background: var(--accent); color: #fff; font-size: 17px; box-shadow: 0 4px 14px rgba(255,77,61,.35); }
.rail-logo .rail-dot { display: none; }
/* continue row: cards 16:9 consistentes */
.row-scroll .card { width: 250px; flex: 0 0 auto; }
.card .card-thumb { aspect-ratio: 16 / 9; }
.card .card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.card .card-thumb .progress-track { height: 4px; }
/* show hero más legible */
.show-bg { opacity: .2; filter: blur(2px) saturate(1.05); }
.show-hero { min-height: 300px; }
.show-hero::after { content:''; position:absolute; inset:0; background: linear-gradient(90deg, rgba(10,12,16,.72), rgba(10,12,16,.25)); }
.show-hero-content { z-index: 2; position: relative; }
/* float-top fino */
.float-top { gap: 10px; padding: 8px 12px; }
.float-top .search { width: 240px; }

/* ===== RAIL v3.2 ===== */
/* logo arriba, NAVEGACIÓN centrada verticalmente */
.rail { justify-content: flex-start; gap: 0; }
.rail-logo { margin-bottom: 0; }
/* el grupo completo de botones flota al centro vertical del viewport:
   padding-bottom = alto del logo (44px) para compensar que el logo ocupa
   la parte de arriba y el nav (flex:1) quede centrado de verdad */
.rail-nav-wrap { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; width: 100%; padding-bottom: 44px; }
.rail-nav { display: flex; flex-direction: column; gap: 10px; align-items: center; margin: 0; width: 100%; }
.rail-btn { position: relative; top: 0; width: 46px; height: 46px; }
.rail-btn svg { width: 23px; height: 23px; }
@media (max-width: 720px) {
  .rail { width: 56px; }
  .rail-btn { width: 42px; height: 42px; }
}

/* ===== RESPONSIVE v4 (mobile/tablet/TV) ===== */

/* ---------- MOBILE (≤640px): rail → BOTTOM BAR ---------- */
@media (max-width: 640px) {
  .rail { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 64px; flex-direction: row; justify-content: space-around; align-items: center; padding: 0 6px calc(0px + env(safe-area-inset-bottom)); background: rgba(10,12,16,.92); border-top: 1px solid rgba(255,255,255,.06); }
  .rail-logo { display: none; }
  .rail-nav-wrap { flex-direction: row; justify-content: space-around; width: 100%; padding: 0; }
  .rail-nav { flex-direction: row; gap: 0; width: 100%; justify-content: space-around; }
  .rail-btn { width: 48px; height: 48px; } /* touch target ≥44 */
  main { padding-bottom: 84px; }
  body[data-route="watch"] .rail { display: flex; opacity: 1; pointer-events: auto; } /* en watch móvil la barra sigue útil */
  body[data-route="watch"] main { padding-bottom: 0; }
  /* float-top: pasa a dos filas compactas arriba */
  .float-top { left: 10px; right: 10px; top: 8px; justify-content: space-between; padding: 6px 8px; }
  .float-top .search { width: 100%; order: 3; flex-basis: 100%; margin-top: 6px; }
  .float-top { flex-wrap: wrap; }
  .float-top .seg-item { padding: 7px 9px; }
  /* hero más corto y legible */
  .hero { min-height: 46vh; padding: 0 16px 24px 16px; }
  .hero-title { font-size: clamp(30px, 8.5vw, 40px); }
  .hero-desc { -webkit-line-clamp: 3; }
  .hero-actions { flex-wrap: wrap; }
  .btn-hero-play { padding: 11px 20px; font-size: 14px; }
  .btn-hero-round { width: 42px; height: 42px; }
  /* secciones full-bleed sin padding izquierdo del rail */
  .section, .gallery-head { padding: 0 16px; margin-top: 22px; }
  .section-title { font-size: 18px; }
  .show-hero { margin: 0 12px 8px; min-height: 240px; }
  .show-title { font-size: clamp(26px, 7vw, 34px); }
  /* rows con momentum + snap */
  .row-scroll { scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .poster { scroll-snap-align: start; width: 118px; }
  .row-scroll .card { width: 210px; }
  .grid { gap: 10px; }
  /* cards de episodios full-width en grid */
  .grid .card { width: auto; }
  /* toast arriba para no chocar con bottom bar */
  .toast { bottom: auto; top: 74px; }
}

/* ---------- TABLET (641-1024px) ---------- */
@media (min-width: 641px) and (max-width: 1024px) {
  .hero { min-height: 52vh; }
  .poster { width: 150px; }
  .row-scroll .card { width: 230px; }
}

/* ---------- TV (≥1600px con body.tv) ---------- */
body.tv .section-title { font-size: 28px; }
body.tv .poster-title { font-size: 17px; font-weight: 600; }
body.tv .poster-sub { font-size: 14px; }
body.tv .hero-title { font-size: clamp(48px, 4.6vw, 84px); }
body.tv .hero-desc { font-size: 19px; max-width: 700px; }
body.tv .hero-kicker { font-size: 15px; }
body.tv .hero-meta { font-size: 17px; }
body.tv .btn-hero-play { font-size: 19px; padding: 16px 34px; }
body.tv .btn-hero-round { width: 60px; height: 60px; }
body.tv .rail { width: 84px; }
body.tv .rail-btn { width: 60px; height: 60px; }
body.tv .rail-btn svg { width: 30px; height: 30px; }
body.tv .rail-logo { width: 58px; height: 58px; font-size: 22px; }
body.tv .section, body.tv .gallery-head { padding-left: 120px; padding-right: 48px; }
body.tv .show-hero { margin-left: 120px; margin-right: 48px; }
body.tv .hero { padding-left: 120px; }
body.tv .card-meta .card-title { font-size: 17px; }
body.tv .card-meta .card-sub { font-size: 14px; }
body.tv .float-top .search { width: 320px; font-size: 15px; }
body.tv .float-top .seg-item { font-size: 15px; padding: 8px 14px; }
body.tv .poster { width: 240px; }
body.tv .row-scroll .card { width: 340px; }
body.tv .grid { gap: 22px; }
/* focus visible para navegación con d-pad de TV */
body.tv .poster:focus-visible .poster-box, body.tv .card:focus-visible .card-thumb { box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(255,77,61,.6) !important; transform: scale(1.05); }
body.tv .rail-btn:focus-visible, body.tv .seg-item:focus-visible, body.tv .btn-hero-play:focus-visible, body.tv .search:focus-visible { outline: 3px solid #fff !important; outline-offset: 2px; }
/* tv-mode resume: al volver a home en TV, mantener hero legible */
@media (min-width: 1600px) and (max-height: 899px) { /* laptop XL: tv off por altura */ }

/* global focus general (TV-friendly) */
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ============================================================
   VISTAS NUEVAS — galerías paginadas, chips de género, buscador
   ============================================================ */

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.section-link:hover, .section-link:focus-visible { color: #fff; background: rgba(255,255,255,.08); }
.section-link .ic { width: 14px; height: 14px; }

/* --- galería (películas / series): grid, nunca scroll horizontal --- */
.gallery-section { padding-bottom: 40px; }
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 18px;
}
.tag-chip {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tag-chip:hover { color: #fff; background: rgba(255,255,255,.1); }
.tag-chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-chip:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 20px 14px;
  padding: 2px 0 6px;
}
.gallery-grid .poster { width: 100%; flex: none; }
.gallery-grid .empty { grid-column: 1 / -1; }

/* rejilla de episodios (miniaturas 16:9) */
.cards-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px 14px; }
.cards-grid .card { width: 100%; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 26px 0 6px;
}
.pager-btn {
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}
.pager-btn:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.pager-btn:disabled { opacity: .35; cursor: default; }
.pager-info { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* --- buscador --- */
.search-hero { padding: 6px 0 10px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  max-width: 720px;
}
.search-box:focus-within { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); }
.search-box .ic { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}
.search-input::placeholder { color: var(--muted); }
.search-hint { color: var(--muted); font-size: 12.5px; margin: 10px 2px 0; }

/* --- resultados remotos de Cinecalidad --- */
.result-card { cursor: pointer; }
.result-card .poster-box { position: relative; }
.result-card.is-added .poster-box { box-shadow: 0 0 0 2px rgba(34,197,94,.5), 0 6px 18px rgba(0,0,0,.35); }
.result-card[aria-busy="true"] { opacity: .55; pointer-events: none; }
.badge-kind {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  background: rgba(10,12,16,.82);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.result-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.result-actions .btn { font-size: 12px; padding: 7px 10px; border-radius: 9px; }
.result-actions .btn .ic { width: 13px; height: 13px; }

/* el buscador flotante estorba en la propia vista de búsqueda */
body[data-route="search"] .float-top .search { display: none; }

/* --- TV (10-foot UI) --- */
body.tv .tag-chip { font-size: 15px; padding: 10px 17px; }
body.tv .pager-btn { font-size: 16px; padding: 12px 22px; }
body.tv .pager-info { font-size: 15px; }
body.tv .section-link { font-size: 16px; }
body.tv .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 26px 20px; }
body.tv .cards-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
body.tv .search-input { font-size: 20px; }
body.tv .search-hint { font-size: 15px; }
body.tv .result-actions .btn { font-size: 14px; padding: 9px 13px; }
body.tv .tag-chip:focus-visible, body.tv .pager-btn:focus-visible, body.tv .poster:focus-visible .poster-box {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* --- tablet / móvil --- */
@media (max-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px 12px; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 10px; }
  .cards-grid { grid-template-columns: 1fr; }
  .tag-chips { gap: 6px; padding-bottom: 14px; }
  .tag-chip { font-size: 12px; padding: 6px 11px; }
  .gallery-section { padding-bottom: 92px; } /* deja respirar a la barra inferior */
  .search-box { padding: 10px 12px; }
  .search-input { font-size: 16px; } /* evita el zoom de iOS */
  .pager { gap: 10px; padding-top: 20px; }
  .pager-btn { padding: 9px 13px; }
  .result-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* buscador: misma alineación que .section/.gallery-head respecto al rail */
.search-hero { padding: 18px 30px 6px 90px; }
.search-hero .gallery-title { margin: 0; }
.search-hero .search-box { max-width: 760px; }
@media (max-width: 1024px) { .search-hero { padding: 16px 24px 6px 90px; } }
@media (max-width: 720px) { .search-hero { padding: 16px 16px 6px 76px; } }
@media (max-width: 640px) { .search-hero { padding: 14px 16px 6px; background: none; } }
body.tv .search-hero { padding: 30px 48px 10px 120px; }

/* ---------- eliminar de la biblioteca (papelera sobre la carátula) ---------- */
.poster-del {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(10, 12, 16, .72);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .15s ease, transform .15s ease, background .15s ease, border-color .15s ease;
}
.poster-del .ic { width: 15px; height: 15px; }
/* NUNCA a la vista por defecto: aparece al pasar el ratón, al seleccionar con
   teclado (TV) o mientras se mantiene pulsada la carátula en táctil. */
.poster:hover .poster-del,
.poster:focus-visible .poster-del,
.poster:has(.poster-del:focus-visible) .poster-del,
.poster.is-touching .poster-del,
.poster-del:focus-visible { opacity: 1; transform: scale(1); }
.poster-del:hover { background: #e5484d; border-color: #e5484d; }
.poster-del:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
body.tv .poster-del { width: 34px; height: 34px; }
body.tv .poster-del .ic { width: 18px; height: 18px; }

/* ---------- diálogo de confirmación ---------- */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 6, 10, .72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.confirm-panel {
  width: min(440px, 94vw);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.confirm-panel h2 { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin: 0 0 10px; }
.confirm-panel p { margin: 0 0 18px; color: var(--text-dim); font-size: 14px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-danger { background: #e5484d; color: #fff; }
.btn-danger:hover { background: #f2565b; }

/* ---------- enlace externo (sin resultados en el catálogo) ---------- */
.link-out {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  color: #8fb2ff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.link-out:hover, .link-out:focus-visible { background: rgba(143, 178, 255, .14); border-color: #8fb2ff; color: #fff; }

