*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c26;
  --accent: #e50914;
  --accent2: #ff6b35;
  --text: #e8e8f0;
  --muted: #8888a0;
  --radius: 8px;
  --nav-h: 64px;
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ── NAVBAR ── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 4%;
  background: #0a0a0f;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.navbar.scrolled { background: #0a0a0f; }

.logo {
  font-size: 1.5rem; font-weight: 800; letter-spacing: 2px; cursor: pointer; user-select: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.nav-left { display: flex; align-items: center; gap: 2rem; }
.nav-links { list-style: none; display: flex; gap: 1.4rem; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 0.88rem; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 1rem; }

.search-wrap { position: relative; }
.search-wrap input {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px; padding: 7px 36px 7px 14px; color: var(--text);
  font-size: 0.85rem; width: 200px; outline: none; transition: all 0.3s;
}
.search-wrap input:focus { background: rgba(255,255,255,0.13); border-color: rgba(255,255,255,0.3); width: 260px; }
.search-wrap input::placeholder { color: var(--muted); }
.search-icon { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; align-items: center; }

.avatar {
  width: 34px; height: 34px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 0.85rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.wl-badge {
  position: absolute; top: -6px; right: -6px;
  background: #f5c518; color: #000; font-size: 0.6rem; font-weight: 800;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer; }

/* ── NAV DROPDOWN ── */
.has-dropdown { position: relative; }
.nav-arrow { font-size: 0.6rem; opacity: 0.6; margin-left: 2px; transition: transform 0.2s; display: inline-block; }
.has-dropdown > a { align-items: center; gap: 2px; }
.has-dropdown.open .nav-arrow { transform: rotate(180deg); }

.nav-dropdown {
  display: none; position: absolute; top: calc(100% + 12px); left: 50%;
  transform: translateX(-50%);
  background: var(--surface); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 6px; min-width: 180px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  z-index: 200;
  animation: dropIn 0.18s ease;
}
.nav-dropdown.open { display: block; }
@keyframes dropIn { from { opacity:0; transform: translateX(-50%) translateY(-6px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

.nav-dropdown::before {
  content: ''; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(255,255,255,0.1);
}
.nav-dropdown a {
  display: block; padding: 8px 14px; border-radius: 6px;
  color: var(--muted); font-size: 0.84rem; font-weight: 500;
  text-decoration: none; transition: all 0.15s; white-space: nowrap;
}
.nav-dropdown a:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.nav-dropdown a:first-child { color: var(--text); font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.07); margin-bottom: 4px; padding-bottom: 10px; }

/* ── SEARCH SUGGESTIONS ── */
.search-wrap { position: relative; }
.search-suggestions {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; width: 320px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6); z-index: 200;
  animation: dropIn 0.18s ease;
}
.suggestion-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; transition: background 0.15s;
}
.suggestion-item:hover { background: rgba(255,255,255,0.07); }
.suggestion-item img { width: 36px; height: 54px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--surface2); }
.suggestion-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.suggestion-title { font-size: 0.86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-meta { font-size: 0.74rem; color: var(--muted); }
.suggestion-hint {
  padding: 10px 14px; font-size: 0.8rem; color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.06); text-align: center;
}
.suggestion-hint.suggestion-loading { font-style: italic; }
.suggestion-item mark {
  background: none; color: var(--accent2); font-weight: 700;
}

/* ── SEARCH HEADER / FILTER PILLS ── */
.search-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.search-header .section-title { margin-bottom: 0; }
.search-filters { display: flex; gap: 8px; }
.filter-pill {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  color: var(--muted); font-size: 0.8rem; font-weight: 600; padding: 5px 14px;
  border-radius: 20px; cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.filter-pill:hover { background: rgba(255,255,255,0.15); color: var(--text); }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── LOADING ── */
.loading-screen {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.loading-screen.hidden { display: none; }
.loading-screen p { color: var(--muted); font-size: 0.9rem; }

.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── HERO ── */
.hero {
  position: relative; height: 92vh; min-height: 520px;
  display: flex; align-items: flex-end; padding-bottom: 80px; overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center top; }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.35) 55%, transparent 100%),
              linear-gradient(to top, rgba(10,10,15,1) 0%, transparent 45%);
}
.hero-content { position: relative; z-index: 2; padding: 0 6%; max-width: 580px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 4px; margin-bottom: 14px;
}
.hero-title { font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.1; margin-bottom: 12px; }
.hero-meta { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.hero-meta .score { color: #f5c518; font-weight: 700; }
.type-badge { color: var(--accent); font-weight: 600; }
.hero-desc { font-size: 0.93rem; line-height: 1.65; color: #ccc; margin-bottom: 20px; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.genre-tag { background: rgba(255,255,255,0.09); border: 1px solid rgba(255,255,255,0.14); padding: 4px 12px; border-radius: 20px; font-size: 0.76rem; color: var(--muted); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 26px;
  border-radius: 6px; font-size: 0.88rem; font-weight: 600; cursor: pointer; border: none;
  transition: all 0.2s; white-space: nowrap; font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #c40812; transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.14); color: var(--text); border: 1px solid rgba(255,255,255,0.18); }
.btn-secondary:hover { background: rgba(255,255,255,0.24); }

/* ── MAIN ── */
.main { padding: 0 4% 60px; }
.section { margin-bottom: 44px; }
.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }

/* ── ROW ── */
.row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; user-select: none; cursor: grab; }
.row.dragging { cursor: grabbing; scroll-snap-type: none; }
.row::-webkit-scrollbar { height: 3px; }

/* ── CARD ── */
.card {
  flex: 0 0 150px; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  position: relative; background: var(--surface); scroll-snap-align: start;
  transition: transform 0.22s, box-shadow 0.22s;
}
.card:hover { transform: scale(1.06); z-index: 2; box-shadow: 0 14px 40px rgba(0,0,0,0.65); }
.card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: var(--surface2); }
.card-info { padding: 8px 10px 10px; }
.card-title { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.card-meta { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }
.card-score { color: #f5c518; font-weight: 600; }

.card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, transparent 55%);
  opacity: 0; transition: opacity 0.22s;
  display: flex; align-items: flex-end; justify-content: space-between; padding: 10px;
}
.card:hover .card-overlay { opacity: 1; }

.play-btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); border: none;
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
.play-btn:hover { transform: scale(1.12); }

.wl-mini {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.28); color: #fff; font-size: 0.85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.wl-mini:hover, .wl-mini.in-wl { background: var(--accent); border-color: var(--accent); }

/* ── GRID ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grid .card { flex: none; width: 100%; }
.empty-msg { color: var(--muted); grid-column: 1/-1; padding: 20px 0; font-size: 0.9rem; }
.row-loader { color: var(--muted); padding: 20px 0; font-size: 0.9rem; grid-column: 1/-1; }

/* ── CONTINUE WATCHING ── */
.continue-card .continue-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: #fff;
  font-size: 0.68rem; font-weight: 700; padding: 3px 8px;
  border-radius: 4px; letter-spacing: 0.5px; z-index: 1;
}
.remove-continue {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; line-height: 1;
}
.remove-continue:hover { background: var(--accent); border-color: var(--accent); }
.watchlist-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.watchlist-header .section-title { margin-bottom: 0; }
.watchlist-empty { color: var(--muted); font-size: 0.95rem; padding: 40px 0; text-align: center; }

/* ── PLAYER ── */
.player-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: #000;
  display: flex; flex-direction: column;
}
.player-overlay.hidden { display: none; }

.player-box { width: 100%; height: 100%; display: flex; flex-direction: column; position: relative; }

.player-header {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 52px; flex-shrink: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.95), rgba(0,0,0,0.7));
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.player-back {
  background: none; border: none; color: var(--muted);
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: color 0.2s, background 0.2s;
}
.player-back:hover { color: var(--text); background: rgba(255,255,255,0.1); }

.player-title-wrap { flex: 1; min-width: 0; }
.player-title-main {
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}

.player-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.src-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.src-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  color: var(--muted); font-size: 0.72rem; font-weight: 600;
  padding: 5px 11px; border-radius: 20px;
  cursor: pointer; transition: all 0.2s; font-family: inherit; white-space: nowrap;
}
.src-btn:hover { background: rgba(255,255,255,0.16); color: var(--text); }
.src-btn.active-src { background: var(--accent); border-color: var(--accent); color: #fff; }

.player-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  color: var(--text); width: 34px; height: 34px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; flex-shrink: 0;
}
.player-btn:hover { background: rgba(255,255,255,0.2); }

.player-server-btn {
  width: auto; padding: 0 12px; gap: 6px; font-size: 0.78rem; font-weight: 600;
  font-family: inherit;
}
.server-btn-label { white-space: nowrap; }

/* ── SERVER PANEL ── */
.server-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 400;
  background: var(--surface); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; width: 280px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
  animation: modalIn 0.2s ease;
}
.server-panel.hidden { display: none; }
.server-panel-backdrop {
  position: fixed; inset: 0; z-index: 399;
  background: rgba(0,0,0,0.6);
}
.server-panel-backdrop.hidden { display: none; }
.server-panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; font-size: 0.8rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.server-grid {
  display: flex; flex-direction: column; gap: 4px; padding: 8px;
}
.server-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
  border-radius: 8px; padding: 8px 12px; cursor: pointer;
  transition: all 0.18s; font-family: inherit; color: var(--muted);
  text-align: left; width: 100%;
}
.server-card:hover { background: rgba(255,255,255,0.1); color: var(--text); border-color: rgba(255,255,255,0.2); }
.server-card.active-server { background: rgba(229,9,20,0.15); border-color: var(--accent); color: var(--text); }
.server-card.active-server svg { stroke: var(--accent); }
.server-card-name { flex: 1; font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-card-tag {
  font-size: 0.65rem; font-weight: 700; padding: 2px 6px;
  border-radius: 4px; background: rgba(255,255,255,0.1);
  color: var(--muted); flex-shrink: 0; letter-spacing: 0.5px;
}
.server-card.active-server .server-card-tag { background: var(--accent); color: #fff; }

.player-wrap { flex: 1; position: relative; background: #000; overflow: hidden; }
.player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* episode picker — below the video as a proper bar */
.episode-picker {
  flex-shrink: 0; background: rgba(10,10,15,0.97);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 16px;
}
.episode-picker.hidden { display: none; }
.ep-picker-inner { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ep-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: var(--muted); font-weight: 500;
}
.ep-label span { white-space: nowrap; }
.ep-label select {
  background: var(--surface2); border: 1px solid rgba(255,255,255,0.15);
  color: var(--text); border-radius: 6px; padding: 6px 10px;
  font-size: 0.82rem; cursor: pointer; outline: none; font-family: inherit;
  transition: border-color 0.2s;
}
.ep-label select:focus { border-color: var(--accent); }

.ep-autoplay { margin-left: auto; cursor: pointer; gap: 6px; }
.ep-autoplay input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer;
}

.ep-next-btn {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  background: var(--accent); border: none; color: #fff;
  font-size: 0.8rem; font-weight: 600; padding: 7px 14px;
  border-radius: 6px; cursor: pointer; font-family: inherit;
  transition: background 0.2s; white-space: nowrap; flex-shrink: 0;
}
.ep-next-btn:hover { background: #c40812; }
.ep-next-btn.hidden { display: none; }

/* load more */
.load-more-btn {
  display: flex; margin: 20px auto 0; justify-content: center;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 800px;
  max-height: 90vh; overflow-y: auto; position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.8); animation: modalIn 0.28s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(0.95) translateY(18px); } to { opacity:1; transform: none; } }

.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  background: rgba(0,0,0,0.55); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 50%; font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.modal-close:hover { background: var(--accent); }

.modal-banner {
  width: 100%; aspect-ratio: 16/7; background-size: cover; background-position: center;
  border-radius: 12px 12px 0 0; position: relative; background-color: var(--surface2);
}
.modal-banner::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--surface) 0%, transparent 65%);
  border-radius: 12px 12px 0 0;
}
.modal-body { padding: 0 26px 26px; }
.modal-loading { padding: 40px; display: flex; justify-content: center; }
.modal-title { font-size: 1.7rem; font-weight: 800; margin-bottom: 10px; }
.modal-meta { display: flex; align-items: center; gap: 12px; font-size: 0.84rem; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.modal-meta .score { color: #f5c518; font-weight: 700; font-size: 0.95rem; }
.rating-badge { border: 1px solid var(--muted); padding: 2px 7px; border-radius: 3px; font-size: 0.76rem; }
.modal-desc { font-size: 0.93rem; line-height: 1.7; color: #ccc; margin-bottom: 18px; }
.modal-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tmdb-link { color: var(--muted); font-size: 0.78rem; text-decoration: none; transition: color 0.2s; }
.tmdb-link:hover { color: var(--accent2); }

/* ── TRAILER ── */
#trailerWrap { position: fixed; inset: 0; z-index: 400; }
.trailer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.92); }
.trailer-box {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(920px, 95vw); aspect-ratio: 16/9; background: #000; border-radius: 8px; overflow: hidden;
}
.trailer-box iframe { width: 100%; height: 100%; border: none; }
.trailer-close {
  position: absolute; top: -42px; right: 0; background: none; border: none;
  color: #fff; font-size: 1.8rem; cursor: pointer; z-index: 1;
}

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text); padding: 11px 22px; border-radius: 8px; font-size: 0.88rem;
  z-index: 500; white-space: nowrap; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  animation: toastIn 0.28s ease;
}
.toast.hidden { display: none; }
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

.hidden { display: none !important; }

/* ══════════════════════════════════════
   TABLET  (≤ 768px)
══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Nav — hide links, show hamburger */
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: #0a0a0f; border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 12px 4% 16px; gap: 4px; z-index: 99;
  }
  .nav-links.open li { width: 100%; }
  .nav-links.open > li > a {
    display: block; padding: 10px 12px; border-radius: 8px;
    font-size: 0.95rem;
  }
  .nav-links.open .nav-dropdown {
    position: static; transform: none; box-shadow: none;
    border: none; background: rgba(255,255,255,0.04);
    border-radius: 8px; margin: 4px 0 4px 12px; padding: 4px;
    animation: none;
  }
  .nav-links.open .nav-dropdown::before { display: none; }
  .nav-links.open .nav-dropdown.open { display: block; }
  .hamburger { display: block; }

  /* Search — full width when focused */
  .search-wrap input { width: 120px; font-size: 0.82rem; }
  .search-wrap input:focus { width: 160px; }
  .search-suggestions { width: 280px; right: 0; left: auto; }

  /* Hero */
  .hero { height: 60vh; min-height: 360px; padding-bottom: 50px; }
  .hero-content { max-width: 100%; padding: 0 4%; }
  .hero-title { font-size: 1.6rem; }
  .hero-desc { -webkit-line-clamp: 2; line-clamp: 2; font-size: 0.85rem; }
  .hero-genres { display: none; }

  /* Cards */
  .card { flex: 0 0 120px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }

  /* Modal */
  .modal { border-radius: 12px 12px 0 0; max-height: 92vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-body { padding: 0 16px 24px; }
  .modal-title { font-size: 1.2rem; }
  .modal-banner { aspect-ratio: 16/8; }

  /* Player header wraps on small screens */
  .player-header { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .src-btns { gap: 4px; }
  .src-btn { font-size: 0.7rem; padding: 3px 8px; }}

/* ══════════════════════════════════════
   MOBILE  (≤ 480px)
══════════════════════════════════════ */
@media (max-width: 480px) {
  :root { --nav-h: 56px; }

  /* Navbar — logo + hamburger + search icon only */
  .navbar { padding: 0 3%; }
  .logo { font-size: 1.2rem; letter-spacing: 1px; }
  .nav-right { gap: 6px; }
  .search-wrap {
    position: relative;
  }
  .search-wrap input {
    width: 44px; height: 44px; padding: 0 0 0 44px;
    border-color: transparent; background: transparent;
    cursor: pointer; color: transparent; caret-color: var(--text);
  }
  .search-wrap input:focus, .search-wrap input:not(:placeholder-shown) {
    width: 160px; height: 44px; padding: 0 36px 0 14px;
    background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25);
    cursor: text; color: var(--text);
  }
  .search-icon {
    right: auto; left: 12px; pointer-events: auto; cursor: pointer;
  }
  .search-wrap input:focus ~ .search-icon,
  .search-wrap input:not(:placeholder-shown) ~ .search-icon {
    left: auto; right: 11px;
  }
  .search-suggestions { width: calc(100vw - 24px); right: 0; left: auto; }

  /* Hero — compact, centered */
  .hero {
    height: 55vh; min-height: 300px;
    align-items: center; padding-bottom: 0;
  }
  .hero-overlay {
    background: linear-gradient(to top, rgba(10,10,15,0.95) 0%, rgba(0,0,0,0.5) 60%, rgba(0,0,0,0.3) 100%);
  }
  .hero-content {
    max-width: 100%; padding: 0 4%;
    text-align: center; display: flex; flex-direction: column; align-items: center;
  }
  .hero-title { font-size: 1.4rem; margin-bottom: 8px; }
  .hero-meta { justify-content: center; font-size: 0.78rem; gap: 8px; margin-bottom: 10px; }
  .hero-desc { display: none; }
  .hero-genres { display: none; }
  .hero-badge { display: none; }
  .hero-actions { justify-content: center; gap: 8px; }
  .btn { padding: 10px 20px; font-size: 0.82rem; }

  /* Bottom nav bar */
  body { padding-bottom: 60px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: #0d0d14; border-top: 1px solid rgba(255,255,255,0.08);
    height: 58px;
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; cursor: pointer;
    color: var(--muted); font-size: 0.6rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    border: none; background: none; transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item svg { width: 20px; height: 20px; }
  .bottom-nav-item.active { color: var(--accent); }
  .bottom-nav-item:hover { color: var(--text); }

  /* Hide desktop nav entirely on mobile */
  .nav-left .nav-links { display: none !important; }
  .hamburger { display: none; }

  /* Main padding */
  .main { padding: 0 3% 70px; }
  .section { margin-bottom: 32px; }
  .section-title { font-size: 0.95rem; }

  /* Cards — 2 columns in grid, smaller in rows */
  .card { flex: 0 0 110px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .card-title { font-size: 0.76rem; }
  .card-meta { font-size: 0.66rem; }
  .card-info { padding: 6px 8px 8px; }

  /* Always show card overlay on mobile (no hover) */
  .card-overlay { opacity: 1; background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 45%); }
  .play-btn { width: 30px; height: 30px; font-size: 0.75rem; }
  .wl-mini { width: 26px; height: 26px; font-size: 0.75rem; }

  /* Modal — full screen bottom sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 16px 16px 0 0; max-height: 88vh;
    animation: slideUp 0.3s ease;
  }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .modal-banner { aspect-ratio: 16/9; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 0 14px 30px; }
  .modal-title { font-size: 1.1rem; }
  .modal-desc { font-size: 0.85rem; -webkit-line-clamp: 4; line-clamp: 4; }
  .modal-actions { gap: 8px; }
  .modal-actions .btn { flex: 1; justify-content: center; padding: 11px 10px; font-size: 0.82rem; }

  /* Player — full screen */
  .player-header { padding: 0 10px; height: 48px; }
  .player-title-main { font-size: 0.78rem; }
  .src-btn { font-size: 0.68rem; padding: 4px 9px; }
  .ep-picker-inner { gap: 12px; }
  .ep-label { font-size: 0.76rem; }
  .server-panel { width: calc(100vw - 24px); right: 12px; }
  .server-grid { grid-template-columns: 1fr 1fr; }

  /* Episode picker — full width at bottom */
  .episode-picker {
    left: 8px; right: 8px; bottom: 8px;
    justify-content: center; flex-wrap: wrap;
  }

  /* Search header stacks */
  .search-header { flex-direction: column; align-items: flex-start; }
  .search-filters { width: 100%; overflow-x: auto; padding-bottom: 4px; flex-wrap: nowrap; }
  .filter-pill { white-space: nowrap; }

  /* Toast — wider */
  .toast { width: calc(100% - 32px); text-align: center; white-space: normal; bottom: 70px; }

  /* Watchlist header */
  .watchlist-header { flex-wrap: wrap; gap: 8px; }
}
