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

:root {
  --bg: #111;
  --surface: #1a1a1a;
  --surface2: #222;
  --border: #2a2a2a;
  --border2: #333;
  --text: #e8e8e8;
  --muted: #777;
  --dim: #444;
  --white: #fff;
  --red: #c0392b;
  --radius: 3px;
  --nav-h: 52px;
  --page-pad: 3.5%;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── NAV ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--page-pad);
  background: rgba(17,17,17,0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0;
}

.nav-link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 0 1rem;
  height: var(--nav-h);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.01em;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--white); border-bottom-color: var(--red); }

.nav-right { display: flex; align-items: center; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 32px;
  width: 240px;
  transition: border-color 0.15s, width 0.2s;
}
.search-box:focus-within { border-color: var(--dim); width: 300px; }
.search-icon { color: var(--muted); flex-shrink: 0; }
.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--muted); }
.search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  padding: 0;
  display: none;
  line-height: 1;
  transition: color 0.15s;
}
.search-clear:hover { color: var(--text); }
.search-clear.visible { display: block; }

/* ── HERO ── */
.hero {
  position: relative;
  height: 62vh;
  min-height: 380px;
  max-height: 600px;
  margin-top: var(--nav-h);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 20%;
}
.hero-fade {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgba(17,17,17,0.92) 0%, rgba(17,17,17,0.4) 55%, transparent 100%),
    linear-gradient(to top, rgba(17,17,17,1) 0%, transparent 45%);
}
.hero-content {
  position: relative; z-index: 1;
  padding: 0 var(--page-pad) 3rem;
  max-width: 520px;
}
.hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.6rem;
}
.hero-title {
  font-size: clamp(24px, 3.5vw, 48px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--white);
}
.hero-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.hero-desc {
  font-size: 13px;
  line-height: 1.7;
  color: #aaa;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 10px; }

/* ── BUTTONS ── */
.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 1.25rem;
  height: 36px;
  background: var(--white);
  color: #111;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-play:hover { background: #ddd; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 1.25rem;
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.18); }

/* ── PAGE ── */
.page {
  padding: 1.5rem var(--page-pad) 4rem;
}

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.toolbar-count { font-size: 12px; color: var(--muted); }
.toolbar-right { display: flex; align-items: center; gap: 0.75rem; }

.sort-select {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
}
.sort-select:focus { border-color: var(--dim); }

/* ── GENRE CHIPS ── */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.chip {
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--dim); }
.chip.active { color: var(--white); border-color: var(--white); background: rgba(255,255,255,0.06); }

/* ── GRID ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

/* ── CARD ── */
.card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid var(--border);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  border-color: var(--border2);
  z-index: 2;
}
.card:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

.card-thumb {
  aspect-ratio: 2/3;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--surface2);
}
.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s;
}
.card-thumb img.loading { opacity: 0; }
.card-thumb img.loaded { opacity: 1; }

.card-placeholder { display: none; }

.card-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1.5rem 0.5rem 0.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
}
.card-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.card-year {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  margin-top: 1px;
}

.card-unavailable {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.card-unavailable .card-thumb { filter: grayscale(0.6); }

.card-coming-soon {
  position: absolute;
  bottom: 8px; left: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.6);
  padding: 3px 7px;
  border-radius: 2px;
  z-index: 3;
}

.card-type-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
}

/* ── COLLECTION FOLDER CARDS ── */
.folder-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
  display: flex;
  flex-direction: column;
}
.folder-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  border-color: var(--border2);
}
.folder-poster-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface2);
  flex-shrink: 0;
}
.folder-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.folder-poster-placeholder {
  width: 100%;
  height: 100%;
  background: var(--surface2);
}
.folder-info { padding: 0.75rem 1rem; }
.folder-title { font-size: 14px; font-weight: 600; color: var(--white); line-height: 1.3; word-break: break-word; }
.folder-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Collections grid */
.col-grid-wrap .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }

/* ── COLLECTION VIEW ── */
.col-view { padding: 1.5rem var(--page-pad) 4rem; }
.col-view-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  transition: color 0.15s;
  margin-top: 4px;
  flex-shrink: 0;
}
.back-btn:hover { color: var(--text); }
.col-view-title { font-size: 22px; font-weight: 600; color: var(--white); letter-spacing: -0.02em; }
.col-view-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── LOAD MORE ── */
.load-more-wrap { text-align: center; padding: 2rem 0; }
.load-more {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 10px 2rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.load-more:hover { background: var(--surface); border-color: var(--dim); }

/* ── EMPTY ── */
.empty { text-align: center; padding: 6rem 0; }
.empty-title { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--muted); }

/* ── DETAIL MODAL ── */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.overlay.open { display: flex; }

.detail-modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 6px;
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  animation: fadeUp 0.22s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.detail-bg-wrap {
  position: relative;
  height: 260px;
  overflow: hidden;
  background: var(--surface2);
}
.detail-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
}
.detail-bg-fade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--surface) 0%, transparent 60%);
}

.overlay-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  z-index: 5;
  transition: background 0.15s;
}
.overlay-close:hover { background: rgba(0,0,0,0.9); }

.detail-body { padding: 0 1.5rem 1.75rem; }
.detail-title { font-size: 22px; font-weight: 600; color: var(--white); letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.detail-meta { font-size: 12px; color: var(--muted); margin-bottom: 0.75rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.detail-desc { font-size: 13px; line-height: 1.7; color: #aaa; margin-bottom: 1.25rem; }
.detail-actions { display: flex; gap: 10px; }

/* ── PLAYER ── */
.player-wrap {
  display: none;
  position: fixed; inset: 0;
  background: #000;
  z-index: 300;
  flex-direction: column;
}
.player-wrap.open { display: flex; }

.player-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: rgba(0,0,0,0.6);
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
}
.player-back {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--white);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; padding: 0; transition: opacity 0.15s;
}
.player-back:hover { opacity: 0.7; }
.player-title { font-size: 13px; color: rgba(255,255,255,0.6); }

#playerVideo { width: 100%; height: 100%; object-fit: contain; }

.player-spinner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; transition: opacity 0.3s;
}
.player-spinner.hidden { opacity: 0; }

.spinner {
  width: 36px; height: 36px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  :root { --page-pad: 4%; }
  .nav-link { padding: 0 0.6rem; font-size: 12px; }
  .search-box { width: 160px; }
  .search-box:focus-within { width: 180px; }
  .hero { height: 55vh; }
  .hero-desc { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; }
  .detail-bg-wrap { height: 180px; }
}

/* ── COMING SOON TOGGLE ── */
.coming-soon-btn {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.coming-soon-btn:hover { color: var(--text); border-color: var(--dim); }
.coming-soon-btn.active { color: var(--white); border-color: var(--white); background: rgba(255,255,255,0.06); }
