/* ================================================================
   9ANIMESS — Complete CSS (9animetv.to / HiAnime design)
   Background: #111319  Cards: #1a1a22  Accent: #5a2d98
   ================================================================ */

/* ---- CSS Variables ---- */
:root {
  --bg: #111319;
  --bg-alt: #1a1a22;
  --bg-card: #1e1e28;
  --bg-hover: #262630;
  --accent: #5a2d98;
  --accent-hover: #7340bb;
  --accent-light: rgba(90, 45, 152, .15);
  --sub: #b0e3af;
  --dub: #b9d0f0;
  --raw: #ffa500;
  --text: #eee;
  --text2: #999;
  --text3: #666;
  --border: rgba(255, 255, 255, .06);
  --navbar-h: 60px;
  --radius: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .5);
  --transition: .2s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
html { scroll-behavior: smooth }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit }
button { border: none; background: none; cursor: pointer; color: inherit; font-family: inherit }
img { max-width: 100%; display: block }
ul, ol { list-style: none }
input, select, textarea { font-family: inherit }

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px }
::-webkit-scrollbar-track { background: var(--bg) }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hover) }

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg);
}

/* ================================================================
   NAVBAR
   ================================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-h);
  background: rgba(17, 19, 25, .97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.nav-wrap {
  display: flex;
  align-items: center;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 12px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.hamburger {
  padding: 6px;
  border-radius: 4px;
  color: var(--text2);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hamburger:hover {
  color: var(--text);
  background: var(--accent-light);
}

.logo {
  font-weight: 800;
  font-size: 1.4rem;
  color: #fff;
  letter-spacing: -.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo-img { width: 30px; height: 30px; object-fit: contain; border-radius: 0; flex-shrink: 0 }

.nav-center {
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
}

.search-box { position: relative }
.search-box input {
  width: 100%;
  padding: 9px 38px 9px 14px;
  background: #252530;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: #fff;
  font-size: .85rem;
  outline: none;
  transition: var(--transition);
}
.search-box input:focus {
  border-color: var(--accent);
  background: #1c1c28;
}
.search-box input::placeholder { color: var(--text3) }

.search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  padding: 4px;
  display: flex;
  align-items: center;
}
.search-icon:hover { color: var(--accent) }

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 380px;
  overflow-y: auto;
  display: none;
  z-index: 100;
  box-shadow: var(--shadow);
}
.search-results.show {
  display: block;
  animation: fadeIn .15s ease;
}

.sr-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: .15s;
}
.sr-item:last-child { border-bottom: none }
.sr-item:hover { background: var(--bg-hover) }
.sr-item img {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.sr-info { flex: 1; min-width: 0 }
.sr-name {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sr-meta {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 2px;
}

.sr-all {
  display: block;
  text-align: center;
  padding: 10px;
  font-size: .82rem;
  color: var(--accent);
  font-weight: 600;
  transition: .15s;
}
.sr-all:hover { background: var(--accent-light) }

.nav-right {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.nav-link {
  font-size: .82rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  color: var(--text2);
  transition: var(--transition);
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: var(--accent-light);
}

@media (max-width: 768px) {
  .nav-right { display: none }
  .nav-center { max-width: none; flex: 1; margin: 0 0 0 8px }
  .logo-img { width: 24px; height: 24px }
  .logo { font-size: 1.1rem; gap: 4px }
}

/* ================================================================
   SIDEBAR (slide-out)
   ================================================================ */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  z-index: 1200;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.sidebar.show { transform: translateX(0) }

.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.sb-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text2);
  transition: var(--transition);
}
.sb-close:hover {
  background: var(--accent);
  color: #fff;
}

.sb-nav { padding: 8px 0 }

.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: .85rem;
  color: var(--text2);
  transition: .15s;
  position: relative;
}
.sb-link i {
  font-style: normal;
  font-size: 1rem;
  width: 22px;
  text-align: center;
}
.sb-link:hover,
.sb-link.active {
  color: var(--accent);
  background: var(--accent-light);
}
.sb-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.sb-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 16px;
}

/* ================================================================
   MAIN LAYOUT
   ================================================================ */
#app {
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Loading */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg) } }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px) }
  to { opacity: 1; transform: translateY(0) }
}

/* ================================================================
   SPOTLIGHT / HERO SLIDER
   ================================================================ */
.spotlight {
  position: relative;
  width: 100%;
  height: 440px;
  overflow: hidden;
  background: var(--bg-alt);
}

.spot-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .7s ease;
}
.spot-slide.active { opacity: 1 }

/* CRITICAL: Background image must show properly - no blur, no scale */
.spot-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  filter: brightness(.35);
}

.spot-grad {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(17, 19, 25, .95) 0%, rgba(17, 19, 25, .6) 50%, transparent 100%),
    linear-gradient(to top, var(--bg) 0%, transparent 40%);
}

.spot-content {
  position: absolute;
  bottom: 40px;
  left: 40px;
  right: 40%;
  z-index: 2;
}

.spot-rank {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.spot-title {
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
}

.spot-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge-sub,
.badge-dub {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: .7rem;
  font-weight: 700;
}
.badge-sub {
  background: rgba(176, 227, 175, .15);
  color: var(--sub);
}
.badge-dub {
  background: rgba(185, 208, 240, .15);
  color: var(--dub);
}
.badge-genre {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: .7rem;
  color: var(--text2);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.spot-desc {
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
  max-width: 480px;
}

.spot-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  font-size: .88rem;
  font-weight: 700;
  transition: var(--transition);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(90, 45, 152, .4);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .15);
  color: #fff;
  border-radius: 20px;
  font-size: .88rem;
  font-weight: 600;
  transition: var(--transition);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, .15);
}

/* Spotlight dots */
.spot-dots {
  position: absolute;
  bottom: 16px;
  right: 32px;
  display: flex;
  gap: 5px;
  z-index: 5;
}
.spot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .3);
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.spot-dot.active {
  width: 22px;
  border-radius: 4px;
  background: var(--accent);
}

/* Spotlight arrows */
.spot-arrows {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
}
.spot-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  border: 1px solid var(--border);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  cursor: pointer;
  transition: var(--transition);
}
.spot-arrow:hover { background: var(--accent) }
.spot-arrow.prev { left: 12px }
.spot-arrow.next { right: 12px }

@media (max-width: 768px) {
  .spotlight { height: 340px }
  .spot-content { left: 20px; right: 20px; bottom: 24px }
  .spot-desc { display: none }
  .spot-arrow { display: none }
}

/* ================================================================
   TWO-COL LAYOUT (main + 300px sidebar)
   ================================================================ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  padding: 28px 0;
  align-items: start;
}
.col-main { min-width: 0 }
.col-side {
  position: sticky;
  top: calc(var(--navbar-h) + 16px);
}

@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr }
  .col-side { position: static }
}

/* ================================================================
   SECTION HEADER
   ================================================================ */
.anime-section { margin-bottom: 32px }

.sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sec-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-title::before {
  content: '';
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
}

.sec-more {
  font-size: .78rem;
  color: var(--accent);
  font-weight: 600;
  padding: 4px 12px;
  border: 1px solid rgba(90, 45, 152, .3);
  border-radius: 20px;
  transition: var(--transition);
}
.sec-more:hover {
  background: var(--accent);
  color: #fff;
}

/* ================================================================
   ANIME GRID
   ================================================================ */
.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
@media (max-width: 480px) {
  .anime-grid { grid-template-columns: repeat(3, 1fr); gap: 8px }
}

/* ================================================================
   ANIME CARD
   ================================================================ */
.acard {
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.acard:hover { transform: translateY(-4px) }
.acard:hover .ac-img img { transform: scale(1.05) }
.acard:hover .ac-title { color: var(--accent) }
.acard:hover .ac-play { opacity: 1 }

.ac-img {
  position: relative;
  aspect-ratio: 3 / 4.2;
  overflow: hidden;
  background: var(--bg-alt);
  border-radius: 0;
}
.ac-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

/* HD badge - top left */
.ac-quality {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: .6rem;
  font-weight: 700;
  background: rgba(0,0,0,.7);
  color: #fff;
  z-index: 2;
}

/* Bottom badges bar - episode count + SUB/DUB at bottom of image */
.ac-bottom-badges {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0;
  z-index: 2;
}
.ac-ep {
  padding: 3px 6px;
  font-size: .6rem;
  font-weight: 700;
  background: rgba(0,0,0,.8);
  color: #fff;
}
.ac-badge {
  padding: 3px 6px;
  font-size: .6rem;
  font-weight: 700;
}
.ac-badge.sub { background: var(--sub); color: #0a2e0a }
.ac-badge.dub { background: var(--dub); color: #0a1a2e }

.ac-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(90, 45, 152, .5);
}
.ac-play svg {
  width: 16px;
  height: 16px;
  fill: #fff;
  margin-left: 2px;
}

.ac-body { padding: 8px 4px 4px }
.ac-title {
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: .15s;
}
.ac-meta {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.ac-meta span {
  font-size: .68rem;
  color: var(--text3);
}

/* ================================================================
   TOP 10 WIDGET
   ================================================================ */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.w-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.w-title {
  font-size: .95rem;
  font-weight: 700;
}

.w-tabs {
  display: flex;
  gap: 3px;
}
.w-tab {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text3);
  transition: .15s;
  cursor: pointer;
}
.w-tab.active {
  background: var(--accent);
  color: #fff;
}
.w-tab:hover:not(.active) {
  background: var(--accent-light);
  color: var(--accent);
}

.w-list {
  max-height: 520px;
  overflow-y: auto;
}

.t10-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: .15s;
}
.t10-item:last-child { border-bottom: none }
.t10-item:hover { background: var(--bg-hover) }

.t10-rank {
  font-size: 1rem;
  font-weight: 800;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text3);
}
.t10-rank.r1 { color: #ffd700 }
.t10-rank.r2 { color: #c0c0c0 }
.t10-rank.r3 { color: #cd7f32 }

.t10-poster {
  width: 38px;
  height: 52px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-alt);
}
.t10-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t10-info { flex: 1; min-width: 0 }
.t10-name {
  font-size: .8rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  transition: .15s;
}
.t10-item:hover .t10-name { color: var(--accent) }

.t10-views {
  font-size: .7rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}
.t10-views svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.t10-eps {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}
.t10-ep {
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}
.t10-ep.sub { background: rgba(176, 227, 175, .12); color: var(--sub) }
.t10-ep.dub { background: rgba(185, 208, 240, .12); color: var(--dub) }

/* ================================================================
   GENRE CLOUD WIDGET
   ================================================================ */
.genre-cloud {
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gc-tag {
  padding: 4px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .72rem;
  color: var(--text2);
  transition: .15s;
  cursor: pointer;
}
.gc-tag:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(90, 45, 152, .3);
}

/* ================================================================
   DETAIL PAGE
   ================================================================ */
.detail-hero {
  position: relative;
  overflow: hidden;
}
.detail-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  filter: brightness(.15) blur(2px);
  transform: scale(1.05);
}
.detail-inner {
  position: relative;
  display: flex;
  gap: 28px;
  padding: 32px 0;
  z-index: 1;
}
.detail-poster {
  flex-shrink: 0;
  width: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.detail-poster img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.detail-info {
  flex: 1;
  min-width: 0;
}

.di-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.di-badge {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 700;
}
.di-badge.quality {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
}
.di-badge.type {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text2);
}

.di-title {
  font-size: clamp(1.3rem, 2.2vw, 1.9rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}
.di-jname {
  font-size: .85rem;
  color: var(--text3);
  margin-bottom: 12px;
}
.di-desc {
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 16px;
  max-width: 600px;
}

.di-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.di-meta-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text3);
  margin-bottom: 2px;
}
.di-meta-value {
  font-size: .82rem;
  font-weight: 500;
}

.di-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.di-genre {
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .75rem;
  color: var(--text2);
  transition: .15s;
  cursor: pointer;
}
.di-genre:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(90, 45, 152, .3);
}

.di-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .detail-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .detail-poster { width: 160px }
  .di-genres, .di-actions { justify-content: center }
}

/* ================================================================
   EPISODES SECTION (detail page)
   ================================================================ */
.eps-section { padding: 24px 0 }
.eps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.eps-title { font-size: 1.1rem; font-weight: 700 }
.eps-count { font-size: .82rem; color: var(--text3) }

.eps-ranges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.eps-range {
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: .15s;
}
.eps-range.active,
.eps-range:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.eps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 5px;
}
.ep-btn {
  padding: 7px 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text2);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: .15s;
}
.ep-btn:hover {
  color: var(--accent);
  border-color: rgba(90, 45, 152, .3);
}
.ep-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.ep-btn.filler {
  border-color: rgba(255, 165, 0, .3);
  color: #ffa500;
}

/* ================================================================
   WATCH PAGE
   ================================================================ */
.watch-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: calc(100vh - var(--navbar-h));
}

.watch-main { min-width: 0 }

/* Player */
.player-box {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
}
.player-box iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  gap: 10px;
  color: var(--text3);
}

/* Player Controls Bar (Auto Play / Auto Next / Light / Expand) */
.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.player-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
}
.player-controls label:hover { color: var(--text) }

.player-controls input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--text3);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: .15s;
  flex-shrink: 0;
}
.player-controls input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.player-controls input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.player-controls .pc-spacer { flex: 1 }

.player-controls .pc-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: .15s;
}
.player-controls .pc-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.player-controls .pc-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Watch info message */
.watch-info-msg {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.6;
}
.watch-info-msg strong { color: var(--accent); font-weight: 600 }

/* Expand mode */
.watch-wrap.expanded { grid-template-columns: 1fr }
.watch-wrap.expanded .watch-side { display: none }
.player-box.player-expanded { max-height: 80vh }

/* Watch info bar */
.watch-bar {
  padding: 12px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.wb-title {
  font-size: .95rem;
  font-weight: 700;
  flex: 1;
}
.wb-ep {
  font-size: .78rem;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 20px;
}

/* Server section */
.srv-section {
  padding: 12px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.srv-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: nowrap;
}
.srv-tab {
  padding: 5px 14px;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--text3);
  cursor: pointer;
  transition: .15s;
}
.srv-tab.active.sub {
  background: rgba(176, 227, 175, .12);
  color: var(--sub);
  border-color: rgba(176, 227, 175, .3);
}
.srv-tab.active.dub {
  background: rgba(185, 208, 240, .12);
  color: var(--dub);
  border-color: rgba(185, 208, 240, .3);
}
.srv-tab.active.raw {
  background: rgba(255, 165, 0, .1);
  color: var(--raw);
  border-color: rgba(255, 165, 0, .3);
}
.srv-tab:hover:not(.active) {
  background: var(--accent-light);
  color: var(--accent);
}

.srv-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
}
.srv-btn {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.srv-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.srv-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Watch sidebar (episode list) */
.watch-side {
  background: var(--bg-alt);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--navbar-h));
  overflow: hidden;
  position: sticky;
  top: var(--navbar-h);
}
.ws-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ws-title { font-weight: 700; font-size: .88rem }
.ws-count { font-size: .72rem; color: var(--text3) }
.ws-list { overflow-y: auto; flex: 1 }

.ws-ep {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, .03);
  transition: .1s;
  font-size: .82rem;
}
.ws-ep:hover { background: var(--bg-hover) }
.ws-ep.active { background: var(--accent-light) }

.ws-ep-num {
  font-weight: 700;
  color: var(--text3);
  width: 28px;
  flex-shrink: 0;
  text-align: center;
}
.ws-ep.active .ws-ep-num { color: var(--accent) }

.ws-ep-title { flex: 1; color: var(--text2) }
.ws-ep.active .ws-ep-title { color: var(--text); font-weight: 600 }

.ws-filler-tag { font-size: .6rem; padding: 1px 5px; border-radius: 3px; background: rgba(255,165,0,.15); color: #ffa500; font-weight: 700; margin-left: auto }
.ws-ep.filler { border-left: 2px solid #ffa500 }

.ws-search { padding: 8px 12px; border-bottom: 1px solid var(--border) }
.ws-search-input { width: 100%; padding: 6px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: .8rem; outline: none }
.ws-search-input:focus { border-color: var(--accent) }

/* Sub/Dub badges in detail */
.di-badge.sub-badge { background: rgba(176,227,175,.15); color: var(--sub) }
.di-badge.dub-badge { background: rgba(185,208,240,.15); color: var(--dub) }

/* Seasons list */
.di-seasons { margin-top: 12px }
.di-season-list { display: flex; flex-wrap: wrap; gap: 6px }
.di-season { padding: 5px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); font-size: .78rem; color: var(--text2); transition: .15s }
.di-season:hover { border-color: var(--accent); color: var(--accent) }
.di-season.current { background: var(--accent); color: #fff; border-color: var(--accent) }

/* Schedule poster */
.sched-poster { width: 40px; height: 56px; border-radius: 4px; overflow: hidden; flex-shrink: 0 }
.sched-poster img { width: 100%; height: 100%; object-fit: cover }

/* Player controls checkbox label */
.pc-check { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: .8rem; color: var(--text2) }
.pc-check:hover { color: var(--text) }

/* Player controls row layout */
.pc-row { display: flex; align-items: center; gap: 12px }

/* Mobile episodes section - hidden on desktop */
.watch-episodes-mobile { display: none }
.watch-episodes-mobile .ws-list { max-height: 300px; overflow-y: auto }

@media (max-width: 1024px) {
  .watch-wrap { grid-template-columns: 1fr }
  .watch-side { display: none }
  .watch-episodes-mobile { display: block; border: 1px solid var(--border); margin: 12px 0 }

  /* Reorder: player -> controls -> info -> servers -> episodes -> detail */
  .watch-main { display: flex; flex-direction: column }
  .watch-main .player-box { order: 1 }
  .watch-main .player-controls { order: 2 }
  .watch-main .watch-info-msg { order: 3 }
  .watch-main .srv-section { order: 4 }
  .watch-main .watch-episodes-mobile { order: 5 }
  .watch-main .detail-hero { order: 6 }
}

@media (max-width: 768px) {
  .player-controls { padding: 8px 12px; gap: 8px 12px }
  .pc-check span { font-size: .75rem }
  .pc-row { gap: 10px }
  .srv-section { padding: 10px 12px }
  .srv-btn { padding: 5px 10px; font-size: .72rem }
  .srv-tab { padding: 4px 10px; font-size: .72rem }
}

/* ================================================================
   BROWSE / CATEGORY PAGE
   ================================================================ */
.page-hero { padding: 28px 0 20px }
.ph-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.ph-sub {
  font-size: .85rem;
  color: var(--text2);
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 480px) {
  .browse-grid { grid-template-columns: repeat(3, 1fr); gap: 8px }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 24px 0;
  flex-wrap: wrap;
}
.pg-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .15s;
}
.pg-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.pg-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pg-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* ================================================================
   SEARCH PAGE
   ================================================================ */
.search-hero { padding: 24px 0 }
.sh-title {
  font-size: 1.4rem;
  font-weight: 700;
}
.sh-title span { color: var(--accent) }
.sh-count {
  font-size: .82rem;
  color: var(--text3);
  margin-top: 4px;
}

/* ================================================================
   GENRES PAGE
   ================================================================ */
.genres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 20px 0;
}
.g-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 12px;
  cursor: pointer;
  transition: .15s;
  text-align: center;
}
.g-card:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.g-name { font-size: .85rem; font-weight: 600 }
.g-card:hover .g-name { color: var(--accent) }

/* ================================================================
   SCHEDULE PAGE
   ================================================================ */
.sched-days {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
}
.sched-day {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.sched-day.active,
.sched-day:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.sched-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sched-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: .15s;
}
.sched-item:hover {
  border-color: rgba(90, 45, 152, .3);
  background: var(--bg-hover);
}

.sched-time {
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent);
  width: 60px;
  flex-shrink: 0;
  text-align: center;
  background: var(--accent-light);
  padding: 5px;
  border-radius: 4px;
}
.sched-info { flex: 1; min-width: 0 }
.sched-name { font-size: .88rem; font-weight: 600 }
.sched-ep {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 2px;
}

/* ================================================================
   EMPTY & ERROR STATES
   ================================================================ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  text-align: center;
}
.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: .5;
}
.empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.empty-desc {
  font-size: .85rem;
  color: var(--text2);
}

/* ================================================================
   FOOTER
   ================================================================ */
.footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
.ft-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px 16px 24px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 28px;
}
.ft-col .logo {
  margin-bottom: 8px;
}
.ft-col .logo-img { width: 24px; height: 24px }
.ft-desc {
  font-size: .82rem;
  color: var(--text3);
  line-height: 1.6;
  max-width: 280px;
}
.ft-col h4 {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.ft-col a {
  display: block;
  font-size: .8rem;
  color: var(--text3);
  margin-bottom: 5px;
  transition: .15s;
}
.ft-col a:hover { color: var(--accent) }
.ft-bottom {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  text-align: center;
  font-size: .75rem;
  color: var(--text3);
}

@media (max-width: 768px) {
  .ft-inner { grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 24px 16px 16px }
  .ft-desc { max-width: none }
  .ft-col:first-child { grid-column: 1 / -1 }
}
@media (max-width: 400px) {
  .ft-inner { grid-template-columns: repeat(2, 1fr); gap: 16px }
}

/* ================================================================
   SKELETON LOADING
   ================================================================ */
.skel {
  border-radius: var(--radius);
  overflow: hidden;
}
.skel-poster {
  aspect-ratio: 3 / 4.2;
  background: linear-gradient(90deg, var(--bg-alt) 0%, var(--bg-hover) 50%, var(--bg-alt) 100%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
}
.skel-text {
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--bg-alt) 0%, var(--bg-hover) 50%, var(--bg-alt) 100%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  margin: 8px 4px;
}
.skel-text.short { width: 55% }

@keyframes shimmer {
  0% { background-position: -600px 0 }
  100% { background-position: 600px 0 }
}

/* ================================================================
   QUICK FILTER (sidebar widget)
   ================================================================ */
.qf-section { padding: 14px }
.qf-title {
  font-size: .88rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.qf-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qf-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: .82rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}
.qf-select option { background: var(--bg-card) }
.qf-btn {
  width: 100%;
  padding: 9px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: .85rem;
  font-weight: 700;
  transition: var(--transition);
  margin-top: 4px;
}
.qf-btn:hover { background: var(--accent-hover) }

/* ================================================================
   UTILITY & ANIMATION HELPERS
   ================================================================ */

/* Fade-in for page transitions */
.page-enter {
  animation: fadeIn .3s ease;
}

/* Selection color */
::selection {
  background: var(--accent);
  color: #fff;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tooltip base (optional use by JS) */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .72rem;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: .15s;
  z-index: 50;
}
[data-tooltip]:hover::after { opacity: 1 }
