/* سينمانا — ستايل مستوحى من Netflix، بلمسة أهدأ وأسرع */
:root {
  --bg: #0b0b0b;
  --surface: #181818;
  --surface-2: #232323;
  --text: #ffffff;
  --muted: #b3b3b3;
  /* Repainted per film by paintTheme() — everything keyed to the accent follows
     the hero, so the page takes on the colour of whatever is on screen. */
  --accent: #e50914;
  --accent-2: #f6121d;
  --accent-rgb: 229, 9, 20;
  --deep-rgb: 42, 10, 18;
  --gold: #f5c518;
  --line: rgba(255, 255, 255, .12);
  --header-h: 68px;
  --hero-interval: 5s;
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient wash: two stacked layers, the incoming one carries the next film's
   colour and crossfades over the outgoing one — the room changes colour with
   the film instead of snapping. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient span {
  position: absolute;
  inset: -25%;
  opacity: 0;
  transition: opacity 1.3s ease;
  background:
    radial-gradient(46rem 32rem at 80% -8%, rgba(var(--a-rgb, 229, 9, 20), .26), transparent 66%),
    radial-gradient(38rem 28rem at 4% 48%, rgba(var(--a-rgb, 229, 9, 20), .12), transparent 64%);
}

.ambient span.on { opacity: 1; }

main,
.site-footer { position: relative; z-index: 1; }

::selection { background: rgba(var(--accent-rgb), .5); }

::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

.container {
  width: min(1440px, 100%);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3.5rem);
}

section[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- header ---------- */
.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 120;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .85), rgba(0, 0, 0, 0));
  transition: background .35s ease, backdrop-filter .35s ease;
}

.site-header.scrolled {
  background: rgba(10, 10, 12, .72);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
  backdrop-filter: blur(20px) saturate(1.35);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: clamp(.8rem, 2vw, 2rem);
  width: 100%;
}

.logo {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  font-weight: 900;
  letter-spacing: -.5px;
  color: var(--accent);
  white-space: nowrap;
  text-transform: uppercase;
  transition: color .9s ease, text-shadow .9s ease;
  text-shadow: 0 0 24px rgba(var(--accent-rgb), .35);
}

.logo span { color: #fff; }

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(.7rem, 1.6vw, 1.6rem);
  font-size: .92rem;
  font-weight: 600;
}

.main-nav a {
  color: rgba(255, 255, 255, .72);
  transition: color .2s ease;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active { color: #fff; }

.header-tools {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-inline-start: auto;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: .5rem;
  height: 38px;
  padding-inline: .75rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, .7);
  border: 1px solid transparent;
  transition: border-color .2s ease, background .2s ease;
}

.search-box:focus-within {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(0, 0, 0, .9);
}

.search-box svg {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, .75);
  flex: 0 0 auto;
}

.search-box input {
  width: clamp(140px, 18vw, 240px);
  background: none;
  border: 0;
  outline: none;
  color: #fff;
  font-size: .88rem;
  font-family: inherit;
}

.search-box input::placeholder { color: rgba(255, 255, 255, .5); }

.lang-switch {
  display: flex;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 4px;
  overflow: hidden;
}

.lang-btn {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, .75);
  font-size: .78rem;
  font-weight: 700;
  padding: .32rem .6rem;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.lang-btn.active { background: #fff; color: #000; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: min(94vh, 900px);
  display: flex;
  align-items: flex-end;
  isolation: isolate;
  overflow: hidden;
  background: #060608;
}

/* Every slide carries its own blurred bloom, its own sharp plate and its own
   colour wash, so a film change is one opacity crossfade over the whole stack. */
.hero-stage {
  position: absolute;
  inset: 0;
  z-index: -3;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.15s cubic-bezier(.4, 0, .2, 1);
  will-change: opacity;
}

.hero-slide.active { opacity: 1; }

.hero-slide .slide-blur,
.hero-slide .slide-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 22%;
}

.hero-slide .slide-blur {
  filter: blur(64px) saturate(1.7);
  transform: scale(1.3);
  opacity: .8;
}

.hero-slide .slide-img {
  transform: scale(1.02);
  transform-origin: 60% 30%;
}

.hero-slide.active .slide-img {
  animation: kenburns 24s ease-out both;
}

@keyframes kenburns {
  from { transform: scale(1.02); }
  to { transform: scale(1.12); }
}

.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(115% 90% at 76% 16%, rgba(var(--s-rgb, 229, 9, 20), .45), transparent 62%);
  mix-blend-mode: screen;
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(to top, var(--bg) 0%, rgba(11, 11, 11, .9) 16%, rgba(11, 11, 11, .3) 48%, rgba(11, 11, 11, 0) 74%),
    linear-gradient(to right, rgba(11, 11, 11, .9) 0%, rgba(11, 11, 11, .45) 36%, rgba(11, 11, 11, 0) 68%);
}

[dir="rtl"] .hero-veil {
  background:
    linear-gradient(to top, var(--bg) 0%, rgba(11, 11, 11, .9) 16%, rgba(11, 11, 11, .3) 48%, rgba(11, 11, 11, 0) 74%),
    linear-gradient(to left, rgba(11, 11, 11, .9) 0%, rgba(11, 11, 11, .45) 36%, rgba(11, 11, 11, 0) 68%);
}

.hero-content {
  position: relative;
  padding-block: clamp(4rem, 11vh, 9rem) clamp(3rem, 7vh, 5.5rem);
  max-width: 1440px;
  width: 100%;
}

/* Frosted plate under the copy: the picture keeps moving behind it through the
   blur, and the accent rim redraws itself for each film. */
.hero-panel {
  position: relative;
  max-width: min(620px, 100%);
  padding: clamp(1.15rem, 2.3vw, 2rem);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, .09);
  background: linear-gradient(155deg, rgba(var(--deep-rgb), .62), rgba(10, 10, 14, .3));
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  backdrop-filter: blur(26px) saturate(1.3);
  box-shadow: 0 32px 90px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(var(--accent-rgb), .7), transparent 42%, rgba(var(--accent-rgb), .3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* The swap itself: copy leaves upward, new copy rises out of a blur. */
.hero-content.swap .hero-panel > * {
  animation: heroIn .8s cubic-bezier(.16, 1, .3, 1) both;
}

.hero-content.swap .hero-panel > *:nth-child(2) { animation-delay: .06s; }
.hero-content.swap .hero-panel > *:nth-child(3) { animation-delay: .1s; }
.hero-content.swap .hero-panel > *:nth-child(4) { animation-delay: .14s; }
.hero-content.swap .hero-panel > *:nth-child(5) { animation-delay: .18s; }
.hero-content.swap .hero-panel > *:nth-child(6) { animation-delay: .22s; }

@keyframes heroIn {
  from { opacity: 0; transform: translateY(22px); filter: blur(7px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

.hero-dots {
  position: absolute;
  inset-block-end: clamp(1.4rem, 3.4vh, 2.4rem);
  inset-inline-end: clamp(1rem, 4vw, 3.5rem);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.hero-dot {
  width: 34px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  overflow: hidden;
  cursor: pointer;
  transition: width .35s ease, background .25s ease;
}

.hero-dot span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: background .6s ease;
}

.hero-dot:hover { background: rgba(255, 255, 255, .4); }

.hero-dot.active { width: 62px; }

.hero-dot.active span {
  animation: dotFill var(--hero-interval) linear forwards;
}

@keyframes dotFill {
  from { width: 0; }
  to { width: 100%; }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: .9rem;
}

.hero-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-logo {
  display: block;
  max-width: min(520px, 70%);
  max-height: 150px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 6px 24px rgba(0, 0, 0, .7));
}

.hero-title {
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.02em;
  margin-bottom: .8rem;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .6);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem .9rem;
  font-size: .92rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .88);
  margin-bottom: 1rem;
}

.hero-meta .meta-rating {
  color: var(--gold);
  font-weight: 800;
}

.hero-meta .meta-pill {
  padding: .1rem .45rem;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 3px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.hero-desc {
  max-width: 60ch;
  font-size: clamp(.92rem, 1.1vw, 1.05rem);
  line-height: 1.75;
  color: rgba(255, 255, 255, .9);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .8);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; }

/* ---------- scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s ease, transform .8s cubic-bezier(.16, 1, .3, 1);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

.row-scroll.reveal .movie-card { opacity: 0; }

.row-scroll.reveal.in .movie-card {
  animation: cardIn .6s cubic-bezier(.16, 1, .3, 1) both;
}

.row-scroll.reveal.in .movie-card:nth-child(2) { animation-delay: .04s; }
.row-scroll.reveal.in .movie-card:nth-child(3) { animation-delay: .08s; }
.row-scroll.reveal.in .movie-card:nth-child(4) { animation-delay: .12s; }
.row-scroll.reveal.in .movie-card:nth-child(5) { animation-delay: .16s; }
.row-scroll.reveal.in .movie-card:nth-child(6) { animation-delay: .2s; }
.row-scroll.reveal.in .movie-card:nth-child(7) { animation-delay: .24s; }
.row-scroll.reveal.in .movie-card:nth-child(8) { animation-delay: .28s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .8rem 1.7rem;
  border: none;
  border-radius: 4px;
  font-size: .98rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .12s ease;
}

.btn:active { transform: scale(.97); }

.btn svg { width: 1.1rem; height: 1.1rem; }

.btn-primary {
  background: #fff;
  color: #000;
}

.btn-primary:hover { background: rgba(255, 255, 255, .78); }

.btn-ghost {
  background: rgba(109, 109, 110, .55);
  color: #fff;
}

.btn-ghost:hover { background: rgba(109, 109, 110, .38); }

.btn-ghost.active {
  color: #fff;
  background: rgba(229, 9, 20, .85);
}

.btn-ghost.active svg { fill: currentColor; }

.btn-sm { padding: .58rem 1.15rem; font-size: .87rem; }

.icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-size: .95rem;
  cursor: pointer;
  transition: background .2s ease;
}

.icon-btn:hover { background: rgba(255, 255, 255, .16); }

.link-btn {
  background: none;
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- sections ---------- */
.section { padding-block: 1.4rem .6rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
}

.section-head h2 {
  font-size: clamp(1.05rem, 1.5vw, 1.4rem);
  font-weight: 800;
  letter-spacing: -.01em;
}

.count { color: var(--muted); font-size: .85rem; font-weight: 600; }

/* ---------- rows ---------- */
.row-shell { position: relative; }

.row-scroll {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  padding-block: .4rem 1.6rem;
  scrollbar-width: none;
}

.row-scroll::-webkit-scrollbar { display: none; }

/* min-width: 0 keeps a long unbreakable title from widening the card — without
   it, min-content wins over the flex basis and one card in the row grows. */
.row-scroll .movie-card {
  flex: 0 0 clamp(136px, 14.5vw, 210px);
  min-width: 0;
  scroll-snap-align: start;
}

.row-arrow {
  position: absolute;
  inset-block: 0;
  inset-block-end: 1.6rem;
  z-index: 6;
  width: 44px;
  display: grid;
  place-items: center;
  border: 0;
  color: #fff;
  background: rgba(11, 11, 11, .75);
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s ease, background .2s ease;
}

.row-shell:hover .row-arrow { opacity: 1; }

.row-arrow:hover { background: rgba(11, 11, 11, .95); }

.row-arrow[disabled] { opacity: 0; pointer-events: none; }

.row-arrow svg { width: 26px; height: 26px; }

.row-arrow.prev { inset-inline-start: 0; }
.row-arrow.next { inset-inline-end: 0; }

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.6rem 1rem;
}

/* ---------- movie card ---------- */
.movie-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
  outline: none;
  border-radius: 6px;
  transition: transform .28s cubic-bezier(.2, .7, .3, 1), z-index 0s .28s;
}

.movie-card:hover,
.movie-card:focus-visible {
  transform: scale(1.09);
  z-index: 8;
  transition-delay: .18s, 0s;
}

/* The frame is always 2:3 and always full-bleed: the poster is painted as the
   background too, so a slow or letterboxed image can never leave a bare band. */
.card-art {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  background-color: #101014;
  background-image: var(--art, none), linear-gradient(150deg, var(--g1, #1f1f1f), var(--g2, #3a3a3a));
  background-size: cover, cover;
  background-position: center 20%, center;
  background-repeat: no-repeat, no-repeat;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}

.card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0) 40%);
}

.card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}

.movie-card:hover .card-img { transform: scale(1.05); }

.card-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  font-size: .95rem;
  font-weight: 800;
  color: rgba(255, 255, 255, .85);
}

/* Brand mark and rank ribbon ride the top corners and mirror with the document. */
.card-n {
  position: absolute;
  inset-block-start: .35rem;
  inset-inline-start: .5rem;
  z-index: 3;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: #e50914;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .7);
  pointer-events: none;
}

.card-rank {
  position: absolute;
  inset-block-start: .45rem;
  inset-inline-end: .45rem;
  z-index: 3;
  padding: .08rem .28rem;
  border-radius: 2px;
  background: #e50914;
  color: #fff;
  font-size: .56rem;
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1.4;
  text-transform: uppercase;
  pointer-events: none;
}

/* The pill is glass, not paint: the poster shows through it and the accent
   never floods it, so a row of cards reads as one material. */
.card-pill {
  position: absolute;
  inset-block-end: .5rem;
  inset-inline: .5rem;
  z-index: 3;
  padding: .18rem .3rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(12, 12, 16, .42);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
  color: #fff;
  font-size: .74rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .16);
  text-shadow: 0 1px 4px rgba(0, 0, 0, .55);
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.movie-card:hover .card-pill {
  background: rgba(20, 20, 26, .58);
  border-color: rgba(255, 255, 255, .32);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.card-hover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  background: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, .35), rgba(0, 0, 0, .72));
  opacity: 0;
  transition: opacity .22s ease;
}

.movie-card:hover .card-hover,
.movie-card:focus-visible .card-hover { opacity: 1; }

.poster-play {
  flex: 0 0 auto;
  width: 3.1rem;
  height: 3.1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #000;
  transform: scale(.7);
  transition: transform .3s cubic-bezier(.16, 1, .3, 1);
}

.movie-card:hover .poster-play { transform: scale(1); }

.poster-play svg { width: 1.35rem; height: 1.35rem; margin-inline-start: 2px; }

.poster-fav {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  transform: scale(.7);
  transition: transform .3s cubic-bezier(.16, 1, .3, 1), background .2s ease;
}

.movie-card:hover .poster-fav { transform: scale(1); }

.poster-fav svg { width: 1.05rem; height: 1.05rem; }

.poster-fav:hover { background: rgba(0, 0, 0, .85); }

.poster-fav.active { color: #fff; background: rgba(var(--accent-rgb), .92); border-color: transparent; }

.poster-fav.active svg { fill: currentColor; }

/* Title sits under the art like the reference; the detail line slides in. */
.card-title {
  margin-top: .5rem;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  min-height: 1.15em;
  min-width: 0;
  margin-top: .12rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  overflow: hidden;
  font-size: .72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .58);
  opacity: 0;
  transition: opacity .22s ease;
}

.movie-card:hover .card-meta,
.movie-card:focus-visible .card-meta { opacity: 1; }

.card-meta span { display: inline-flex; align-items: center; gap: .18rem; }

.card-meta svg { width: .7rem; height: .7rem; color: var(--gold); }

.card-meta .dot { opacity: .5; }

/* ---------- genre menu ---------- */
.genre-menu { position: relative; }

.genre-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  height: 38px;
  padding-inline: .8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.genre-toggle:hover {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .34);
}

.genre-toggle svg { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; }

.genre-toggle-label { white-space: nowrap; }

.genre-menu.open .genre-toggle {
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(var(--accent-rgb), .45);
}

/* Anchored to the button, dropped from the same corner it is pinned to. */
.genre-panel {
  position: absolute;
  inset-block-start: calc(100% + .6rem);
  inset-inline-end: 0;
  z-index: 130;
  width: min(310px, calc(100vw - 2rem));
  max-height: min(72vh, 560px);
  display: flex;
  flex-direction: column;
  padding: .45rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(13, 13, 16, .94);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  backdrop-filter: blur(26px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  opacity: 0;
  transform: translateY(-10px) scale(.97);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .2s ease, transform .28s cubic-bezier(.16, 1, .3, 1);
}

[dir="rtl"] .genre-panel { transform-origin: top left; }

.genre-menu.open .genre-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.genre-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .35rem .55rem .5rem;
  margin-bottom: .3rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .42);
}

.genre-panel-head #genreTotal {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 700;
  color: rgba(255, 255, 255, .3);
}

.genre-panel .chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}

.genre-panel .chips::-webkit-scrollbar { width: 6px; }
.genre-panel .chips::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 999px; }

.genre-panel .chip {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .42rem .5rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: rgba(255, 255, 255, .82);
  font-size: .84rem;
  font-weight: 700;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.genre-panel .chip:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.genre-panel .chip.active { background: rgba(var(--accent-rgb), .2); color: #fff; }

.chip-icon {
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .72);
  transition: background .16s ease, color .16s ease;
}

.chip-icon svg { width: .95rem; height: .95rem; }

.genre-panel .chip.active .chip-icon { background: var(--accent); color: #fff; }

.chip-label { flex: 1; }

.chip-count {
  font-size: .72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, .38);
}

.genre-panel .chip.active .chip-count { color: rgba(255, 255, 255, .72); }

/* Each row drops in a beat after the one above it. */
.genre-menu.open .genre-panel .chip {
  animation: menuItem .34s cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 18ms);
}

@keyframes menuItem {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- skeletons ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #1c1c1c;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

.skel-card {
  aspect-ratio: 2 / 3;
  border-radius: 6px;
}

.movie-grid .skel-card { aspect-ratio: 2 / 3; }

/* ---------- messages ---------- */
.empty-msg {
  color: var(--muted);
  font-size: .95rem;
  padding: 1.4rem 0;
}

.inline-error {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  background: rgba(229, 9, 20, .1);
  border: 1px solid rgba(229, 9, 20, .3);
  border-radius: 6px;
  padding: .8rem 1rem;
  font-size: .88rem;
  margin-block: .6rem;
}

.error-section { text-align: center; padding-block: 3rem; }
.error-section p { color: var(--muted); margin-bottom: 1rem; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: clamp(0rem, 3vh, 2rem);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .78);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.details-box {
  position: relative;
  width: min(880px, 100%);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  border-radius: 8px;
  background: #181818;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .8);
  animation: pop .25s ease;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  inset-block-start: .8rem;
  inset-inline-end: .8rem;
  z-index: 3;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 20, 20, .85);
  color: #fff;
  font-size: .95rem;
  cursor: pointer;
}

.modal-close:hover { background: #000; }

.details-hero {
  position: relative;
  min-height: 340px;
  display: flex;
  align-items: flex-end;
  background: #101010;
}

.details-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #181818 4%, rgba(24, 24, 24, .75) 45%, rgba(24, 24, 24, .1) 100%);
}

.details-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 1.2rem;
  padding: 1.5rem;
  width: 100%;
}

.details-poster {
  flex: 0 0 auto;
  width: 118px;
  border-radius: 6px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .6);
  background: var(--surface-2);
}

.details-title-block { flex: 1; min-width: 0; }

.details-title-block h2 {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .6);
}

.details-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .8rem;
  color: rgba(255, 255, 255, .82);
  font-size: .88rem;
  margin-top: .5rem;
}

.details-genres {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .65rem;
}

.genre-tag {
  padding: .16rem .6rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, .12);
  font-size: .72rem;
  font-weight: 700;
}

.details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1rem;
}

.details-body { padding: 0 1.5rem 1.6rem; }

.details-desc {
  color: #dcdcdc;
  font-size: .95rem;
  line-height: 1.85;
  margin-bottom: .7rem;
}

.details-cast {
  color: var(--muted);
  font-size: .82rem;
  margin-bottom: 1.3rem;
}

/* ---------- player ---------- */
.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #050508;
  display: flex;
  flex-direction: column;
}

.player-overlay[hidden] { display: none; }

.player-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.player-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  flex-wrap: wrap;
}

.player-heading { flex: 1; min-width: 160px; }

.player-heading h3 { font-size: 1.05rem; font-weight: 800; }

.player-heading p { color: var(--muted); font-size: .78rem; }

.player-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.sub-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  padding: .45rem .6rem;
  font-size: .82rem;
  max-width: 190px;
  outline: none;
}

.player-stage {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  padding: 1rem;
  min-height: 0;
  overflow-y: auto;
}

.player-stage video {
  width: min(1100px, 100%);
  max-height: calc(100vh - 200px);
  background: #000;
  border-radius: 10px;
}

.player-stage video[hidden] { display: none; }

.player-frame {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #000;
  display: block;
}

.frame-wrap {
  position: relative;
  width: min(1100px, 100%);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 200px);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  container-type: inline-size;
}

.frame-wrap[hidden] { display: none; }

.player-frame[hidden] { display: none; }

/* First-click barrier: absorbs the tap that embedded players use to fire
   popunder ads, then steps aside so the player's own controls stay usable. */
.frame-shield {
  position: absolute;
  inset: 0;
  margin: 0;
  width: auto;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: radial-gradient(circle at 50% 45%, rgba(8, 10, 18, .35), rgba(4, 5, 10, .82));
  cursor: pointer;
  z-index: 2;
  transition: opacity .18s ease;
}

.frame-shield[hidden] { display: none; }

.frame-shield.passthrough {
  pointer-events: none;
  opacity: 0;
}

.frame-shield-btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font: inherit;
  font-weight: 600;
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.frame-shield-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Their control climbs in 120px buckets rather than continuously — 700, 820,
   940, 1060, 1180, 1300 — so the same buckets are reproduced here. The box and
   both insets are all derived from one number, exactly as theirs are. */
.ctrl-mask {
  --fs-size: 27.55px;
  position: absolute;
  bottom: calc(var(--fs-size) * .5769);
  right: calc(var(--fs-size) * .8654);
  z-index: 4;
  width: var(--fs-size);
  aspect-ratio: 1;
  height: auto;
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border: 0;
  opacity: .8;
  pointer-events: auto;
  transition: opacity .2s ease;
}

@container (min-width: 700px) { .ctrl-mask { --fs-size: 31.19px; } }
@container (min-width: 820px) { .ctrl-mask { --fs-size: 34.31px; } }
@container (min-width: 940px) { .ctrl-mask { --fs-size: 37.44px; } }
@container (min-width: 1060px) { .ctrl-mask { --fs-size: 41.59px; } }
@container (min-width: 1180px) { .ctrl-mask { --fs-size: 46.8px; } }
@container (min-width: 1300px) { .ctrl-mask { --fs-size: 52px; } }

/* Faded, not gone: the box keeps taking clicks, so the corner always zooms even
   when the glyph is resting. Waking is handled in app.js — pointer entering the
   picture, a key, a scroll, a click. */
.ctrl-mask.faded { opacity: 0; }

.stage-fs {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: rgba(255, 255, 255, .8);
  cursor: pointer;
}

.stage-fs svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  stroke: none;
}

.stage-fs:hover,
.stage-fs:focus-visible { color: #fff; }

.stage-fs.active { color: #fff; }

.stage-fs[hidden] { display: none; }

/* The stage is the screen in both fullscreen paths, so the control rides along
   at the same size. Opacity is deliberately not set here: the resting rule has
   to win in fullscreen too, or the glyph would hang there forever. */
.player-stage.theater .ctrl-mask,
.player-stage:fullscreen .ctrl-mask {
  pointer-events: auto;
}

/* Element fullscreen: the stage itself becomes the screen. */
.player-stage:fullscreen,
.player-stage.theater {
  position: fixed;
  inset: 0;
  z-index: 999;
  padding: 0;
  gap: 0;
  background: #000;
  overflow: hidden;
}

.player-stage:fullscreen .frame-wrap,
.player-stage.theater .frame-wrap {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}

.player-stage:fullscreen video,
.player-stage.theater video {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}

/* The icon keeps the mask's size in every state — no separate scale for
   fullscreen, or the glyph would jump when the stage takes the screen. */
.player-stage:fullscreen .player-note,
.player-stage.theater .player-note,
.player-stage:fullscreen .player-error,
.player-stage.theater .player-error {
  display: none;
}

.player-note {
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
  max-width: 70ch;
}

.player-note[hidden] { display: none; }

.player-error {
  background: var(--surface);
  border: 1px solid rgba(229, 9, 20, .35);
  border-radius: 12px;
  padding: 1rem;
  width: min(640px, 100%);
  font-size: .88rem;
}

.player-error[hidden] { display: none; }

.server-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: .7rem;
}

.server-row label { font-size: .8rem; color: var(--muted); }

.server-row input {
  flex: 1;
  min-width: 200px;
  background: #0f0f18;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  padding: .5rem .7rem;
  color: var(--text);
  font-size: .82rem;
  outline: none;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid rgba(255, 255, 255, .08);
  margin-top: 3rem;
  padding: 2.6rem 0;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.9;
}

.footer-logo {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: .5rem;
}

.footer-logo span { color: #fff; }

.copy { font-size: .78rem; opacity: .65; margin-top: .5rem; }

body.modal-open { overflow: hidden; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  inset-block-end: 1.5rem;
  inset-inline-start: 50%;
  transform: translate(-50%, 20px);
  z-index: 500;
  padding: .7rem 1.2rem;
  border-radius: 4px;
  background: #fff;
  color: #000;
  font-size: .88rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .main-nav { display: none; }
}

@media (max-width: 860px) {
  .search-box input { width: 150px; }

  .hero { min-height: 70vh; }

  .row-scroll .movie-card { flex-basis: 136px; }

  .chip-count { display: none; }

  .genre-toggle-label { display: none; }

  .genre-toggle { padding-inline: .65rem; }

  .details-head { gap: .9rem; padding: 1.2rem; }

  .details-poster { width: 96px; }
}

@media (max-width: 560px) {
  :root { --header-h: 60px; }

  .header-inner { gap: .6rem; }

  .search-box { padding-inline: .55rem; }

  .search-box input { width: 110px; }

  .hero-logo { max-height: 96px; }

  .hero-actions .btn { padding: .7rem 1.2rem; font-size: .9rem; }

  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.1rem .7rem;
  }

  .details-head {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: .7rem;
  }

  .details-poster { width: 78px; }

  .details-body { padding: 0 1rem 1.2rem; }

  .player-top { padding: .7rem .8rem; }

  .player-stage { padding: .6rem; }

  .player-stage video { max-height: calc(100vh - 240px); }

  .player-controls { width: 100%; }

  .sub-select { flex: 1; max-width: none; }
}
