/* ═══════════════════════════════════════════════
   NOTFLIX — Home / Nav / Card CSS (redesign 2026)
   Player CSS preserved below this section
   ═══════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --bg:           #0a0a0f;
  --surface:      #141418;
  --surface2:     #1e1e24;
  --border:       rgba(255,255,255,0.07);
  --text:         #f0f0f0;
  --muted:        #888899;
  --accent:       #e50914;
  --accent-glow:  rgba(229,9,20,0.3);
  --red:          #e50914;        /* compat alias */
  --panel:        rgba(255,255,255,.075);
  --line:         rgba(255,255,255,.14);
}

/* ── Reset & base ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
               BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ── Topbar ──────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 300;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 24px;
  height: 64px;
  padding: 0 clamp(16px, 4vw, 56px);
  background: transparent;
  transition: background 0.35s ease, backdrop-filter 0.35s ease, border-color 0.35s ease;
  border-bottom: 1px solid transparent;
}

.topbar.scrolled {
  background: rgba(10,10,15,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}

/* Brand */
.brand {
  color: var(--accent);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

/* Nav links */
nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

nav a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.07);
}

nav a.nav-active {
  color: var(--text);
  font-weight: 600;
}

/* Auth area */
.auth {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.signin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.signin-link:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* Hamburger button (mobile) */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.18s ease;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.08); }
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.mobile-drawer {
  position: fixed;
  top: 0; right: 0;
  z-index: 400;
  width: min(300px, 80vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 72px 24px 32px;
  gap: 4px;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
.mobile-drawer.open { transform: translateX(0); }

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 390;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.mobile-drawer a {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.18s ease, background 0.18s ease;
}
.mobile-drawer a:hover,
.mobile-drawer a.nav-active {
  color: var(--text);
  background: rgba(255,255,255,0.07);
}
.mobile-drawer a.nav-active { font-weight: 600; }

.drawer-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ── Search ──────────────────────────────────── */
.top-search {
  display: grid;
  grid-template-columns: 38px 0 0;
  align-items: center;
  justify-self: end;
  width: 38px;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  transition: width 0.24s ease, background 0.24s ease, border-color 0.24s ease;
}

.top-search:focus-within,
.top-search.is-open {
  grid-template-columns: 38px minmax(120px, 160px) 46px;
  width: min(280px, 30vw);
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.1);
}

.search-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  cursor: pointer;
}
.search-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.top-search input {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  opacity: 0;
  outline: 0;
  transition: opacity 0.18s ease;
}
.top-search:focus-within input,
.top-search.is-open input {
  padding: 0 4px;
  opacity: 1;
}

.top-search button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  cursor: pointer;
}
.top-search:focus-within button,
.top-search.is-open button {
  opacity: 1;
  pointer-events: auto;
}

/* ── Body offset for fixed nav ───────────────── */
body:not(.watch-page) > *:not(.topbar):not(.mobile-drawer):not(.drawer-overlay):first-of-type {
  padding-top: 64px;
}

/* ── Hero Carousel ───────────────────────────── */
.hero-carousel-container {
  position: relative;
  width: 100%;
  height: 68vh;
  min-height: 380px;
  max-height: 680px;
  overflow: hidden;
  background: #000;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  z-index: 1;
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

/* dual-gradient overlay — bottom-to-top fade + left vignette */
.hero-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom,
      rgba(10,10,15,0.10) 0%,
      rgba(10,10,15,0.50) 60%,
      rgba(10,10,15,1.00) 100%),
    linear-gradient(to right,
      rgba(10,10,15,0.90) 0%,
      rgba(10,10,15,0.20) 55%,
      transparent 100%);
  z-index: 1;
}

.hero-copy {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0 48px 48px;
  z-index: 3;
  max-width: 640px;
}

.hero-copy .hero-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-copy h1 {
  font-size: clamp(28px, 5vw, 54px) !important;
  font-weight: 800 !important;
  margin: 0 0 8px !important;
  line-height: 1.05 !important;
  color: #fff;
  text-transform: none !important;
}

.hero-copy .hero-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 500;
}

.hero-copy .desc {
  font-size: 15px;
  color: rgba(255,255,255,0.72);
  line-height: 1.55;
  margin: 0 0 24px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 520px;
  text-shadow: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Carousel Arrows */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.carousel-arrow:hover {
  background: rgba(255,255,255,0.22);
  transform: translateY(-50%) scale(1.08);
}
.carousel-arrow[disabled] {
  opacity: 0.3;
  pointer-events: none;
}
.carousel-arrow.prev { left: 20px; }
.carousel-arrow.next { right: 20px; }

/* Carousel dots */
.carousel-dots {
  position: absolute;
  bottom: 18px;
  right: 36px;
  display: flex;
  gap: 7px;
  z-index: 5;
}
.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  padding: 0;
}
.indicator-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

/* ── Buttons ─────────────────────────────────── */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.pill-button { border-radius: 999px; }

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  min-height: 48px;
  border: 0;
  border-radius: 4px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease;
}
.ghost-button:hover { background: rgba(255,255,255,0.28); }

/* ── Genre filter ────────────────────────────── */
.genre-filter,
.genre-chip-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}
.genre-filter::-webkit-scrollbar,
.genre-chip-grid::-webkit-scrollbar { display: none; }

.genre-filter {
  padding: 20px clamp(16px, 4vw, 56px) 0;
}
.home-shell .genre-filter { padding-inline: 0; }

.genre-filter a,
.genre-chip,
.genre-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.genre-filter a:hover,
.genre-chip:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }

.genre-filter a.active,
.genre-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.genre-check input { width: auto; min-height: 0; }

/* ── Home shell ──────────────────────────────── */
.home-shell {
  padding: 0 clamp(12px, 4vw, 56px) 48px;
}

/* ── Rail ────────────────────────────────────── */
.rail { padding: 32px 0 0; }

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  padding: 0 4px;
}

.rail-head-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.rail-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.rail-see-all {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.18s ease;
}
.rail-see-all:hover { color: var(--accent); }

.rail-arrows {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rail-arrows button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  background: var(--surface2);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.rail-arrows button:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
  transform: scale(1.06);
}
.rail-arrows button:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Rail scrollable row */
.poster-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 148px;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 12px 24px 20px;
}
.poster-rail::-webkit-scrollbar { display: none; }
.poster-rail > * { scroll-snap-align: start; }

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

/* ── Cards ───────────────────────────────────── */
.card {
  position: relative !important;
  overflow: visible !important;
  display: grid;
  gap: 6px;
  width: 148px;
}

.card-link {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 6px;
  aspect-ratio: 2/3;
  background: var(--surface2);
}

.card-link img,
.poster-empty {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface2);
  display: block;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.poster-empty {
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

@media (hover: hover) {
  .card:hover .card-link img,
  .card:hover .poster-empty {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  }
}

.card-details-inline {
  display: grid;
  gap: 2px;
  padding: 0 2px;
}
.card-details-inline strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-details-inline span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card badge */
.card-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(229,9,20,0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Progress bar */
.card-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,0.18);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}
.card-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 0 0 0 6px;
}

/* Card popout (desktop hover only) */
.card-popout {
  position: absolute;
  top: 0; left: 0;
  width: 220px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.85);
  border: 1px solid var(--border);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.88) translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  visibility: hidden;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (hover: hover) {
  .card:hover .card-popout,
  .card.is-active .card-popout {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1.15) translateY(-12px);
    visibility: visible;
  }
  .card:hover .card-link,
  .card:hover .card-details-inline,
  .card.is-active .card-link,
  .card.is-active .card-details-inline {
    opacity: 0;
    transition: opacity 0.18s ease;
  }
}

.popout-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: var(--surface2);
}
.popout-image-container img {
  width: 100%;
  height: 100% !important;
  object-fit: cover !important;
  display: block;
}

.popout-info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popout-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.18s ease;
  border: none;
}
.play-circle-btn {
  width: 32px; height: 32px;
  background: #fff;
  color: #000;
  font-size: 11px;
  padding-left: 2px;
  text-decoration: none;
}
.play-circle-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.1);
}
.circle-btn {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35) !important;
  font-size: 14px;
}
.circle-btn:hover {
  border-color: #fff !important;
  background: rgba(255,255,255,0.18);
  transform: scale(1.1);
}
.circle-btn.active {
  background: rgba(229,9,20,0.18);
  border-color: var(--accent) !important;
  color: var(--accent);
}

.popout-metadata { display: flex; flex-direction: column; gap: 2px; }
.popout-metadata strong {
  display: block;
  font-size: 13px !important;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 !important;
  font-weight: 700;
}
.popout-metadata .meta-desc {
  display: block;
  font-size: 11px !important;
  color: var(--muted);
  padding: 0 !important;
}

/* Episode progress reuse */
.episode-progress {
  display: block;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.18);
  position: absolute;
  bottom: 0; left: 0;
  border-radius: 0;
  overflow: hidden;
}
.episode-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* ── TV/Show browser episode cards ──────────── */
.episode-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.episode-card:hover {
  background: var(--surface2);
  border-color: rgba(255,255,255,0.14);
}
.episode-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 8px var(--accent-glow);
}

/* ── Rating icons ────────────────────────────── */
.player-rating-center {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.6);
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.15);
  margin-left: 20px;
  pointer-events: auto;
}
.rating-icon {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  color: #fff;
  opacity: 0.6;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rating-icon:hover { opacity: 1; transform: scale(1.2); }
.rating-icon.active {
  opacity: 1;
  background: rgba(229,9,20,0.2);
  border: 1px solid var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
  transform: scale(1.1);
}

/* Resume button */
.resume-show-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 800 !important;
  margin-top: 15px !important;
  font-size: 15px !important;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.resume-show-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(229,9,20,0.6);
  transition: all 0.2s ease;
}

/* ── Misc layout ─────────────────────────────── */
h1 { margin: 10px 0 12px; font-size: clamp(36px, 7vw, 68px); line-height: 0.95; }
p { color: #d4d4d8; line-height: 1.55; }

.meta-line { color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.danger { color: #fca5a5; }

.empty {
  min-height: 72vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 34px;
  text-align: center;
}

/* ── Login ───────────────────────────────────── */
.login-layout {
  min-height: 78vh;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  align-items: start;
  padding: 42px clamp(18px, 5vw, 70px);
}
.login-card {
  display: grid;
  gap: 13px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.login-card.wide { max-width: 760px; }
.login-card h1 { font-size: clamp(34px, 6vw, 64px); }
.login-card h2 { margin: 0; }

.email-icon {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 950;
}

.notice {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
}

/* ── Settings ────────────────────────────────── */
.settings-page {
  min-height: 78vh;
  display: grid;
  align-items: start;
  padding: 44px clamp(18px, 5vw, 70px);
}
.settings-panel {
  width: min(720px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.settings-panel h1 { font-size: clamp(38px, 7vw, 72px); }
.settings-form { display: grid; gap: 14px; }

/* ── Admin ───────────────────────────────────── */
.admin {
  display: grid;
  grid-template-columns: minmax(360px, 620px) 1fr;
  gap: 24px;
  padding: 34px clamp(18px, 5vw, 70px);
}
.admin.single-admin {
  grid-template-columns: minmax(320px, 760px);
  justify-content: center;
}
.admin.show-admin {
  grid-template-columns: minmax(380px, 680px) minmax(360px, 1fr);
}
.admin section, .admin aside {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.admin-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.admin-titlebar h1,
.admin-titlebar h2 { margin: 0; }
.editor, .show-create-form { display: grid; gap: 12px; }
.show-info-panel, .episode-manager { margin-top: 18px; }

label { display: grid; gap: 7px; color: #d4d4d8; font-size: 13px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,0.35);
  color: #fff;
  padding: 10px 12px;
}
textarea { min-height: 112px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; gap: 18px; }
.checks label { display: flex; align-items: center; gap: 8px; }
.checks input { width: auto; min-height: 0; }

.subtitle-inline {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.055);
}
.subtitle-inline strong { font-size: 13px; }
.subtitle-upload-list { display: grid; gap: 12px; }
.subtitle-upload-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(0,0,0,0.18);
}
.subtitle-remove { justify-self: start; min-height: 34px; padding-inline: 12px; }

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  margin-bottom: 10px;
}
.media-admin-row { grid-template-columns: 76px 1fr auto auto; }
.media-admin-row img,
.media-admin-row > span:first-child {
  width: 76px;
  aspect-ratio: 16/9;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255,255,255,0.09);
}
.media-admin-row div { display: grid; gap: 4px; }
.admin-row.stacked { display: grid; grid-template-columns: 1fr; }
.admin-row.stacked p { margin: 0; }
.admin-row small { color: var(--muted); }
.admin-episode-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.admin-episode-card { grid-template-columns: 148px 1fr auto auto; align-items: center; }
.admin-episode-card .ghost-button,
.admin-episode-card .primary { min-height: 34px; padding: 8px 12px; text-align: center; }

.genre-admin { display: grid; gap: 12px; margin-bottom: 18px; }
.genre-add { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.genre-chip .danger { padding-left: 8px; border-left: 1px solid var(--line); }

/* ── Mobile ──────────────────────────────────── */
@media (max-width: 768px) {
  .topbar {
    height: 56px;
    gap: 12px;
  }
  nav { display: none; }
  .auth { display: none; }
  .hamburger-btn { display: flex; }

  .hero-carousel-container {
    min-height: 320px;
    height: 55vh;
  }
  .hero-copy {
    padding: 0 24px 32px;
  }
  .hero-copy h1 { font-size: clamp(22px, 7vw, 34px) !important; }

  .poster-rail {
    grid-auto-columns: 120px;
    padding: 10px 16px 16px;
  }
  .card { width: 120px; }
}

/* ── Touch devices: no card popout ──────────── */
@media (hover: none), (pointer: coarse) {
  .card-popout { display: none !important; }
  .card.is-active .card-link,
  .card.is-active .card-details-inline { opacity: 1 !important; }
  .card:hover { transform: none !important; box-shadow: none !important; }
  .card:hover img, .card:hover .poster-empty { transform: none; box-shadow: none; }
}


/* ═══ PLAYER / WATCH PAGE CSS (preserved) ═══ */

.watch {
  min-height: 100vh;
  background: #020203;
}

.cinema-player {
  --cue-size: 28px;
  --player-brightness: 1;
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.cinema-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  filter: brightness(var(--player-brightness));
}

.cinema-player video::cue {
  font-size: var(--cue-size);
  line-height: 1.25;
  color: #fff;
  background: rgba(0,0,0,.38);
  text-shadow: 0 2px 8px rgba(0,0,0,.8);
}

.cinema-player[data-caption-bg="dark"] video::cue {
  background: rgba(0,0,0,.78);
}

.cinema-player[data-caption-bg="clear"] video::cue {
  background: transparent;
}

.player-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.62), transparent 24%, transparent 58%, rgba(0,0,0,.72));
  transition: opacity .24s ease;
}

.player-top,
.player-bottom,
.center-playback {
  position: absolute;
  z-index: 2;
  transition: opacity .24s ease, transform .24s ease;
}

.player-top {
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 20px;
  padding: clamp(22px, 5vw, 54px) clamp(20px, 6vw, 70px);
}

.player-top strong {
  max-width: 48vw;
  text-align: right;
  font-size: clamp(16px, 2.5vw, 24px);
}

.player-left {
  display: flex;
  align-items: center;
  gap: 18px;
  color: rgba(255,255,255,.84);
  font-weight: 800;
}

.player-left span {
  align-self: end;
  padding-top: 42px;
  font-size: 13px;
}

.player-icon,
.big-play,
.mini-play,
.center-skip {
  display: inline-grid;
  place-items: center;
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.player-icon {
  width: 34px;
  height: 34px;
  font-size: 40px;
}

.center-playback {
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: clamp(18px, 5vw, 48px);
  transform: translate(-50%, -50%);
}

.big-play {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  background: rgba(0,0,0,.34);
  font-size: 34px;
}

.center-skip {
  width: 74px;
  height: 52px;
  border-radius: 999px;
  background: rgba(0,0,0,.32);
  color: rgba(255,255,255,.9);
  font-weight: 900;
  backdrop-filter: blur(12px);
}

/* When controls are hidden, fade out center buttons */
.controls-hidden .center-playback {
  opacity: 0;
  pointer-events: none;
}

/* When playing (not paused) and controls are visible, make center buttons slightly translucent */
.cinema-player:not(.is-paused):not(.controls-hidden) .center-playback {
  opacity: 1;
  pointer-events: auto;
}

.player-message {
  position: absolute;
  left: 50%;
  bottom: 148px;
  z-index: 7;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  backdrop-filter: blur(12px);
}

.player-bottom {
  left: clamp(20px, 7vw, 120px);
  right: clamp(20px, 7vw, 120px);
  bottom: clamp(28px, 7vh, 74px);
  display: grid;
  gap: 16px;
}

.timeline-center {
  display: grid;
  grid-template-columns: auto minmax(220px, 760px) auto;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(920px, 100%);
  justify-self: center;
  font-weight: 850;
}

.mini-play {
  width: 30px;
  height: 30px;
  font-size: 18px;
}

.fullscreen-toggle {
  position: absolute;
  right: 0;
  bottom: 0;
}

.seek {
  min-height: 0;
  padding: 0;
  accent-color: #fff;
}

.player-control-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: end;
  gap: 14px;
}

.player-control-left {
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 10px;
  min-width: 0;
}

.player-slider-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 9px 0 2px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
}

.player-slider-control input {
  width: 86px;
  min-height: 0;
  padding: 0;
  accent-color: #fff;
}

.subtitle-controls {
  position: relative;
  display: flex;
  grid-column: 2;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.caption-chip {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 7px;
  background: rgba(255,255,255,.22);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 8px 26px rgba(0,0,0,.26);
}

.caption-chip.active {
  background: rgba(255,255,255,.9);
  color: #141416;
}

.gear-chip {
  width: 34px;
  padding: 0;
}

.subtitle-settings {
  position: absolute;
  right: 0;
  bottom: 44px;
  display: none;
  width: min(320px, 92vw);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(15,15,17,.94);
}

.subtitle-settings.is-open {
  display: grid;
}

.episodes-toggle {
  min-height: 34px;
  border-radius: 999px;
}

.next-episode-prompt {
  position: absolute;
  right: clamp(18px, 5vw, 64px);
  bottom: clamp(110px, 15vh, 168px);
  z-index: 5;
  display: grid;
  gap: 3px;
  width: min(310px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(12,12,14,.82);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 18px 48px rgba(0,0,0,.38);
  backdrop-filter: blur(16px);
}

.next-episode-prompt strong {
  font-size: 13px;
  color: rgba(255,255,255,.76);
}

.episodes-panel {
  position: absolute;
  right: clamp(16px, 4vw, 56px);
  bottom: clamp(86px, 15vh, 150px);
  z-index: 6;
  display: grid;
  gap: 12px;
  width: min(560px, calc(100vw - 28px));
  max-height: min(560px, 68vh);
  padding: 16px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: rgba(10,10,12,.94);
  overflow: auto;
  box-shadow: 0 22px 80px rgba(0,0,0,.56);
  backdrop-filter: blur(18px);
}

.episodes-panel[hidden],
.next-episode-prompt[hidden] {
  display: none;
}

.episodes-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.episodes-panel-head button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-weight: 950;
}

.season-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.season-tab {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-weight: 900;
  white-space: nowrap;
}

.season-tab.active {
  background: #fff;
  color: #101012;
}

.episode-grid {
  display: grid;
  gap: 10px;
}

.episode-grid.compact {
  max-height: 390px;
  overflow: auto;
}

.episode-card {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: #fff;
  text-decoration: none;
}

.episode-card.active {
  border-color: rgba(229,9,20,.72);
  background: rgba(229,9,20,.16);
}

.episode-card img,
.episode-thumb-empty {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255,255,255,.08);
}

.episode-thumb-empty {
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.72);
  font-weight: 900;
}

.episode-card span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.episode-card strong,
.episode-card small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-card strong {
  white-space: nowrap;
}

.episode-card small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: rgba(255,255,255,.66);
}

.show-browser {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #030304;
}

.show-browser > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .48;
}

.show-browser-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.92), rgba(0,0,0,.62) 45%, rgba(0,0,0,.8)), linear-gradient(0deg, #030304, transparent 48%);
}

.show-browser-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(980px, 100%);
  padding: clamp(22px, 5vw, 56px);
}

.show-browser h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 76px);
}

.show-browser p {
  max-width: 680px;
  color: rgba(255,255,255,.72);
}

.controls-hidden .player-shade,
.controls-hidden .player-top,
.controls-hidden .player-bottom,
.controls-hidden .center-playback {
  opacity: 0;
  pointer-events: none;
}

.subtitle-admin {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.subtitle-form {
  display: grid;
  gap: 12px;
}

.subtitle-list {
  display: grid;
  gap: 10px;
}

.subtitle-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 22px;
  background: radial-gradient(circle at 50% 20%, rgba(229,9,20,.24), transparent 34%), rgba(0,0,0,.88);
  backdrop-filter: blur(14px);
}

.upload-overlay.is-visible {
  display: grid;
}

.upload-card {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(12,12,14,.95);
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}

.upload-card h2 {
  margin: 0;
  font-size: clamp(32px, 7vw, 54px);
  line-height: 1;
}

.upload-detail {
  min-height: 24px;
  margin: 0;
}

.upload-meter {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.13);
}

.upload-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  transition: width .18s ease;
}

.upload-percent {
  font-size: 30px;
}

.upload-overlay.is-error .upload-meter span {
  background: #fca5a5;
}

.upload-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  width: min(390px, calc(100vw - 36px));
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: rgba(10,10,12,.94);
  box-shadow: 0 24px 80px rgba(0,0,0,.56);
  backdrop-filter: blur(18px);
}

.upload-dock h2 {
  margin: 0;
  font-size: 16px;
}

.upload-jobs {
  display: grid;
  gap: 10px;
  max-height: 48vh;
  overflow: auto;
}

.upload-job {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
}

.upload-job-close,
.upload-job-cancel {
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.upload-job-cancel {
  width: auto;
  padding: 0 10px;
  border-color: rgba(252,165,165,.32);
  color: #fecaca;
  text-transform: uppercase;
}

.upload-job-status,
.upload-job-percent {
  align-self: start;
}

.upload-job-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.11);
  color: #fff;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.upload-job[data-status="done"] .upload-job-status {
  border-color: rgba(34,197,94,.44);
  background: rgba(34,197,94,.18);
  color: #bbf7d0;
}

.upload-job[data-status="error"] .upload-job-status {
  border-color: rgba(252,165,165,.44);
  background: rgba(239,68,68,.2);
  color: #fecaca;
}

.upload-job[data-status="canceled"] .upload-job-status {
  border-color: rgba(148,163,184,.42);
  background: rgba(148,163,184,.18);
  color: #e5e7eb;
}

.upload-job-close:hover,
.upload-job-close:focus-visible,
.upload-job-cancel:hover,
.upload-job-cancel:focus-visible {
  background: rgba(255,255,255,.22);
}

.upload-job p {
  margin: 4px 0 0;
  font-size: 12px;
}

.upload-job .upload-meter {
  grid-column: 1 / -1;
  height: 8px;
}

.upload-job a {
  grid-column: 1 / -1;
  justify-self: start;
  color: #fff;
  font-weight: 900;
}

.upload-resume {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 2px;
}

.upload-resume[hidden] {
  display: none;
}

.upload-resume input {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(0,0,0,.28);
  color: #fff;
}

.upload-resume button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #e50914;
  color: #fff;
  font-weight: 950;
}

.upload-job[data-status="done"] .upload-meter span {
  background: #22c55e;
}

.upload-job[data-status="error"] .upload-meter span {
  background: #fca5a5;
}

.upload-job[data-status="canceled"] .upload-meter span {
  background: #94a3b8;
}

@media (max-width: 820px) {
  .topbar, .admin, .two, .subtitle-row, .media-admin-row, .player-top { grid-template-columns: 1fr; }
  .admin.show-admin,
  .admin.single-admin {
    grid-template-columns: 1fr;
  }
  .admin-titlebar {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-episode-card {
    grid-template-columns: 1fr;
  }
  .topbar {
    gap: 14px;
    padding: 14px 16px;
  }
  nav, .auth { flex-wrap: wrap; justify-content: start; }
  .signin-link {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
  }
  .top-search,
  .top-search:focus-within,
  .top-search.is-open {
    justify-self: start;
    grid-template-columns: 38px minmax(120px, 1fr) 46px;
    width: min(100%, 360px);
    border-color: rgba(255,255,255,.24);
    background: rgba(255,255,255,.12);
  }
  .top-search input,
  .top-search button {
    opacity: 1;
    pointer-events: auto;
  }
  .home-shell {
    padding-inline: 12px;
  }
  .hero-panel {
    min-height: 54vh;
  }
  .hero {
    padding: 54px 18px 28px;
  }
  h1 {
    font-size: clamp(34px, 12vw, 58px);
  }
  .poster-rail {
    grid-auto-columns: minmax(148px, 72vw);
  }
  .admin {
    padding: 18px 12px;
  }
  .settings-page,
  .login-layout {
    padding: 24px 12px;
  }
  .player-top strong {
    max-width: none;
    text-align: left;
  }
  .player-bottom {
    left: 14px;
    right: 14px;
    bottom: 18px;
  }
  .timeline-center {
    grid-template-columns: auto minmax(120px, 1fr) auto;
    width: 100%;
    gap: 9px;
    font-size: 13px;
  }
  .player-control-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .player-control-left {
    flex-wrap: wrap;
    gap: 8px;
  }
  .player-slider-control {
    flex: 1 1 138px;
  }
  .player-slider-control input {
    width: 100%;
  }
  .subtitle-controls {
    grid-column: auto;
    justify-content: start;
    max-height: 116px;
    overflow: auto;
  }
  .caption-chip {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }
  .subtitle-settings {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 142px;
    width: auto;
  }
  .upload-dock {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
}

@media (max-width: 520px) {
  .brand {
    font-size: 23px;
  }
  nav, .auth {
    gap: 11px;
    font-size: 12px;
  }
  .genre-filter {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 5px;
  }
  .genre-filter a {
    white-space: nowrap;
  }
  .player-left span {
    padding-top: 0;
  }
  .player-icon {
    font-size: 34px;
  }
  .big-play {
    width: 68px;
    height: 68px;
    font-size: 27px;
  }
  .center-playback {
    gap: 12px;
  }
  .center-skip {
    width: 56px;
    height: 44px;
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  .player-shade {
    background: linear-gradient(180deg, rgba(0,0,0,.72), transparent 25%, transparent 44%, rgba(0,0,0,.88));
  }
  .player-top {
    padding: max(14px, env(safe-area-inset-top)) 14px 0;
    gap: 8px;
  }
  .player-left {
    gap: 10px;
  }
  .player-left span {
    display: none;
  }
  .player-top strong {
    font-size: 14px;
    line-height: 1.25;
  }
  .player-bottom {
    left: 0;
    right: 0;
    bottom: 0;
    gap: 12px;
    padding: 14px 14px max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.12);
    background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.88) 24%, rgba(0,0,0,.96));
    backdrop-filter: blur(10px);
  }
  .timeline-center {
    grid-template-columns: 42px minmax(0, 1fr) 56px;
    gap: 10px;
    font-size: 12px;
  }
  .seek {
    height: 36px;
    /* Ensure touch works on iOS Safari - must not be blocked by overlapping elements */
    position: relative;
    z-index: 10;
    touch-action: auto;
  }
  .player-control-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .player-control-left {
    display: grid;
    grid-template-columns: 46px 46px minmax(0, auto);
    gap: 9px;
    align-items: center;
  }
  .mini-play {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    font-size: 18px;
  }
  .fullscreen-toggle {
    position: static;
    justify-self: start;
  }
  .player-slider-control {
    display: none;
  }
  .subtitle-controls {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: start;
    gap: 7px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0 4px;
    scrollbar-width: none;
  }
  .subtitle-controls::-webkit-scrollbar {
    display: none;
  }
  .caption-chip {
    min-width: max-content;
    min-height: 34px;
    border-radius: 999px;
    font-size: 12px;
    box-shadow: none;
  }
  .gear-chip {
    min-width: 34px;
  }
  .subtitle-settings {
    left: 12px;
    right: 12px;
    bottom: calc(210px + env(safe-area-inset-bottom));
    padding: 12px;
  }
  .episodes-toggle {
    min-height: 42px;
    padding-inline: 12px;
    font-size: 12px;
  }
  .episodes-panel {
    left: 10px;
    right: 10px;
    bottom: calc(118px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 54vh;
    padding: 12px;
  }
  .episode-card {
    grid-template-columns: 96px 1fr;
    gap: 9px;
  }
  .next-episode-prompt {
    right: 10px;
    bottom: calc(126px + env(safe-area-inset-bottom));
    width: min(300px, calc(100vw - 20px));
  }
  .show-browser-content {
    padding: 18px 12px 32px;
  }
  .show-browser h1 {
    font-size: 38px;
  }
}

@media (max-height: 520px) and (max-width: 920px) {
  .player-top {
    padding: 10px 16px 0;
  }
  .player-bottom {
    left: 12px;
    right: 12px;
    bottom: 10px;
    padding: 10px;
    gap: 8px;
  }
  .player-control-left {
    grid-template-columns: 40px 40px;
  }
  .player-slider-control {
    display: none;
  }
  .subtitle-controls {
    max-height: 42px;
  }
}


/* ── ShowBox Search Section ───────────────────────────────────────────────── */
.showbox-search-section {
  margin: 0 0 42px;
  padding: 28px 32px 32px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
}
.showbox-search-section h2 {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .02em;
}
.showbox-search-section h2 span {
  color: var(--red);
}
.showbox-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}
.showbox-search-bar input {
  flex: 1;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color .18s;
}
.showbox-search-bar input:focus { border-color: var(--red); }
.showbox-search-bar button {
  padding: 11px 22px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: opacity .16s, transform .12s;
  white-space: nowrap;
}
.showbox-search-bar button:hover { opacity: .88; transform: translateY(-1px); }
.showbox-search-bar button:disabled { opacity: .5; cursor: default; transform: none; }
.showbox-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.showbox-filter-tabs button {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: transparent;
  color: #a1a1aa;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.showbox-filter-tabs button.active,
.showbox-filter-tabs button:hover {
  border-color: var(--red);
  background: rgba(229,9,20,.15);
  color: #fff;
}
.showbox-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  min-height: 40px;
}
.showbox-results.loading::after {
  content: 'Searching ShowBox...';
  grid-column: 1/-1;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 24px;
}
.showbox-results.empty::after {
  content: 'No results found.';
  grid-column: 1/-1;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 24px;
}
.sb-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.sb-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--red);
  box-shadow: 0 12px 32px rgba(229,9,20,.22);
}
.sb-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: #111;
}
.sb-card-no-img {
  width: 100%;
  aspect-ratio: 2/3;
  background: linear-gradient(135deg,#1a1a2e,#16213e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 8px;
}
.sb-card-info {
  padding: 8px 10px 10px;
}
.sb-card-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-card-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 6px;
}
.sb-card-type {
  background: rgba(229,9,20,.2);
  color: var(--red);
  border-radius: 4px;
  padding: 0 5px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
}
.sb-add-btn {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  padding: 8px 16px;
  background: var(--red);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .18s, transform .18s;
  pointer-events: none;
}
.sb-card:hover .sb-add-btn {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.sb-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  border-radius: 10px;
}


/* ── Browse page (Movies / Shows grid) ── */
.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 8px 0 24px;
}
.browse-grid .card {
  width: 100%;
}
.browse-count-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 10px;
}
.browse-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0 40px;
}
.browse-done {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 0;
  margin: 0;
}
