:root {
  --bg: #141414;
  --bg-2: #1c1c1c;
  --card: #232323;
  --text: #f5f5f1;
  --muted: #a3a3a3;
  --red: #e50914;
  --red-dark: #b20710;
  --green: #46d369;
  --gutter: clamp(16px, 4vw, 60px);
  --card-w: clamp(200px, 22vw, 300px);
  --radius: 6px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: currentColor; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px var(--gutter);
  background: linear-gradient(to bottom, rgba(0,0,0,.75), transparent);
  transition: background .3s;
}
.nav.solid { background: var(--bg); box-shadow: 0 2px 12px rgba(0,0,0,.4); }
.logo {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 34px;
  letter-spacing: 1.5px;
  color: var(--red);
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.logo.small { font-size: 20px; }
.nav-links { display: flex; gap: 18px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  font-size: 14px;
  color: #e5e5e5;
  white-space: nowrap;
  transition: color .2s;
}
.nav-links a:hover { color: var(--muted); }
.nav-links a.active { color: #fff; font-weight: 700; }
.nav-right { margin-left: auto; display: flex; align-items: center; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.55);
  border-radius: 4px;
}
.search svg { width: 18px; height: 18px; flex: none; }
.search input {
  width: 180px;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 14px;
}
.search:focus-within { border-color: #fff; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(82vh, 760px);
  display: flex;
  align-items: flex-end;
  padding: 120px var(--gutter) clamp(90px, 14vh, 160px);
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  transform: scale(1.04);
  transform-origin: top center;
  animation: heroZoom 12s ease-out forwards;
}
@keyframes heroZoom { to { transform: scale(1.12); } }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(20,20,20,.92) 0%, rgba(20,20,20,.55) 40%, transparent 75%),
    linear-gradient(to top, var(--bg) 8%, rgba(20,20,20,.6) 30%, transparent 55%);
}
.hero-content { position: relative; z-index: 1; max-width: 640px; animation: fadeUp .7s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #ddd;
  font-weight: 600;
}
.hero-kicker b { color: var(--red); font-family: "Bebas Neue", sans-serif; font-size: 22px; letter-spacing: 0; }
.hero h1 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-weight: 400;
  font-size: clamp(48px, 8vw, 104px);
  line-height: .92;
  margin: 10px 0 12px;
  letter-spacing: 1px;
  text-shadow: 0 2px 20px rgba(0,0,0,.5);
}
.hero .caption { font-size: clamp(16px, 1.6vw, 21px); font-weight: 600; margin: 0 0 10px; }
.hero .desc {
  color: #ddd;
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 1.5;
  margin: 0 0 22px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-dots { position: absolute; right: var(--gutter); bottom: clamp(100px, 16vh, 170px); z-index: 1; display: flex; gap: 6px; }
.hero-dots button {
  width: 22px; height: 3px; padding: 0; border: 0;
  background: rgba(255,255,255,.35);
}
.hero-dots button.on { background: #fff; }

/* ---------- Meta + buttons ---------- */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; color: #ddd; margin-bottom: 14px; }
.meta .match { color: var(--green); font-weight: 700; }
.meta .badge { border: 1px solid rgba(255,255,255,.45); padding: 0 6px; font-size: 12px; border-radius: 3px; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 0;
  border-radius: 4px;
  font-weight: 700;
  font-size: 16px;
  transition: background .2s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 22px; height: 22px; }
.btn-primary { background: #fff; color: #000; }
.btn-primary:hover { background: rgba(255,255,255,.78); }
.btn-secondary { background: rgba(109,109,110,.7); color: #fff; }
.btn-secondary:hover { background: rgba(109,109,110,.45); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.55);
  background: rgba(30,30,30,.7);
  padding: 0;
  transition: border-color .2s, background .2s;
}
.icon-btn:hover { border-color: #fff; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.play { background: #fff; color: #000; border-color: #fff; }
.icon-btn.play:hover { background: #ddd; }

/* ---------- Rows ---------- */
.rows { position: relative; z-index: 2; margin-top: clamp(-120px, -10vh, -60px); padding-bottom: 40px; }
.row { margin-bottom: 18px; }
.row-head { display: flex; align-items: baseline; gap: 12px; padding: 0 var(--gutter); }
.row h2 { font-size: clamp(17px, 1.6vw, 22px); font-weight: 700; margin: 0; }
.row-head a { font-size: 13px; color: #54b9c5; font-weight: 600; opacity: 0; transform: translateX(-6px); transition: .25s; }
.row:hover .row-head a, .row-head a:focus { opacity: 1; transform: none; }
.row-track-wrap { position: relative; }
.row-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  overflow-y: hidden;
  padding: 10px var(--gutter) 24px;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: none;
}
.row-track::-webkit-scrollbar { display: none; }
.arrow {
  position: absolute;
  top: 10px;
  bottom: 24px;
  width: calc(var(--gutter) - 4px);
  min-width: 36px;
  z-index: 5;
  border: 0;
  background: rgba(20,20,20,.6);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .2s, background .2s;
}
.arrow svg { width: 30px; height: 30px; transition: transform .2s; }
.arrow:hover { background: rgba(20,20,20,.85); }
.arrow:hover svg { transform: scale(1.25); }
.arrow.left { left: 0; border-radius: 0 4px 4px 0; }
.arrow.right { right: 0; border-radius: 4px 0 0 4px; }
.row:hover .arrow { opacity: 1; }
.arrow[disabled] { visibility: hidden; }

/* ---------- Cards ---------- */
.card {
  position: relative;
  flex: 0 0 var(--card-w);
  scroll-snap-align: start;
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s;
  outline: none;
}
.card-img {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #333;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tags { display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 12px; color: #ccc; }
.tags span + span::before { content: "•"; color: #646464; margin: 0 6px; }
.card:hover .card-img img { filter: brightness(1.1); }

/* Floating hover preview */
.preview {
  position: absolute;
  z-index: 40;
  background: var(--bg-2);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0,0,0,.75);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(.7);
}
.preview.show { opacity: 1; pointer-events: auto; transform: none; transition: opacity .2s, transform .28s cubic-bezier(.2,.8,.2,1); }
.preview-img { aspect-ratio: 16 / 9; cursor: pointer; }
.preview-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-info { padding: 14px 16px 18px; }
.preview-info .btns { gap: 8px; margin-bottom: 12px; }
.preview-info .btns .icon-btn:last-child { margin-left: auto; }
.preview-info .meta { font-size: 13px; gap: 8px; margin-bottom: 8px; }
.preview-info .caption { font-size: 14px; line-height: 1.4; margin: 0 0 10px; color: #e5e5e5; }
.card:focus-visible { box-shadow: 0 0 0 3px #fff; }

/* Top 10 cards */
.card.ranked { flex-basis: calc(var(--card-w) * 1.35); display: flex; align-items: flex-end; background: transparent; }
.card.ranked .rank {
  flex: 0 0 30%;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: calc(var(--card-w) * .5);
  line-height: .78;
  color: var(--bg);
  -webkit-text-stroke: 3px #595959;
  text-align: right;
  margin-right: -14px;
  letter-spacing: -8px;
  user-select: none;
}
.card.ranked .card-img { flex: 1; }

/* ---------- Grid view ---------- */
.grid-view { padding: 110px var(--gutter) 60px; min-height: 70vh; }
.grid-title { font-size: clamp(22px, 2.4vw, 32px); margin: 0 0 22px; }
.grid-title small { color: var(--muted); font-weight: 400; font-size: .6em; margin-left: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px 10px; padding-bottom: 60px; }
.grid .card { flex: none; }
.empty { color: var(--muted); font-size: 16px; }
.empty code, .footer code { background: #262626; padding: 2px 6px; border-radius: 4px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; overflow-y: auto; padding: 32px 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.72); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
  position: relative;
  width: min(860px, 100%);
  background: var(--bg-2);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
  animation: pop .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(20px); } }
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: #181818; display: grid; place-items: center;
}
.modal-close svg { width: 22px; height: 22px; }
.modal-hero { position: relative; aspect-ratio: 2.4 / 1; width: 100%; }
.modal-hero img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.modal-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg-2) 2%, transparent 55%); }
.modal-hero-content { position: absolute; left: 40px; right: 40px; bottom: 28px; z-index: 1; }
.modal-hero h2 { font-family: "Bebas Neue", Impact, sans-serif; font-weight: 400; font-size: clamp(34px, 5vw, 58px); line-height: .95; margin: 0 0 16px; text-shadow: 0 2px 16px rgba(0,0,0,.7), 0 1px 3px rgba(0,0,0,.6); }
.modal-body { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; padding: 6px 40px 32px; }
.modal-body .caption { font-weight: 600; font-size: 17px; margin: 0 0 12px; }
.modal-body p { line-height: 1.6; margin: 0 0 12px; color: #ddd; }
.side-facts { font-size: 14px; line-height: 1.7; color: #ddd; }
.side-facts span { color: #777; }
.more-like h3 { font-size: 22px; margin: 6px 40px 14px; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; padding: 0 40px 40px; }
.mini {
  background: #2f2f2f;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: background .2s;
}
.mini:hover { background: #3a3a3a; }
.mini img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.mini div { padding: 12px 14px 16px; }
.mini .meta { font-size: 12px; margin-bottom: 6px; }
.mini p { margin: 0; font-size: 13px; line-height: 1.45; color: #d2d2d2; }

/* ---------- Footer ---------- */
.footer { padding: 30px var(--gutter) 50px; color: #777; font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200;
  transform: translate(-50%, 20px);
  background: #fff; color: #000; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 4px;
  opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav { flex-wrap: wrap; gap: 10px 16px; }
  .nav-links { order: 3; width: 100%; }
  .search input { width: 120px; }
  .modal-body { grid-template-columns: 1fr; padding: 6px 20px 24px; }
  .modal-hero-content { left: 20px; right: 20px; }
  .more-like h3 { margin: 6px 20px 14px; }
  .more-grid { padding: 0 20px 28px; }
}
@media (max-width: 520px) {
  :root { --card-w: 62vw; }
  .search input { width: 90px; }
  .hero { min-height: 72vh; padding-top: 140px; }
  .hero-dots { display: none; }
  .btn { padding: 9px 16px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
