:root {
  --bg: #0a0a0a;
  --surface: #121212;
  --card: #181818;
  --card-hover: #242424;
  --text: #ffffff;
  --muted: #b3b3b3;
  --accent: #e50914;
  --accent-2: #46d369;
  --line: #2a2a2a;
  --shadow: rgba(0, 0, 0, 0.55) 0 12px 32px;
  --radius: 10px;
  --nav-h: 64px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}
body { padding-bottom: 48px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
img { display: block; max-width: 100%; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(10,10,10,.96), rgba(10,10,10,.78));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: -.02em; font-size: 1.15rem;
  white-space: nowrap;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7a0b12);
  display: grid; place-items: center; font-size: 14px;
}
.nav-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: 0; cursor: pointer;
  background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 999px;
  font-weight: 600; font-size: .9rem;
}
.pill:hover { color: var(--text); background: rgba(255,255,255,.06); }
.pill.active { color: #000; background: var(--text); }

.search-wrap { margin-left: auto; position: relative; min-width: min(360px, 42vw); }
.search-wrap input {
  width: 100%;
  background: #1f1f1f; color: var(--text);
  border: 0; border-radius: 999px;
  padding: 11px 16px 11px 40px;
  outline: none;
  box-shadow: rgb(18,18,18) 0 1px 0, rgb(90,90,90) 0 0 0 1px inset;
}
.search-wrap input:focus { box-shadow: 0 0 0 2px rgba(229,9,20,.45); }
.search-ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; font-size: 14px;
}
.icon-btn {
  border: 0; background: #1f1f1f; color: var(--text);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
}
.icon-btn:hover { background: #2a2a2a; }

.hero {
  position: relative;
  min-height: clamp(320px, 52vw, 480px);
  margin: 0 0 8px;
  overflow: hidden;
  background: #000;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center top;
  filter: saturate(1.05);
  transform: scale(1.04);
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(10,10,10,.92) 12%, rgba(10,10,10,.55) 48%, rgba(10,10,10,.15) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 42%);
}
.hero-body {
  position: relative; z-index: 1;
  max-width: 720px;
  padding: 72px 24px 48px;
}
.hero-kicker {
  display: inline-flex; gap: 8px; align-items: center;
  color: var(--accent-2); font-weight: 700; font-size: .85rem;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px;
}
.hero h1 {
  margin: 0 0 12px; font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.05; letter-spacing: -.03em;
}
.hero-meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; font-size: .95rem; }
.hero-meta .score { color: var(--accent-2); font-weight: 700; }
.hero p {
  margin: 0 0 20px; color: #e6e6e6; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  border: 0; cursor: pointer; border-radius: 6px;
  padding: 12px 18px; font-weight: 700; font-size: .95rem;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--text); color: #000; }
.btn-primary:hover { background: #e5e5e5; }
.btn-ghost { background: rgba(109,109,110,.7); color: #fff; }
.btn-ghost:hover { background: rgba(109,109,110,.9); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.08); }

.main { padding: 8px 0 40px; }
.rail {
  margin: 18px 0 8px;
  padding: 0 20px;
}
.rail-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.rail-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.rail-head span { color: var(--muted); font-size: .85rem; }
.scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 168px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.scroller::-webkit-scrollbar { height: 8px; }
.scroller::-webkit-scrollbar-thumb { background: #333; border-radius: 8px; }

.card {
  scroll-snap-align: start;
  background: transparent; border: 0; padding: 0; text-align: left;
  color: inherit; cursor: pointer; width: 100%;
}
.poster {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: #1a1a1a;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover .poster { transform: translateY(-4px) scale(1.02); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.72); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 4px 7px; border-radius: 999px;
}
.poster .score-chip {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0,0,0,.75); color: var(--accent-2);
  font-size: 11px; font-weight: 800;
  padding: 4px 7px; border-radius: 6px;
}
.card-title {
  margin: 8px 2px 2px;
  font-size: .92rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-sub { margin: 0 2px; color: var(--muted); font-size: .78rem; }

.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 8px 20px 24px;
}

.banner-legal {
  margin: 12px 20px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(229,9,20,.15), rgba(24,24,24,.9));
  border: 1px solid rgba(229,9,20,.25);
  color: #f0f0f0; font-size: .88rem; line-height: 1.45;
}
.banner-legal strong { color: #fff; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.72);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(920px, 100%);
  background: #141414;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.06);
}
.modal-hero {
  position: relative; min-height: 240px;
  background: #000 center/cover no-repeat;
}
.modal-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(0deg, #141414 5%, transparent 55%);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer;
}
.modal-body { padding: 0 22px 24px; position: relative; margin-top: -48px; }
.modal-body h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 3vw, 2rem); }
.modal-meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.modal-meta .score { color: var(--accent-2); font-weight: 800; }
.modal-overview { color: #ddd; line-height: 1.55; margin: 0 0 18px; }
.section-label {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 700; margin: 0 0 10px;
}
.providers {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.provider {
  display: inline-flex; align-items: center; gap: 8px;
  background: #222; border: 1px solid #333;
  padding: 8px 12px; border-radius: 999px;
  font-size: .85rem; font-weight: 600;
}
.provider img { width: 22px; height: 22px; border-radius: 6px; }
.provider.empty { color: var(--muted); background: transparent; border-style: dashed; }
.trailer-wrap {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: #000; border-radius: 10px; overflow: hidden; margin-bottom: 8px;
}
.trailer-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.trailer-empty {
  height: 180px; display: grid; place-items: center;
  color: var(--muted); background: #1a1a1a; border-radius: 10px;
}

.setup-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.82);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.setup-backdrop.open { display: flex; }
.setup-card {
  width: min(480px, 100%);
  background: var(--card);
  border-radius: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.setup-card h2 { margin: 0 0 8px; }
.setup-card p { color: var(--muted); line-height: 1.5; margin: 0 0 14px; font-size: .92rem; }
.setup-card ol { margin: 0 0 14px; padding-left: 18px; color: #ddd; font-size: .9rem; line-height: 1.55; }
.setup-card input {
  width: 100%; margin-bottom: 12px;
  background: #111; color: #fff; border: 1px solid #333;
  border-radius: 8px; padding: 12px;
}
.setup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #222; color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: .88rem; z-index: 120; display: none;
  box-shadow: var(--shadow); border: 1px solid #333;
}
.toast.show { display: block; }
.loading {
  padding: 40px 20px; text-align: center; color: var(--muted);
}
.skeleton {
  background: linear-gradient(90deg, #1a1a1a, #242424, #1a1a1a);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: var(--radius);
  aspect-ratio: 2/3;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.footer {
  padding: 28px 20px; color: var(--muted); font-size: .82rem;
  border-top: 1px solid rgba(255,255,255,.06); margin-top: 24px;
  line-height: 1.5;
}
.footer a { color: #fff; text-decoration: underline; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 10px; }
  .search-wrap { order: 3; min-width: 100%; width: 100%; margin-left: 0; }
  .nav-pills { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
  .hero-body { padding: 56px 16px 36px; }
  .scroller { grid-auto-columns: minmax(120px, 42vw); }
}
