/* DuckFlix Web — Dark Streaming Theme */

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: #1a1a3e;
  --bg-hover: #252550;
  --bg-input: #1e1e40;
  --text-primary: #e8e8f0;
  --text-secondary: #9090b0;
  --text-muted: #606080;
  --accent: #7c5cfc;
  --accent-hover: #6a48e0;
  --accent-glow: rgba(124, 92, 252, 0.3);
  --success: #4caf50;
  --warning: #ff9800;
  --error: #f44336;
  --border: #2a2a50;
  --nav-height: 56px;
  --bottom-nav-height: 60px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { display: block; }
input, button, select { font-size: 16px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== TOP NAV ===== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-right: 32px;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active { color: var(--text-primary); background: var(--bg-card); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius);
  font-size: 18px;
  transition: all 0.2s;
}
.nav-icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

#logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  transition: all 0.2s;
}
#logout-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }

/* ===== BOTTOM NAV (Mobile) ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(10, 10, 26, 0.98);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 10px;
  text-decoration: none;
  padding: 6px 12px;
  transition: color 0.2s;
}
.bottom-nav-item .nav-icon { font-size: 22px; }
.bottom-nav-item.active { color: var(--accent); }

/* ===== APP CONTAINER ===== */
#app {
  min-height: 100vh;
  padding-top: var(--nav-height);
}

.player-mode .top-nav,
.player-mode .bottom-nav { display: none !important; }
.player-mode #app { padding-top: 0; padding-bottom: 0; }

/* ===== LOGIN ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-height));
  padding: 20px;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.login-logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--accent); }
.login-input::placeholder { color: var(--text-muted); }

.login-btn {
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s;
}
.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  color: var(--error);
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

/* ===== HOME PAGE ===== */
.home-page {
  padding: 24px 20px 80px;
  max-width: 1400px;
  margin: 0 auto;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.home-section {
  margin-bottom: 32px;
}

/* ===== HORIZONTAL RAIL ===== */
.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail.dragging { scroll-behavior: auto; cursor: grabbing; user-select: none; }

/* ===== POSTER CARD ===== */
.poster-card {
  flex: 0 0 auto;
  width: 140px;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.poster-card:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.poster-img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.poster-info {
  padding: 8px 4px 4px;
}

.poster-title {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poster-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.rating-badge {
  font-weight: 600;
}

/* Progress bar on continue watching cards */
.progress-bar-container {
  position: absolute;
  bottom: 50px;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.15);
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  transition: width 0.3s;
}

/* Download overlay on cards */
.download-overlay {
  position: absolute;
  bottom: 50px;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: rgba(0,0,0,0.75);
  color: var(--accent);
  font-size: 10px;
  text-align: center;
  font-weight: 500;
}
.download-overlay.failed {
  color: var(--error);
}
.dismiss-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  margin-left: 4px;
  padding: 0 4px;
}

/* ===== POSTER GRID ===== */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.poster-grid .poster-card {
  width: 100%;
}

.load-more-btn {
  display: block;
  margin: 20px auto 0;
  padding: 10px 28px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: background 0.2s;
}
.load-more-btn:hover { background: var(--bg-hover); }

/* ===== SEARCH PAGE ===== */
.search-page {
  padding: 24px 20px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.search-bar {
  position: relative;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  pointer-events: none;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.2s;
}
.filter-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ===== BROWSE / DISCOVER ===== */
.browse-page {
  padding: 24px 20px 80px;
  max-width: 1400px;
  margin: 0 auto;
}

.browse-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.browse-tab {
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.browse-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.browse-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

.filter-panel {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-select {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  min-width: 130px;
}
.filter-select:focus { border-color: var(--accent); }
.filter-select option { background: var(--bg-secondary); }

/* ===== DETAIL PAGE ===== */
.detail-page {
  position: relative;
}

.detail-backdrop {
  width: 100%;
  height: 50vh;
  min-height: 300px;
  object-fit: cover;
  position: relative;
}

.detail-backdrop-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50vh;
  min-height: 300px;
  background: linear-gradient(to bottom, rgba(10,10,26,0.3) 0%, var(--bg-primary) 100%);
  pointer-events: none;
}

.detail-content {
  position: relative;
  margin-top: -120px;
  padding: 0 20px 80px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.detail-header {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.detail-poster {
  width: 180px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  aspect-ratio: 2/3;
  object-fit: cover;
  background: var(--bg-card);
}

.detail-info {
  flex: 1;
  min-width: 0;
}

.detail-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.detail-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.detail-genres {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.genre-tag {
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.detail-overview {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-width: 700px;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.play-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s;
}
.play-btn:hover { background: var(--accent-hover); }

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.2s;
}
.action-btn:hover { background: var(--bg-hover); border-color: var(--text-secondary); }
.action-btn.active { border-color: var(--accent); color: var(--accent); }

/* ===== CAST RAIL ===== */
.cast-card {
  flex: 0 0 auto;
  width: 100px;
  text-align: center;
  cursor: pointer;
}

.cast-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 6px;
  background: var(--bg-card);
}

.cast-name {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

.cast-character {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== EPISODES ===== */
.episodes-section {
  margin-top: 24px;
}

.season-select {
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
}
.season-select:focus { border-color: var(--accent); }

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.episode-card {
  display: flex;
  gap: 14px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  align-items: center;
}
.episode-card:hover { background: var(--bg-hover); border-color: var(--accent); }

.episode-thumb {
  width: 160px;
  height: 90px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-card);
}

.episode-info { flex: 1; min-width: 0; }

.episode-number {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.episode-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.episode-date {
  font-size: 12px;
  color: var(--text-muted);
}

.episode-overview {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-watched {
  color: var(--success);
  font-size: 18px;
  flex-shrink: 0;
}

.episode-progress {
  width: 50px;
  flex-shrink: 0;
}
.episode-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.episode-progress-fill {
  height: 100%;
  background: var(--accent);
}

/* ===== PERSON PAGE ===== */
.person-page {
  padding: 24px 20px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.person-header {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
}

.person-photo {
  width: 150px;
  height: 225px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background: var(--bg-card);
  flex-shrink: 0;
}

.person-info h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.person-bio {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 600px;
}

.person-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== LIVE TV ===== */
.livetv-page {
  padding: 24px 20px 80px;
  max-width: 1400px;
  margin: 0 auto;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.channel-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  align-items: center;
}
.channel-card:hover { background: var(--bg-hover); border-color: var(--accent); }
.channel-card.active { border-color: var(--accent); background: var(--bg-card); }

.channel-logo {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--bg-card);
  flex-shrink: 0;
}

.channel-info { flex: 1; min-width: 0; }

.channel-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-program {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-fav-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  padding: 4px;
  transition: color 0.2s;
}
.channel-fav-btn.favorited { color: var(--warning); }

/* ===== EPG TIMELINE ===== */
.epg-container {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  max-height: calc(100vh - 280px);
  position: relative;
}

.epg-time-ruler {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  min-height: 32px;
}

.epg-corner {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 140px;
  max-width: 140px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.epg-time-labels {
  position: relative;
  flex: 1;
}

.epg-time-marker {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-left: 8px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

.epg-body {
  position: relative;
}

.epg-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 0 6px var(--accent-glow);
}

.epg-now-dot {
  position: absolute;
  top: -6px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

.epg-row {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  min-height: 52px;
}
.epg-row:hover .epg-channel-info { background: var(--bg-hover); }

.epg-channel-info {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 140px;
  max-width: 140px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.epg-channel-info:hover { background: var(--bg-hover); }

.epg-channel-info .channel-logo {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  flex-shrink: 0;
}

.epg-channel-info .channel-name {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-programs-track {
  position: relative;
  flex: 1;
  min-height: 52px;
}

.epg-program {
  position: absolute;
  top: 3px;
  height: calc(100% - 6px);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  padding: 4px 8px;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.epg-program:hover { background: rgba(255,255,255,0.09); }

.epg-program.now {
  background: rgba(124, 92, 252, 0.12);
  border-color: rgba(124, 92, 252, 0.4);
}
.epg-program.now:hover { background: rgba(124, 92, 252, 0.2); }

.epg-program-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.epg-program-time {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.3;
}

.epg-program.empty {
  color: var(--text-muted);
  font-size: 11px;
  background: none;
  border: 1px dashed rgba(255,255,255,0.06);
}

.epg-no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 14px;
}

.group-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ===== ERROR / LOADING STATES ===== */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 20px;
}
.error-page h2 {
  font-size: 20px;
  margin-bottom: 8px;
}
.error-page p {
  color: var(--text-secondary);
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + 12px);
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .top-nav .nav-links { display: none; }
  #logout-btn { display: none; }
  .bottom-nav { display: flex; }
  #app { padding-bottom: var(--bottom-nav-height); }

  .home-page { padding: 16px 12px 100px; }
  .poster-card { width: 115px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }

  .detail-header { flex-direction: column; align-items: center; text-align: center; }
  .detail-poster { width: 140px; }
  .detail-title { font-size: 22px; }
  .detail-actions { justify-content: center; }
  .detail-content { margin-top: -80px; }

  .episode-thumb { width: 120px; height: 68px; }

  .person-header { flex-direction: column; align-items: center; text-align: center; }

  .search-page, .browse-page, .livetv-page { padding: 16px 12px 100px; }
}

@media (max-width: 480px) {
  .poster-card { width: 100px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
  .poster-title { font-size: 11px; }
  .episode-card { flex-direction: column; align-items: stretch; }
  .episode-thumb { width: 100%; height: auto; aspect-ratio: 16/9; }
  .channel-grid { grid-template-columns: 1fr; }
  .epg-corner, .epg-channel-info { min-width: 100px; max-width: 100px; }
  .epg-channel-info .channel-logo { width: 22px; height: 22px; }
  .epg-channel-info .channel-name { font-size: 10px; }
  .epg-container { max-height: calc(100vh - 320px); }
}

@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
}
