:root {
  --bg: #141414;
  --bg-card: #1a1a1a;
  --bg-input: #2a2a2a;
  --bg-elevated: #242424;
  --accent: #00a4dc;
  --accent-hover: #01bfff;
  --accent-alpha: rgba(0,164,220,0.15);
  --text: #fff;
  --text-secondary: rgba(255,255,255,0.7);
  --text-muted: rgba(255,255,255,0.45);
  --border: rgba(255,255,255,0.1);
  --border-hover: rgba(255,255,255,0.2);
  --radius: 4px;
  --radius-lg: 6px;
  --blur: blur(20px) saturate(180%);
}

/* ── MOBILE ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header-logo span { display: none; }
  .header-search input { max-width: 140px; }
  .content { padding: 80px 16px 48px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .card-title { font-size: 11px; }
  .card-info { padding: 6px 8px 10px; }
  .ctrl-btn svg { width: 26px; height: 26px; }
  .ctrl-btn.sm svg { width: 22px; height: 22px; }
  .ctrl-btn { padding: 10px; }
  .progress-wrap { height: 6px; margin-bottom: 28px; }
  .progress-wrap:hover { height: 6px; }
  .progress-thumb { width: 22px; height: 22px; opacity: 1; }
  .volume-slider { width: 80px; }
  .time-display { font-size: 11px; }
  .login-box { padding: 28px 20px; }
  .section-title { font-size: 15px; }
}

@media (max-width: 400px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
  .volume-wrap { display: none; }
}

/* ── TV ──────────────────────────────────────────────────────── */
@media (min-width: 1920px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  .card-title { font-size: 14px; }
  .section-title { font-size: 22px; }
  .ctrl-btn svg { width: 28px; height: 28px; }
  .ctrl-btn.sm svg { width: 24px; height: 24px; }
  .time-display { font-size: 16px; }
  .progress-wrap { height: 6px; }
  .progress-thumb { width: 20px; height: 20px; }
}

/* ── BASE ────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Rubik', sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── LOGIN ───────────────────────────────────────────────────── */
#login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 60% 30%, rgba(0,164,220,0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 80%, rgba(0,80,140,0.08) 0%, transparent 50%),
    var(--bg);
}
.login-box {
  background: rgba(20,20,20,0.92);
  backdrop-filter: var(--blur);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 52px 44px;
  width: 100%; max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}
.login-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 36px; justify-content: center;
}
.login-logo span { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; }
.login-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 7px;
}
.login-input-wrap { margin-bottom: 16px; }
input[type="text"], input[type="password"] {
  width: 100%; padding: 13px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Rubik', sans-serif; font-size: 14px; font-weight: 400;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 0 3px var(--accent-alpha);
}
.btn-primary {
  width: 100%; padding: 13px;
  background: var(--accent);
  border: none; border-radius: var(--radius);
  color: #fff;
  font-family: 'Rubik', sans-serif; font-size: 14px; font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer; transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  margin-bottom: 10px;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px rgba(0,164,220,0.35);
}
.btn-primary:active { transform: scale(0.98); }
.auth-msg {
  font-size: 12px; font-weight: 400; margin-top: 12px; text-align: center;
  min-height: 18px; color: #e05555;
}

/* ── HEADER ──────────────────────────────────────────────────── */
#app-page { display: none; }
header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100; height: 64px;
  display: flex; align-items: center;
  padding: 0 4%;
  gap: 24px;
  /* Netflix-style gradient header */
  background: linear-gradient(to bottom, rgba(20,20,20,0.98) 0%, rgba(20,20,20,0.0) 100%);
  transition: background 0.3s;
}
header.scrolled {
  background: rgba(20,20,20,0.98);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.header-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-logo span { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.header-nav { display: flex; gap: 2px; flex: 1; }
.header-search { flex: 1; display: flex; justify-content: center; }
.header-search input {
  width: 100%; max-width: 280px;
  padding: 7px 16px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  color: var(--text);
  font-family: 'Rubik', sans-serif; font-size: 13px; font-weight: 400;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.header-search input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 0 3px var(--accent-alpha);
}
.header-search input::placeholder { color: var(--text-muted); }
.nav-btn {
  padding: 6px 14px;
  background: none; border: none; border-radius: var(--radius);
  color: rgba(255,255,255,0.65);
  font-family: 'Rubik', sans-serif; font-size: 13px; font-weight: 500;
  letter-spacing: 0.1px;
  cursor: pointer; transition: color 0.15s;
}
.nav-btn:hover { color: rgba(255,255,255,0.95); }
.nav-btn.active { color: #fff; font-weight: 600; }
.header-actions { display: flex; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 34px; height: 34px;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover {
  border-color: rgba(255,255,255,0.3);
  color: #fff;
  background: rgba(255,255,255,0.08);
}
.icon-btn svg { width: 16px; height: 16px; }

/* ── CONTENT ─────────────────────────────────────────────────── */
.content {
  padding: 80px 4% 48px;
  max-width: 1800px;
  margin: 0 auto;
}
.section { margin-bottom: 48px; }
.section-title {
  font-size: 18px; font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
  color: #fff;
}

/* ── GRID ────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: transparent;
  border-radius: var(--radius-lg);
  overflow: visible;
  cursor: pointer;
  transition:
    transform 0.25s cubic-bezier(0.34,1.3,0.64,1),
    box-shadow 0.25s ease;
  position: relative;
}
.card:hover {
  transform: translateY(-4px) scale(1.03);
  z-index: 2;
}
.card-thumb {
  width: 100%; aspect-ratio: 2/3;
  background: #1c1c1c;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 28px;
  position: relative;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  transition: box-shadow 0.25s;
}
.card:hover .card-thumb {
  box-shadow: 0 16px 40px rgba(0,0,0,0.7);
}
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.4s;
  border-radius: var(--radius-lg);
}
.card-thumb img.loaded { opacity: 1; }
.card-overlay {
  position: absolute; inset: 0;
  border-radius: var(--radius-lg);
  opacity: 0; transition: opacity 0.2s;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
}
.card:hover .card-overlay { opacity: 1; }
.play-circle {
  width: 44px; height: 44px;
  background: rgba(0,0,0,0.7);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.play-circle:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}
.play-circle svg { width: 16px; height: 16px; fill: white; margin-left: 3px; }
.card-info { padding: 8px 2px 4px; }
.card-title {
  font-size: 12px; font-weight: 500;
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: rgba(255,255,255,0.9);
}
.card-meta {
  font-size: 11px; font-weight: 300;
  color: var(--text-muted); margin-top: 2px;
  letter-spacing: 0.1px;
}
.empty {
  color: var(--text-muted); font-size: 13px; font-weight: 300;
  padding: 64px 0; text-align: center; line-height: 2;
}
.loading-text { color: var(--text-muted); font-size: 13px; padding: 24px 0; }

/* ── CONTINUE WATCHING ───────────────────────────────────────── */
.continue-section { margin-bottom: 48px; }
.progress-bar-thumb {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,0.2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.progress-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 0 0 0 var(--radius-lg);
  box-shadow: 0 0 6px rgba(0,164,220,0.5);
}

/* ── SERIES MODAL ────────────────────────────────────────────── */
.season-header {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 14px 0 8px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.episode-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.15s;
}
.episode-row:hover { background: rgba(255,255,255,0.06); }
.episode-num {
  width: 32px; height: 32px; background: var(--bg-input);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-muted); flex-shrink: 0;
}
.episode-info { flex: 1; min-width: 0; }
.episode-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.episode-meta { font-size: 11px; font-weight: 300; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.1px; }
.play-episode-btn {
  width: 28px; height: 28px; background: var(--accent-alpha);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; opacity: 0; transition: opacity 0.15s;
}
.episode-row:hover .play-episode-btn { opacity: 1; }
.play-episode-btn svg { width: 10px; height: 10px; fill: var(--accent); margin-left: 1px; }

/* ── PLAYER ──────────────────────────────────────────────────── */
#player-modal {
  display: none; position: fixed; inset: 0;
  background: #000; z-index: 200; overflow: hidden;
}
#player-modal.open { display: block; }
#player-modal.hide-cursor { cursor: none; }
#video-el {
  width: 100%; height: 100%; object-fit: contain;
  position: absolute; inset: 0; z-index: 1;
}
#player-controls {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
  padding: 52px 32px 28px;
  transition: opacity 0.3s;
}
#player-controls.hidden { opacity: 0; pointer-events: none; }
#player-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  padding: 24px 32px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, transparent 100%);
  transition: opacity 0.3s;
}
#player-top.hidden { opacity: 0; pointer-events: none; }
.player-title-text { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; line-height: 1.3; }
.player-close-btn {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; transition: background 0.15s; line-height: 1;
}
.player-close-btn:hover { background: rgba(255,255,255,0.25); }

/* Progress bar */
.progress-wrap {
  position: relative; height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px; cursor: pointer;
  margin-bottom: 20px; transition: height 0.15s;
}
.progress-wrap:hover { height: 6px; }
.progress-buf {
  position: absolute; left: 0; top: 0; height: 100%;
  background: rgba(255,255,255,0.35); border-radius: 2px; pointer-events: none;
}
.progress-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--accent); border-radius: 2px; pointer-events: none;
  box-shadow: 0 0 8px rgba(0,164,220,0.5);
}
.progress-thumb {
  position: absolute; top: 50%; transform: translate(-50%,-50%);
  width: 14px; height: 14px; background: #fff; border-radius: 50%;
  pointer-events: none; opacity: 0; transition: opacity 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.progress-wrap:hover .progress-thumb { opacity: 1; }
.progress-tooltip {
  position: absolute; bottom: 20px;
  background: rgba(0,0,0,0.9); color: #fff;
  font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 4px;
  pointer-events: none; transform: translateX(-50%);
  white-space: nowrap; opacity: 0; transition: opacity 0.15s;
}
.progress-wrap:hover .progress-tooltip { opacity: 1; }

/* Controls row */
.controls-row { display: flex; align-items: center; gap: 6px; }
.ctrl-btn {
  background: none; border: none;
  color: rgba(255,255,255,0.9); cursor: pointer;
  padding: 6px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s; flex-shrink: 0;
}
.ctrl-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.ctrl-btn svg { width: 20px; height: 20px; }
.ctrl-btn.sm svg { width: 18px; height: 18px; }
.volume-wrap { display: flex; align-items: center; gap: 4px; }
.volume-slider {
  -webkit-appearance: none; appearance: none;
  width: 72px; height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px; outline: none; cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; background: #fff;
  border-radius: 50%; cursor: pointer;
}
.time-display {
  font-size: 12px; font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin-left: 4px; font-variant-numeric: tabular-nums; white-space: nowrap;
  letter-spacing: 0.3px;
}
.ctrl-spacer { flex: 1; }

/* Center flash */
#center-flash {
  position: absolute; top: 50%; left: 50%; z-index: 15;
  transform: translate(-50%,-50%) scale(0);
  width: 72px; height: 72px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  transition: transform 0.1s, opacity 0.3s; opacity: 0;
}
#center-flash.show { transform: translate(-50%,-50%) scale(1); opacity: 1; }
#center-flash svg { width: 32px; height: 32px; fill: white; }

/* ── SUBTITLE MENU ───────────────────────────────────────────── */
.subtitle-wrap { position: relative; }
.subtitle-menu {
  display: none; position: absolute; bottom: 44px; right: 0;
  background: rgba(16,16,16,0.97);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  min-width: 180px; max-height: 240px; overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
.subtitle-menu.open { display: block; }
.subtitle-option {
  padding: 9px 16px; font-size: 13px;
  color: rgba(255,255,255,0.7);
  cursor: pointer; transition: background 0.15s; white-space: nowrap;
}
.subtitle-option:hover { background: rgba(255,255,255,0.08); color: #fff; }
.subtitle-option.active { color: var(--accent); font-weight: 500; }
video::cue {
  background: rgba(0,0,0,0.8); color: #fff;
  font-family: 'Rubik', sans-serif; font-size: 1em;
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }
