/* MovieFlix: dark cinematic UI. Red is the only accent; hero art is blurred from each film's own thumbnail. */
:root {
  --bg: #09070a;
  --panel: #130d11;
  --panel2: #1b1217;
  --line: rgba(255, 255, 255, .08);
  --fg: #f5f2f3;
  --muted: #a79ea3;
  --red: #d6101d;
  --red2: #f02634;
  --gap: 14px;
  --side: 224px;
  --top: 72px;
  --display: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.fill { fill: currentColor; stroke: none; }

.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }

/* Sidebar */
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 16px 20px; background: linear-gradient(180deg, #0e090c, #09070a); border-right: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px; font: 700 24px/1 var(--sans); letter-spacing: -.02em; text-decoration: none; }
.logo svg { width: 32px; height: 32px; }
.logo b { color: var(--red2); font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 6px; margin-top: 34px; }
.nav a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { color: var(--fg); background: rgba(255, 255, 255, .05); }
.nav a[aria-current="page"] { color: #fff; background: linear-gradient(90deg, #8d0a14, #b30d19); box-shadow: 0 10px 26px -12px rgba(214, 16, 29, .8); }
.nav svg.i { width: 22px; height: 22px; }

.premium { margin-top: auto; padding: 18px 16px; border: 1px solid rgba(214, 16, 29, .35); border-radius: 14px; text-align: center; background: radial-gradient(120% 90% at 50% 0%, rgba(214, 16, 29, .18), rgba(214, 16, 29, .03)); }
.premium .crown { width: 28px; height: 28px; color: #f6b73c; fill: #f6b73c; stroke: none; }
.premium strong { display: block; margin-top: 6px; font-size: 16px; }
.premium p { margin: 4px 0 14px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.help { display: flex; align-items: center; gap: 10px; margin: 18px 6px 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: left; }
.help:hover { color: var(--fg); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 26px; border-radius: 999px; font-weight: 600; text-decoration: none; transition: transform .15s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn.red { background: var(--red); color: #fff; box-shadow: 0 10px 28px -10px rgba(214, 16, 29, .9); }
.btn.red:hover { background: var(--red2); }
.btn.ghost { border: 1.5px solid rgba(255, 255, 255, .55); background: rgba(0, 0, 0, .25); }
.btn.ghost:hover { border-color: #fff; background: rgba(255, 255, 255, .08); }
.btn.sm { min-height: 36px; padding: 0 18px; font-size: 13px; }
.btn[aria-pressed="true"] { border-color: var(--red2); }
.icon-btn { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; transition: background .15s; }
.icon-btn:hover { background: rgba(255, 255, 255, .09); }

/* Top bar */
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(16px, 2.4vw, 32px); transition: background .25s, border-color .25s; border-bottom: 1px solid transparent; }
.topbar.scrolled { background: rgba(9, 7, 10, .88); backdrop-filter: blur(14px); border-color: var(--line); }
.top-logo { display: none; }
.top-logo svg { width: 30px; height: 30px; display: block; }
.search { position: relative; flex: 0 1 420px; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: rgba(20, 14, 18, .82); backdrop-filter: blur(10px); color: var(--muted); }
.search:focus-within { border-color: rgba(255, 255, 255, .45); color: var(--fg); }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--fg); font: inherit; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { appearance: none; }
.search kbd { font: 500 12px var(--sans); padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.top-logo { flex: none; }
.dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--red2); border: 2px solid var(--bg); }
.dot[hidden] { display: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; font: 700 13px var(--sans); background: linear-gradient(135deg, #b30d19, #4a0a12); border: 2px solid rgba(255, 255, 255, .25); }
.bell-wrap { position: relative; }
.pop { position: absolute; right: -50px; top: 52px; width: min(340px, calc(100vw - 24px)); padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
.pop[hidden] { display: none; }
.pop h3 { margin: 6px 8px 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pop button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: 10px; text-align: left; }
.pop button:hover { background: rgba(255, 255, 255, .06); }
.pop .th { width: 64px; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; flex: none; position: relative; }
.pop .t { font-weight: 600; font-size: 14px; line-height: 1.3; }
.pop .y { font-size: 12px; color: var(--muted); }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 clamp(16px, 2.4vw, 32px) 12px; padding: 12px 16px; border: 1px solid rgba(246, 183, 60, .4); border-radius: 12px; background: rgba(246, 183, 60, .08); font-size: 14px; }
.banner[hidden] { display: none; }
.banner p { margin: 0; }

#view { outline: 0; padding-bottom: 40px; }
.pad { padding: 0 clamp(16px, 2.4vw, 32px); }

/* Poster */
.poster { position: absolute; inset: 0; overflow: hidden; background: #150e12; }
.ph { position: absolute; inset: 0; display: grid; place-items: center; background:
  radial-gradient(90% 90% at 25% 15%, hsl(var(--a) 70% 38%), transparent 70%),
  linear-gradient(145deg, hsl(var(--b) 60% 16%), #0b0709); color: rgba(255, 255, 255, .32); }
.ph svg.i { width: 34px; height: 34px; stroke-width: 1.4; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s; }
.poster.loaded img { opacity: 1; }
.poster.loaded .ph { visibility: hidden; }

/* Hero */
.hero { position: relative; margin-top: calc(-1 * var(--top)); height: clamp(460px, 64vh, 600px); overflow: hidden; isolation: isolate; background: #0e090c; }
.hero.sk { background: linear-gradient(100deg, #150e12 30%, #21161c 50%, #150e12 70%); background-size: 200% 100%; animation: sh 1.4s infinite; }
.slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .7s, visibility .7s; }
.slide.on { opacity: 1; visibility: visible; }
.slide-bg { position: absolute; inset: -50px; background: center / cover no-repeat, linear-gradient(135deg, #3a0a12, #0e090c); filter: blur(30px) saturate(1.5) brightness(.75); }
.slide::after { content: ""; position: absolute; inset: 0; z-index: 1; background:
  linear-gradient(90deg, var(--bg) 3%, rgba(9, 7, 10, .8) 36%, rgba(9, 7, 10, .1) 78%),
  linear-gradient(0deg, var(--bg) 1%, transparent 42%),
  linear-gradient(180deg, rgba(9, 7, 10, .75), transparent 26%); }
.slide-art { position: absolute; z-index: 1; right: max(70px, 8%); top: calc(var(--top) + 30px); bottom: 84px; aspect-ratio: 4 / 3; max-width: 46%; border-radius: 14px; overflow: hidden; box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .1); transform: rotate(2.2deg); }
.slide-copy { position: absolute; z-index: 2; left: clamp(24px, 3.4vw, 48px); bottom: 100px; max-width: min(560px, 88%); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 4px; background: var(--red); font-size: 13px; font-weight: 600; }
.slide h1 { margin: 12px 0 10px; font: 400 clamp(44px, 5.4vw, 84px) / .94 var(--display); letter-spacing: .01em; text-transform: uppercase; text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
.slide .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: #d8d0d4; margin-bottom: 10px; }
.slide .meta span + span::before { content: "\00b7"; margin-right: 14px; color: var(--muted); }
.slide p { margin: 0 0 22px; max-width: 52ch; font-size: 16px; color: #ece6e9; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.slide .cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-nav { position: absolute; z-index: 3; top: 50%; width: 44px; height: 44px; margin-top: -22px; display: grid; place-items: center; border-radius: 50%; background: rgba(10, 6, 9, .72); border: 1px solid var(--line); backdrop-filter: blur(8px); transition: background .15s; }
.hero-nav:hover { background: rgba(10, 6, 9, .95); }
.hero-nav.prev { left: 18px; }
.hero-nav.next { right: 18px; }
.dots { position: absolute; z-index: 3; left: clamp(24px, 3.4vw, 48px); bottom: 62px; display: flex; gap: 8px; }
.dots button { width: 9px; height: 9px; border-radius: 99px; background: rgba(255, 255, 255, .35); transition: width .25s, background .25s; }
.dots button[aria-current="true"] { width: 28px; background: var(--red2); }

/* Rows */
.row { padding-top: 26px; }
.row-head { display: flex; align-items: center; justify-content: space-between; margin: 0 clamp(16px, 2.4vw, 32px) 14px; }
.row-head h2, .page-head h1 { margin: 0; padding-left: 12px; border-left: 4px solid var(--red); font: 600 22px/1.1 var(--sans); letter-spacing: -.01em; }
.seeall { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.seeall:hover { color: var(--red2); }
.row-wrap { position: relative; --cols: 6; }
.row-track { display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: clamp(16px, 2.4vw, 32px); padding: 8px clamp(16px, 2.4vw, 32px) 14px; scrollbar-width: none; }
.row-track::-webkit-scrollbar { display: none; }
.row-track > * { flex: 0 0 calc((100% - 2 * clamp(16px, 2.4vw, 32px) - (var(--cols) - 1) * var(--gap)) / var(--cols)); scroll-snap-align: start; min-width: 0; }
.arr { position: absolute; top: 8px; bottom: 14px; z-index: 5; width: 48px; display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
.arr.l { left: 0; background: linear-gradient(90deg, rgba(9, 7, 10, .95), transparent); }
.arr.r { right: 0; background: linear-gradient(270deg, rgba(9, 7, 10, .95), transparent); }
.row-wrap:hover .arr { opacity: 1; }
@media (hover: none) { .arr { display: none; } }

/* Cards */
.card { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; cursor: pointer; background: #150e12; box-shadow: 0 0 0 1px var(--line); transition: transform .22s, box-shadow .22s; }
.card:hover, .card:focus-visible { transform: translateY(-5px) scale(1.025); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .9), 0 0 0 1.5px rgba(240, 38, 52, .7); z-index: 2; }
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(8, 5, 7, .92) 0%, rgba(8, 5, 7, .2) 48%, transparent 70%); pointer-events: none; }
.card-info { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 10px 12px; }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 12px; color: #c9c0c5; margin-top: 2px; }
.card .play { position: absolute; z-index: 1; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; display: grid; place-items: center; border-radius: 50%; background: rgba(214, 16, 29, .92); opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s; }
.card:hover .play, .card:focus-visible .play { opacity: 1; transform: none; }
.card .mini { position: absolute; z-index: 2; top: 8px; right: 8px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: rgba(8, 5, 7, .78); border: 1px solid rgba(255, 255, 255, .25); opacity: 0; transition: opacity .2s, background .2s; }
.card:hover .mini, .card:focus-within .mini, .card .mini[aria-pressed="true"] { opacity: 1; }
.card .mini:hover { background: var(--red); }
.card .mini svg.i { width: 16px; height: 16px; }
@media (hover: none) { .card .mini { opacity: 1; } }
.rank { position: absolute; z-index: 3; top: 0; left: 10px; padding: 7px 7px 10px; background: var(--red); font: 700 10px/1.05 var(--sans); text-align: center; letter-spacing: .04em; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%); }
.sk-card { aspect-ratio: 4 / 3; border-radius: 10px; background: linear-gradient(100deg, #150e12 30%, #21161c 50%, #150e12 70%); background-size: 200% 100%; animation: sh 1.4s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* Grid pages */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(var(--top) + 18px) clamp(16px, 2.4vw, 32px) 20px; }
.page-head small { color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px var(--gap); padding: 4px clamp(16px, 2.4vw, 32px) 10px; }
.more { display: flex; justify-content: center; padding: 28px 0 8px; }
.empty { margin: 8vh auto 0; max-width: 420px; padding: 0 20px; text-align: center; color: var(--muted); }
.empty svg.i { width: 44px; height: 44px; margin-bottom: 10px; stroke-width: 1.3; }
.empty h2 { margin: 0 0 6px; color: var(--fg); font-size: 20px; }
.empty .btn { margin-top: 18px; }

/* Settings */
.panel { max-width: 640px; margin: 0 clamp(16px, 2.4vw, 32px) 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.panel > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; }
.panel > div + div { border-top: 1px solid var(--line); }
.panel strong { display: block; }
.panel span.sub { font-size: 13px; color: var(--muted); }
.switch { position: relative; flex: none; width: 46px; height: 26px; border-radius: 99px; background: #3a2e34; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--red); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* Dialogs */
dialog { width: min(1000px, calc(100vw - 24px)); max-height: calc(100vh - 24px); margin: auto; padding: 0; border: 0; border-radius: 16px; overflow: auto; background: var(--panel); color: var(--fg); box-shadow: 0 40px 120px rgba(0, 0, 0, .8); }
dialog#info { width: min(560px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(4, 2, 4, .82); backdrop-filter: blur(6px); }
.close { position: absolute; z-index: 5; top: 12px; right: 12px; background: rgba(8, 5, 7, .75); border: 1px solid var(--line); }
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage .note { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; padding: 24px; text-align: center; color: var(--muted); background: radial-gradient(80% 80% at 50% 0%, #2a0c12, #0b0709); }
.stage .note strong { color: var(--fg); font-size: 20px; }
.pinfo { padding: 22px clamp(18px, 3vw, 32px) 28px; }
dialog#info .pinfo { padding-top: 34px; }
.pinfo h2 { margin: 0 0 4px; font: 400 clamp(32px, 4.5vw, 46px) / 1 var(--display); letter-spacing: .01em; text-transform: uppercase; }
.pinfo .meta { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.pinfo p { margin: 0 0 14px; color: #ddd5d9; max-width: 70ch; }
.pinfo .actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chips span { padding: 4px 12px; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; color: var(--muted); }
.pinfo h3 { margin: 22px 0 8px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 11px 20px; border-radius: 99px; background: #fff; color: #111; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.foot { padding: 28px clamp(16px, 2.4vw, 32px) 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot p { margin: 0; max-width: 80ch; }

/* Responsive */
@media (max-width: 1280px) { .row-wrap { --cols: 5; } .slide-art { max-width: 40%; } }
@media (max-width: 1040px) { .row-wrap { --cols: 4; } .slide-art { display: none; } }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: 0; padding: 0; border: 0; background: none; }
  .side .logo, .premium, .help { display: none; }
  .nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; flex-direction: row; justify-content: space-around; gap: 0; margin: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); background: rgba(12, 8, 11, .96); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .nav a { flex: 1; min-width: 0; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 10px; justify-content: center; border-radius: 8px; }
  .nav svg.i { width: 20px; height: 20px; }
  .top-logo { display: block; }
  #view { padding-bottom: 84px; }
  .toast { bottom: 90px; }
  .foot { padding-bottom: 96px; }
  .search kbd { display: none; }
}
@media (max-width: 700px) {
  :root { --gap: 10px; }
  .row-wrap { --cols: 2.4; }
  .hero { height: 520px; }
  .slide-copy { bottom: 92px; }
  .slide p { font-size: 14px; }
  .hero-nav { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .banner { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}