/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg:           hsl(222, 47%, 7%);
  --bg2:          hsl(222, 39%, 10%);
  --bg3:          hsl(222, 30%, 14%);
  --fg:           hsl(220, 14%, 90%);
  --fg-muted:     hsl(220, 9%, 63%);
  --primary:      hsl(217, 91%, 53%);
  --primary-glow: hsl(217, 91%, 53%, 0.3);
  --secondary:    hsl(199, 89%, 61%);
  --border:       hsl(222, 20%, 18%);
  --danger:       hsl(0, 84%, 60%);
  --card-shadow:  0 4px 24px hsl(222, 47%, 4%, 0.5);
  --card-hover:   0 8px 40px hsl(217, 91%, 53%, 0.15);
  --radius:       0.75rem;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
h1,h2,h3,h4,h5,h6 { font-family: 'Poppins', 'Inter', system-ui, sans-serif; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
img { display: block; max-width: 100%; }

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: hsl(217,91%,53%,0.5); }

/* ─── Layout Helpers ─────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.25rem; }
.page { display: none; min-height: calc(100vh - 64px); }
.page.active { display: block; }

/* ─── Header ─────────────────────────────────────────────────── */
#header {
  position: sticky; top: 0; z-index: 100;
  background: hsl(222,47%,7%,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 1.25rem;
  height: 64px;
  display: flex; align-items: center; gap: 2rem;
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.35rem; }
.logo-icon { font-size: 1.4rem; }
.logo-accent { color: var(--secondary); }
.nav-links { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.nav-link {
  padding: 0.4rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color 0.2s, background 0.2s;
  display: flex; align-items: center; gap: 0.35rem;
}
.nav-link:hover, .nav-link.active { color: var(--fg); background: var(--bg3); }
.watchlist-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 0.1rem 0.45rem;
  min-width: 1.1rem;
  text-align: center;
  display: none;
}
.watchlist-badge.visible { display: inline-block; }

/* hamburger */
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 0.5rem; margin-left: auto; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--fg); border-radius: 2px; transition: 0.3s; }
.mobile-nav { display: none; flex-direction: column; padding: 0.75rem 1.25rem 1rem; gap: 0.25rem; border-top: 1px solid var(--border); }
.mobile-nav.open { display: flex; }
.mobile-nav .nav-link { font-size: 1rem; padding: 0.6rem 1rem; }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  height: min(90vh, 680px);
  overflow: hidden;
  display: flex; align-items: flex-end;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center top;
  transition: background-image 0.8s ease;
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to top,
    hsl(222,47%,7%) 0%,
    hsl(222,47%,7%,0.7) 40%,
    hsl(222,47%,7%,0.2) 100%
  );
}
.hero-content {
  position: relative; z-index: 2;
  width: 100%; max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}
.hero-info { max-width: 640px; animation: fadeUp 0.6s ease both; }
.hero-badge {
  display: inline-block;
  background: hsl(217,91%,53%,0.2);
  border: 1px solid hsl(217,91%,53%,0.4);
  color: var(--secondary);
  font-size: 0.75rem; font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 99px; margin-bottom: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800; line-height: 1.1;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 20px hsl(222,47%,4%,0.8);
}
.hero-meta {
  display: flex; align-items: center; gap: 1rem;
  color: var(--fg-muted); font-size: 0.9rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.hero-meta .rating { color: #fbbf24; font-weight: 600; }
.hero-desc {
  color: hsl(220,14%,75%);
  font-size: 1rem; line-height: 1.65;
  margin-bottom: 1.5rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: 0.6rem;
  font-size: 0.9rem; font-weight: 600;
  border: none; transition: all 0.2s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 20px hsl(217,91%,53%,0.3);
}
.btn-primary:hover { background: hsl(217,91%,60%); box-shadow: 0 0 30px hsl(217,91%,53%,0.5); transform: translateY(-1px); }
.btn-ghost {
  background: hsl(220,14%,90%,0.1);
  color: var(--fg);
  border: 1px solid hsl(220,14%,90%,0.2);
  backdrop-filter: blur(4px);
}
.btn-ghost:hover { background: hsl(220,14%,90%,0.2); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: hsl(217,91%,53%,0.1); }
.btn-icon {
  background: none; border: none;
  color: var(--fg-muted); padding: 0.4rem;
  border-radius: 0.5rem; transition: all 0.2s;
  display: inline-flex; align-items: center;
}
.btn-icon:hover { color: var(--fg); background: var(--bg3); }
.btn-text {
  background: none; border: none;
  color: var(--primary); font-size: 0.875rem; font-weight: 500;
  padding: 0.25rem 0.5rem; border-radius: 0.4rem;
  transition: color 0.2s;
}
.btn-text:hover { color: var(--secondary); }

/* ─── Sections ───────────────────────────────────────────────── */
.section { padding: 2.5rem 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.section-title { font-size: 1.35rem; font-weight: 700; }

/* ─── Genre Chips ─────────────────────────────────────────────── */
.genre-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.genre-chip {
  padding: 0.4rem 1rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--fg-muted);
  font-size: 0.85rem; font-weight: 500;
  transition: all 0.2s;
}
.genre-chip:hover { border-color: var(--primary); color: var(--fg); }
.genre-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── Movie Grid ──────────────────────────────────────────────── */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
}
@media (min-width: 480px) { .movie-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
@media (min-width: 768px) { .movie-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }

/* ─── Movie Card ──────────────────────────────────────────────── */
.movie-card {
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  position: relative;
}
.movie-card:hover { transform: translateY(-6px); box-shadow: var(--card-hover); }
.movie-card:hover .card-overlay { opacity: 1; }
.card-poster-wrap { position: relative; aspect-ratio: 2/3; overflow: hidden; background: var(--bg3); }
.card-poster { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.movie-card:hover .card-poster { transform: scale(1.05); }
.card-overlay {
  position: absolute; inset: 0;
  background: hsl(222,47%,7%,0.75);
  opacity: 0; transition: opacity 0.3s;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.card-rating {
  position: absolute; top: 0.5rem; left: 0.5rem;
  background: hsl(222,47%,7%,0.85);
  backdrop-filter: blur(4px);
  color: #fbbf24; font-size: 0.78rem; font-weight: 700;
  padding: 0.2rem 0.5rem; border-radius: 0.4rem;
  display: flex; align-items: center; gap: 0.2rem;
}
.card-watchlist-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: hsl(222,47%,7%,0.85);
  backdrop-filter: blur(4px);
  border: none; border-radius: 0.4rem;
  color: var(--fg-muted);
  padding: 0.3rem 0.4rem;
  font-size: 1rem; transition: all 0.2s;
  cursor: pointer;
}
.card-watchlist-btn:hover { color: var(--primary); }
.card-watchlist-btn.in-watchlist { color: var(--primary); }
.card-body { padding: 0.75rem; }
.card-title {
  font-size: 0.9rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}
.card-year { font-size: 0.78rem; color: var(--fg-muted); }

/* ─── Skeletons ──────────────────────────────────────────────── */
.skel {
  background: var(--bg3);
  border-radius: 0.5rem;
  position: relative; overflow: hidden;
}
.skel::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, hsl(220,9%,63%,0.07), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.skel-badge  { height: 1.25rem; width: 6rem; margin-bottom: 0.75rem; border-radius: 99px; }
.skel-title  { height: 3rem; width: 80%; margin-bottom: 0.5rem; }
.skel-title-sm { height: 2.5rem; width: 55%; }
.skel-meta   { height: 1rem; width: 50%; margin: 0.75rem 0; }
.skel-desc   { height: 1rem; width: 100%; margin-bottom: 0.4rem; }
.skel-desc-sm { width: 75%; }
.skel-btns   { height: 2.5rem; width: 14rem; margin-top: 1rem; border-radius: 0.6rem; }
.skel-chip   { height: 2rem; width: 5.5rem; border-radius: 99px; display: inline-flex; }
.skel-card   { aspect-ratio: 2/3; border-radius: var(--radius); }

/* ─── Search Page ─────────────────────────────────────────────── */
.search-hero { text-align: center; padding: 2.5rem 0 2rem; }
.search-title { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.search-subtitle { color: var(--fg-muted); margin-bottom: 1.75rem; }
.search-bar-wrap { max-width: 640px; margin: 0 auto; }
.search-bar {
  position: relative; display: flex; align-items: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px hsl(217,91%,53%,0.15); }
.search-icon { position: absolute; left: 1rem; color: var(--fg-muted); pointer-events: none; flex-shrink: 0; }
.search-input {
  width: 100%; background: none; border: none; outline: none;
  color: var(--fg); font-size: 1rem; font-family: inherit;
  padding: 0.85rem 1rem 0.85rem 3rem;
}
.search-input::placeholder { color: var(--fg-muted); }
.search-clear {
  position: absolute; right: 0.75rem;
  background: none; border: none;
  color: var(--fg-muted); font-size: 1rem;
  padding: 0.25rem 0.4rem; border-radius: 0.4rem;
  transition: color 0.2s;
}
.search-clear:hover { color: var(--fg); }

.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.tab {
  padding: 0.45rem 1rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--fg-muted);
  font-size: 0.85rem; font-weight: 500;
  transition: all 0.2s;
}
.tab:hover { border-color: var(--primary); color: var(--fg); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.results-header { color: var(--fg-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.load-more-wrap { text-align: center; padding: 2rem 0; }

/* ─── Movie Detail ────────────────────────────────────────────── */
.detail-hero {
  position: relative;
  min-height: 500px;
  background-size: cover; background-position: center;
  display: flex; align-items: flex-end;
}
.detail-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, hsl(222,47%,7%,0.5) 60%, transparent 100%);
}
.detail-hero-content {
  position: relative; z-index: 2;
  max-width: 1280px; width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex; gap: 2rem; align-items: flex-end;
}
.detail-poster {
  width: 180px; flex-shrink: 0;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px hsl(222,47%,4%,0.7);
  display: none;
}
@media (min-width: 600px) { .detail-poster { display: block; } }
.detail-meta-wrap { flex: 1; }
.detail-back-btn { margin-bottom: 1rem; }
.detail-title { font-size: clamp(1.75rem, 4vw, 3rem); font-weight: 800; margin-bottom: 0.5rem; }
.detail-tagline { color: var(--fg-muted); font-style: italic; margin-bottom: 0.75rem; }
.detail-meta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-bottom: 1rem; }
.badge {
  display: inline-block;
  background: var(--bg3);
  color: var(--fg-muted);
  font-size: 0.78rem; font-weight: 600;
  padding: 0.2rem 0.6rem; border-radius: 0.4rem;
}
.badge-primary { background: hsl(217,91%,53%,0.2); color: var(--primary); }
.badge-yellow { background: hsl(45,93%,47%,0.15); color: #fbbf24; }

.detail-body { max-width: 1280px; margin: 0 auto; padding: 2rem 1.25rem; }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 768px) { .detail-grid { grid-template-columns: 2fr 1fr; } }
.detail-overview-label { color: var(--fg-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.detail-overview { line-height: 1.75; color: hsl(220,14%,80%); }
.detail-info-card { background: var(--bg2); border-radius: var(--radius); padding: 1.25rem; border: 1px solid var(--border); }
.detail-info-row { display: flex; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.detail-info-row:last-child { border-bottom: none; }
.detail-info-label { color: var(--fg-muted); }

.detail-cast { margin-top: 2rem; }
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 1rem; margin-top: 1rem; }
.cast-card { background: var(--bg2); border-radius: var(--radius); overflow: hidden; text-align: center; border: 1px solid var(--border); }
.cast-photo { width: 100%; aspect-ratio: 2/3; object-fit: cover; background: var(--bg3); }
.cast-name { font-size: 0.8rem; font-weight: 600; padding: 0.4rem 0.4rem 0.1rem; }
.cast-character { font-size: 0.72rem; color: var(--fg-muted); padding: 0 0.4rem 0.5rem; }

/* ─── Empty / 404 ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--fg-muted); }
.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.25rem; font-weight: 700; color: var(--fg); margin-bottom: 0.4rem; }

.not-found { text-align: center; padding: 5rem 1rem; }
.not-found-code { font-size: 8rem; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.not-found h2 { font-size: 2rem; margin-bottom: 0.5rem; }
.not-found p { color: var(--fg-muted); margin-bottom: 1.5rem; }

/* ─── Toast ──────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 0.75rem;
  padding: 0.75rem 1.1rem;
  font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 4px 24px hsl(222,47%,4%,0.5);
  animation: slideIn 0.3s ease;
  min-width: 220px;
}
.toast.removing { animation: slideOut 0.3s ease forwards; }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
@keyframes slideOut { from { opacity:1; transform: translateX(0); } to { opacity:0; transform: translateX(20px); } }

/* ─── Footer ──────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding: 1.5rem 0; text-align: center; color: var(--fg-muted); font-size: 0.85rem; margin-top: 3rem; }
.footer a { color: var(--primary); }
.footer a:hover { text-decoration: underline; }

/* ─── Phase 1: Source Picker Modal ───────────────────────────── */
.picker-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: hsl(222,47%,4%,0.88);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.picker-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  width: 100%; max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px hsl(222,47%,4%,0.85);
  animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes slideUp { from { opacity:0; transform: translateY(30px) scale(0.97); } to { opacity:1; transform: translateY(0) scale(1); } }

.picker-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg2); z-index: 2;
  border-radius: 1.25rem 1.25rem 0 0;
}
.picker-title-wrap { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.picker-poster-thumb {
  width: 44px; height: 60px; border-radius: 0.4rem;
  background-size: cover; background-position: center;
  background-color: var(--bg3);
  flex-shrink: 0; border: 1px solid var(--border);
}
.picker-movie-name {
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.picker-subtitle { font-size: 0.78rem; color: var(--fg-muted); margin-top: 0.1rem; }
.picker-close {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--fg-muted); border-radius: 0.5rem;
  padding: 0.3rem 0.65rem; font-size: 1rem;
  transition: all 0.2s; flex-shrink: 0;
}
.picker-close:hover { background: hsl(0,84%,60%,0.15); color: var(--danger); border-color: var(--danger); }

/* Sections inside picker */
.picker-sections { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.picker-section-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--fg-muted);
  padding: 0.5rem 0.5rem 0.25rem;
}
.picker-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  transition: all 0.18s; cursor: pointer; width: 100%; text-align: left;
}
.picker-item:hover {
  border-color: var(--primary);
  background: hsl(217,91%,53%,0.08);
  transform: translateX(3px);
}
.picker-item:hover .picker-item-arrow { opacity: 1; transform: translateX(0); }
.picker-item-icon {
  font-size: 1.5rem; flex-shrink: 0;
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 0.6rem;
  border: 1px solid var(--border);
}
.picker-item-info { flex: 1; min-width: 0; }
.picker-item-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.15rem; }
.picker-item-desc { font-size: 0.76rem; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-item-arrow {
  color: var(--primary); font-size: 1.1rem; flex-shrink: 0;
  opacity: 0; transform: translateX(-4px); transition: all 0.18s;
}

.picker-no-source { padding: 2.5rem; text-align: center; color: var(--fg-muted); }
.picker-no-source h3 { font-size: 1.1rem; color: var(--fg); margin-bottom: 0.35rem; }

/* ─── Phase 2: Fullscreen Player ─────────────────────────────── */
.player-fullscreen {
  position: fixed; inset: 0; z-index: 1001;
  background: #000;
  display: flex; flex-direction: column;
  animation: fadeIn 0.22s ease;
}

.player-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 1rem;
  background: hsl(222,47%,5%,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid hsl(222,20%,18%,0.6);
  flex-shrink: 0; gap: 1rem; z-index: 2;
}
.player-topbar-left { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.player-back-btn {
  background: hsl(220,14%,90%,0.08); border: 1px solid hsl(220,14%,90%,0.12);
  color: var(--fg); border-radius: 0.5rem;
  padding: 0.4rem 0.85rem; font-size: 0.85rem; font-weight: 600;
  transition: all 0.2s; white-space: nowrap; flex-shrink: 0;
}
.player-back-btn:hover { background: hsl(220,14%,90%,0.15); }
.player-now-playing {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.875rem; color: var(--fg); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-source-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: pulse 2s ease infinite;
}
.player-source-dot.yt { background: #f87171; box-shadow: 0 0 8px #f87171; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

.player-close-btn {
  background: hsl(0,84%,60%,0.12); border: 1px solid hsl(0,84%,60%,0.3);
  color: hsl(0,84%,70%); border-radius: 0.5rem;
  padding: 0.4rem 0.9rem; font-size: 0.85rem; font-weight: 600;
  transition: all 0.2s; flex-shrink: 0;
}
.player-close-btn:hover { background: hsl(0,84%,60%,0.25); color: #fff; }

/* The actual player stage — takes ALL remaining space */
.player-stage {
  flex: 1; position: relative; background: #000;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
}
.player-stage iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: none;
}
.player-spinner-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.75rem; color: var(--fg-muted); font-size: 0.9rem;
}

.player-bottombar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem;
  background: hsl(222,47%,5%,0.95);
  border-top: 1px solid hsl(222,20%,18%,0.6);
  font-size: 0.75rem; color: var(--fg-muted);
  flex-shrink: 0; gap: 1rem; flex-wrap: wrap;
}
.player-bottombar a { color: var(--primary); }
.player-bottombar a:hover { text-decoration: underline; }

/* ─── Toast ──────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 0.75rem;
  padding: 0.75rem 1.1rem;
  font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 4px 24px hsl(222,47%,4%,0.5);
  animation: slideIn 0.3s ease;
  min-width: 220px;
}
.toast.removing { animation: slideOut 0.3s ease forwards; }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
@keyframes slideOut { from { opacity:1; transform: translateX(0); } to { opacity:0; transform: translateX(20px); } }

/* ─── Footer ──────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding: 1.5rem 0; text-align: center; color: var(--fg-muted); font-size: 0.85rem; margin-top: 3rem; }
.footer a { color: var(--primary); }
.footer a:hover { text-decoration: underline; }

/* Watch buttons on detail page */
.watch-btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.btn-watch-trailer {
  background: hsl(0,0%,100%,0.1);
  color: #fff;
  border: 1px solid hsl(0,0%,100%,0.25);
  backdrop-filter: blur(4px);
}
.btn-watch-trailer:hover { background: hsl(0,0%,100%,0.2); }
.btn-watch-full {
  background: linear-gradient(135deg, hsl(217,91%,53%), hsl(199,89%,61%));
  color: #fff; border: none;
  box-shadow: 0 0 20px hsl(217,91%,53%,0.4);
}
.btn-watch-full:hover { filter: brightness(1.1); box-shadow: 0 0 30px hsl(217,91%,53%,0.6); transform: translateY(-1px); }

/* Animations */
@keyframes fadeUp { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.5s ease both; }

