:root {
  color-scheme: dark;
  --bg: #09090c;
  --panel: #121216;
  --panel-strong: #19191f;
  --line: #2a2a31;
  --text: #f6f3ee;
  --muted: #a9a6ad;
  --soft: #d5d0ca;
  --red: #df193c;
  --red-hover: #f12a4b;
  --gold: #d9b46b;
  --danger: #ff6b78;
  --success: #7bd8aa;
  --radius: 14px;
  --content: 1240px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); }
body.menu-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { display: block; max-width: 100%; }

.skip-link { position: fixed; z-index: 1000; left: 16px; top: -80px; padding: 10px 14px; border-radius: 8px; background: var(--text); color: #09090c; text-decoration: none; }
.skip-link:focus { top: 16px; }

.site-header { position: sticky; z-index: 50; top: 0; border-bottom: 1px solid rgba(255,255,255,.07); background: rgba(9,9,12,.94); backdrop-filter: blur(18px); }
.header-inner { width: min(var(--content), calc(100% - 40px)); min-height: 72px; margin: 0 auto; display: flex; align-items: center; gap: 34px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; font-size: 19px; font-weight: 850; letter-spacing: -.02em; text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255,255,255,.12); }
.brand span { white-space: nowrap; }
.main-nav { display: flex; align-items: center; gap: 24px; }
.nav-link { position: relative; color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; transition: color .18s ease; }
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -26px; height: 2px; background: var(--red); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-actions .button { flex: none; }
.header-search { width: 220px; }
.button.mobile-menu-button { display: none; }

.button { min-height: 42px; border: 1px solid transparent; border-radius: 999px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--red); color: #fff; font-weight: 800; text-decoration: none; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.button:hover { background: var(--red-hover); }
.button:active { transform: translateY(1px); }
.button.secondary { background: rgba(12,12,15,.74); border-color: rgba(255,255,255,.22); }
.button.secondary:hover { background: rgba(33,33,39,.92); border-color: rgba(255,255,255,.36); }
.button.ghost { background: transparent; border-color: var(--line); color: var(--soft); }
.button.ghost:hover { background: var(--panel-strong); border-color: #44444d; }
.button.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.button.full { width: 100%; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.field { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; outline: none; background: var(--panel); color: var(--text); }
.field::placeholder { color: #77747d; }
.field:focus { border-color: #62626d; box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
select.field { cursor: pointer; }

.page { min-height: calc(100vh - 72px); }
.container { width: min(var(--content), calc(100% - 40px)); margin: 0 auto; }
.page-content { padding: 46px 0 80px; }
.page-heading { max-width: 760px; margin-bottom: 34px; }
.page-heading h1 { margin: 0 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 5vw, 64px); font-weight: 500; line-height: .98; letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; }

.hero { min-height: min(760px, calc(100vh - 72px)); position: relative; display: flex; align-items: flex-end; overflow: hidden; background: #17131a; }
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.hero-shade { position: absolute; inset: 0; background: rgba(4,4,7,.48); }
.hero-side-shade { position: absolute; inset: 0 42% 0 0; background: rgba(4,4,7,.42); }
.hero-bottom-shade { position: absolute; left: 0; right: 0; bottom: 0; height: 150px; background: rgba(9,9,12,.88); }
.hero-content { position: relative; z-index: 2; width: min(var(--content), calc(100% - 40px)); margin: 0 auto; padding: 100px 0 76px; }
.hero-copy { width: min(610px, 64vw); }
.hero h1 { max-width: 720px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(52px, 7.4vw, 104px); font-weight: 500; line-height: .88; letter-spacing: -.055em; text-wrap: balance; }
.hero-meta { margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px; color: var(--soft); font-size: 13px; font-weight: 700; }
.hero-meta span { border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 6px 10px; background: rgba(0,0,0,.26); }
.hero-description { max-width: 570px; margin: 20px 0 0; color: #ddd8d2; font-size: 16px; line-height: 1.65; text-shadow: 0 1px 12px #000; }
.hero-actions { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 10px; }

.content-stack { position: relative; z-index: 3; padding: 48px 0 80px; }
.shelf { margin-top: 44px; }
.shelf:first-child { margin-top: 0; }
.section-heading { margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(27px, 3vw, 39px); font-weight: 500; letter-spacing: -.035em; }
.section-heading p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.text-link { flex: none; color: var(--soft); font-size: 13px; font-weight: 800; text-decoration: none; }
.text-link:hover { color: #fff; }

.card-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px 14px; }
.card-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 18%); gap: 14px; overflow-x: auto; padding-bottom: 12px; scrollbar-color: #3b3b43 transparent; scroll-snap-type: x proximity; }
.series-card { min-width: 0; scroll-snap-align: start; }
.series-poster { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: var(--radius); background: var(--panel); border: 1px solid rgba(255,255,255,.07); }
.series-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .28s ease, opacity .28s ease; }
.series-card:hover .series-poster img { transform: scale(1.035); opacity: .82; }
.series-card-link { display: block; text-decoration: none; }
.series-badge { position: absolute; z-index: 2; top: 10px; left: 10px; border-radius: 999px; padding: 5px 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.series-progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.24); }
.series-progress span { display: block; height: 100%; background: var(--red); }
.series-info { padding: 11px 2px 0; }
.series-info h3 { margin: 0; overflow: hidden; color: var(--text); font-size: 15px; font-weight: 800; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.series-info p { margin: 6px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.browse-toolbar { margin-bottom: 28px; display: grid; grid-template-columns: minmax(220px, 1fr) 190px; gap: 12px; }
.genre-tabs { margin: 0 0 26px; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.genre-tab { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.genre-tab:hover, .genre-tab.active { border-color: #555560; background: var(--panel-strong); color: #fff; }
.result-count { margin: 0 0 18px; color: var(--muted); font-size: 13px; }

.detail-hero { position: relative; min-height: 650px; overflow: hidden; display: flex; align-items: flex-end; }
.detail-backdrop { position: absolute; inset: 0; }
.detail-backdrop img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; filter: saturate(.8); }
.detail-overlay { position: absolute; inset: 0; background: rgba(6,6,9,.72); }
.detail-content { position: relative; z-index: 2; width: min(var(--content), calc(100% - 40px)); margin: 0 auto; padding: 90px 0 58px; display: grid; grid-template-columns: 230px minmax(0, 690px); gap: 40px; align-items: end; }
.detail-poster { aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 24px 60px rgba(0,0,0,.42); }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-copy h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(45px, 6vw, 76px); font-weight: 500; line-height: .94; letter-spacing: -.05em; }
.detail-description { margin: 18px 0 0; color: var(--soft); line-height: 1.7; }
.detail-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 6px 10px; color: var(--soft); font-size: 12px; font-weight: 750; }

.episode-section { padding: 42px 0 80px; }
.episode-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.episode-button { min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--soft); font-weight: 750; cursor: pointer; }
.episode-button:hover { border-color: #555560; color: #fff; }
.episode-button.current { border-color: var(--red); background: #281218; color: #fff; }

.watch-layout { min-height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.watch-stage { min-width: 0; padding: 26px; display: grid; place-items: center; background: #050506; }
.video-shell { position: relative; width: min(100%, 430px); aspect-ratio: 9 / 16; overflow: hidden; background: #111; box-shadow: 0 22px 70px rgba(0,0,0,.62); }
.video-shell video { width: 100%; height: 100%; object-fit: cover; background: #111; }
.video-fallback { position: absolute; inset: 0; display: grid; align-content: end; padding: 28px; background: rgba(0,0,0,.22); pointer-events: none; }
.video-fallback h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 34px; font-weight: 500; line-height: 1; }
.video-fallback p { margin: 9px 0 0; color: var(--soft); font-size: 13px; }
.watch-panel { border-left: 1px solid var(--line); background: var(--panel); padding: 26px 22px; overflow-y: auto; }
.watch-panel h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-weight: 500; line-height: 1.02; }
.watch-subtitle { margin: 10px 0 22px; color: var(--muted); font-size: 13px; }
.watch-actions { display: flex; gap: 8px; margin-bottom: 26px; }
.watch-episodes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }

.auth-page { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 46px 20px 70px; background: #0d0d11; }
.auth-card { width: min(100%, 440px); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); padding: 34px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.auth-card h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 42px; font-weight: 500; letter-spacing: -.04em; }
.auth-intro { margin: 10px 0 26px; color: var(--muted); line-height: 1.6; }
.form-group { margin-top: 16px; }
.form-group label { display: block; margin-bottom: 7px; color: var(--soft); font-size: 13px; font-weight: 750; }
.form-message { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 13px; }
.form-message.success { color: var(--success); }
.auth-links { margin-top: 18px; display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 13px; }
.auth-links a:hover { color: #fff; }

.library-section { margin-top: 44px; }
.empty-state { min-height: 220px; border: 1px dashed #34343d; border-radius: 16px; display: grid; place-items: center; padding: 28px; text-align: center; background: #0e0e12; }
.empty-state h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 500; }
.empty-state p { max-width: 480px; margin: 10px auto 20px; color: var(--muted); line-height: 1.6; }

.account-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 24px; }
.panel h2 { margin: 0 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 500; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); }
.account-row:first-of-type { border-top: 0; }
.account-row strong, .account-row span { display: block; }
.account-row span { margin-top: 5px; color: var(--muted); font-size: 13px; }

.legal { max-width: 760px; }
.legal h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 6vw, 72px); font-weight: 500; line-height: .95; letter-spacing: -.04em; }
.legal h2 { margin-top: 34px; font-size: 21px; }
.legal p, .legal li { color: var(--soft); line-height: 1.75; }

.site-footer { border-top: 1px solid var(--line); background: #070709; }
.footer-inner { width: min(var(--content), calc(100% - 40px)); margin: 0 auto; padding: 38px 0; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 12px; }
.footer-links { display: flex; gap: 18px; }
.footer-links a:hover { color: #fff; }

.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: min(360px, calc(100% - 44px)); border: 1px solid #41414b; border-radius: 12px; padding: 13px 16px; background: #1b1b21; color: #fff; box-shadow: 0 18px 50px rgba(0,0,0,.38); opacity: 0; transform: translateY(18px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

@media (max-width: 1040px) {
  .header-inner { gap: 22px; }
  .header-search { width: 180px; }
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card-row { grid-auto-columns: minmax(170px, 24%); }
  .episode-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .watch-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 820px) {
  .header-inner { width: min(100% - 28px, var(--content)); min-height: 64px; }
  .main-nav { position: fixed; z-index: 49; inset: 64px 0 auto; display: none; flex-direction: column; align-items: stretch; gap: 0; padding: 14px; border-bottom: 1px solid var(--line); background: #0b0b0e; }
  .main-nav.open { display: flex; }
  .nav-link { padding: 14px 12px; border-radius: 10px; }
  .nav-link:hover, .nav-link.active { background: var(--panel); }
  .nav-link.active::after { display: none; }
  .button.mobile-menu-button { display: inline-flex; }
  .header-search { display: none; }
  .page { min-height: calc(100vh - 64px); }
  .hero { min-height: 700px; }
  .hero-copy { width: min(100%, 620px); }
  .hero-side-shade { right: 0; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-row { grid-auto-columns: minmax(152px, 34%); }
  .detail-content { grid-template-columns: 160px minmax(0, 1fr); gap: 26px; }
  .episode-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .watch-layout { display: block; }
  .watch-stage { min-height: calc(100vh - 64px); padding: 18px; }
  .video-shell { width: min(100%, 420px); }
  .watch-panel { border-left: 0; border-top: 1px solid var(--line); }
  .account-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .container, .hero-content, .detail-content, .footer-inner { width: min(100% - 28px, var(--content)); }
  .brand span { font-size: 17px; }
  .hero { min-height: 680px; align-items: flex-end; }
  .hero-media img { object-position: 61% center; }
  .hero-shade { background: rgba(4,4,7,.56); }
  .hero-content { padding: 80px 0 48px; }
  .hero-copy { width: 100%; }
  .hero h1 { font-size: clamp(49px, 16vw, 76px); }
  .hero-description { font-size: 14px; }
  .content-stack { padding-top: 34px; }
  .section-heading { align-items: center; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 10px; }
  .card-row { grid-auto-columns: 43%; gap: 10px; }
  .browse-toolbar { grid-template-columns: 1fr; }
  .detail-hero { min-height: auto; }
  .detail-content { display: block; padding-top: 56px; }
  .detail-poster { width: 132px; margin-bottom: 24px; }
  .detail-copy h1 { font-size: 48px; }
  .episode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .watch-stage { min-height: auto; padding: 0; }
  .video-shell { width: 100%; max-height: calc(100vh - 64px); }
  .watch-panel { padding: 24px 16px 42px; }
  .auth-card { padding: 26px 20px; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
