/* ============================================================
   AnFlix — cinematic dark streaming UI
   Educational demo · open-license cinema
   ============================================================ */

/* ----------  Design tokens  ---------- */
:root {
  --bg: #05050a;
  --bg-soft: #0a0a13;
  --bg-elev: #10101c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f3fa;
  --muted: #9c9cb4;
  --muted-2: #6d6d85;
  --accent: #ff4d6d;
  --accent-2: #7c5cff;
  --accent-3: #2dd4bf;
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2));
  --grad-soft: linear-gradient(120deg, rgba(255, 77, 109, .18), rgba(124, 92, 255, .18));
  --glow: 0 0 40px rgba(124, 92, 255, 0.35), 0 0 12px rgba(255, 77, 109, 0.2);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 72px;
  --card-w: 188px;
  --font: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(.22, .8, .3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ambient glows behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(700px 420px at -10% 30%, rgba(255, 77, 109, 0.10), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(45, 212, 191, 0.07), transparent 60%),
    var(--bg);
}

/* film grain */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
::selection { background: rgba(124, 92, 255, 0.5); }

/* slim scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #22223a; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #33335a; }

/* ----------  Nav  ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  transition: background .35s var(--ease), backdrop-filter .35s var(--ease), box-shadow .35s var(--ease);
}
.nav.scrolled {
  background: rgba(8, 8, 16, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 1px 0 var(--stroke), 0 14px 40px rgba(0, 0, 0, 0.45);
}
.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 clamp(16px, 4vw, 48px);
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.5vw, 34px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.14em;
}
.logo-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--grad);
  display: grid;
  place-items: center;
  box-shadow: var(--glow);
}
.logo-mark svg { width: 18px; height: 18px; fill: #fff; }
.logo-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo-sub {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--muted-2);
  text-transform: uppercase;
  margin-left: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 28px);
  margin-left: clamp(6px, 2vw, 20px);
}
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  transition: color .25s var(--ease);
  position: relative;
  padding: 6px 2px;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}

.nav-spacer { flex: 1; }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--muted);
  transition: all .25s var(--ease);
}
.icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--stroke-strong);
  transform: translateY(-1px);
}
.icon-btn svg { width: 19px; height: 19px; }

.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--muted);
  min-width: 200px;
  transition: all .3s var(--ease);
  cursor: text;
}
.nav-search:hover, .nav-search:focus-within {
  border-color: rgba(124, 92, 255, 0.5);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}
.nav-search svg { width: 17px; height: 17px; flex: none; }
.nav-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  width: 100%;
}
.nav-search input::placeholder { color: var(--muted-2); }
.nav-search input::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }
.nav-search kbd {
  font-family: inherit;
  font-size: 0.68rem;
  color: var(--muted-2);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 2px 7px;
  flex: none;
}

/* ----------  Hero  ---------- */
.hero {
  position: relative;
  min-height: min(92vh, 860px);
  display: flex;
  align-items: flex-end;
  padding: calc(var(--nav-h) + 40px) clamp(16px, 4vw, 48px) clamp(40px, 6vh, 80px);
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: blur(26px) saturate(1.25) brightness(0.42) contrast(1.05);
  transform: scale(1.15);
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 5, 10, 0.35) 0%, rgba(5, 5, 10, 0.15) 35%, rgba(5, 5, 10, 0.92) 82%, var(--bg) 100%),
    linear-gradient(90deg, rgba(5, 5, 10, 0.88) 0%, rgba(5, 5, 10, 0.35) 55%, rgba(5, 5, 10, 0.1) 100%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(24px, 4vw, 72px);
  align-items: end;
}
.hero-copy { max-width: 680px; }

.hero-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-3);
  margin-bottom: 18px;
}
.hero-ribbon::before {
  content: "";
  width: 26px; height: 2px;
  background: var(--accent-3);
  border-radius: 2px;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  text-wrap: balance;
}
.hero-title .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 16px;
}
.hero-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-2); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--muted);
}
.badge.star { color: #ffd166; border-color: rgba(255, 209, 102, 0.35); background: rgba(255, 209, 102, 0.08); }
.badge.quality { color: var(--accent-3); border-color: rgba(45, 212, 191, 0.35); background: rgba(45, 212, 191, 0.08); }
.badge.license { color: var(--accent-2); border-color: rgba(124, 92, 255, 0.4); background: rgba(124, 92, 255, 0.1); }
.badge svg { width: 12px; height: 12px; }

.hero-desc {
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.06rem);
  max-width: 58ch;
  margin-bottom: 28px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  transition: all .3s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 19px; height: 19px; }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 30px rgba(255, 77, 109, 0.35), 0 4px 14px rgba(124, 92, 255, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(255, 77, 109, 0.45), 0 8px 22px rgba(124, 92, 255, 0.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: var(--surface-2); transform: translateY(-2px); border-color: rgba(255,255,255,0.28); }

.btn.list-btn.on { border-color: rgba(45, 212, 191, 0.55); color: var(--accent-3); background: rgba(45, 212, 191, 0.1); }

/* hero poster card */
.hero-poster {
  position: relative;
  justify-self: end;
  width: min(320px, 100%);
  aspect-ratio: 2 / 3;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--stroke);
  transform: rotate(2.5deg);
  transition: transform .5s var(--ease);
}
.hero-poster:hover { transform: rotate(0deg) scale(1.02); }
.hero-poster img { width: 100%; height: 100%; object-fit: cover; }
.hero-poster.fallback img { display: none; }
.hero-poster.fallback::before {
  content: attr(data-title);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.3;
  background: linear-gradient(160deg, #20203a, #0d0d1a);
}
.hero-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 -80px 90px -40px rgba(0, 0, 0, 0.8);
}

/* ----------  Sections & rows  ---------- */
.section {
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 46px) clamp(16px, 4vw, 48px) 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}
.section-title {
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  background: var(--grad);
  margin-right: 12px;
  transform: rotate(45deg);
  box-shadow: var(--glow);
}
.section-link {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: color .25s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-link:hover { color: var(--accent-3); }
.section-link svg { width: 14px; height: 14px; transition: transform .25s var(--ease); }
.section-link:hover svg { transform: translateX(3px); }

.row-wrap { position: relative; }

.row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 6px 2px 22px;
  scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }

.row-arrow {
  position: absolute;
  top: 42%;
  z-index: 5;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 20, 0.85);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: all .3s var(--ease);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
}
.row-wrap:hover .row-arrow { opacity: 1; }
.row-arrow:hover { background: var(--bg-elev); transform: scale(1.08); border-color: rgba(255,255,255,0.3); }
.row-arrow.prev { left: -14px; }
.row-arrow.next { right: -14px; }
.row-arrow svg { width: 20px; height: 20px; }

/* ----------  Cards  ---------- */
.card {
  position: relative;
  flex: none;
  width: var(--card-w);
  cursor: pointer;
  transition: transform .35s var(--ease);
}
.card:hover { transform: translateY(-6px); }

.card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(160deg, #16162a, #0b0b16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--stroke);
  transition: box-shadow .35s var(--ease);
}
.card:hover .card-poster {
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(124, 92, 255, 0.55), var(--glow);
}
.card-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity .5s var(--ease), transform 6s var(--ease);
}
.card-poster img.loaded { opacity: 1; transform: scale(1); }
.card:hover .card-poster img.loaded { transform: scale(1.06); }

.card-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(4, 4, 9, 0.58) 78%, rgba(4, 4, 9, 0.92) 100%);
}

.card-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(160deg, #1c1c34, #0d0d1a);
}

.card-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 12px 11px;
  z-index: 2;
}
.card-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-sub {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-sub .star { color: #ffd166; }

.card-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  width: 54px; height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 20, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  color: #fff;
  opacity: 0;
  transition: all .35s var(--ease);
  z-index: 2;
}
.card-play svg { width: 22px; height: 22px; margin-left: 3px; }
.card:hover .card-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.card-add {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 16, 0.7);
  border: 1px solid var(--stroke-strong);
  color: #fff;
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-4px);
  transition: all .3s var(--ease);
  z-index: 2;
}
.card:hover .card-add { opacity: 1; transform: translateY(0); }
.card-add:hover { background: rgba(124, 92, 255, 0.35); border-color: rgba(124, 92, 255, 0.8); }
.card-add.on { opacity: 1; transform: translateY(0); color: var(--accent-3); border-color: rgba(45, 212, 191, 0.6); background: rgba(45, 212, 191, 0.18); }
.card-add svg { width: 15px; height: 15px; }

/* ranked (top 10) cards — poster stays the same width as every other row */
.card.ranked { width: auto; display: flex; align-items: flex-end; gap: 8px; }
.card.ranked .rank {
  font-size: 118px;
  font-weight: 800;
  line-height: 0.78;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 3px rgba(255, 255, 255, 0.22);
  user-select: none;
  transition: -webkit-text-stroke .3s var(--ease);
  flex: none;
  transform: translateY(6px);
}
.card.ranked:hover .rank { -webkit-text-stroke: 3px rgba(124, 92, 255, 0.65); }
.card.ranked .card-body { flex: none; width: var(--card-w); min-width: 0; position: relative; }

/* grid view */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  padding: 8px 0 30px;
}
.grid .card, .grid .card.ranked { width: auto; }
.grid .card.ranked { flex-direction: column; align-items: stretch; gap: 0; }
.grid .card.ranked .rank { display: none; }

/* chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0 10px;
}
.chip {
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--stroke);
  transition: all .25s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--stroke-strong); transform: translateY(-1px); }
.chip.active {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.4);
}

/* view header (search results / genre view) */
.view-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.view-title { font-size: clamp(1.5rem, 3.4vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; }
.view-count { color: var(--muted); font-weight: 600; }

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.empty svg { width: 44px; height: 44px; margin-bottom: 14px; opacity: 0.5; }
.empty-title { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }

/* ----------  Watch page  ---------- */
.watch-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 26px) clamp(14px, 3vw, 40px) 40px;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 18px;
  transition: color .25s;
}
.crumb:hover { color: var(--accent-3); }
.crumb svg { width: 15px; height: 15px; }

.player-shell {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--stroke), 0 0 60px rgba(124, 92, 255, 0.14);
  aspect-ratio: 16 / 9;
}
/* the player component (rendered inline, no iframe) */
#vidy-root { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: #000; }
#vidy-root .vidy-shell { border-radius: 0; }
.player-shell video {
  width: 100%; height: 100%;
  display: block;
  background: #000;
}
.player-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #10101f, #04040a);
  transition: opacity .5s var(--ease);
  z-index: 3;
}
.player-loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.player-msg { color: var(--muted); font-size: 0.9rem; margin-top: 14px; text-align: center; }
.player-loading .inner { display: grid; place-items: center; }

.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translate(-50%, 90px);
  background: rgba(14, 14, 26, 0.92);
  border: 1px solid var(--stroke-strong);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  transition: transform .45s var(--ease);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show { transform: translate(-50%, 0); }
.toast svg { width: 17px; height: 17px; color: var(--accent-3); }

.watch-info { margin-top: 26px; }
.watch-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
}
.watch-title {
  font-size: clamp(1.6rem, 3.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  flex: 1 1 320px;
}
.watch-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.watch-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 18px;
}
.watch-credits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 22px 0;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.credit dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.credit dd { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.credit a { color: var(--accent-3); }
.credit a:hover { text-decoration: underline; }

.watch-desc {
  color: var(--muted);
  max-width: 78ch;
  font-size: 1.02rem;
  margin-bottom: 10px;
}
.license-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted-2);
  margin-top: 6px;
}
.license-note svg { width: 14px; height: 14px; }

/* ----------  Search overlay  ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(4, 4, 9, 0.86);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12vh 20px 40px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
  overflow-y: auto;
}
.search-overlay.open { opacity: 1; pointer-events: auto; }
.search-box {
  width: min(720px, 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 8px 0 22px;
  height: 64px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.search-box svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 500;
}
.search-box input::placeholder { color: var(--muted-2); }
.search-box input::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }
.search-close {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all .25s var(--ease);
  flex: none;
}
.search-close:hover { color: var(--text); background: var(--surface-2); }
.search-close svg { width: 18px; height: 18px; }
.search-hint { color: var(--muted-2); font-size: 0.85rem; margin-top: 16px; }
.search-results {
  width: min(1100px, 100%);
  margin-top: 30px;
}
.search-results .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ----------  Footer  ---------- */
.footer {
  margin-top: clamp(50px, 8vh, 90px);
  border-top: 1px solid var(--stroke);
  background: linear-gradient(180deg, transparent, rgba(124, 92, 255, 0.04));
}
.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px clamp(16px, 4vw, 48px) 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 40px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.footer-brand .logo-mark { width: 28px; height: 28px; border-radius: 8px; }
.footer-brand .logo-mark svg { width: 15px; height: 15px; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { transition: color .25s; }
.footer-links a:hover { color: var(--accent-3); }
.footer-note { max-width: 460px; line-height: 1.55; font-size: 0.82rem; color: var(--muted-2); }

/* ----------  Reveal animation  ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ----------  Responsive  ---------- */
@media (max-width: 1020px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-poster { display: none; }
}
@media (max-width: 780px) {
  :root { --nav-h: 62px; --card-w: 148px; }
  .nav-links { display: none; }
  .nav-search { min-width: 0; padding: 0 13px; }
  .nav-search span { display: none; }
  .logo-sub { white-space: nowrap; }
  .nav-search kbd { display: none; }
  .card.ranked .rank { font-size: 92px; -webkit-text-stroke-width: 2.5px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 14px; }
  .hero { min-height: 64vh; }
  .btn { height: 48px; padding: 0 22px; font-size: 0.94rem; }
  .row-arrow { display: none; }
  .watch-title-row { gap: 12px; }
  .credits { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  :root { --card-w: 132px; }
  .hero-desc { -webkit-line-clamp: 4; }
}

/* ============================================================
   TMDB era — trailer frame, skeletons, providers, search loading
   ============================================================ */

/* player frame (official trailer inside the classic shell) */
.player-frame { position: relative; width: 100%; height: 100%; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-frame > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.no-trailer-note {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: #e7e7f2; font-weight: 700; font-size: 0.98rem;
  text-shadow: 0 2px 18px rgba(0,0,0,.8);
}
.no-trailer-note svg { width: 20px; height: 20px; color: var(--accent-3); }

/* skeleton loading */
.skeleton-card { pointer-events: none; }
.skeleton-fill {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(100deg, rgba(255,255,255,.05) 30%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.grid .skeleton-card .card-poster { aspect-ratio: 2 / 3; position: relative; }

/* where to watch */
.providers {
  margin: 20px 0 6px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.prov-title { font-size: .98rem; font-weight: 800; margin-bottom: 13px; letter-spacing: -0.01em; }
.prov-region { color: var(--muted); font-weight: 600; font-size: .78rem; margin-left: 6px; text-transform: uppercase; letter-spacing: .1em; }
.prov-row { display: flex; flex-wrap: wrap; gap: 10px; }
.prov-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px 8px 9px;
  border-radius: 13px;
  background: var(--bg-elev);
  border: 1px solid var(--stroke);
  transition: transform .25s var(--ease), border-color .25s;
}
.prov-chip:hover { transform: translateY(-2px); border-color: var(--stroke-strong); }
.prov-chip img { width: 27px; height: 27px; border-radius: 8px; }
.prov-name { font-size: .88rem; font-weight: 700; }
.prov-kind {
  font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-3); background: rgba(45,212,191,.1);
  border: 1px solid rgba(45,212,191,.3); border-radius: 999px; padding: 2px 8px;
}
.prov-note { margin-top: 12px; font-size: .78rem; color: var(--muted-2); }
.prov-note a { color: var(--accent-3); }
.prov-note a:hover { text-decoration: underline; }

/* search overlay loading */
.search-loading { display: grid; place-items: center; padding: 60px 0; }

/* ============================================================
   AnFlix — cinematic dark streaming UI
   Educational demo · open-license cinema
   ============================================================ */

/* ----------  Design tokens  ---------- */
:root {
  --bg: #05050a;
  --bg-soft: #0a0a13;
  --bg-elev: #10101c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f3fa;
  --muted: #9c9cb4;
  --muted-2: #6d6d85;
  --accent: #ff4d6d;
  --accent-2: #7c5cff;
  --accent-3: #2dd4bf;
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2));
  --grad-soft: linear-gradient(120deg, rgba(255, 77, 109, .18), rgba(124, 92, 255, .18));
  --glow: 0 0 40px rgba(124, 92, 255, 0.35), 0 0 12px rgba(255, 77, 109, 0.2);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 72px;
  --card-w: 188px;
  --font: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(.22, .8, .3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ambient glows behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(700px 420px at -10% 30%, rgba(255, 77, 109, 0.10), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(45, 212, 191, 0.07), transparent 60%),
    var(--bg);
}

/* film grain */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
::selection { background: rgba(124, 92, 255, 0.5); }

/* slim scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #22223a; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #33335a; }

/* ----------  Nav  ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  transition: background .35s var(--ease), backdrop-filter .35s var(--ease), box-shadow .35s var(--ease);
}
.nav.scrolled {
  background: rgba(8, 8, 16, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 1px 0 var(--stroke), 0 14px 40px rgba(0, 0, 0, 0.45);
}
.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 clamp(16px, 4vw, 48px);
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.5vw, 34px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.14em;
}
.logo-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--grad);
  display: grid;
  place-items: center;
  box-shadow: var(--glow);
}
.logo-mark svg { width: 18px; height: 18px; fill: #fff; }
.logo-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo-sub {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--muted-2);
  text-transform: uppercase;
  margin-left: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 28px);
  margin-left: clamp(6px, 2vw, 20px);
}
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  transition: color .25s var(--ease);
  position: relative;
  padding: 6px 2px;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}

.nav-spacer { flex: 1; }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--muted);
  transition: all .25s var(--ease);
}
.icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--stroke-strong);
  transform: translateY(-1px);
}
.icon-btn svg { width: 19px; height: 19px; }

.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--muted);
  min-width: 200px;
  transition: all .3s var(--ease);
  cursor: text;
}
.nav-search:hover, .nav-search:focus-within {
  border-color: rgba(124, 92, 255, 0.5);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}
.nav-search svg { width: 17px; height: 17px; flex: none; }
.nav-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  width: 100%;
}
.nav-search input::placeholder { color: var(--muted-2); }
.nav-search input::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }
.nav-search kbd {
  font-family: inherit;
  font-size: 0.68rem;
  color: var(--muted-2);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 2px 7px;
  flex: none;
}

/* ----------  Hero  ---------- */
.hero {
  position: relative;
  min-height: min(92vh, 860px);
  display: flex;
  align-items: flex-end;
  padding: calc(var(--nav-h) + 40px) clamp(16px, 4vw, 48px) clamp(40px, 6vh, 80px);
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: blur(26px) saturate(1.25) brightness(0.42) contrast(1.05);
  transform: scale(1.15);
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 5, 10, 0.35) 0%, rgba(5, 5, 10, 0.15) 35%, rgba(5, 5, 10, 0.92) 82%, var(--bg) 100%),
    linear-gradient(90deg, rgba(5, 5, 10, 0.88) 0%, rgba(5, 5, 10, 0.35) 55%, rgba(5, 5, 10, 0.1) 100%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(24px, 4vw, 72px);
  align-items: end;
}
.hero-copy { max-width: 680px; }

.hero-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-3);
  margin-bottom: 18px;
}
.hero-ribbon::before {
  content: "";
  width: 26px; height: 2px;
  background: var(--accent-3);
  border-radius: 2px;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  text-wrap: balance;
}
.hero-title .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 16px;
}
.hero-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-2); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--muted);
}
.badge.star { color: #ffd166; border-color: rgba(255, 209, 102, 0.35); background: rgba(255, 209, 102, 0.08); }
.badge.quality { color: var(--accent-3); border-color: rgba(45, 212, 191, 0.35); background: rgba(45, 212, 191, 0.08); }
.badge.license { color: var(--accent-2); border-color: rgba(124, 92, 255, 0.4); background: rgba(124, 92, 255, 0.1); }
.badge svg { width: 12px; height: 12px; }

.hero-desc {
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.06rem);
  max-width: 58ch;
  margin-bottom: 28px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  transition: all .3s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 19px; height: 19px; }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 30px rgba(255, 77, 109, 0.35), 0 4px 14px rgba(124, 92, 255, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(255, 77, 109, 0.45), 0 8px 22px rgba(124, 92, 255, 0.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: var(--surface-2); transform: translateY(-2px); border-color: rgba(255,255,255,0.28); }

.btn.list-btn.on { border-color: rgba(45, 212, 191, 0.55); color: var(--accent-3); background: rgba(45, 212, 191, 0.1); }

/* hero poster card */
.hero-poster {
  position: relative;
  justify-self: end;
  width: min(320px, 100%);
  aspect-ratio: 2 / 3;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--stroke);
  transform: rotate(2.5deg);
  transition: transform .5s var(--ease);
}
.hero-poster:hover { transform: rotate(0deg) scale(1.02); }
.hero-poster img { width: 100%; height: 100%; object-fit: cover; }
.hero-poster.fallback img { display: none; }
.hero-poster.fallback::before {
  content: attr(data-title);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.3;
  background: linear-gradient(160deg, #20203a, #0d0d1a);
}
.hero-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 -80px 90px -40px rgba(0, 0, 0, 0.8);
}

/* ----------  Sections & rows  ---------- */
.section {
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 46px) clamp(16px, 4vw, 48px) 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}
.section-title {
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  background: var(--grad);
  margin-right: 12px;
  transform: rotate(45deg);
  box-shadow: var(--glow);
}
.section-link {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: color .25s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-link:hover { color: var(--accent-3); }
.section-link svg { width: 14px; height: 14px; transition: transform .25s var(--ease); }
.section-link:hover svg { transform: translateX(3px); }

.row-wrap { position: relative; }

.row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 6px 2px 22px;
  scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }

.row-arrow {
  position: absolute;
  top: 42%;
  z-index: 5;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 20, 0.85);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: all .3s var(--ease);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
}
.row-wrap:hover .row-arrow { opacity: 1; }
.row-arrow:hover { background: var(--bg-elev); transform: scale(1.08); border-color: rgba(255,255,255,0.3); }
.row-arrow.prev { left: -14px; }
.row-arrow.next { right: -14px; }
.row-arrow svg { width: 20px; height: 20px; }

/* ----------  Cards  ---------- */
.card {
  position: relative;
  flex: none;
  width: var(--card-w);
  cursor: pointer;
  transition: transform .35s var(--ease);
}
.card:hover { transform: translateY(-6px); }

.card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(160deg, #16162a, #0b0b16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--stroke);
  transition: box-shadow .35s var(--ease);
}
.card:hover .card-poster {
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(124, 92, 255, 0.55), var(--glow);
}
.card-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity .5s var(--ease), transform 6s var(--ease);
}
.card-poster img.loaded { opacity: 1; transform: scale(1); }
.card:hover .card-poster img.loaded { transform: scale(1.06); }

.card-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(4, 4, 9, 0.58) 78%, rgba(4, 4, 9, 0.92) 100%);
}

.card-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(160deg, #1c1c34, #0d0d1a);
}

.card-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 12px 11px;
  z-index: 2;
}
.card-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-sub {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-sub .star { color: #ffd166; }

.card-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  width: 54px; height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 20, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  color: #fff;
  opacity: 0;
  transition: all .35s var(--ease);
  z-index: 2;
}
.card-play svg { width: 22px; height: 22px; margin-left: 3px; }
.card:hover .card-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.card-add {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 16, 0.7);
  border: 1px solid var(--stroke-strong);
  color: #fff;
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-4px);
  transition: all .3s var(--ease);
  z-index: 2;
}
.card:hover .card-add { opacity: 1; transform: translateY(0); }
.card-add:hover { background: rgba(124, 92, 255, 0.35); border-color: rgba(124, 92, 255, 0.8); }
.card-add.on { opacity: 1; transform: translateY(0); color: var(--accent-3); border-color: rgba(45, 212, 191, 0.6); background: rgba(45, 212, 191, 0.18); }
.card-add svg { width: 15px; height: 15px; }

/* ranked (top 10) cards — poster stays the same width as every other row */
.card.ranked { width: auto; display: flex; align-items: flex-end; gap: 8px; }
.card.ranked .rank {
  font-size: 118px;
  font-weight: 800;
  line-height: 0.78;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 3px rgba(255, 255, 255, 0.22);
  user-select: none;
  transition: -webkit-text-stroke .3s var(--ease);
  flex: none;
  transform: translateY(6px);
}
.card.ranked:hover .rank { -webkit-text-stroke: 3px rgba(124, 92, 255, 0.65); }
.card.ranked .card-body { flex: none; width: var(--card-w); min-width: 0; position: relative; }

/* grid view */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  padding: 8px 0 30px;
}
.grid .card, .grid .card.ranked { width: auto; }
.grid .card.ranked { flex-direction: column; align-items: stretch; gap: 0; }
.grid .card.ranked .rank { display: none; }

/* chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0 10px;
}
.chip {
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--stroke);
  transition: all .25s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--stroke-strong); transform: translateY(-1px); }
.chip.active {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.4);
}

/* view header (search results / genre view) */
.view-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.view-title { font-size: clamp(1.5rem, 3.4vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; }
.view-count { color: var(--muted); font-weight: 600; }

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.empty svg { width: 44px; height: 44px; margin-bottom: 14px; opacity: 0.5; }
.empty-title { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }

/* ----------  Watch page  ---------- */
.watch-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 26px) clamp(14px, 3vw, 40px) 40px;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 18px;
  transition: color .25s;
}
.crumb:hover { color: var(--accent-3); }
.crumb svg { width: 15px; height: 15px; }

.player-shell {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--stroke), 0 0 60px rgba(124, 92, 255, 0.14);
  aspect-ratio: 16 / 9;
}
/* the player component (rendered inline, no iframe) */
#vidy-root { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: #000; }
#vidy-root .vidy-shell { border-radius: 0; }
.player-shell video {
  width: 100%; height: 100%;
  display: block;
  background: #000;
}
.player-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #10101f, #04040a);
  transition: opacity .5s var(--ease);
  z-index: 3;
}
.player-loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.player-msg { color: var(--muted); font-size: 0.9rem; margin-top: 14px; text-align: center; }
.player-loading .inner { display: grid; place-items: center; }

.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translate(-50%, 90px);
  background: rgba(14, 14, 26, 0.92);
  border: 1px solid var(--stroke-strong);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  transition: transform .45s var(--ease);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show { transform: translate(-50%, 0); }
.toast svg { width: 17px; height: 17px; color: var(--accent-3); }

.watch-info { margin-top: 26px; }
.watch-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
}
.watch-title {
  font-size: clamp(1.6rem, 3.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  flex: 1 1 320px;
}
.watch-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.watch-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 18px;
}
.watch-credits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 22px 0;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.credit dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.credit dd { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.credit a { color: var(--accent-3); }
.credit a:hover { text-decoration: underline; }

.watch-desc {
  color: var(--muted);
  max-width: 78ch;
  font-size: 1.02rem;
  margin-bottom: 10px;
}
.license-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted-2);
  margin-top: 6px;
}
.license-note svg { width: 14px; height: 14px; }

/* ----------  Search overlay  ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(4, 4, 9, 0.86);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12vh 20px 40px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
  overflow-y: auto;
}
.search-overlay.open { opacity: 1; pointer-events: auto; }
.search-box {
  width: min(720px, 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 8px 0 22px;
  height: 64px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.search-box svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 500;
}
.search-box input::placeholder { color: var(--muted-2); }
.search-box input::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }
.search-close {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all .25s var(--ease);
  flex: none;
}
.search-close:hover { color: var(--text); background: var(--surface-2); }
.search-close svg { width: 18px; height: 18px; }
.search-hint { color: var(--muted-2); font-size: 0.85rem; margin-top: 16px; }
.search-results {
  width: min(1100px, 100%);
  margin-top: 30px;
}
.search-results .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ----------  Footer  ---------- */
.footer {
  margin-top: clamp(50px, 8vh, 90px);
  border-top: 1px solid var(--stroke);
  background: linear-gradient(180deg, transparent, rgba(124, 92, 255, 0.04));
}
.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px clamp(16px, 4vw, 48px) 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 40px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.footer-brand .logo-mark { width: 28px; height: 28px; border-radius: 8px; }
.footer-brand .logo-mark svg { width: 15px; height: 15px; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { transition: color .25s; }
.footer-links a:hover { color: var(--accent-3); }
.footer-note { max-width: 460px; line-height: 1.55; font-size: 0.82rem; color: var(--muted-2); }

/* ----------  Reveal animation  ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ----------  Responsive  ---------- */
@media (max-width: 1020px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-poster { display: none; }
}
@media (max-width: 780px) {
  :root { --nav-h: 62px; --card-w: 148px; }
  .nav-links { display: none; }
  .nav-search { min-width: 0; padding: 0 13px; }
  .nav-search span { display: none; }
  .logo-sub { white-space: nowrap; }
  .nav-search kbd { display: none; }
  .card.ranked .rank { font-size: 92px; -webkit-text-stroke-width: 2.5px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 14px; }
  .hero { min-height: 64vh; }
  .btn { height: 48px; padding: 0 22px; font-size: 0.94rem; }
  .row-arrow { display: none; }
  .watch-title-row { gap: 12px; }
  .credits { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  :root { --card-w: 132px; }
  .hero-desc { -webkit-line-clamp: 4; }
}

/* ============================================================
   TMDB era — trailer frame, skeletons, providers, search loading
   ============================================================ */

/* player frame (official trailer inside the classic shell) */
.player-frame { position: relative; width: 100%; height: 100%; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-frame > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.no-trailer-note {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: #e7e7f2; font-weight: 700; font-size: 0.98rem;
  text-shadow: 0 2px 18px rgba(0,0,0,.8);
}
.no-trailer-note svg { width: 20px; height: 20px; color: var(--accent-3); }

/* skeleton loading */
.skeleton-card { pointer-events: none; }
.skeleton-fill {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(100deg, rgba(255,255,255,.05) 30%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.grid .skeleton-card .card-poster { aspect-ratio: 2 / 3; position: relative; }

/* where to watch */
.providers {
  margin: 20px 0 6px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.prov-title { font-size: .98rem; font-weight: 800; margin-bottom: 13px; letter-spacing: -0.01em; }
.prov-region { color: var(--muted); font-weight: 600; font-size: .78rem; margin-left: 6px; text-transform: uppercase; letter-spacing: .1em; }
.prov-row { display: flex; flex-wrap: wrap; gap: 10px; }
.prov-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px 8px 9px;
  border-radius: 13px;
  background: var(--bg-elev);
  border: 1px solid var(--stroke);
  transition: transform .25s var(--ease), border-color .25s;
}
.prov-chip:hover { transform: translateY(-2px); border-color: var(--stroke-strong); }
.prov-chip img { width: 27px; height: 27px; border-radius: 8px; }
.prov-name { font-size: .88rem; font-weight: 700; }
.prov-kind {
  font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-3); background: rgba(45,212,191,.1);
  border: 1px solid rgba(45,212,191,.3); border-radius: 999px; padding: 2px 8px;
}
.prov-note { margin-top: 12px; font-size: .78rem; color: var(--muted-2); }
.prov-note a { color: var(--accent-3); }
.prov-note a:hover { text-decoration: underline; }

/* search overlay loading */
.search-loading { display: grid; place-items: center; padding: 60px 0; }


/* ----------  hero primary action: red "Watch Now"  ---------- */
.hero-actions .btn-primary {
  background: #e50914;
  box-shadow: 0 10px 30px rgba(229, 9, 20, 0.42), 0 4px 14px rgba(0, 0, 0, 0.35);
}
.hero-actions .btn-primary:hover {
  background: #f21824;
  box-shadow: 0 16px 44px rgba(229, 9, 20, 0.52), 0 8px 22px rgba(0, 0, 0, 0.4);
}

/* ----------  footer: socials + "Created by Asanga"  ---------- */
.footer-credit {
  width: 100%;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--muted-2);
}
.footer-credit strong { color: var(--muted); font-weight: 600; }
.footer-social { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.footer-social a {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--stroke);
  color: var(--muted);
  transition: color .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.footer-social a:hover { color: #fff; border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); }
.footer-social svg { width: 16px; height: 16px; }

/* ----------  mobile: the trending film must be seen SHARP, not blurred  ---------- */
@media (max-width: 1020px) {
  .hero { align-items: flex-end; }
  .hero-inner { grid-template-columns: 1fr; gap: 20px; align-items: start; }
  .hero-poster {
    display: block;                 /* was display:none -> only the blurred backdrop was left */
    order: -1;
    justify-self: start;
    width: min(190px, 46%);
    border-radius: 18px;
    transform: none;
    margin-top: 6px;
  }
  .hero-poster:hover { transform: none; }
  .hero-copy { max-width: 100%; }
  /* softer backdrop so it reads as ambience, not as a blurry poster */
  .hero-bg img { filter: blur(12px) saturate(1.2) brightness(0.5) contrast(1.02); transform: scale(1.06); }
}
@media (max-width: 780px) {
  .hero-poster { width: min(152px, 44%); }
  .hero-title { font-size: clamp(1.9rem, 8.4vw, 2.7rem); }
  .hero { min-height: auto; padding-top: calc(var(--nav-h) + 26px); padding-bottom: 34px; }
}
