:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #09090b;
  color: #f4f4f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #09090b;
  --panel: #111115;
  --muted: #a1a1aa;
  --line: rgba(255,255,255,.09);
  --accent: #e50914;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
.loading-screen, .auth-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 28px; }
.loading-screen p { color: var(--muted); }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; background: var(--accent); color: white; font-size: 30px; font-weight: 900; box-shadow: 0 12px 40px rgba(229,9,20,.22); }
.auth-card { width: min(100%, 410px); padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, #17171d, #101014); box-shadow: 0 24px 80px rgba(0,0,0,.38); }
.auth-brand { display: flex; justify-content: center; margin-bottom: 25px; }
.auth-card h1 { margin: 0; text-align: center; font-size: 27px; letter-spacing: -.8px; }
.auth-card .subtitle { margin: 9px 0 28px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.field { display: grid; gap: 8px; margin: 17px 0; }
.field label { color: #d4d4d8; font-size: 13px; font-weight: 650; }
.field input { width: 100%; padding: 14px 15px; border: 1px solid #303039; border-radius: 11px; outline: none; background: #09090d; color: white; }
.field input:focus { border-color: #e50914; box-shadow: 0 0 0 3px rgba(229,9,20,.13); }
.primary-btn { width: 100%; border: 0; border-radius: 11px; padding: 14px 18px; background: var(--accent); color: white; font-weight: 750; transition: filter .2s, transform .2s; }
.primary-btn:hover { filter: brightness(1.12); }
.primary-btn:disabled { opacity: .65; cursor: wait; }
.form-message { min-height: 20px; margin: 13px 0 0; color: #fca5a5; font-size: 13px; text-align: center; }
.auth-foot { margin: 22px 0 0; color: #71717a; font-size: 11px; text-align: center; }
.app-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 30px; padding: 17px clamp(18px, 4vw, 60px); background: rgba(9,9,11,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.app-logo { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 850; white-space: nowrap; }
.app-logo .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 19px; }
.nav { display: flex; align-items: center; gap: 22px; flex: 1; }
.nav button, .logout-btn { padding: 7px 0; border: 0; background: none; color: #c4c4cc; font-size: 13px; }
.nav button.active, .nav button:hover { color: white; }
.logout-btn { margin-left: auto; }
.content { padding: 34px clamp(18px, 4vw, 60px) 70px; }
.welcome-panel { min-height: 330px; display: flex; align-items: end; padding: clamp(25px, 5vw, 58px); border: 1px solid var(--line); border-radius: 22px; background: radial-gradient(ellipse at 80% 20%, rgba(229,9,20,.22), transparent 38%), linear-gradient(120deg, #1c1c23, #101014 70%); }
.welcome-panel h1 { max-width: 650px; margin: 0; font-size: clamp(32px, 5vw, 56px); letter-spacing: -2px; }
.welcome-panel p { max-width: 520px; color: #b4b4bd; line-height: 1.6; }
.section-title { margin: 34px 0 12px; font-size: 19px; }
.empty-state { padding: 26px; border: 1px dashed #34343d; border-radius: 14px; color: var(--muted); text-align: center; }
@media (max-width: 650px) {
  .auth-card { padding: 27px 22px; }
  .app-header { flex-wrap: wrap; gap: 14px; }
  .nav { order: 3; width: 100%; overflow-x: auto; gap: 20px; }
  .content { padding-top: 22px; }
  .welcome-panel { min-height: 280px; }
}

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 17px; }
.media-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #141419; }
.media-card img, .media-placeholder { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: linear-gradient(145deg, #27272f, #101014); }
.media-placeholder { display: grid; place-items: center; color: #555560; font-size: 42px; font-weight: 900; }
.media-caption { display: grid; gap: 5px; padding: 11px; }
.media-caption strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.media-caption span { color: var(--muted); font-size: 11px; }
.search-field { max-width: 560px; margin: 20px 0; }
[hidden] { display: none !important; }
@media (max-width: 480px) { .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; } }

.media-caption { align-items: start; }
.play-btn { margin-top: 5px; padding: 7px 11px; border: 0; border-radius: 7px; background: #e50914; color: white; font-size: 11px; font-weight: 750; }
.player-layer { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.88); }
.player-box { width: min(100%, 1100px); }
.player-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; }
.player-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #202027; color: white; font-size: 17px; }
.player-box video { display: block; width: 100%; max-height: 78vh; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; }
.player-status { color: var(--muted); text-align: center; font-size: 13px; }

.series-box { width: min(100%, 760px); max-height: 90vh; overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #111115; }
.series-box .field { max-width: 260px; }
.series-box select { padding: 11px; border: 1px solid #303039; border-radius: 9px; background: #09090d; color: white; }
.episode-list { display: grid; gap: 9px; }
.episode-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #18181e; }
.episode-row div { display: grid; gap: 5px; }
.episode-row strong { font-size: 13px; }
.episode-row span { color: var(--muted); font-size: 11px; }

.category-filter { max-width: 320px; margin: 18px 0; }
.category-filter select { width: 100%; padding: 12px; border: 1px solid #303039; border-radius: 9px; background: #111115; color: white; }
