:root {
  --bg: #141414;
  --red: #e50914;
  --text: #fff;
  --muted: #b3b3b3;
  --card-radius: 4px;
  --header-h: 68px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Helvetica Neue', Helvetica, Arial, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.hidden { display: none !important; }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 2000;
  background: #000; display: flex; align-items: center; justify-content: center;
  transition: opacity .6s ease;
}
.splash.fade { opacity: 0; pointer-events: none; }
.splash-logo { animation: splashPulse 1.4s ease infinite; }

/* ---------- Brand wordmark (original Sinemata logo) ---------- */
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: .32em;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #E50914;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.brand-mark::before {
  content: "";
  width: .58em;
  height: .74em;
  background: #E50914;
  /* play-triangle glyph */
  clip-path: polygon(0 0, 0 100%, 100% 50%);
  flex: none;
}
.splash-logo.brand-mark { font-size: 46px; }
.logo .brand-mark { font-size: 21px; }
@media (min-width: 1024px) { .logo .brand-mark { font-size: 24px; } }
@keyframes splashPulse {
  0%, 100% { opacity: .55; transform: scale(.98); }
  50% { opacity: 1; transform: scale(1); }
}

/* ---------- Header ---------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4%;
  background: linear-gradient(180deg, rgba(0,0,0,.75) 10%, transparent);
  border: 1px solid transparent;
  transition: all .3s ease;
}
/* Island / floating-pill navbar once the user scrolls past the threshold. */
.header.scrolled {
  left: 16px; right: 16px; top: 12px;
  border-radius: 9999px;
  background: rgba(15, 15, 15, .85);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
}
@media (min-width: 1024px) {
  .header.scrolled { left: 24px; right: 24px; }
}
.header-left { display: flex; align-items: center; gap: 28px; }
.logo { text-decoration: none; }
.nav-links { display: flex; gap: 18px; }
.nav-links a {
  color: #e5e5e5; text-decoration: none; font-size: 14px; transition: color .3s;
}
.nav-links a:hover { color: #b3b3b3; }
.nav-links a.active { font-weight: 600; color: #fff; }

.header-right { display: flex; align-items: center; gap: 18px; }
.search { display: flex; align-items: center; position: relative; }
.search-toggle { display: flex; align-items: center; justify-content: center; color: #fff; min-width: 44px; min-height: 44px; }
.search-toggle:focus-visible,
.lang-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
.lang-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 36px; padding: 4px 10px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.4);
  border-radius: 4px; cursor: pointer; transition: background-color .2s, border-color .2s;
}
.lang-toggle:hover { background: rgba(255,255,255,.22); border-color: #fff; }
.lang-toggle:active { transform: scale(.95); }
.search-input {
  width: 0; padding: 0; opacity: 0; border: 1px solid transparent;
  background: rgba(0,0,0,.7); color: #fff; height: 34px; border-radius: 2px;
  transition: width .3s ease, opacity .3s ease, padding .3s ease;
  margin-left: 6px; font-size: 14px;
}
.search.open .search-input {
  width: 220px; opacity: 1; padding: 0 10px; border-color: #fff;
}
.profile { position: relative; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.profile img { width: 32px; height: 32px; border-radius: 4px; }
.caret { color: #fff; transition: transform .3s; }
.profile:hover .caret { transform: rotate(180deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; height: 85vh; min-height: 520px;
  display: flex; align-items: flex-end;
  padding: 0 4% 9% 4%;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover; background-position: center top;
  transition: background-image .6s ease;
}
.hero-vignette {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(77deg, rgba(0,0,0,.75) 0%, transparent 60%),
    linear-gradient(180deg, transparent 50%, rgba(20,20,20,.6) 85%, var(--bg) 100%);
}
.hero-content { max-width: 600px; }
.hero-title {
  font-size: clamp(28px, 4vw, 56px); font-weight: 800; line-height: 1.05;
  margin-bottom: 18px; text-shadow: 2px 2px 6px rgba(0,0,0,.6);
}
.hero-overview {
  font-size: clamp(14px, 1.2vw, 18px); line-height: 1.4; color: #e5e5e5;
  max-width: 520px; margin-bottom: 22px;
  text-shadow: 1px 1px 4px rgba(0,0,0,.6);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-buttons { display: flex; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 24px; font-size: 17px; font-weight: 600; border-radius: 4px;
  transition: opacity .2s, background-color .2s;
}
.btn svg { width: 24px; height: 24px; }
.btn-play { background: #fff; color: #000; }
.btn-play:hover { background: rgba(255,255,255,.78); }
.btn-info { background: rgba(109,109,110,.7); color: #fff; }
.btn-info:hover { background: rgba(109,109,110,.5); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn:active { transform: scale(.97); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ---------- Rows ---------- */
.rows { position: relative; z-index: 2; margin-top: -60px; padding-bottom: 40px; }
.row { margin: 0 0 3vw 0; }
.row-title {
  font-size: clamp(15px, 1.4vw, 22px); font-weight: 600; color: #e5e5e5;
  margin: 0 0 8px 4%;
}
.row-track-wrap { position: relative; }
.row-track {
  display: flex; gap: 6px; padding: 0 4%;
  overflow-x: auto; scroll-behavior: smooth;
  scrollbar-width: none;
}
.row-track::-webkit-scrollbar { display: none; }

.card-item {
  position: relative;
  flex: 0 0 auto;
  width: clamp(140px, 15vw, 240px);
  cursor: pointer;
  transition: transform .3s ease;
}
.card-item:focus { outline: none; }
.card-item:focus-visible { outline: none; }
.card-item:focus-visible .card {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.card {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--card-radius); overflow: hidden;
  background: #2b2b2b;
}
.card img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.card-fallback {
  position: absolute; inset: 0; z-index: 0; display: flex; align-items: center; justify-content: center;
  padding: 10px; text-align: center; font-weight: 700; font-size: 15px; color: #fff;
}
.card-badge {
  position: absolute; top: 6px; left: 6px; z-index: 2; background: var(--red);
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 2px;
  letter-spacing: .5px;
}
.row-track:hover .card-item { opacity: .55; }
.row-track .card-item:hover { opacity: 1; transform: scale(1.12); z-index: 5; }
.card-caption {
  margin-top: 6px; padding: 6px 2px 4px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px; font-weight: 500; color: #e5e5e5;
  line-height: 1.3;
  text-align: left;
  text-transform: none; letter-spacing: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  padding: 0 2px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 11px; font-weight: 400; color: #999;
  line-height: 1.3;
  text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-desc {
  margin-top: 3px; padding: 0 2px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 11px; font-weight: 400; color: #8a8a8a;
  line-height: 1.35;
  text-align: left;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}

/* Corner badges (type / quality / rating / comments) */
.card-badge-corner {
  position: absolute; z-index: 3; font-size: 10px; font-weight: 700;
  line-height: 1; padding: 3px 6px; border-radius: 3px; color: #fff;
  background: rgba(0,0,0,.72); border: 1px solid rgba(255,255,255,.18);
  letter-spacing: .3px; pointer-events: none; white-space: nowrap;
}
.card-badge-quality  { top: 6px; right: 6px; }
.card-badge-rating   { bottom: 6px; left: 6px; color: #f5c518; }
.card-badge-comments { bottom: 6px; right: 6px; }

.row-arrow {
  position: absolute; top: 0; bottom: 0; z-index: 6;
  width: 4%; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5); color: #fff; opacity: 0; transition: opacity .2s;
}
.row-arrow svg { width: 30px; height: 30px; }
.row-track-wrap:hover .row-arrow { opacity: 1; }
.row-arrow.left { left: 0; }
.row-arrow.right { right: 0; }
.row-arrow:hover { background: rgba(0,0,0,.8); }
.row-arrow:focus-visible { opacity: 1; outline: 2px solid #fff; outline-offset: -4px; }
.row-arrow:active { background: rgba(0,0,0,.92); }

/* ---------- Search results ---------- */
.search-results { padding: calc(var(--header-h) + 20px) 4% 40px; min-height: 80vh; }
.search-results-title { font-size: 20px; color: #e5e5e5; margin-bottom: 18px; }
.search-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.search-grid .card-item { width: 100%; }
.search-grid .card { width: 100%; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 0; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.75); }
.modal-card {
  position: relative; z-index: 2; width: min(900px, 92vw);
  background: #181818; border-radius: 8px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.7);
  animation: modalIn .3s ease;
}
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  width: 44px; height: 44px; border-radius: 50%; background: #181818;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.modal-close:hover { background: #2a2a2a; }
.modal-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.modal-close:active { transform: scale(.92); }
.modal-hero { position: relative; aspect-ratio: 16/9; max-height: 480px; }
.modal-hero-img { position: absolute; inset: 0; background-size: cover; background-position: center top; }
.modal-hero-fade { position: absolute; inset: 0; background: linear-gradient(transparent 40%, #181818 98%); }
.modal-hero-content { position: absolute; bottom: 28px; left: 40px; right: 40px; }
.modal-title { font-size: clamp(22px, 3vw, 40px); font-weight: 800; margin-bottom: 18px; text-shadow: 1px 1px 6px rgba(0,0,0,.6); }
.modal-hero-buttons { display: flex; align-items: center; gap: 12px; }
.btn-circle {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: rgba(42,42,42,.6); transition: border-color .2s;
}
.btn-circle:hover { border-color: #fff; }
.btn-circle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-color: #fff; }
.btn-circle:active { transform: scale(.92); }
.btn-circle.added { background: #fff; color: #000; border-color: #fff; }

.modal-body { display: flex; gap: 28px; padding: 8px 40px 24px; }
.modal-info-main { flex: 2; }
.modal-info-side { flex: 1; font-size: 14px; line-height: 1.7; }
.modal-meta { display: flex; align-items: center; gap: 12px; font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.match { color: #46d369; font-weight: 700; }
.imdb-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.imdb-logo {
  background: #f5c518; color: #000; font-weight: 800; font-size: 11px;
  padding: 1px 5px; border-radius: 3px; letter-spacing: -.3px;
}
.badge { border: 1px solid #777; padding: 0 6px; font-size: 12px; border-radius: 2px; }
.modal-overview { font-size: 15px; line-height: 1.5; }
.muted { color: var(--muted); }
.modal-more { padding: 0 40px 32px; }
.modal-more h3 { font-size: 20px; margin-bottom: 16px; }
.modal-similar-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.similar-card { background: #2f2f2f; border-radius: 4px; overflow: hidden; cursor: pointer; transition: transform .2s; }
.similar-card:hover { transform: scale(1.04); }
.similar-card .thumb { aspect-ratio: 16/9; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; font-weight: 600; font-size: 13px; }
.similar-card .cap { padding: 8px 10px; font-size: 13px; color: #d2d2d2; }

/* Episodes */
.modal-episodes { padding: 0 40px 32px; }
.episodes-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.episodes-head h3 { font-size: 20px; }
.episode-count { color: var(--muted); font-size: 14px; }
.season-select {
  margin-left: auto; background: #2b2b2b; border: 1px solid #444; border-radius: 4px;
  color: #fff; padding: 7px 12px; font-size: 14px; font-family: inherit; cursor: pointer;
}
.season-select:focus { outline: none; border-color: #888; }
.episode-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.episode-section { display: flex; flex-direction: column; gap: 10px; }
.episode-row {
  display: flex; align-items: center; gap: 16px; padding: 12px 14px; border-radius: 6px;
  background: #2a2a2a; border: 1px solid transparent; cursor: pointer;
  text-align: left; width: 100%; color: inherit; font: inherit; transition: background .15s, border-color .15s;
}
.episode-row:hover { background: #383838; }
.episode-row:focus-visible { outline: none; border-color: #888; }
.episode-row.active { border-color: var(--red); background: #3a2326; }
.episode-row.locked { cursor: default; opacity: .5; }
.episode-row.locked:hover { background: #2a2a2a; }
.episode-num {
  flex: 0 0 auto; min-width: 28px; text-align: center; font-size: 20px; font-weight: 700;
  color: var(--muted);
}
.episode-row.active .episode-num { color: #fff; }
.episode-thumb {
  flex: 0 0 auto; position: relative; width: 134px; height: 76px; border-radius: 4px;
  overflow: hidden; background: #111; display: flex; align-items: center; justify-content: center;
}
.episode-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.episode-thumb.noimg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, #333, #1c1c1c);
}
.episode-thumb-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .15s;
}
.episode-row:hover .episode-thumb-play, .episode-row.active .episode-thumb-play { opacity: 1; }
.episode-row.locked .episode-thumb-play { display: none; }
.episode-body { flex: 1 1 auto; min-width: 0; }
.episode-titleline { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.episode-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.episode-meta { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.episode-overview {
  font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.episode-tag {
  display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: #bbb; background: #1f1f1f; border: 1px solid #3a3a3a;
  border-radius: 3px; padding: 2px 7px;
}

/* Comments */
.modal-comments { padding: 0 40px 36px; }
.modal-comments h3 { font-size: 20px; margin-bottom: 16px; }
.comment-count { color: var(--muted); font-size: 15px; font-weight: 400; }
.comment-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.comment-input {
  background: #2b2b2b; border: 1px solid #444; border-radius: 4px;
  color: #fff; padding: 9px 12px; font-size: 14px; font-family: inherit;
}
.comment-input:focus { outline: none; border-color: #888; }
.comment-input::placeholder { color: #8a8a8a; }
.comment-name-wrap { flex: 0 0 200px; }
#commentName { flex: 0 0 200px; }
.comment-textarea { flex: 1 1 100%; resize: vertical; min-height: 42px; }
.comment-submit { flex: 0 0 auto; padding: 8px 22px; }
.comment-list { display: flex; flex-direction: column; gap: 14px; }
.comment-empty { color: var(--muted); font-size: 14px; }
.comment { border-bottom: 1px solid #2c2c2c; padding-bottom: 12px; }
.comment-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.comment-name { font-weight: 700; font-size: 14px; }
.comment-time { color: var(--muted); font-size: 12px; }
.comment-text { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 600px) {
  .modal-comments { padding: 0 22px 28px; }
  .modal-episodes { padding: 0 22px 28px; }
  .season-select { margin-left: 0; }
  #commentName { flex: 1 1 100%; }
  .episode-thumb { width: 96px; height: 56px; }
  .episode-num { min-width: 20px; font-size: 16px; }
  .episode-row { gap: 10px; padding: 10px; }
  .episode-titleline { flex-direction: column; gap: 2px; }
}

/* ---------- Trailer / Video Player Overlay ---------- */
/* Fully fluid: every size uses vh / dvh / vw / em / clamp so the player can
   never be clipped at the bottom (the bug this layout fixes). Root cause of the
   old clipping: the box was sized by WIDTH while the frame kept a 16/9 ratio, so
   on short/wide viewports bar + video exceeded max-height and overflow:hidden cut
   off the controls. Fix: derive the box WIDTH from the spare HEIGHT, so the title
   bar + a 16/9 video always fit inside the viewport with no clipped controls and
   no excess black bars. --gap = breathing room kept around the box (top+bottom),
   --bar-h = title bar height; both are subtracted from 100dvh in the width math. */
.trailer-overlay {
  position: fixed; inset: 0; z-index: 1500;
  width: 100vw; height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(0.8vh, 1.5vh, 2vh) clamp(2vw, 2.5vw, 3vw);
  box-sizing: border-box;
  animation: fadeIn .2s ease-out;
}
.trailer-overlay.closing { animation: fadeOut .15s ease-in forwards; }

.trailer-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .75);
  -webkit-backdrop-filter: blur(clamp(2px, 0.3vw, 6px));
  backdrop-filter: blur(clamp(2px, 0.3vw, 6px));
}
.trailer-box {
  --bar-h: clamp(2.5em, 5vh, 4em);
  --gap: clamp(3vh, 8vh, 10vh);
  --maxw: 70vw;
  /* Single source of truth for the video area's height: the smaller of
     (a) the height a 16/9 video would need at the max width, and
     (b) the spare viewport height after the gap and the title bar.
     Both box width AND height derive from this, so heights are DEFINITE and
     can never overflow -> native controls bar is never clipped, at any zoom. */
  --vid-h: min(calc(var(--maxw) * 9 / 16), calc(100dvh - var(--gap) - var(--bar-h)));
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  box-sizing: border-box;
  width: calc(var(--vid-h) * 16 / 9);   /* exactly 16/9 of the video area */
  height: calc(var(--vid-h) + var(--bar-h));
  background: #141414;
  border-radius: clamp(0.3em, 1vw, 1.2em);
  overflow: hidden;
  box-shadow: 0 clamp(1vh, 2.5vh, 3vh) clamp(3vw, 6vw, 8vw) rgba(0, 0, 0, .8);
  animation: modalIn .2s ease-out;
}
.trailer-overlay.closing .trailer-box { animation: modalOut .15s ease-in forwards; }
.trailer-bar {
  flex: 0 0 auto;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(0.5em, 1.5vw, 1.2em);
  background: #1a1a1a;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.trailer-label {
  font-size: clamp(0.95em, 1.6vw, 1.15em); font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: .5em;
}
.trailer-close {
  flex: 0 0 auto;
  width: clamp(2.4em, 2.5vw, 2.5em); height: clamp(2.4em, 2.5vw, 2.5em);
  min-width: 44px; min-height: 44px;
  border-radius: 50%;
  background: transparent; color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease;
}
.trailer-close:hover { background: rgba(255, 255, 255, .1); }
.trailer-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.trailer-close:active { transform: scale(.92); }
.trailer-frame-wrap {
  flex: 1 1 auto; min-height: 0;          /* fills the definite --vid-h, no aspect-ratio conflict */
  position: relative; width: 100%; background: #000;
  overflow: hidden;
}
.trailer-frame-wrap iframe,
.trailer-frame-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.trailer-frame-wrap video { object-fit: contain; display: block; }

/* ----- loading state (transcode / buffering) ----- */
.player-loader {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: #000; pointer-events: none;
  animation: loaderIn .2s ease;
}
.player-loader.hidden { display: none; }
.player-spinner {
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.16);
  border-top-color: #e50914;
  animation: spin .8s linear infinite;
}
.player-loader-text {
  font-size: 14px; font-weight: 600; letter-spacing: .02em; color: #d8d8d8;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loaderIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .player-spinner { animation-duration: 1.6s; }
  .player-loader { animation: none; }
}

/* ----- pre-roll ad (free / guest tier) ----- */
.preroll {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; justify-content: flex-end;
  background:
    radial-gradient(120% 80% at 50% 30%, rgba(229,9,20,.22), transparent 60%),
    linear-gradient(0deg, rgba(0,0,0,.92), rgba(10,10,12,.92));
}
.preroll.hidden { display: none; }
.preroll-media {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center;
}
.preroll-tag {
  align-self: center; font-size: 11px; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: #fff; background: rgba(229,9,20,.9);
  padding: 4px 10px; border-radius: 4px;
}
.preroll-promo-title { margin: 0; font-size: clamp(18px, 3.4vw, 30px); font-weight: 800; color: #fff; }
.preroll-promo-sub { margin: 8px auto 0; max-width: 46ch; font-size: clamp(13px, 1.6vw, 15px); color: #cfcfcf; }
.preroll-bar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px clamp(14px, 3vw, 28px);
  background: rgba(0,0,0,.55); border-top: 1px solid rgba(255,255,255,.1);
}
.preroll-status { font-size: 13px; color: #d2d2d2; font-variant-numeric: tabular-nums; }
.preroll-actions { display: flex; align-items: center; gap: 10px; }
.preroll-upgrade {
  border: 0; border-radius: 6px; padding: 10px 16px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: #fff; background: #e50914;
}
.preroll-upgrade:hover { background: #f6121d; }
.preroll-skip {
  border: 1px solid rgba(255,255,255,.55); border-radius: 6px; padding: 10px 16px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: #fff; background: rgba(255,255,255,.08);
  min-width: 120px; text-align: center;
}
.preroll-skip:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.preroll-skip:disabled { opacity: .5; cursor: default; }
.preroll-upgrade:focus-visible,
.preroll-skip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 560px) {
  .preroll-bar { flex-direction: column; align-items: stretch; }
  .preroll-actions { justify-content: space-between; }
  .preroll-skip, .preroll-upgrade { flex: 1 1 auto; }
}

/* ----- Player breakpoints: only --maxw + padding + radius, heights stay derived ----- */
@media (min-width: 1024px) {
  .trailer-overlay { padding: clamp(3vh, 4vh, 5vh) clamp(3vw, 4vw, 6vw); }
  .trailer-box { --maxw: 70vw; border-radius: clamp(0.5em, 1vw, 1.2em); }
}
@media (max-width: 1024px) {
  .trailer-overlay { padding: clamp(2vh, 3vh, 4vh) clamp(2vw, 3vw, 5vw); }
  .trailer-box { --maxw: 80vw; border-radius: clamp(0.4em, 0.8vw, 1em); }
}
@media (max-width: 768px) {
  .trailer-overlay { padding: clamp(2vh, 3vh, 4vh) clamp(2vw, 2.5vw, 3vw); }
  .trailer-box { --maxw: 92vw; border-radius: clamp(0.3em, 0.6vw, 0.8em); }
}
@media (max-width: 480px) {
  .trailer-overlay { padding: clamp(0.8vh, 1.5vh, 2vh); }
  .trailer-box { --maxw: 95vw; --gap: clamp(1vh, 2vh, 3vh);
                 border-radius: clamp(0.2em, 0.4vw, 0.5em); }
}
@media (max-height: 500px) {
  .trailer-overlay { padding: clamp(0.5vh, 1vh, 1.5vh); }
  .trailer-box { --gap: clamp(1vh, 2vh, 3vh); --maxw: 95vw;
                 border-radius: clamp(0.1em, 0.3vw, 0.4em); }
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes modalOut { from { transform: scale(1); opacity: 1; } to { transform: scale(.95); opacity: 0; } }

/* ---------- Footer ---------- */
.footer { padding: 40px 4%; color: #777; font-size: 13px; text-align: center; }

/* ---------- Loading skeleton ---------- */
.skeleton-card {
  flex: 0 0 auto; width: clamp(140px, 15vw, 240px); aspect-ratio: 16/9;
  border-radius: var(--card-radius);
  background: linear-gradient(90deg, #1c1c1c 25%, #2b2b2b 50%, #1c1c1c 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 740px) {
  .nav-links { display: none; }
  .hero { height: 70vh; padding-bottom: 18%; }
  .hero-overview { -webkit-line-clamp: 2; }
  .modal-body { flex-direction: column; gap: 12px; padding: 8px 22px 20px; }
  .modal-hero-content { left: 22px; right: 22px; }
  .modal-more { padding: 0 22px 24px; }
  .btn { padding: 7px 18px; font-size: 15px; }
}

/* ---------- Reduced motion ---------- */
/* Users who ask the OS for less motion get instant state changes instead of
   the hover-zoom, fades, and shimmer — vestibular-safety + a11y best practice. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .row-track .card-item:hover { transform: none; }
}

/* ======================================================================
   Auth, profiles & subscription (auth.js)
   ====================================================================== */
body.auth-locked { overflow: hidden; }

/* ---------- full-screen auth overlay ---------- */
.auth-root {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; flex-direction: column;
  color: #fff; overflow-y: auto;
  background: #141414;
}
.auth-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(0deg, rgba(0,0,0,.75), rgba(0,0,0,.55)),
    radial-gradient(120% 120% at 80% 0%, #5b0a0f 0%, #141414 55%, #000 100%);
  background-size: cover; background-position: center;
}
.auth-scrim { position: absolute; inset: 0; z-index: 1; background: rgba(0,0,0,.45); }
.auth-scrim.solid { background: rgba(20,20,20,.6); }
.auth-header { position: relative; z-index: 2; padding: 18px 4%; }
.auth-logo { font-size: 32px; }
.auth-skip {
  position: absolute; top: 20px; right: 4%; z-index: 3;
  border: 1px solid rgba(255,255,255,.4); border-radius: 6px;
  padding: 8px 14px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: #fff; background: rgba(0,0,0,.35);
}
.auth-skip:hover { background: rgba(0,0,0,.6); border-color: rgba(255,255,255,.7); }
.auth-skip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.auth-card-wrap {
  position: relative; z-index: 2; flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px 60px;
}
.auth-card {
  width: min(420px, 100%);
  background: rgba(0,0,0,.72);
  border-radius: 8px;
  padding: 44px 44px 36px;
  display: flex; flex-direction: column; gap: 16px;
}
.auth-title { font-size: 30px; font-weight: 700; margin-bottom: 6px; }
.auth-error {
  background: #e87c03; color: #fff; font-size: 14px;
  border-radius: 4px; padding: 10px 14px; line-height: 1.3;
}
.auth-field { position: relative; display: block; }
.auth-field input {
  width: 100%; height: 52px; padding: 18px 16px 6px;
  background: #333; border: 0; border-radius: 4px;
  color: #fff; font-size: 16px; outline: 1px solid transparent;
  transition: outline-color .15s, background-color .15s;
}
.auth-field input:focus { background: #454545; outline-color: #e5e5e5; }
.auth-field input:focus-visible { outline: 2px solid #fff; }
.auth-label {
  position: absolute; left: 16px; top: 16px;
  color: #8c8c8c; font-size: 16px; pointer-events: none;
  transition: transform .12s ease, font-size .12s ease, color .12s;
  transform-origin: left top;
}
.auth-field input:focus + .auth-label,
.auth-field input:not(:placeholder-shown) + .auth-label {
  transform: translateY(-9px); font-size: 11px; color: #b3b3b3;
}
.auth-submit {
  margin-top: 8px; height: 48px; border-radius: 4px;
  background: var(--red); color: #fff; font-size: 16px; font-weight: 700;
  transition: background-color .2s, transform .1s;
}
.auth-submit:hover { background: #f6121d; }
.auth-submit:active { transform: scale(.99); }
.auth-submit:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.auth-switch { color: #b3b3b3; font-size: 15px; margin-top: 6px; }
.auth-switch a { color: #fff; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-note { color: #8c8c8c; font-size: 12px; line-height: 1.4; margin-top: 2px; }

/* ---------- Who's watching ---------- */
.who-wrap {
  position: relative; z-index: 2; margin: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 16px; gap: 28px; text-align: center;
}
.who-title { font-size: clamp(28px, 5vw, 52px); font-weight: 500; color: #fff; }
.who-grid { display: flex; flex-wrap: wrap; gap: clamp(12px, 3vw, 28px); justify-content: center; }
.who-tile {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: none; border-radius: 6px; padding: 6px;
}
.who-tile img {
  width: clamp(84px, 12vw, 120px); height: clamp(84px, 12vw, 120px);
  border-radius: 6px; border: 3px solid transparent; transition: border-color .15s, transform .15s;
}
.who-tile .who-name { color: #808080; font-size: 16px; transition: color .15s; }
.who-tile:hover img { border-color: #fff; transform: translateY(-2px); }
.who-tile:hover .who-name { color: #fff; }
.who-tile:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.who-add .who-add-icon {
  width: clamp(84px, 12vw, 120px); height: clamp(84px, 12vw, 120px);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; color: #808080; border: 2px dashed #4d4d4d; border-radius: 6px;
}
.who-add:hover .who-add-icon { color: #fff; border-color: #fff; }
.who-edit { font-size: 12px; color: #e87c03; }
.who-manage {
  color: #808080; border: 1px solid #808080; background: none;
  padding: 9px 22px; font-size: 16px; letter-spacing: .5px;
  border-radius: 2px; transition: color .15s, border-color .15s;
}
.who-manage:hover { color: #fff; border-color: #fff; }
.who-manage:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- navbar profile dropdown ---------- */
.profile:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
.profile-menu {
  position: absolute; top: calc(100% + 14px); right: 0; z-index: 200;
  width: 240px; padding: 8px 0;
  background: rgba(0,0,0,.92); border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.6);
  font-size: 14px; cursor: default;
  animation: pmIn .16s ease;
}
@keyframes pmIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.profile-menu::before {
  content: ""; position: absolute; top: -16px; right: 14px;
  border: 8px solid transparent; border-bottom-color: rgba(255,255,255,.15);
}
.pm-section { padding: 2px 0; }
.pm-empty { display: block; padding: 8px 16px; color: #8c8c8c; font-size: 13px; }
.pm-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: #e5e5e5; text-align: left; background: none;
  transition: background-color .12s, color .12s;
}
.pm-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.pm-item:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.pm-item img { width: 28px; height: 28px; border-radius: 4px; }
.pm-ic { width: 20px; text-align: center; opacity: .9; }
.pm-divider { height: 1px; background: rgba(255,255,255,.12); margin: 6px 0; }
.pm-plan {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  color: #e5e5e5; font-size: 13px;
}
.pm-plan.is-premium { color: #f5b50a; }
.pm-upgrade {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 4px;
}
.pm-upgrade:hover { background: #f6121d; }
.pm-signout { justify-content: center; color: #b3b3b3; font-size: 13px; }

/* ---------- simulated ad banner ---------- */
.ad-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  display: flex; align-items: center; gap: 14px;
  padding: 12px max(16px, 4%);
  background: linear-gradient(90deg, rgba(20,20,20,.97), rgba(40,20,5,.97));
  border-top: 1px solid rgba(245,181,10,.4);
  box-shadow: 0 -8px 24px rgba(0,0,0,.5);
  transform: translateY(0); transition: transform .35s ease;
}
.ad-banner.collapsed { transform: translateY(110%); }
.ad-tag {
  flex: none; font-size: 11px; font-weight: 800; letter-spacing: 1px;
  color: #141414; background: #f5b50a; padding: 3px 7px; border-radius: 3px;
}
.ad-text { color: #e5e5e5; font-size: 14px; line-height: 1.3; }
.ad-cta {
  margin-left: auto; flex: none; background: var(--red); color: #fff;
  font-weight: 700; font-size: 13px; padding: 9px 16px; border-radius: 4px;
  transition: background-color .2s;
}
.ad-cta:hover { background: #f6121d; }
.ad-cta:focus-visible, .ad-x:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ad-x { flex: none; color: #b3b3b3; font-size: 16px; width: 32px; height: 32px; border-radius: 4px; }
.ad-x:hover { color: #fff; background: rgba(255,255,255,.1); }
body.has-ad .footer { padding-bottom: 84px; }

/* ---------- subscribe modal ---------- */
.sub-modal { position: fixed; inset: 0; z-index: 2500; display: none; }
.sub-modal.open { display: block; }
.sub-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.8); }
.sub-card {
  position: relative; z-index: 2; margin: 7vh auto; width: min(720px, 92vw);
  background: #181818; border-radius: 10px; padding: 36px 36px 40px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6); animation: pmIn .2s ease;
}
.sub-close {
  position: absolute; top: 14px; right: 14px; width: 38px; height: 38px;
  border-radius: 50%; background: #181818; color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.sub-close:hover { background: #333; }
.sub-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sub-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.sub-sub { color: #b3b3b3; font-size: 14px; margin-bottom: 24px; }
.sub-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sub-plan {
  position: relative; background: #232323; border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; padding: 22px 20px; display: flex; flex-direction: column; gap: 10px;
}
.sub-plan.featured { border-color: var(--red); background: #2a1416; }
.sub-badge {
  position: absolute; top: -11px; left: 20px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: 1px; padding: 3px 8px; border-radius: 3px;
}
.sub-plan h3 { font-size: 18px; }
.sub-price { font-size: 22px; font-weight: 700; }
.sub-plan ul { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 6px 0 14px; }
.sub-plan li { color: #d2d2d2; font-size: 13px; padding-left: 20px; position: relative; }
.sub-plan li::before { content: "✓"; position: absolute; left: 0; color: #2db84d; font-weight: 700; }
.sub-plan li.bad::before { content: "✕"; color: #e87c03; }
.sub-btn {
  margin-top: auto; height: 44px; border-radius: 4px; font-weight: 700; font-size: 15px;
  background: var(--red); color: #fff; transition: background-color .2s, transform .1s;
}
.sub-btn:hover:not(:disabled) { background: #f6121d; }
.sub-btn:active:not(:disabled) { transform: scale(.99); }
.sub-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sub-btn.ghost { background: #333; }
.sub-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- add-profile name modal ---------- */
.name-modal { position: fixed; inset: 0; z-index: 3100; display: none; }
.name-modal.open { display: block; }
.name-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.8); }
.name-card {
  position: relative; z-index: 2; margin: 18vh auto; width: min(420px, 92vw);
  background: #181818; border-radius: 10px; padding: 32px 32px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6); animation: pmIn .2s ease;
}
.name-close {
  position: absolute; top: 14px; right: 14px; width: 38px; height: 38px;
  border-radius: 50%; background: #181818; color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.name-close:hover { background: #333; }
.name-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.name-title { font-size: 22px; font-weight: 700; margin-bottom: 18px; }
.name-input {
  width: 100%; height: 48px; border-radius: 4px; border: 1px solid #404040;
  background: #2a2a2a; color: #fff; font-size: 15px; padding: 0 14px; margin-bottom: 22px;
}
.name-input::placeholder { color: #8c8c8c; }
.name-input:focus { outline: none; border-color: #fff; background: #333; }
.name-actions { display: flex; justify-content: flex-end; gap: 10px; }
.name-btn {
  min-width: 96px; height: 42px; padding: 0 18px; border-radius: 4px;
  font-weight: 700; font-size: 14px; background: var(--red); color: #fff;
  transition: background-color .2s, transform .1s;
}
.name-btn:hover { background: #f6121d; }
.name-btn:active { transform: scale(.99); }
.name-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.name-btn.ghost { background: #333; }
.name-btn.ghost:hover { background: #404040; }

/* ---------- auth toast ---------- */
.auth-toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  z-index: 3200; background: #2db84d; color: #fff;
  padding: 12px 22px; border-radius: 6px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.auth-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- QRIS checkout (simulated) ---------- */
.qris-modal { position: fixed; inset: 0; z-index: 3300; display: none; }
.qris-modal.open { display: block; }
.qris-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.85); backdrop-filter: blur(2px); }
.qris-card {
  position: relative; z-index: 2; margin: 8vh auto; width: min(360px, 92vw);
  background: #fff; color: #111; border-radius: 14px; padding: 22px 26px 26px;
  text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.6); animation: pmIn .22s ease;
}
.qris-close {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  background: #eee; color: #333; font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.qris-close:hover { background: #ddd; }
.qris-close:focus-visible { outline: 2px solid #111; outline-offset: 2px; }
.qris-head { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.qris-brand {
  font-weight: 800; font-style: italic; letter-spacing: .5px; font-size: 22px;
  color: #e2231a;
}
.qris-gpn {
  font-size: 11px; font-weight: 700; color: #fff; background: #c8102e;
  padding: 2px 6px; border-radius: 3px; letter-spacing: .5px;
}
.qris-title { font-size: 16px; font-weight: 700; margin: 2px 0 2px; color: #111; }
.qris-merchant { font-size: 13px; font-weight: 600; color: #555; letter-spacing: .4px; margin-bottom: 12px; }
.qris-qr {
  width: 232px; height: 232px; margin: 0 auto 12px; padding: 6px;
  border: 1px solid #e3e3e3; border-radius: 10px; background: #fff;
}
.qris-qr canvas { width: 220px; height: 220px; display: block; }
.qris-amount { font-size: 26px; font-weight: 800; color: #111; margin-bottom: 2px; }
.qris-order { font-size: 12px; color: #888; margin-bottom: 6px; }
.qris-timer { font-size: 13px; font-weight: 700; color: #e2231a; margin-bottom: 8px; }
.qris-hint { font-size: 12px; color: #666; line-height: 1.4; margin-bottom: 16px; }
.qris-card .sub-btn { width: 100%; margin-top: 0; }
.qris-card .sub-btn + .sub-btn { margin-top: 8px; }
.qris-card .sub-btn.ghost { background: #e6e6e6; color: #333; }
.qris-card .sub-btn.ghost:hover:not(:disabled) { background: #d8d8d8; }


@media (max-width: 560px) {
  .auth-card { padding: 32px 24px; }
  .sub-plans { grid-template-columns: 1fr; }
  .ad-text { font-size: 13px; }
  .profile-menu { width: 220px; }
}
