/*
Theme Name: AnimeVault
Theme URI: https://ai.apijav.com
Author: AnimeVault
Description: A full-featured anime streaming WordPress theme powered by the AnimeVault API. Includes home page, anime detail pages, episode player, search, browse, and genre pages.
Version: 1.5.7
License: GNU General Public License v2 or later
Text Domain: animevault
Tags: anime, streaming, dark, video, entertainment
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --bg-primary:    #0a0a0f;
  --bg-secondary:  #111118;
  --bg-card:       #16161f;
  --bg-elevated:   #1d1d28;
  --accent:        #e63946;
  --accent-dim:    rgba(230, 57, 70, 0.15);
  --accent-glow:   rgba(230, 57, 70, 0.4);
  --gold:          #f4a261;
  --text-primary:  #f0f0f5;
  --text-secondary:#a0a0b8;
  --text-muted:    #5a5a7a;
  --border:        rgba(255,255,255,0.07);
  --border-hover:  rgba(255,255,255,0.15);
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --shadow-card:   0 4px 24px rgba(0,0,0,0.5);
  --card-min-width: 155px;
  --shadow-glow:   0 0 30px rgba(230,57,70,0.25);
  --font-display:  'Cinzel', serif;
  --font-ui:       'DM Sans', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
  --transition:    0.2s cubic-bezier(0.4,0,0.2,1);
  --header-h:      64px;
  --api-base:      'https://ai.apijav.com';
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(230,57,70,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(244,162,97,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
ul, ol { list-style: none; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.section-title {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.2em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-wrap {
  position: relative;
  z-index: 1;
  padding-top: var(--header-h);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ============================================================
   HEADER / NAV
   ============================================================ */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
}
#site-header .container {
  display: flex;
  align-items: center;
  gap: 32px;
  width: 100%;
}

.site-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.site-logo span { color: var(--accent); }

/* Search bar in header */
.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.header-search input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 9px 48px 9px 18px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search button {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: color var(--transition);
  display: flex;
}
.header-search button:hover { color: var(--accent); }

/* Search autocomplete */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: none;
  z-index: 200;
}
.search-suggestions.active { display: block; }
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
}
.suggestion-item:hover { background: var(--border); }
.suggestion-item img { width: 36px; height: 50px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.suggestion-item .s-info .s-name { font-size: 0.85rem; font-weight: 600; }
.suggestion-item .s-info .s-meta { font-size: 0.75rem; color: var(--text-muted); }

/* Main nav */
.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}
.main-nav a:hover, .main-nav a.active { color: var(--text-primary); background: var(--border); }

.nav-dropdown { position: relative; }
.nav-dropdown > a::after { content: ' ▾'; font-size: 0.7rem; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 8px; /* gap bridge — keeps menu open while cursor travels */
  background: transparent;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--transition), transform var(--transition);
}
.dropdown-menu-inner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  min-width: 200px;
}
/* Genres dropdown: multi-column grid like anikai */
#nav-genres-list.dropdown-menu-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 2px;
  min-width: 480px;
}
.nav-dropdown:hover .dropdown-menu,
.dropdown-menu.open { opacity: 1; pointer-events: all; transform: none; }
.dropdown-menu a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.dropdown-menu a:hover { color: var(--text-primary); background: var(--border); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  margin-left: auto;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: var(--transition); }

/* Mobile nav */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 999;
  padding: 80px 24px 24px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  border: 1px solid var(--border);
}
.mobile-nav .close-mobile {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 1.5rem;
  color: var(--text-secondary);
  background: none;
  border: none;
}

@media (max-width: 768px) {
  .main-nav { display: none; }
  .hamburger { display: flex; }
  .header-search { max-width: 200px; }
}

/* ============================================================
   PROVIDER SWITCHER
   ============================================================ */
.provider-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}
.provider-bar .container { display: flex; align-items: center; gap: 12px; }
.provider-bar span { font-size: 0.75rem; color: var(--text-muted); }
.provider-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.provider-btn.active, .provider-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   ANIME CARD
   ============================================================ */
.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width, 155px), 1fr));
  gap: 16px;
}

/* Home page sections: cards fill available space naturally */
.home-grid {
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width, 155px), 1fr));
}


.anime-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.anime-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.card-poster {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg-elevated);
}
.card-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.4s ease;
  image-rendering: auto;
}
.anime-card:hover .card-poster img { transform: scale(1.05); }

.card-poster .ep-badge {
  position: absolute;
  bottom: 8px; left: 8px;
  display: flex;
  gap: 4px;
}
.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.badge-sub { background: rgba(0,200,120,0.9); color: #fff; }
.badge-dub { background: rgba(80,120,255,0.9); color: #fff; }
.badge-type { background: rgba(0,0,0,0.75); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-filler { background: rgba(100,100,100,0.8); color: #ccc; }
.badge-new { background: var(--accent); color: #fff; }

.card-poster .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
}
.anime-card:hover .overlay { opacity: 1; }

.card-body { padding: 10px 12px 12px; }
.card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  font-family: var(--font-ui);
}
.card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ============================================================
   SPOTLIGHT / HERO  (9anime-style)
   ============================================================ */
.spotlight-section {
  position: relative;
  height: clamp(360px, 52vh, 580px);
  overflow: hidden;
  margin-bottom: 40px;
}
.spotlight-slides { position: relative; width: 100%; height: 100%; }
.spotlight-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
.spotlight-slide.active { opacity: 1; pointer-events: auto; }

/* Full-bleed blurred background */
.spotlight-bg {
  position: absolute;
  inset: 0;
}
.spotlight-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: blur(0px) brightness(0.55);
  transform: scale(1.04);
}
.spotlight-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10,10,15,0.92) 0%, rgba(10,10,15,0.55) 55%, rgba(10,10,15,0.15) 100%),
    linear-gradient(0deg, rgba(10,10,15,0.85) 0%, transparent 35%);
}

/* Inner layout: info left, poster right */
.spotlight-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 60px;
  gap: 32px;
}
.spotlight-info {
  flex: 1;
  min-width: 0;
  z-index: 1;
}
.spotlight-poster-wrap {
  flex-shrink: 0;
  width: clamp(120px, 14vw, 190px);
  aspect-ratio: 2/3;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
  border: 2px solid rgba(255,255,255,0.12);
  z-index: 1;
}
.spotlight-poster-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.spotlight-rank {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}
.spotlight-title {
  font-size: clamp(1.5rem, 3.2vw, 2.6rem);
  font-family: var(--font-display);
  margin-bottom: 12px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
  line-height: 1.2;
}
.spotlight-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.sp-meta-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.sp-genre-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 2px 10px;
}
.spotlight-desc {
  font-size: 0.86rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
  max-width: 500px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 22px;
}
.spotlight-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn-watch {
  background: var(--accent);
  color: #fff;
  padding: 11px 26px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.btn-watch:hover { background: #c82333; box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-info {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  border: 1px solid var(--border-hover);
  transition: background var(--transition);
}
.btn-info:hover { background: rgba(255,255,255,0.18); }

/* Arrow buttons */
.sp-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  backdrop-filter: blur(6px);
}
.sp-arrow:hover { background: var(--accent); transform: translateY(-50%) scale(1.08); }
.sp-arrow-prev { left: 16px; }
.sp-arrow-next { right: 16px; }

/* Dots */
.spotlight-dots {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  z-index: 5;
}
.spotlight-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: all var(--transition);
  cursor: pointer;
}
.spotlight-dot.active { background: var(--accent); width: 24px; border-radius: 4px; }

@media (max-width: 768px) {
  .spotlight-section { height: clamp(300px, 55vw, 420px); }
  .spotlight-inner { padding: 16px 20px; gap: 16px; }
  .spotlight-poster-wrap { width: clamp(80px, 22vw, 120px); }
  .spotlight-title { font-size: clamp(1.1rem, 5vw, 1.6rem); }
  .spotlight-desc { -webkit-line-clamp: 2; font-size: 0.8rem; }
  .btn-watch, .btn-info { padding: 9px 16px; font-size: 0.82rem; }
  .sp-arrow { width: 34px; height: 34px; font-size: 1.3rem; }
  .sp-arrow-prev { left: 6px; }
  .sp-arrow-next { right: 6px; }
}
@media (max-width: 480px) {
  .spotlight-poster-wrap { display: none; }
  .spotlight-inner { padding: 16px; }
  .spotlight-desc { display: none; }
}

/* ============================================================
   TOP 10 SECTION
   ============================================================ */
.top10-section { margin-bottom: 40px; }
.top10-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.top10-tab {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.top10-tab.active, .top10-tab:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.top10-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.top10-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.top10-item:hover { border-color: var(--accent); transform: translateX(4px); }
.top10-rank {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--border);
  width: 40px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}
.top10-item:nth-child(1) .top10-rank { color: var(--gold); }
.top10-item:nth-child(2) .top10-rank { color: #c0c0c0; }
.top10-item:nth-child(3) .top10-rank { color: #cd7f32; }
.top10-poster { width: 44px; height: 60px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.top10-info { flex: 1; overflow: hidden; }
.top10-name { font-size: 0.83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.top10-eps { font-size: 0.72rem; color: var(--text-muted); }

/* ============================================================
   LOADING STATES
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card { aspect-ratio: 2/3; border-radius: var(--radius-md); }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.short { width: 60%; }

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.section-loader { text-align: center; padding: 48px; color: var(--text-muted); }

/* ============================================================
   ANIME DETAIL PAGE
   ============================================================ */
.anime-hero {
  position: relative;
  padding: 40px 0 32px;
  overflow: hidden;
}
.anime-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: blur(40px) brightness(0.25);
  transform: scale(1.1);
}
.anime-hero .container { position: relative; z-index: 1; }

.anime-detail-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}

/* Mobile: side-by-side — small poster left, info right */
@media (max-width: 640px) {
  .anime-detail-grid {
    grid-template-columns: 120px 1fr;
    gap: 16px;
    align-items: start;
  }
}

.detail-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.detail-info { flex: 1; }
.detail-title {
  font-size: clamp(1.4rem, 3.5vw, 2.4rem);
  margin-bottom: 6px;
}
.detail-jname {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-family: var(--font-ui);
}
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.detail-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.detail-badge.highlight { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.stat-item { text-align: center; }
.stat-value { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }

.detail-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}
.detail-desc.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-expand {
  font-size: 0.8rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  margin-bottom: 20px;
  padding: 0;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.tag {
  padding: 4px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

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

/* ============================================================
   EPISODE LIST
   ============================================================ */
.episode-section { margin-top: 32px; }
.ep-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ep-search-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  width: 180px;
  transition: border-color var(--transition);
}
.ep-search-input:focus { border-color: var(--accent); }
.ep-page-size {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
}

.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.ep-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.ep-btn:hover { border-color: var(--accent); color: var(--accent); }
.ep-btn.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(var(--accent-rgb, 99,102,241), 0.45);
  position: relative;
}
.ep-btn.current::after {
  content: '▶';
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.45rem;
  opacity: 0.85;
  animation: ep-playing-pulse 1.4s ease-in-out infinite;
}
@keyframes ep-playing-pulse {
  0%, 100% { opacity: 0.85; }
  50%       { opacity: 0.3; }
}
.ep-btn.filler { opacity: 0.5; }
.ep-btn .ep-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-btn:hover .ep-tooltip { opacity: 1; }

.ep-pagination { display: flex; gap: 8px; flex-wrap: wrap; }
.ep-page-btn {
  padding: 6px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.ep-page-btn.active, .ep-page-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   VIDEO PLAYER PAGE
   ============================================================ */
.player-page { background: #000; min-height: 100vh; }
.player-wrap {
  position: relative;
  width: 100%;
  background: #000;
}
.player-wrap iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  display: block;
  max-height: 75vh; /* safety cap so it never overflows on very wide screens */
}
.player-sidebar { position: relative; z-index: 1; }

.source-selector {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.source-selector span { font-size: 0.8rem; color: var(--text-muted); margin-right: 4px; }
.source-btn {
  padding: 6px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.source-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.source-btn:hover:not(.active) { border-color: var(--border-hover); color: var(--text-primary); }

.ep-nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.ep-nav-btn {
  padding: 8px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ep-nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.ep-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ep-title-display {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-primary);
  text-align: center;
  font-weight: 600;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar { display: flex; flex-direction: column; gap: 24px; }

.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.sidebar-card .section-title { font-size: 0.95rem; }

.sidebar-list .anime-card {
  display: flex;
  flex-direction: row;
  gap: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.sidebar-list .card-poster {
  width: 60px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 6px;
}
.sidebar-list .card-body { padding: 4px 0; }

/* Genre cloud */
.genre-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.genre-pill {
  padding: 5px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.genre-pill:hover, .genre-pill.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   BROWSE / SEARCH PAGE
   ============================================================ */
.browse-filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 28px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  align-items: flex-start;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-group { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.filter-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.filter-options { display: flex; flex-wrap: wrap; gap: 4px; }
.filter-opt {
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-opt:hover, .filter-opt.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  min-width: 160px;
}
.filter-apply {
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  transition: background var(--transition);
  border: none;
  cursor: pointer;
}
.filter-apply:hover { background: #c82333; }
.filter-reset {
  padding: 10px 18px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: pointer;
}
.filter-reset:hover { border-color: var(--border-hover); color: var(--text-primary); }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.results-count { font-size: 0.85rem; color: var(--text-muted); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0 10px;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ============================================================
   AZ LIST
   ============================================================ */
.az-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.az-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.az-btn:hover, .az-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   ERROR / EMPTY STATES
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.88rem; }

.error-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--text-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 340px;
}
.error-toast.show { transform: translateY(0); opacity: 1; }

/* ============================================================
   FOOTER
   ============================================================ */
#site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: 64px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
/* Mobile: brand spans full width, Browse + Genres sit side by side */
@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px 20px;
  }
  .footer-grid .footer-col:first-child {
    grid-column: 1 / -1;
  }
}
.footer-col h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-family: var(--font-display);
}
.footer-col a {
  display: block;
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  transition: color var(--transition);
}
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: gap;
  gap: 12px;
}
.footer-bottom p { font-size: 0.78rem; color: var(--text-muted); }

/* ============================================================
   UTILITY
   ============================================================ */
.mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.fw-bold { font-weight: 700; }
.text-center { text-align: center; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   SMOOTH SECTION REVEAL
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ── Player loading overlay ── */
.av-player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 2;
  aspect-ratio: 16/9;
}
.av-player-loading .av-spin {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: #6c63ff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   WATCH PAGE LAYOUT
   ══════════════════════════════════════════════════════════════ */

/* Root layout: full-width player column + fixed sidebar */
/* ══════════════════════════════════════════════════════════════
   WATCH PAGE — 3-column layout v1.5.3
   Desktop: [episodes 220px] [player+controls+servers flex] [recommended 260px]
   Mobile:  player → controls → servers → episodes → anime info → recommended
   ══════════════════════════════════════════════════════════════ */

.watch-page-layout {
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  grid-template-areas: "sidebar main right";
  gap: 0;
  width: 100%;
  align-items: start;
}

/* ═══ LEFT SIDEBAR — Episodes ═══ */
.watch-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: var(--header-h, 70px);
  height: calc(100vh - var(--header-h, 70px));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.watch-sidebar::-webkit-scrollbar { width: 3px; }
.watch-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.av-sidebar-now-playing {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.av-snp-thumb { width: 44px; height: 62px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.av-snp-info { flex: 1; min-width: 0; }
.av-snp-title { font-size: .75rem; font-weight: 700; color: var(--text-primary); line-height: 1.3; margin-bottom: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.av-snp-ep { font-size: .67rem; color: var(--text-muted); }

.av-sidebar-episodes { flex: 1; min-height: 0; }
.av-sidebar-episodes .episode-section { margin: 0; }
.av-sidebar-episodes .section-title { padding: 8px 10px 5px; margin: 0; font-size: .77rem; border-bottom: 1px solid var(--border); }
.av-sidebar-episodes .ep-controls { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.av-sidebar-episodes .ep-grid { padding: 5px 6px 8px; }
.av-sidebar-episodes .ep-btn { min-width: 32px; height: 32px; font-size: .72rem; }

/* ═══ CENTER — Player + controls + servers + info ═══ */
.watch-main {
  grid-area: main;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

/* Player box — 16:9, never taller than 60vh */
.watch-player-box {
  background: #000;
  width: 100%;
  flex-shrink: 0;
}
.watch-player-box .player-wrap { border-radius: 0; }
#player-iframe,
.watch-player-box .player-wrap iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 60vh;
  border: none;
}

/* Controls bar */
.av-watch-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.av-wc-left, .av-wc-right { display: flex; align-items: center; gap: 3px 8px; flex-wrap: wrap; }
.av-wc-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 4px; font-size: .73rem;
  color: var(--text-secondary); background: transparent;
  border: 1px solid var(--border); cursor: pointer;
  transition: color .15s, border-color .15s; white-space: nowrap;
}
.av-wc-btn:hover { color: #fff; border-color: var(--accent); }
.av-wc-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .73rem; color: var(--text-secondary); cursor: pointer;
  user-select: none; white-space: nowrap;
}
.av-wc-toggle input[type="checkbox"] { accent-color: var(--accent); width: 12px; height: 12px; }
.av-wc-toggle--skip span { color: #f59e0b; font-weight: 600; }
.av-wc-nav {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 4px; font-size: .73rem;
  color: var(--text-secondary); background: transparent;
  border: 1px solid var(--border); cursor: pointer;
  transition: color .15s, border-color .15s; white-space: nowrap;
}
.av-wc-nav:hover { color: #fff; border-color: var(--accent); }
.av-wc-nav:disabled { opacity: .3; cursor: not-allowed; }
.av-wc-addlist {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 4px; font-size: .73rem;
  color: var(--text-secondary); background: transparent;
  border: 1px solid var(--border); cursor: pointer;
  transition: color .15s, border-color .15s; white-space: nowrap;
}
.av-wc-addlist:hover { color: #fff; border-color: #818cf8; }

/* Server notice */
.av-watch-server-notice {
  padding: 8px 12px; font-size: .78rem;
  color: var(--text-secondary); background: var(--bg-secondary);
  border-bottom: 1px solid var(--border); text-align: center; flex-shrink: 0;
}

/* Server buttons */
.av-watch-server-box {
  padding: 8px 12px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}

/* Anime info */
.av-watch-info-wrap { padding: 14px; display: flex; flex-direction: column; gap: 16px; }
/* Mobile copy inside av-watch-mobile-only — hidden on desktop */
.av-watch-info-wrap--mobile { display: none; }
.av-watch-anime-info { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.av-wai-poster-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.av-wai-poster { width: 64px; height: 90px; object-fit: cover; border-radius: 5px; flex-shrink: 0; }
.av-wai-meta { flex: 1; min-width: 0; }
.av-wai-title { font-size: .92rem; font-weight: 700; color: var(--text-primary); line-height: 1.3; margin: 0 0 3px; }
.av-wai-synonyms { font-size: .68rem; color: var(--text-muted); margin: 0 0 5px; line-height: 1.4; }
.av-wai-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.av-wai-badge { font-size: .6rem; padding: 1px 5px; border-radius: 3px; background: rgba(255,255,255,.07); color: var(--text-secondary); border: 1px solid var(--border); font-weight: 600; letter-spacing: .04em; }
.av-wai-badge-cc { color: #4ade80; border-color: #4ade80; }
.av-wai-desc { font-size: .78rem; color: var(--text-secondary); line-height: 1.7; margin: 0 0 10px; }
.av-wai-more { color: var(--accent); text-decoration: none; }
.av-wai-details { display: flex; flex-direction: column; gap: 4px; }
.av-wai-row { display: flex; gap: 6px; font-size: .75rem; color: var(--text-secondary); flex-wrap: wrap; }
.av-wai-row > span:first-child { color: var(--text-muted); min-width: 64px; flex-shrink: 0; }
.av-wai-link { color: var(--accent); text-decoration: none; }
.av-wai-link:hover { text-decoration: underline; }
.av-wai-genres { display: flex; flex-wrap: wrap; gap: 3px; }

/* Mobile-only block — hidden on desktop */
.av-watch-mobile-only { display: none; }

/* Compact episode section inside mobile block */
.av-watch-mobile-only .episode-section {
  margin-top: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border);
}
.av-watch-mobile-only .episode-section .section-title {
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.av-watch-mobile-only .ep-controls {
  gap: 8px;
  margin-bottom: 10px;
}
.av-watch-mobile-only .ep-search-input {
  width: 100%;
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: 0.8rem;
}
.av-watch-mobile-only .ep-page-size {
  padding: 6px 8px;
  font-size: 0.78rem;
}
.av-watch-mobile-only .ep-grid {
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px;
}
.av-watch-mobile-only .ep-btn {
  font-size: 0.75rem;
}
/* Comments slot in mobile block */
#av-mobile-comments { margin-top: 20px; }
#av-mobile-comments .container { padding: 0; margin: 0; width: 100%; max-width: 100%; }
/* Recommended in mobile block spacing */
#av-mobile-recommended { margin-top: 20px; }

/* ═══ RIGHT SIDEBAR — Recommended ═══ */
.watch-right-sidebar {
  grid-area: right;
  position: sticky;
  top: var(--header-h, 70px);
  height: calc(100vh - var(--header-h, 70px));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
}
.watch-right-sidebar::-webkit-scrollbar { width: 3px; }
.watch-right-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.av-right-now-playing {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px;
}
.av-rnp-thumb { width: 52px; height: 72px; object-fit: cover; border-radius: 5px; flex-shrink: 0; }
.av-rnp-info { flex: 1; min-width: 0; }
.av-rnp-title { font-size: .78rem; font-weight: 700; color: var(--text-primary); line-height: 1.3; margin-bottom: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.av-rnp-ep { font-size: .67rem; color: var(--text-muted); }

.av-right-recommended .section-title { font-size: .8rem; margin-bottom: 8px; }
.av-right-recommended .watch-related-list { margin: 0; }

/* Shared watch-related card styles */
.watch-related-list { display: flex; flex-direction: column; gap: 8px; }
.watch-related-item { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; border-radius: 6px; padding: 5px; transition: background var(--transition); }
.watch-related-item:hover { background: var(--bg-elevated); }
.watch-related-thumb-wrap { position: relative; width: 52px; height: 70px; flex-shrink: 0; border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.watch-related-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.watch-related-badges { position: absolute; bottom: 2px; left: 2px; right: 2px; display: flex; flex-direction: column; gap: 1px; }
.watch-related-badges .badge { font-size: .5rem; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-related-info { flex: 1; min-width: 0; }
.watch-related-title { font-size: .75rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 3px; }
.watch-related-item:hover .watch-related-title { color: var(--accent); }
.watch-related-meta { font-size: .67rem; color: var(--text-muted); }

/* ═══ THEATRE MODE ═══ */
.av-expand-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 1000; cursor: pointer; }
.av-theatre-mode {
  position: fixed !important; inset: 0 !important; z-index: 1001 !important;
  display: flex !important; flex-direction: column !important;
  max-width: 100% !important; padding: 0 !important; margin: 0 !important;
  overflow: hidden !important; background: #000 !important;
  grid-template-columns: unset !important; grid-template-areas: unset !important;
}
.av-theatre-mode .watch-sidebar,
.av-theatre-mode .watch-right-sidebar { display: none !important; }
.av-theatre-mode .watch-main { display: flex !important; flex-direction: column !important; width: 100% !important; height: 100% !important; overflow: hidden !important; border: none !important; }
.av-theatre-mode .watch-player-box { flex: 1 !important; min-height: 0 !important; display: flex !important; flex-direction: column !important; }
.av-theatre-mode .watch-player-box .player-wrap { flex: 1 !important; height: 100% !important; }
.av-theatre-mode #player-iframe,
.av-theatre-mode .watch-player-box .player-wrap iframe { width: 100% !important; height: 100% !important; max-height: none !important; aspect-ratio: unset !important; }
.av-theatre-mode .av-watch-controls { flex-shrink: 0 !important; background: #111 !important; border-top: 1px solid var(--border) !important; border-bottom: none !important; }
.av-theatre-mode .av-watch-server-notice,
.av-theatre-mode .av-watch-server-box,
.av-theatre-mode .av-watch-info-wrap,
.av-theatre-mode .av-watch-info-wrap--mobile,
.av-theatre-mode .av-watch-mobile-only { display: none !important; }
body.av-theatre-active { overflow: hidden !important; }

/* Light mode */
.av-light-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 999; pointer-events: none; }
body.av-light-mode .watch-player-box { position: relative; z-index: 1000; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1200px) {
  .watch-page-layout { grid-template-columns: 200px 1fr 240px; }
}

@media (max-width: 1024px) {
  /* Drop right sidebar — recommended moves to mobile block */
  .watch-page-layout { grid-template-columns: 200px 1fr; grid-template-areas: "sidebar main"; }
  .watch-right-sidebar { display: none; }
  .av-watch-mobile-only { display: block; }
  .av-watch-mobile-only .av-watch-related { display: block; }
  /* Show anime details inside mobile block, hide the desktop copy */
  .av-watch-info-wrap--mobile { display: flex; flex-direction: column; gap: 16px; padding: 14px; }
  .av-watch-info-wrap { display: none; }
}

@media (max-width: 768px) {
  /* Single column — episodes sidebar also hidden */
  .watch-page-layout { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .watch-sidebar { display: none; }
  .watch-main { border-right: none; }
  #player-iframe,
  .watch-player-box .player-wrap iframe { max-height: 55vw; }
  .av-watch-controls { padding: 5px 10px; gap: 3px 6px; }
  .av-wc-btn, .av-wc-nav, .av-wc-addlist { padding: 3px 7px; font-size: .68rem; }
  .av-wc-toggle { font-size: .68rem; }
  .av-watch-info-wrap--mobile { padding: 10px; }
}

@media (max-width: 480px) {
  .av-watch-controls { flex-direction: column; align-items: flex-start; gap: 5px; }
  .av-wc-left, .av-wc-right { width: 100%; }
  #player-iframe,
  .watch-player-box .player-wrap iframe { max-height: none; }
}

/* ============================================================
   HOME SECTION PAGINATION NAV
   ============================================================ */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header-row .section-title {
  margin-bottom: 0;
}
.section-page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-page-num {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  min-width: 48px;
  text-align: center;
}
.sp-nav-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.sp-nav-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}
.sp-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ============================================================
   AUTH PAGES  (login / register / forgot-password)
   v1.2.0 addition
   ============================================================ */
.av-auth-page {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 64px;
}

.av-auth-wrap {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.av-auth-logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  text-decoration: none;
}
.av-auth-logo span { color: var(--accent); }

/* Tab bar */
.av-auth-tabs {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  width: 100%;
  gap: 4px;
}
.av-auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: calc(var(--radius-lg) - 4px);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
}
.av-auth-tab.active {
  background: var(--accent);
  color: #fff;
}

/* Card */
.av-auth-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.av-auth-title {
  font-size: 1.4rem;
  margin-bottom: 6px;
}
.av-auth-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Alerts */
.av-auth-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 20px;
}
.av-auth-alert--error   { background: rgba(230,57,70,0.12); border: 1px solid rgba(230,57,70,0.4); color: #ff8089; }
.av-auth-alert--success { background: rgba(0,200,120,0.1);  border: 1px solid rgba(0,200,120,0.4); color: #4ade80; }

/* Form */
.av-auth-form { display: flex; flex-direction: column; gap: 18px; }

.av-compose-guest-fields,
.av-auth-form .av-compose-guest-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}

.av-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.av-field-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.av-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.av-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.av-input-wrap input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 44px 12px 40px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.av-input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.av-input-wrap input::placeholder { color: var(--text-muted); }

.av-pass-toggle {
  position: absolute;
  right: 12px;
  color: var(--text-muted);
  transition: color var(--transition);
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.av-pass-toggle:hover { color: var(--accent); }

/* Password strength bar */
.av-pass-strength {
  height: 4px;
  border-radius: 2px;
  margin-top: 6px;
  background: var(--border);
  overflow: hidden;
  transition: all 0.3s;
}
.av-pass-strength::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--strength, 0%);
  background: var(--strength-color, var(--accent));
  transition: width 0.4s, background 0.4s;
  border-radius: 2px;
}
.av-pass-strength-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Remember / forgot row */
.av-auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.av-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.av-checkbox-label input[type="checkbox"] { accent-color: var(--accent); }
.av-forgot-link {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
}
.av-forgot-link:hover { text-decoration: underline; }

/* Submit button */
.av-auth-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  margin-top: 4px;
}
.av-auth-btn:hover { background: #c82333; box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.av-auth-btn:active { transform: translateY(0); }

.av-auth-switch {
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 20px;
}
.av-auth-switch a { color: var(--accent); }

/* Guest name fields (auth page) */
.av-compose-guest-fields input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  font-family: var(--font-ui);
  transition: border-color var(--transition);
}
.av-compose-guest-fields input:focus { border-color: var(--accent); }

/* Nav user link */
.av-nav-user-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}
.av-nav-user-link:hover { color: var(--text-primary); background: var(--border); }
.av-nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

@media (max-width: 480px) {
  .av-auth-card { padding: 24px 18px; }
  .av-compose-guest-fields { grid-template-columns: 1fr; }
}

/* ============================================================
   COMMENTS SECTION
   v1.2.0 addition
   ============================================================ */
.av-comments {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.av-comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.av-comments-count { color: var(--accent); }

/* Compose card */
.av-compose-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 28px;
}

.av-compose-guest-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.av-compose-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.av-compose-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.av-compose-avatar--guest {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  font-size: 1.2rem;
}

.av-compose-field-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

.av-compose-textarea-wrap { position: relative; }

.av-compose-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  line-height: 1.6;
  outline: none;
  word-break: break-word;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.av-compose-textarea:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
.av-compose-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.av-compose-textarea.av-url-detected {
  border-color: #f4a261;
  box-shadow: 0 0 0 3px rgba(244,162,97,0.2);
}

.av-url-warning {
  display: none;
  font-size: 0.75rem;
  color: #f4a261;
  margin-top: 5px;
  padding: 5px 10px;
  background: rgba(244,162,97,0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(244,162,97,0.25);
}
.av-url-detected ~ .av-url-warning,
.av-compose-textarea.av-url-detected + .av-url-warning { display: block; }

.av-compose-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.av-emoji-trigger {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
}
.av-emoji-trigger:hover { border-color: var(--accent); }

.av-char-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
}
.av-char-count.av-char-warn { color: #f4a261; }
.av-char-count.av-char-over { color: var(--accent); }

.av-submit-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.av-submit-btn:hover { background: #c82333; transform: translateY(-1px); }
.av-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Emoji panel */
.av-emoji-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 50;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  width: 280px;
  box-shadow: var(--shadow-card);
}
.av-emoji-panel[hidden] { display: none; }

.av-emoji-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.av-emoji-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
}
.av-emoji-tab.active,
.av-emoji-tab:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.av-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 160px;
  overflow-y: auto;
}
.av-emoji-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background var(--transition);
  line-height: 1;
  text-align: center;
}
.av-emoji-btn:hover { background: var(--border); }

/* Comment list */
.av-comments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Single comment */
.av-comment {
  display: flex;
  gap: 12px;
}
.av-comment--reply {
  margin-left: 52px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.av-comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.av-comment-body { flex: 1; min-width: 0; }

.av-comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.av-comment-author {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}
.av-comment-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.av-comment-text {
  font-size: 0.87rem;
  color: var(--text-secondary);
  line-height: 1.7;
  word-break: break-word;
}

.av-comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.av-comment-action {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-family: var(--font-ui);
}
.av-comment-action:hover { color: var(--accent); background: var(--accent-dim); }
.av-comment-action.av-liked { color: var(--accent); }

/* Load-more */
.av-comments-load-more {
  text-align: center;
  padding: 16px 0 0;
}
.av-load-more-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 24px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-ui);
}
.av-load-more-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Empty state */
.av-comments-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Reply compose (inline) */
.av-reply-compose {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.av-reply-compose .av-compose-textarea {
  min-height: 60px;
  font-size: 0.83rem;
}

@media (max-width: 520px) {
  .av-compose-guest-fields { grid-template-columns: 1fr; }
  .av-emoji-panel { width: 240px; }
  .av-emoji-grid  { grid-template-columns: repeat(6, 1fr); }
  .av-comment--reply { margin-left: 28px; }
}

/* ============================================================
   BOTTOM MOBILE NAV  v1.2.0
   ============================================================ */

/* Hide old hamburger/side nav completely */
.hamburger,
.mobile-nav,
#mobile-nav { display: none !important; }

/* Bottom nav bar — mobile only */
.av-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 900;
  background: rgba(10,10,15,0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  height: 62px;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom);
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  justify-items: center;
}

@media (max-width: 768px) {
  .av-bottom-nav { display: grid; }
  /* push page content up so it isn't hidden behind nav */
  .page-wrap { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  /* hide desktop header search & nav */
  .header-search { display: none !important; }
  .main-nav      { display: none !important; }
  .av-header-mob-search { display: flex !important; }
}

.av-bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  padding: 6px 4px 4px;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: color 0.2s;
  position: relative;
}
.av-bnav-item.active,
.av-bnav-item:hover { color: var(--accent); }

.av-bnav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}
.av-bnav-icon svg { flex-shrink: 0; }

/* Search centre pill */
.av-bnav-icon--search {
  background: var(--accent);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  margin-top: -14px;
  box-shadow: 0 4px 16px rgba(230,57,70,0.5);
  color: #fff;
}
.av-bnav-search-trigger { color: var(--accent) !important; }

.av-bnav-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.av-bnav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Active dot indicator */
.av-bnav-item.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* Mobile header search icon (shown only on mobile) */
.av-header-mob-search {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  margin-left: auto;
}
.av-header-mob-search:hover { color: var(--accent); }

/* ============================================================
   MORE PANEL  (slides up from bottom)
   ============================================================ */
.av-more-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 910;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.av-more-overlay.open { display: block; }

.av-more-panel {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 920;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  transform: translateY(110%);
  transition: transform 0.38s cubic-bezier(0.32,0.72,0,1);
  will-change: transform;
}
.av-more-panel.open { transform: translateY(0); }

.av-more-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.av-more-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.av-more-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}
.av-more-close:hover { background: var(--border); color: var(--text-primary); }

.av-more-scroll {
  overflow-y: auto;
  flex: 1;
  padding: 0 0 calc(72px + env(safe-area-inset-bottom));
}

/* Profile card */
.av-more-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 16px;
}
.av-more-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}
.av-more-display-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.av-more-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
}
.av-more-badge {
  margin-left: auto;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #ff6b7a);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.av-more-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 20px;
}

.av-more-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 20px 4px;
}

/* Nav rows */
.av-more-nav { padding: 4px 12px; }

.av-more-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 10px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  transition: background var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.av-more-row:hover,
.av-more-row:active { background: var(--bg-elevated); }

.av-more-row-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.av-more-row-text {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}
.av-more-chevron { color: var(--text-muted); flex-shrink: 0; }

.av-more-row--danger .av-more-row-text { color: #e63946; }

/* Genre expand */
.av-more-genres-expand {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 10px 6px;
}
.av-more-genres-expand.open { display: flex; }
.av-more-genre-chip {
  display: inline-flex;
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.av-more-genre-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* Dedicated genres panel grid */
.av-genres-panel-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px calc(72px + env(safe-area-inset-bottom));
}
.av-genres-panel-loading {
  width: 100%;
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.av-genres-panel-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.av-genres-panel-chip:hover,
.av-genres-panel-chip:active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* Auth buttons (guest) */
.av-more-auth-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
}
.av-more-signin-btn,
.av-more-register-btn {
  display: block;
  text-align: center;
  padding: 13px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: var(--font-ui);
  text-decoration: none;
  transition: all var(--transition);
}
.av-more-signin-btn {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(230,57,70,0.35);
}
.av-more-signin-btn:hover { background: #c82333; }
.av-more-register-btn {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.av-more-register-btn:hover { border-color: var(--accent); color: var(--accent); }





/* Mobile header: Sign In button */
.av-header-mob-signin {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition);
  margin-left: auto;
}
.av-header-mob-signin:hover { background: #c82333; }

/* Mobile header: avatar/more button */
.av-header-mob-more {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  padding: 2px;
}
.av-header-mob-more img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

@media (max-width: 768px) {
  .av-header-mob-signin { display: flex; }
  .av-header-mob-more   { display: flex; }
}

/* Mobile search trending section */
.av-mob-search-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 16px 6px;
}
.av-mob-search-trending-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 16px;
}
.av-mob-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.av-mob-search-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.av-mob-search-chip-rank {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 14px;
}

/* ============================================================
   MOBILE SEARCH OVERLAY  — v1.2.3 clean rewrite
   ============================================================ */

/* The overlay itself */
.av-mobile-search {
  display: none;               /* hidden by default */
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 960;
  background: #0d0d12;
  flex-direction: column;
  overflow: hidden;
}
/* Shown when JS sets aria-hidden=false */
.av-mobile-search.av-search-open { display: flex; }

/* ── Sticky search bar at the very top ── */
.av-mob-search-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #13131f;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;              /* never collapses */
  min-height: 56px;
  padding-top: max(14px, env(safe-area-inset-top));
}

/* The actual text input */
.av-mob-search-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  color: #ffffff;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  caret-color: #e63946;
  -webkit-text-fill-color: #ffffff;
  transition: border-color 0.2s;
}
.av-mob-search-input:focus {
  border-color: #e63946;
  background: rgba(255,255,255,0.1);
}
.av-mob-search-input::placeholder {
  color: rgba(255,255,255,0.35);
  -webkit-text-fill-color: rgba(255,255,255,0.35);
}

/* Cancel button */
.av-mob-search-x {
  background: none;
  border: none;
  color: #e63946;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 4px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Scrollable results below ── */
.av-mobile-search-results {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0 calc(72px + env(safe-area-inset-bottom));
}

/* Result rows */
.av-mob-result {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.av-mob-result:active { background: rgba(255,255,255,0.05); }
.av-mob-result img {
  width: 44px;
  height: 62px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #1e1e2e;
}
.av-mob-result-info { flex: 1; min-width: 0; }
.av-mob-result-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.av-mob-result-meta {
  font-size: 0.73rem;
  color: rgba(255,255,255,0.45);
  margin-top: 3px;
}

/* Empty / loading states */
.av-mob-search-empty {
  padding: 32px 24px;
  text-align: center;
  color: rgba(255,255,255,0.35);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Trending section labels */
.av-mob-search-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  padding: 14px 16px 6px;
}

/* Trending chips */
.av-mob-search-trending-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 14px;
}
.av-mob-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.75);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.av-mob-search-chip:active {
  border-color: #e63946;
  color: #e63946;
  background: rgba(230,57,70,0.1);
}
.av-mob-search-chip-rank {
  font-size: 0.68rem;
  font-weight: 900;
  color: #e63946;
  min-width: 14px;
}

/* ── Header right buttons (mobile only) ── */
.av-header-mob-search { display: none !important; }

.av-header-mob-signin {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  background: #e63946;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  margin-left: auto;
  transition: background 0.2s;
}
.av-header-mob-signin:hover { background: #c82333; }

.av-header-mob-more {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  padding: 2px;
}
.av-header-mob-more img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e63946;
}

@media (max-width: 768px) {
  .av-header-mob-signin { display: flex; }
  .av-header-mob-more   { display: flex; }
}

/* ============================================================
   v1.2.4 — Fix: search overlay z-index above header
   ============================================================ */

/* Overlay must beat the fixed header (z-index:1000) and toast (z-index:9999) */
.av-mobile-search {
  z-index: 10000 !important;
}

/* Hide the fixed header when search is open so it doesn't bleed through */
body.av-search-active #site-header,
body.av-search-active .provider-bar {
  display: none !important;
}

/* Ensure topbar is always the first painted child */
.av-mob-search-topbar {
  position: relative;
  z-index: 1;
  /* Solid background — no transparency that could show header through */
  background: #111118 !important;
}

/* ============================================================
   v1.2.5 — Mobile anime detail: compact poster + tighter info
   ============================================================ */
@media (max-width: 640px) {
  /* Poster stays crisp at 120px wide, quality unchanged */
  .detail-poster {
    width: 120px;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.7);
  }

  /* Info column adjustments */
  .detail-title {
    font-size: 1.05rem;
    margin-bottom: 4px;
    line-height: 1.3;
  }
  .detail-jname {
    font-size: 0.75rem;
    margin-bottom: 8px;
  }
  .detail-badges {
    gap: 5px;
    margin-bottom: 10px;
  }
  .detail-badge {
    font-size: 0.68rem;
    padding: 3px 9px;
  }

  /* Stats grid: 2 columns on mobile to save vertical space */
  .detail-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
    margin-bottom: 14px;
  }
  .stat-value { font-size: 0.95rem; }
  .stat-label { font-size: 0.62rem; }

  /* Description slightly smaller */
  .detail-desc { font-size: 0.83rem; line-height: 1.7; }

  /* Hero section padding tighter on mobile */
  .anime-hero { padding: 16px 0 20px; }
}

/* ============================================================
   v1.2.6 — Detail action buttons: smaller on mobile + new
             Watchlist / Favorite buttons
   ============================================================ */

/* Make Watch Ep 1 fit in the narrow left column on mobile */
@media (max-width: 640px) {
  .detail-actions {
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
  }
  .btn-watch,
  .btn-info {
    width: 100%;
    justify-content: center;
    padding: 9px 10px;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
  }
  .btn-fav,
  .btn-wl {
    width: 100%;
    justify-content: center;
  }
}

/* ── Watchlist button ── */
.btn-wl {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.84rem;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border-hover);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  width: fit-content;
}
.btn-wl:hover { border-color: #818cf8; color: #818cf8; background: rgba(129,140,248,0.1); }
.btn-wl.av-active {
  border-color: #818cf8;
  background: rgba(129,140,248,0.15);
  color: #818cf8;
}
.btn-wl svg { flex-shrink: 0; transition: fill 0.2s; }
.btn-wl.av-active svg { fill: #818cf8; }

/* ── Favorite button ── */
.btn-fav {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.84rem;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border-hover);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  width: fit-content;
}
.btn-fav:hover { border-color: #f4a261; color: #f4a261; background: rgba(244,162,97,0.1); }
.btn-fav.av-active {
  border-color: #f4a261;
  background: rgba(244,162,97,0.15);
  color: #f4a261;
}
.btn-fav svg { flex-shrink: 0; transition: fill 0.2s; }
.btn-fav.av-active svg { fill: #f4a261; }

/* ── Login prompt toast (non-blocking) ── */
.av-login-prompt {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e1e2e;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 8000;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.av-login-prompt.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.av-login-prompt a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: 20px;
  transition: background var(--transition);
}
.av-login-prompt a:hover { background: var(--accent-dim); }

/* ── Action feedback toast ── */
.av-action-toast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e1e2e;
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 10px 20px;
  font-size: 0.83rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 8001;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.av-action-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   v1.2.7 — Desktop profile dropdown
   ============================================================ */
.av-user-dropdown { position: relative; }

.av-nav-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 5px;
  border-radius: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.83rem;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
}
.av-nav-user-btn:hover { border-color: var(--accent); }
.av-nav-user-btn .av-nav-avatar { border-radius: 50%; border: 1.5px solid var(--border); }

.av-user-menu { left: auto; right: 0; min-width: 220px; }
.av-user-menu .dropdown-menu-inner { min-width: 220px; padding: 6px; }

.av-user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 10px;
}
.av-user-menu-header img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--accent);
}
.av-user-menu-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}
.av-user-menu-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-top: 1px;
}
.av-user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.av-user-menu-label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 6px 12px 3px;
}
.av-user-menu .dropdown-menu-inner a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--text-secondary);
}
.av-user-menu .dropdown-menu-inner a:hover { color: var(--text-primary); background: var(--border); }
.av-user-menu .dropdown-menu-inner a svg { flex-shrink: 0; color: var(--text-muted); }
.av-user-menu-logout { color: #e63946 !important; }
.av-user-menu-logout:hover { background: rgba(230,57,70,0.1) !important; }
.av-user-menu-logout svg { color: #e63946 !important; }

/* Click-to-open for user dropdown (not hover) */
.av-user-dropdown .dropdown-menu {
  /* Override the hover-based open; JS handles it */
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
}
.av-user-dropdown.open .dropdown-menu {
  pointer-events: all;
  opacity: 1;
  transform: none;
}

/* ============================================================
   v1.2.7 — Library pages (watchlist / favorites / history)
   ============================================================ */
.av-library-page {
  min-height: calc(100vh - var(--header-h));
  padding: 32px 0 60px;
}

/* Page header */
.av-lib-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.av-lib-header-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.av-lib-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 2px;
}
.av-lib-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.av-lib-clear-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
}
.av-lib-clear-btn:hover { border-color: #e63946; color: #e63946; }

/* Tab nav */
.av-lib-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.av-lib-tabs::-webkit-scrollbar { display: none; }
.av-lib-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.av-lib-tab:hover { color: var(--text-primary); }
.av-lib-tab.active {
  color: var(--tab-color, var(--accent));
  border-bottom-color: var(--tab-color, var(--accent));
  background: rgba(255,255,255,0.03);
}
.av-lib-tab svg { flex-shrink: 0; }

/* Anime grid */
.av-lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}

/* Card */
.av-lib-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color var(--transition), transform var(--transition);
}
.av-lib-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.av-lib-card-link { display: block; text-decoration: none; }

.av-lib-card-img-wrap {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg-elevated);
}
.av-lib-card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s;
}
.av-lib-card:hover .av-lib-card-img-wrap img { transform: scale(1.04); }

.av-lib-card-type {
  position: absolute;
  top: 6px; left: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
}

.av-lib-card-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,0.15);
}
.av-lib-card-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.av-lib-card-body {
  padding: 10px 10px 12px;
}
.av-lib-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.av-lib-card-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Remove button */
.av-lib-card-remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
}
.av-lib-card:hover .av-lib-card-remove { opacity: 1; }
.av-lib-card-remove:hover { background: #e63946; border-color: #e63946; }

/* Empty state */
.av-lib-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.av-lib-empty-icon {
  margin: 0 auto 20px;
  width: 56px; height: 56px;
  opacity: 0.5;
}
.av-lib-empty h3 { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 8px; }
.av-lib-empty p  { font-size: 0.88rem; max-width: 360px; margin: 0 auto 24px; line-height: 1.6; }
.av-lib-browse-btn {
  display: inline-flex;
  padding: 11px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background var(--transition);
}
.av-lib-browse-btn:hover { background: #c82333; }

/* LS notice */
.av-lib-ls-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
}

/* Mobile */
@media (max-width: 640px) {
  .av-lib-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
  .av-lib-card-remove { opacity: 1; }
  .av-lib-tabs { gap: 0; }
  .av-lib-tab  { padding: 8px 12px; font-size: 0.75rem; }
  .av-lib-tab span { display: none; }
}

/* ============================================================
   NEXT EPISODE BANNER  — v1.2.9
   ============================================================ */
.av-next-ep-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb, 230,57,70), 0.12), rgba(var(--accent-rgb, 230,57,70), 0.05));
    border: 1px solid rgba(var(--accent-rgb, 230,57,70), 0.35);
    border-radius: var(--radius-sm, 8px);
    padding: 10px 14px;
    margin-top: 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    row-gap: 4px;
}
.av-next-ep-banner .av-neb-icon { font-size: 1rem; flex-shrink: 0; }
.av-next-ep-banner .av-neb-text { flex: 1; min-width: 0; }
.av-next-ep-banner .av-neb-text strong { color: var(--text-primary); }
.av-neb-countdown {
    font-family: var(--font-ui, monospace);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent, #e63946);
    background: rgba(var(--accent-rgb, 230,57,70), 0.1);
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
/* Inside watch sidebar the banner fits flush */
.sidebar-card .av-next-ep-banner { margin-top: 10px; }

/* ── timezone note label  v1.3.0 ── */
.av-neb-tz-note {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
}

/* ============================================================
   WATCH PAGE BREADCRUMB  v1.4.1
   ============================================================ */
.av-watch-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    padding: 12px 20px 4px;
}
.av-watch-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}
.av-watch-breadcrumb a:hover { color: var(--accent); }
.av-watch-breadcrumb span { color: var(--text-muted); }
@media (max-width: 768px) {
    .av-watch-breadcrumb { padding: 10px 12px 4px; }
}

/* ── Episode buttons: not yet available  v1.4.2 ── */
.ep-btn.no-source,
.ep-btn[disabled]:not(.current) {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--bg-secondary);
    border-color: transparent;
}

/* ============================================================
   SERVER GROUPS (SUB / H-SUB / DUB)  v1.4.4
   ============================================================ */
.av-server-groups {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.av-sg-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.av-sg-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    min-width: 52px;
    flex-shrink: 0;
}
.av-sg-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
/* Base server button */
.av-sg-btn {
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.73rem;
    font-weight: 600;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}
.av-sg-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* SUB — blue tint active */
.av-sg-sub.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}
.av-sg-sub:hover:not(.active) { border-color: #3b82f6; color: #3b82f6; }

/* H-SUB — teal tint active */
.av-sg-hsub.active {
    background: #0891b2;
    border-color: #0891b2;
    color: #fff;
}
.av-sg-hsub:hover:not(.active) { border-color: #0891b2; color: #0891b2; }

/* DUB — green tint active */
.av-sg-dub.active {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}
.av-sg-dub:hover:not(.active) { border-color: #16a34a; color: #16a34a; }

@media (max-width: 600px) {
    .av-sg-label { min-width: 44px; font-size: 0.68rem; }
    .av-sg-btn { padding: 3px 10px; font-size: 0.68rem; }
}

/* ============================================================
   AV Library Pagination — v1.4.5
   ============================================================ */
.av-lib-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 2.5rem 0 1.5rem;
}

.av-lib-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 .6rem;
  border-radius: .5rem;
  background: rgba(255,255,255,.06);
  color: var(--av-text-muted, #a0aec0);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s, transform .1s;
  border: 1px solid rgba(255,255,255,.08);
}
.av-lib-page-btn:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  transform: translateY(-1px);
}
.av-lib-page-btn.active,
.av-lib-page-btn[aria-current="page"] {
  background: #e63946;
  color: #fff;
  border-color: #e63946;
  pointer-events: none;
}
.av-lib-page-prev,
.av-lib-page-next {
  padding: 0 .55rem;
}
.av-lib-page-ellipsis {
  color: var(--av-text-muted, #a0aec0);
  padding: 0 .25rem;
  font-size: .875rem;
  line-height: 2.25rem;
}
.av-lib-page-info {
  font-size: .78rem;
  color: var(--av-text-muted, #a0aec0);
  margin-left: .5rem;
  white-space: nowrap;
}

/* ============================================================
   Footer 2-column link grid — v1.4.5
   ============================================================ */
.footer-links-grid {
  display: grid;
  gap: .35rem 1.25rem;
}
.footer-links-grid.footer-links-cols-1 {
  grid-template-columns: 1fr;
}
.footer-links-grid.footer-links-cols-2 {
  grid-template-columns: 1fr 1fr;
}
/* On mobile the footer cols are already narrow — keep links single column */
@media (max-width: 768px) {
  .footer-links-grid.footer-links-cols-2 {
    grid-template-columns: 1fr;
  }
}

/* ── Shared watch-related styles (used in sidebar + mobile) ── */
.watch-related-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.watch-related-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  border-radius: 8px;
  padding: 6px;
  transition: background var(--transition);
}
.watch-related-item:hover { background: var(--bg-elevated); }
.watch-related-thumb-wrap {
  position: relative;
  width: 56px;
  height: 78px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.watch-related-thumb { width:100%;height:100%;object-fit:cover;display:block; }
.watch-related-badges {
  position: absolute;
  bottom: 3px;left:3px;right:3px;
  display: flex;flex-direction:column;gap:2px;overflow:hidden;
}
.watch-related-badges .badge { font-size:.55rem;padding:1px 4px;letter-spacing:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%; }
.watch-related-info { flex:1;min-width:0; }
.watch-related-title {
  font-size:.8rem;font-weight:600;color:var(--text-primary);line-height:1.35;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin-bottom:4px;
}
.watch-related-item:hover .watch-related-title { color:var(--accent); }
.watch-related-meta { display:flex;gap:4px;flex-wrap:wrap;font-size:.7rem;color:var(--text-muted); }