/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f13;
  --bg-2: #16161d;
  --bg-3: #1e1e28;
  --accent: #7c3aed;
  --accent-light: #9d5ff5;
  --accent-dim: rgba(124, 58, 237, 0.2);
  --text: #f0f0f5;
  --text-muted: #8888aa;
  --border: rgba(255,255,255,0.08);
  --card-radius: 10px;
  --nav-h: 64px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; }
input, select { font-family: inherit; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.1); color: var(--text); }
.btn-secondary:hover { background: rgba(255,255,255,0.18); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #ef4444; }
.btn-full { width: 100%; justify-content: center; }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 10px; }

/* ── Navigation ───────────────────────────────────────────────────────────── */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 32px; padding: 0 32px;
  background: linear-gradient(to bottom, rgba(10,10,14,0.95), rgba(10,10,14,0.6));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
#nav.solid { background: rgba(10,10,14,0.98); }

.nav-logo {
  font-size: 20px; font-weight: 800; letter-spacing: 2px;
  color: var(--accent-light);
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.logo-icon { width: 32px; height: 32px; color: var(--accent-light); flex-shrink: 0; }
.logo-icon svg { width: 100%; height: 100%; filter: drop-shadow(0 0 5px var(--accent)); animation: logo-glow 3s ease-in-out infinite; }
.logo-ring { animation: logo-ring-spin 12s linear infinite; transform-origin: 20px 20px; }
.logo-play { animation: logo-play-pulse 3s ease-in-out infinite; }
.logo-text { letter-spacing: 3px; }
@keyframes logo-glow {
  0%,100% { filter: drop-shadow(0 0 4px var(--accent)); }
  50%      { filter: drop-shadow(0 0 12px var(--accent)) drop-shadow(0 0 24px var(--accent)); }
}
@keyframes logo-ring-spin { to { transform: rotate(360deg); } }
@keyframes logo-play-pulse {
  0%,100% { opacity:1; }
  50%      { opacity:.65; }
}

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 6px 14px; border-radius: 6px; font-size: 14px; font-weight: 500;
  color: var(--text-muted); transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-3); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.nav-search-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); color: var(--text-muted); font-size: 14px;
  transition: all 0.15s;
}
.nav-search-btn:hover { color: var(--text); background: var(--bg-2); }

.nav-user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 8px;
  background: var(--bg-3); font-size: 14px; font-weight: 500;
  transition: background 0.15s;
}
.nav-user-btn:hover { background: var(--accent-dim); }

.nav-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}

/* Dropdown */
.nav-dropdown-wrap { position: relative; }
.nav-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  min-width: 180px; padding: 6px; z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all 0.15s;
}
.nav-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 6px; font-size: 13px;
  color: var(--text-muted); transition: all 0.1s;
}
.nav-dropdown a:hover { color: var(--text); background: var(--bg-3); }
.nav-dropdown a i { width: 16px; text-align: center; }
.nav-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.sign-in-btn { background: var(--accent); color: #fff; padding: 8px 18px; border-radius: 8px; font-weight: 600; font-size: 14px; transition: background 0.15s; }
.sign-in-btn:hover { background: var(--accent-light); }

/* ── Views ────────────────────────────────────────────────────────────────── */
.view { padding-top: var(--nav-h); min-height: 100vh; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  position: relative; height: 90vh; max-height: 720px;
  display: flex; align-items: flex-end;
  overflow: hidden; margin-top: calc(-1 * var(--nav-h));
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center top;
}
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(10,10,14,0.95) 0%, rgba(10,10,14,0.6) 50%, transparent 100%),
              linear-gradient(to top, rgba(10,10,14,1) 0%, transparent 40%);
}
.hero-content {
  position: relative; z-index: 2; padding: 0 48px 56px;
  max-width: 640px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: var(--accent-dim); border: 1px solid var(--accent);
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent-light); margin-bottom: 12px;
}
.hero-title {
  font-size: clamp(28px, 4vw, 52px); font-weight: 800; line-height: 1.1;
  margin-bottom: 16px; text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.hero-meta { display: flex; gap: 12px; margin-bottom: 14px; font-size: 14px; color: var(--text-muted); }
.hero-meta .rating { color: #fbbf24; font-weight: 700; }
.hero-overview {
  font-size: 15px; color: rgba(240,240,245,0.8); line-height: 1.6;
  margin-bottom: 24px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; gap: 12px; }

/* ── Content Rows ─────────────────────────────────────────────────────────── */
.rows-container { padding: 0 32px 48px; }
.row { margin-bottom: 36px; }
.row-title {
  font-size: 18px; font-weight: 700; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.row-title i { color: var(--accent-light); font-size: 14px; }

.row-scroll {
  display: flex; gap: 12px; overflow-x: auto;
  padding-bottom: 12px; scroll-snap-type: x mandatory;
  -ms-overflow-style: none; scrollbar-width: none;
}
.row-scroll::-webkit-scrollbar { display: none; }

/* ── Content Card ─────────────────────────────────────────────────────────── */
.card {
  flex-shrink: 0; width: 160px; border-radius: var(--card-radius);
  overflow: hidden; cursor: pointer; position: relative;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), box-shadow 0.25s;
  scroll-snap-align: start; background: var(--bg-3);
  outline: none;
}
.card:hover, .card:focus {
  transform: translateY(-8px) scale(1.04);
  box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 2px var(--accent);
  z-index: 10;
}
.card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.card-placeholder { width: 100%; aspect-ratio: 2/3; background: var(--bg-2); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 32px; }

/* Play overlay — appears on hover/focus */
.card-overlay {
  position: absolute; inset: 0 0 auto 0; aspect-ratio: 2/3;
  background: rgba(0,0,0,0); display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  pointer-events: none;
}
.card-overlay i { font-size: 36px; color: #fff; opacity: 0; transform: scale(0.7); transition: opacity 0.2s, transform 0.2s; }
.card:hover .card-overlay, .card:focus .card-overlay { background: rgba(0,0,0,0.35); }
.card:hover .card-overlay i, .card:focus .card-overlay i { opacity: 1; transform: scale(1); }

/* Rating badge */
.card-rating {
  position: absolute; top: 7px; left: 7px;
  background: rgba(0,0,0,0.75); color: #fbbf24;
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  backdrop-filter: blur(4px);
}

.card-info {
  padding: 10px 10px 12px;
  background: linear-gradient(to bottom, var(--bg-3), var(--bg-2));
}
.card-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.card-sub { font-size: 11px; color: var(--text-muted); }
.card-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}
.progress-bar { height: 3px; background: var(--bg); border-radius: 0; }
.progress-fill { height: 100%; background: var(--accent); }

/* ── Content Grid ─────────────────────────────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px; padding: 0 32px;
}
.content-grid .card { width: auto; }

/* ── Browse ───────────────────────────────────────────────────────────────── */
.browse-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 32px 32px 24px; flex-wrap: wrap; gap: 14px;
  background: linear-gradient(to bottom, var(--bg-2), transparent);
}
.browse-header h1 { font-size: 32px; font-weight: 900; letter-spacing: -0.5px; }
.browse-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.browse-filters select {
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); padding: 9px 14px; border-radius: 24px;
  font-size: 13px; font-weight: 600; cursor: pointer; outline: none;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px; transition: border-color 0.15s, background-color 0.15s;
}
.browse-filters select:focus, .browse-filters select:hover { border-color: var(--accent); background-color: var(--bg-2); }

.pagination { display: flex; gap: 8px; justify-content: center; padding: 32px; }
.pagination button {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  transition: all 0.15s;
}
.pagination button:hover, .pagination button.active { background: var(--accent); border-color: var(--accent); }

/* ── Search ───────────────────────────────────────────────────────────────── */
.search-bar-wrap {
  display: flex; align-items: center; gap: 14px;
  padding: 32px 32px 24px;
}
.search-bar-wrap i { color: var(--text-muted); font-size: 18px; }
#search-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 26px; font-weight: 600; color: var(--text);
}
#search-input::placeholder { color: var(--text-muted); }

/* ── Detail Modal ─────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(4px); }
.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: background 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.2); }

.modal-content {
  position: relative; z-index: 1;
  width: min(860px, 96vw); max-height: 92vh; overflow-y: auto;
  background: var(--bg-2); border-radius: 16px;
  border: 1px solid var(--border); box-shadow: 0 32px 80px rgba(0,0,0,0.7);
  scrollbar-width: thin; scrollbar-color: var(--bg-3) transparent;
}

.modal-hero {
  position: relative; aspect-ratio: 16/9; overflow: hidden;
  border-radius: 16px 16px 0 0;
}
.modal-hero img { width: 100%; height: 100%; object-fit: cover; }
.modal-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-2) 0%, transparent 60%);
}
.modal-hero-actions {
  position: absolute; bottom: 20px; left: 24px; right: 24px; z-index: 2;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.modal-body { padding: 0 24px 24px; }
.modal-title { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.modal-meta {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  font-size: 13px; color: var(--text-muted); margin-bottom: 14px;
}
.modal-meta .star { color: #fbbf24; }
.modal-meta .cert {
  padding: 1px 6px; border: 1px solid var(--text-muted); border-radius: 3px;
  font-size: 11px; font-weight: 700;
}
.modal-genres { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.genre-tag {
  padding: 4px 10px; border-radius: 20px;
  background: var(--accent-dim); border: 1px solid var(--accent);
  font-size: 12px; color: var(--accent-light); font-weight: 500;
}
.modal-overview { font-size: 14px; line-height: 1.7; color: rgba(240,240,245,0.85); margin-bottom: 20px; }

.modal-section-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 12px; margin-top: 20px; }

.cast-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.cast-row::-webkit-scrollbar { display: none; }
.cast-card { flex-shrink: 0; text-align: center; width: 72px; }
.cast-img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; margin: 0 auto 6px; background: var(--bg-3); }
.cast-name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cast-role { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.seasons-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.season-btn {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 600;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text-muted);
  transition: all 0.15s;
}
.season-btn:hover, .season-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.episodes-list { display: flex; flex-direction: column; gap: 6px; }
.ep-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; background: var(--bg-3);
  cursor: pointer; transition: background 0.15s;
}
.ep-row:hover { background: rgba(124,58,237,0.15); }
.ep-num { font-size: 13px; color: var(--text-muted); font-weight: 700; min-width: 28px; }
.ep-thumb { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; background: var(--bg-2); }
.ep-info { flex: 1; min-width: 0; }
.ep-name { font-size: 13px; font-weight: 600; }
.ep-air { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ep-play { color: var(--accent-light); font-size: 18px; }

.similar-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.similar-row::-webkit-scrollbar { display: none; }

/* ── Auth Modal ───────────────────────────────────────────────────────────── */
.auth-box {
  position: relative; z-index: 1;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; width: min(420px, 95vw);
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 24px; background: var(--bg-3); border-radius: 8px; padding: 4px; }
.auth-tab {
  flex: 1; padding: 8px; border-radius: 6px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); transition: all 0.15s;
}
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-form h2 { font-size: 22px; font-weight: 800; margin-bottom: 20px; }
.auth-form input {
  display: block; width: 100%;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; color: var(--text);
  font-size: 14px; margin-bottom: 12px; outline: none;
  transition: border-color 0.15s;
}
.auth-form input:focus { border-color: var(--accent); }
.form-error { color: #f87171; font-size: 13px; margin-top: 8px; min-height: 18px; }
.forgot-link {
  display: block; width: 100%; margin-top: 10px; padding: 6px;
  font-size: 13px; color: var(--text-muted); text-align: center;
  background: none; border: none; cursor: pointer; transition: color 0.15s;
}
.forgot-link:hover { color: var(--accent-light); }

/* ── Profile ──────────────────────────────────────────────────────────────── */
.profile-header {
  display: flex; align-items: center; gap: 24px;
  padding: 36px 32px 24px;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; color: #fff;
  flex-shrink: 0; border: 3px solid rgba(255,255,255,0.1);
}
.profile-info h1 { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.profile-info p { color: var(--text-muted); font-size: 14px; margin-bottom: 2px; }

.profile-tabs {
  display: flex; gap: 4px; padding: 0 32px 24px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); transition: all 0.15s;
}
.tab-btn:hover { background: var(--bg-3); color: var(--text); }
.tab-btn.active { background: var(--accent-dim); color: var(--accent-light); border-bottom: 2px solid var(--accent); }

#profile-content { padding: 24px 32px; }

.history-card {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; border-radius: 10px; background: var(--bg-3);
  margin-bottom: 8px; cursor: pointer; transition: background 0.15s;
}
.history-card:hover { background: var(--accent-dim); }
.history-thumb { width: 56px; height: 84px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg-2); }
.history-info { flex: 1; min-width: 0; }
.history-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.history-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.history-progress { height: 3px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.history-progress-fill { height: 100%; background: var(--accent); }

/* ── Plugin Manager ───────────────────────────────────────────────────────── */
.plugin-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: 10px; background: var(--bg-3);
  margin-bottom: 8px;
}
.plugin-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; color: var(--accent-light); font-size: 18px; }
.plugin-info { flex: 1; }
.plugin-name { font-size: 14px; font-weight: 700; }
.plugin-url { font-size: 11px; color: var(--text-muted); word-break: break-all; }

.add-plugin-form { display: flex; gap: 10px; margin-bottom: 20px; }
.add-plugin-form input {
  flex: 1; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; color: var(--text); font-size: 13px; outline: none;
}
.add-plugin-form input:focus { border-color: var(--accent); }

/* ── Settings ─────────────────────────────────────────────────────────────── */
.settings-wrap { max-width: 640px; margin: 0 auto; padding: 32px; }
.settings-wrap h1 { font-size: 28px; font-weight: 800; margin-bottom: 24px; }
.settings-card {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 16px;
}
.settings-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; display:flex; align-items:center; gap:8px; }
.rd-user-info { display: flex; align-items: center; gap: 12px; }
.rd-status-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.rd-status-dot.off { background: #ef4444; box-shadow: 0 0 8px #ef4444; }

/* Debrid key rows */
.debrid-row { display: flex; align-items: flex-start; gap: 14px; }
.debrid-logo { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; flex-shrink: 0; margin-top: 2px; }
.debrid-logo.rd { background: linear-gradient(135deg,#10b981,#059669); color: #fff; }
.debrid-logo.tb { background: linear-gradient(135deg,#6366f1,#4f46e5); color: #fff; }
.key-input { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 13px; outline: none; transition: border-color .15s; }
.key-input:focus { border-color: var(--accent); }
.btn-sm { padding: 8px 14px; font-size: 12px; border-radius: 7px; }

/* Addon manager */
.addon-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.addon-row:last-child { border-bottom: none; }
.addon-type-badge { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-left: 5px; vertical-align: middle; }
.addon-type-badge.stream { background: rgba(124,58,237,.25); color: #9d5ff5; }
.addon-type-badge.subtitle { background: rgba(16,185,129,.2); color: #10b981; }
.addon-type-badge.catalog { background: rgba(234,179,8,.2); color: #eab308; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 20px; transition: background .2s; cursor: pointer; }
.toggle-slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Subtitle + Language buttons & shared dropdown menu */
#subtitle-btn, #lang-btn { background: rgba(255,255,255,.1); border-radius: 8px; padding: 6px 12px; font-size: 14px; transition: background .15s; }
#subtitle-btn:hover, #lang-btn:hover { background: rgba(255,255,255,.22); }
.sub-badge { position: absolute; top: -5px; right: -5px; background: var(--accent); color: #fff; font-size: 9px; font-weight: 800; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.sub-badge.sub-active { background: #10b981; }
.sub-menu {
  position: absolute; bottom: calc(100% + 10px); right: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; min-width: 180px; max-height: 320px;
  overflow-y: auto; z-index: 50; box-shadow: 0 8px 32px rgba(0,0,0,.7);
}
.sub-menu-title {
  font-size: 10px; font-weight: 800; color: var(--text-muted); letter-spacing: 1.5px;
  text-transform: uppercase; padding: 6px 10px 8px;
}
.sub-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 7px; font-size: 13px; cursor: pointer; transition: background 0.12s;
  color: var(--text);
}
.sub-menu-item:hover { background: rgba(255,255,255,0.1); }
.sub-menu-item.active { color: var(--accent-light); font-weight: 700; }
.sub-menu-item .fa-check { color: var(--accent-light); font-size: 11px; }

/* ── Color swatches ──────────────────────────────────────────────────────── */
.color-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.color-swatch {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent;
  transition: transform .15s, border-color .15s; cursor: pointer;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; transform: scale(1.15); box-shadow: 0 0 0 2px var(--accent); }

/* ── Invite codes ─────────────────────────────────────────────────────────── */
.invite-field { display: flex; align-items: center; gap: 8px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; }
.invite-field input { flex: 1; background: none; border: none; padding: 12px 0; color: var(--text); font-size: 13px; outline: none; }
.invite-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.invite-code-chip { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 13px; letter-spacing: 2px; font-weight: 700; color: var(--accent-light); }
.invite-code-chip.used { color: var(--text-muted); text-decoration: line-through; }
.btn-copy { background: var(--bg-3); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; font-size: 12px; color: var(--text-muted); transition: color .15s; cursor: pointer; }
.btn-copy:hover { color: var(--text); }

/* ── Admin panel ──────────────────────────────────────────────────────────── */
.admin-tab { flex: 1; padding: 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); background: none; border: none; cursor: pointer; transition: color .15s, border-bottom .15s; border-bottom: 2px solid transparent; }
.admin-tab.active { color: var(--accent-light); border-bottom-color: var(--accent); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 10px 10px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,.02); }

/* ── Player ───────────────────────────────────────────────────────────────── */
#player-wrap {
  position: fixed; inset: 0; z-index: 500;
  background: #000; display: flex; flex-direction: column;
}
#player-wrap.hidden { display: none; }

.player-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: rgba(0,0,0,0.8);
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
}
.player-topbar button {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 8px;
  background: rgba(255,255,255,0.1); color: #fff; font-size: 13px; font-weight: 600;
  transition: background 0.15s;
}
.player-topbar button:hover { background: rgba(255,255,255,0.2); }
.player-topbar span { font-size: 15px; font-weight: 700; }

#main-video {
  flex: 1; width: 100%; height: 100%;
  background: #000;
  outline: none;
}

/* Loading state */
.player-loading {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000; gap: 16px;
}
.player-loading p { color: var(--text-muted); font-size: 15px; }

.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Quality badge — bottom-left of player */
#quality-badge {
  position: absolute; bottom: 72px; left: 24px; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
  padding: 7px 12px; pointer-events: all;
}
.qb-pill {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  padding: 2px 8px; border-radius: 4px; letter-spacing: 0.5px;
}
.qb-source { font-size: 12px; color: var(--text-muted); }
.qb-size   { font-size: 12px; color: var(--text-muted); }
.qb-change {
  font-size: 11px; font-weight: 600; color: var(--text); background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 5px;
  padding: 3px 9px; cursor: pointer; margin-left: 4px; transition: background 0.15s;
}
.qb-change:hover { background: var(--accent); border-color: var(--accent); }

/* Compact quality-change menu */
#quality-menu {
  position: absolute; bottom: 116px; left: 24px; z-index: 30;
  background: rgba(15,15,20,0.97); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 8px; min-width: 260px; max-height: 360px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
}
.qm-title { font-size: 11px; font-weight: 700; color: var(--text-muted); padding: 4px 8px 6px; letter-spacing: 1px; text-transform: uppercase; }
.qm-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 7px; background: transparent; border: none; color: var(--text);
  cursor: pointer; text-align: left; transition: background 0.12s; width: 100%;
}
.qm-item:hover, .qm-item.active { background: var(--accent); }
.qm-q    { font-size: 13px; font-weight: 800; min-width: 44px; }
.qm-s    { font-size: 12px; color: rgba(255,255,255,0.7); flex: 1; }
.qm-size { font-size: 11px; color: rgba(255,255,255,0.45); }

/* ── "Up Next" mini-banner (30s before end) ──────────────────────────────── */
.up-next-preview {
  position: absolute; bottom: 80px; right: 24px; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  background: rgba(15,15,20,0.92); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 12px;
  padding: 10px 14px 10px 10px; max-width: 320px;
  animation: slideInRight 0.3s ease-out;
}
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.unp-label { font-size: 9px; font-weight: 800; letter-spacing: 1.5px; color: var(--accent-light); writing-mode: vertical-rl; transform: rotate(180deg); }
.unp-thumb { width: 80px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.unp-info { flex: 1; min-width: 0; }
.unp-ep { font-size: 10px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; }
.unp-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.up-next-preview .unp-play { width: 36px; height: 36px; border-radius: 50%; padding: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.unp-dismiss { background: none; color: rgba(255,255,255,0.5); font-size: 12px; padding: 4px; transition: color 0.15s; }
.unp-dismiss:hover { color: #fff; }

/* ── Netflix-style Next Episode overlay ──────────────────────────────────── */
.postplay-ep {
  position: absolute; inset: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(2px);
  animation: fadeIn 0.4s ease;
}
.ppe-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0.15; filter: blur(20px); transform: scale(1.05);
}
.ppe-content {
  position: relative; z-index: 1; max-width: 700px; width: 90%;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  text-align: center;
}
.ppe-label {
  font-size: 11px; font-weight: 800; letter-spacing: 3px;
  color: var(--accent-light); text-transform: uppercase;
}
.ppe-card {
  display: flex; gap: 20px; text-align: left; align-items: flex-start;
  background: rgba(255,255,255,0.05); border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1); width: 100%;
}
.ppe-thumb { width: 240px; aspect-ratio: 16/9; object-fit: cover; flex-shrink: 0; }
.ppe-meta { padding: 20px 20px 20px 0; flex: 1; }
.ppe-num { font-size: 12px; font-weight: 700; color: var(--accent-light); letter-spacing: 0.5px; margin-bottom: 6px; }
.ppe-name { font-size: 20px; font-weight: 800; margin-bottom: 10px; line-height: 1.2; }
.ppe-overview { font-size: 13px; color: var(--text-muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ppe-actions { display: flex; gap: 14px; align-items: center; }
.ppe-play-btn {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 14px 28px; border-radius: 50px; font-size: 16px; font-weight: 700;
  position: relative; transition: transform 0.15s, box-shadow 0.15s;
}
.ppe-play-btn:hover { transform: scale(1.04); box-shadow: 0 0 24px var(--accent); }
.ppe-ring {
  width: 44px; height: 44px; position: relative; flex-shrink: 0;
}
.ppe-cancel-btn { opacity: 0.7; }
.ppe-cancel-btn:hover { opacity: 1; }
.btn-ghost { background: rgba(255,255,255,0.12); }

/* ── Netflix-style Recommendations overlay ───────────────────────────────── */
.postplay-recs {
  position: absolute; inset: 0; z-index: 35;
  background: rgba(5,5,10,0.97);
  display: flex; flex-direction: column;
  animation: fadeIn 0.4s ease;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ppr-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 36px 48px 20px; flex-shrink: 0;
}
.ppr-header h2 { font-size: 26px; font-weight: 900; letter-spacing: -0.5px; }
.ppr-header-right { display: flex; align-items: center; gap: 20px; }
.ppr-countdown { font-size: 12px; color: var(--text-muted); }
.ppr-close {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  color: #fff; padding: 8px 18px; border-radius: 24px; font-size: 13px; font-weight: 600;
  transition: background 0.15s;
}
.ppr-close:hover { background: rgba(255,255,255,0.2); }
.ppr-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; padding: 8px 48px 48px; flex: 1;
}
.ppr-card {
  cursor: pointer; border-radius: 10px; overflow: hidden;
  background: var(--bg-2); transition: transform 0.2s, box-shadow 0.2s;
  outline: none;
}
.ppr-card:hover, .ppr-card:focus { transform: translateY(-6px) scale(1.02); box-shadow: 0 16px 48px rgba(0,0,0,0.7), 0 0 0 2px var(--accent); }
.ppr-card--featured { grid-column: span 2; }
.ppr-card-img-wrap { position: relative; aspect-ratio: 2/3; overflow: hidden; }
.ppr-card--featured .ppr-card-img-wrap { aspect-ratio: 3/2; }
.ppr-card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s; }
.ppr-card:hover .ppr-card-img-wrap img { transform: scale(1.04); }
.ppr-play-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0); display: flex;
  align-items: center; justify-content: center; transition: background 0.2s;
}
.ppr-play-overlay i { font-size: 40px; color: #fff; opacity: 0; transform: scale(0.7); transition: opacity 0.2s, transform 0.2s; }
.ppr-card:hover .ppr-play-overlay { background: rgba(0,0,0,0.4); }
.ppr-card:hover .ppr-play-overlay i { opacity: 1; transform: scale(1); }
.ppr-card-info { padding: 10px 12px 14px; }
.ppr-card-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.ppr-card-meta { font-size: 11px; color: var(--text-muted); }

/* Old postplay — kept for compat, hidden by default */
.postplay {
  position: absolute; inset: 0; z-index: 30;
  background: linear-gradient(to top, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 40px 48px;
}
.postplay-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
}
.postplay-header h2 { font-size: 22px; font-weight: 800; flex: 1; }
#postplay-countdown {
  font-size: 14px; color: var(--text-muted);
  background: var(--bg-3); padding: 6px 14px; border-radius: 20px;
}
.postplay-header button {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.postplay-header button:hover { background: rgba(255,255,255,0.2); }
.postplay-grid { display: flex; gap: 12px; overflow-x: auto; }
.postplay-grid::-webkit-scrollbar { display: none; }
.postplay-card {
  flex-shrink: 0; width: 140px; cursor: pointer;
  border-radius: 8px; overflow: hidden; transition: transform 0.2s;
  border: 2px solid transparent;
}
.postplay-card:hover { transform: translateY(-4px) scale(1.04); border-color: var(--accent); }
.postplay-card.top-pick { border-color: var(--accent-light); box-shadow: 0 0 20px var(--accent-dim); }
.postplay-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.postplay-card-title { padding: 6px 8px; font-size: 11px; font-weight: 600; background: var(--bg-2); }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 600;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 18px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideUp 0.2s ease; max-width: 320px;
}
.toast.success { border-color: #22c55e; }
.toast.error { border-color: #ef4444; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Empty / Error States ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 14px; opacity: 0.3; display: block; }
.empty-state p { font-size: 15px; }

.skeleton { background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--card-radius); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { flex-shrink: 0; width: 160px; aspect-ratio: 2/3; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Hamburger Button ────────────────────────────────────────────────────── */
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  width: 40px; height: 40px; align-items: center; justify-content: center;
  border-radius: 8px; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: all 0.25s ease;
}

/* ── Mobile Drawer ───────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 490;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
}
.mobile-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 495;
  width: 280px; background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.mobile-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-logo {
  font-size: 18px; font-weight: 800; letter-spacing: 2px;
  color: var(--accent-light);
  display: flex; align-items: center; gap: 8px;
}
.drawer-header button {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg-3); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: background 0.15s;
}
.drawer-header button:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.drawer-user {
  padding: 16px 20px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.drawer-user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.drawer-user-name { font-size: 14px; font-weight: 700; }
.drawer-user-email { font-size: 11px; color: var(--text-muted); }

.drawer-nav { padding: 8px 10px; }
.drawer-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 8px; font-size: 15px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.drawer-nav a i { width: 18px; text-align: center; font-size: 16px; }
.drawer-nav a:hover, .drawer-nav a:active { background: var(--bg-3); color: var(--text); }
.drawer-nav a.drawer-danger { color: #f87171; }
.drawer-nav a.drawer-danger:hover { background: rgba(248,113,113,0.1); }

.drawer-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Bottom Nav (always in DOM, visible only on mobile) ───────────────────── */
#bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: 60px;
  background: rgba(10,10,14,0.97); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  align-items: stretch; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}
.bnav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-muted); font-size: 10px; font-weight: 600;
  -webkit-tap-highlight-color: transparent; transition: color 0.15s;
}
.bnav-btn i { font-size: 18px; }
.bnav-btn.active { color: var(--accent-light); }
.bnav-btn.active i { filter: drop-shadow(0 0 6px var(--accent)); }

/* ── Responsive — Mobile (≤ 640px) ───────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --nav-h: 54px; }

  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  #bottom-nav { display: flex; }

  #nav { padding: 0 14px; gap: 10px; }
  .nav-links { display: none; }
  .nav-search-btn { display: none; }
  .hamburger { display: flex; }

  /* Hero — shorter, text always visible */
  .hero { height: 56vw; max-height: 340px; }
  .hero-bg::after {
    background: linear-gradient(to top, rgba(10,10,14,1) 0%, rgba(10,10,14,0.5) 60%, transparent 100%);
  }
  .hero-content { padding: 0 16px 20px; max-width: 100%; }
  .hero-title { font-size: clamp(18px, 6vw, 28px); margin-bottom: 8px; }
  .hero-overview { display: none; }
  .hero-meta { margin-bottom: 10px; font-size: 13px; }
  .hero-actions .btn { padding: 9px 16px; font-size: 13px; }
  .hero-actions .btn-lg { padding: 10px 20px; font-size: 14px; }

  /* Card rows */
  .rows-container { padding: 0 12px 24px; }
  .row { margin-bottom: 24px; }
  .row-title { font-size: 15px; margin-bottom: 10px; }
  .card { width: 120px; }

  /* Browse grid — 3 columns */
  .content-grid { padding: 0 12px; grid-template-columns: repeat(3, 1fr); gap: 10px; }

  /* Browse header */
  .browse-header { flex-direction: column; align-items: flex-start; padding: 16px 12px 12px; gap: 10px; }
  .browse-header h1 { font-size: 22px; }
  .browse-filters { width: 100%; }
  .browse-filters select { flex: 1; font-size: 12px; padding: 7px 10px; }

  /* Search */
  .search-bar-wrap { padding: 20px 14px 16px; gap: 10px; }
  #search-input { font-size: 20px; }

  /* Detail modal — bottom sheet */
  .modal { align-items: flex-end; }
  .modal-content {
    width: 100%; max-height: 93vh;
    border-radius: 20px 20px 0 0;
  }
  .modal-hero { aspect-ratio: 16/9; border-radius: 20px 20px 0 0; }
  .modal-body { padding: 0 16px 20px; }
  .modal-title { font-size: 20px; }
  .modal-hero-actions { left: 14px; right: 14px; bottom: 12px; flex-wrap: wrap; gap: 8px; }
  .modal-hero-actions .btn { padding: 9px 14px; font-size: 13px; }
  .ep-thumb { width: 72px; }

  /* Auth modal */
  .auth-box { width: 100%; border-radius: 20px 20px 0 0; padding: 24px 20px; }

  /* Profile */
  .profile-header { padding: 20px 14px 14px; flex-direction: column; text-align: center; gap: 12px; }
  .profile-info h1 { font-size: 20px; }
  .profile-tabs { padding: 0 10px 16px; overflow-x: auto; flex-wrap: nowrap; gap: 2px; scrollbar-width: none; }
  .profile-tabs::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; padding: 7px 12px; font-size: 13px; }
  #profile-content { padding: 12px; }
  .history-card { padding: 10px; gap: 10px; }
  .history-thumb { width: 44px; height: 66px; }

  /* Player */
  #quality-badge { bottom: 80px; left: 12px; }
  #quality-menu { bottom: 124px; left: 12px; min-width: 220px; }

  /* Post-play */
  .postplay { padding: 16px 14px; }
  .postplay-header h2 { font-size: 17px; }
  .ppr-grid { grid-template-columns: repeat(2, 1fr); padding: 8px 16px 32px; gap: 10px; }
  .ppr-card--featured { grid-column: span 2; }
  .ppr-header { padding: 24px 16px 12px; }
  .ppr-header h2 { font-size: 18px; }
  .ppr-close { padding: 6px 12px; font-size: 12px; }
  .ppe-card { flex-direction: column; }
  .ppe-thumb { width: 100%; }
  .ppe-meta { padding: 14px; }
  .ppe-name { font-size: 16px; }
  .up-next-preview { right: 12px; max-width: 260px; bottom: 60px; }
  .unp-thumb { width: 64px; }
  .postplay-card { width: 96px; }
  .postplay-card-title { font-size: 10px; }

  /* Toast — above bottom nav */
  .toast { bottom: calc(68px + env(safe-area-inset-bottom)); right: 12px; left: 12px; max-width: 100%; text-align: center; }

  /* Pagination */
  .pagination { padding: 20px 12px; flex-wrap: wrap; }
}

/* ── Responsive — Tablet (641px – 1024px) ────────────────────────────────── */
@media (min-width: 641px) and (max-width: 1024px) {
  #bottom-nav { display: none; }

  #nav { padding: 0 20px; gap: 20px; }
  .hero-content { padding: 0 32px 40px; }
  .rows-container { padding: 0 20px 40px; }
  .card { width: 140px; }
  .content-grid { padding: 0 20px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .browse-header { padding: 20px 20px; }
  .modal-content { width: min(720px, 96vw); }
}

/* ── TV Mode (set via JS when large screen detected) ─────────────────────── */
.tv-mode {
  font-size: 18px;
}
.tv-mode :root { --nav-h: 80px; }
.tv-mode #bottom-nav { display: none !important; }

.tv-mode #nav {
  height: 80px; padding: 0 56px; gap: 40px;
}
.tv-mode .nav-logo { font-size: 26px; letter-spacing: 3px; }
.tv-mode .nav-links a { font-size: 17px; padding: 10px 20px; }
.tv-mode .nav-search-btn { width: 48px; height: 48px; font-size: 18px; }
.tv-mode .nav-user-btn { font-size: 17px; padding: 10px 18px; }

.tv-mode .hero { height: 85vh; max-height: 900px; }
.tv-mode .hero-content { padding: 0 80px 80px; max-width: 760px; }
.tv-mode .hero-title { font-size: clamp(40px, 5vw, 72px); }
.tv-mode .hero-overview { font-size: 18px; line-height: 1.7; }
.tv-mode .hero-meta { font-size: 17px; gap: 18px; margin-bottom: 20px; }
.tv-mode .hero-actions .btn-lg { padding: 18px 44px; font-size: 20px; border-radius: 14px; }
.tv-mode .hero-actions .btn { padding: 16px 32px; font-size: 18px; }

.tv-mode .rows-container { padding: 0 56px 80px; }
.tv-mode .row { margin-bottom: 56px; }
.tv-mode .row-title { font-size: 24px; margin-bottom: 20px; }
.tv-mode .card { width: 200px; border-radius: 12px; }
.tv-mode .card-title { font-size: 14px; }
.tv-mode .card-sub { font-size: 13px; }

.tv-mode .content-grid { padding: 0 56px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 24px; }

/* TV focus rings — large and unmissable from the couch */
.tv-mode *:focus { outline: none; }
.tv-mode .card:focus {
  transform: translateY(-12px) scale(1.07) !important;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8), 0 0 0 4px var(--accent), 0 0 40px var(--accent);
  z-index: 20;
}
.tv-mode .card:focus .card-overlay { background: rgba(0,0,0,0.35); }
.tv-mode .card:focus .card-overlay i { opacity: 1; transform: scale(1.2); }
.tv-mode .btn:focus, .tv-mode button:focus {
  box-shadow: 0 0 0 4px var(--accent), 0 0 20px var(--accent-dim) !important;
  transform: scale(1.04);
}
.tv-mode a:focus {
  box-shadow: 0 0 0 3px var(--accent);
  border-radius: 6px;
}
.tv-mode .ep-row:focus {
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 3px var(--accent);
  border-radius: 8px;
}

.tv-mode .modal-content { width: min(1000px, 92vw); max-height: 88vh; }
.tv-mode .modal-title { font-size: 34px; }
.tv-mode .modal-meta { font-size: 17px; }
.tv-mode .modal-overview { font-size: 18px; line-height: 1.8; }
.tv-mode .modal-hero-actions .btn { padding: 16px 32px; font-size: 18px; }
.tv-mode .ep-row { padding: 16px 18px; font-size: 16px; }
.tv-mode .ep-name { font-size: 16px; }
.tv-mode .ep-thumb { width: 140px; }
.tv-mode .season-btn { padding: 10px 22px; font-size: 16px; }

.tv-mode .player-topbar { padding: 20px 40px; }
.tv-mode .player-topbar button { padding: 14px 24px; font-size: 17px; border-radius: 12px; }
.tv-mode .player-topbar span { font-size: 20px; }
.tv-mode #quality-badge { bottom: 100px; left: 48px; padding: 10px 18px; gap: 12px; border-radius: 12px; }
.tv-mode .qb-pill { font-size: 14px; padding: 4px 12px; }
.tv-mode .qb-source, .tv-mode .qb-size { font-size: 15px; }
.tv-mode .ppe-content { max-width: 900px; }
.tv-mode .ppe-thumb { width: 340px; }
.tv-mode .ppe-name { font-size: 28px; }
.tv-mode .ppe-play-btn { font-size: 20px; padding: 18px 36px; }
.tv-mode .ppr-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 12px 80px 80px; }
.tv-mode .ppr-header { padding: 48px 80px 24px; }
.tv-mode .ppr-header h2 { font-size: 34px; }
.tv-mode .up-next-preview { bottom: 120px; right: 60px; max-width: 380px; padding: 14px 18px 14px 14px; }
.tv-mode .unp-thumb { width: 100px; }
.tv-mode .unp-name { font-size: 15px; }
.tv-mode .unp-play { width: 46px; height: 46px; font-size: 18px; }
.tv-mode .qb-change { font-size: 14px; padding: 6px 16px; }
.tv-mode #quality-menu { bottom: 160px; left: 48px; min-width: 320px; }
.tv-mode .qm-item { padding: 12px 16px; }
.tv-mode .qm-q { font-size: 16px; }
.tv-mode .qm-s { font-size: 15px; }

.tv-mode .postplay { padding: 60px 80px; }
.tv-mode .postplay-header h2 { font-size: 30px; }
.tv-mode .postplay-card { width: 180px; border-radius: 12px; }
.tv-mode .postplay-card-title { font-size: 14px; padding: 10px; }
