/* ============================================================
   AnimeConan — Midnight Violet theme
   RTL Arabic streaming UI, inspired by carateen.tv structure
   ============================================================ */

:root {
  /* Palette */
  --bg-base:        #0B0820;
  --bg-card:        #1A0F38;
  --bg-elevated:    #251849;
  --bg-overlay:     rgba(11, 8, 32, 0.85);
  --border-subtle:  rgba(255, 255, 255, 0.08);
  --border-glow:    rgba(192, 38, 211, 0.55);

  --accent-1:       #C026D3;   /* magenta */
  --accent-1-soft:  rgba(192, 38, 211, 0.18);
  --accent-2:       #00D4FF;   /* cyan */
  --accent-2-soft:  rgba(0, 212, 255, 0.18);
  --gold:           #FFB627;
  --gradient:       linear-gradient(135deg, #C026D3 0%, #6D28D9 50%, #00D4FF 100%);
  --gradient-soft:  linear-gradient(135deg, rgba(192,38,211,.22), rgba(0,212,255,.22));

  --text:           #F5F0FF;
  --text-muted:     #A89BC9;
  --text-faint:     #6B5F8F;
  --success:        #10B981;
  --danger:         #EF4444;

  /* Geometry */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --shadow-1: 0 4px 16px rgba(0,0,0,.35);
  --shadow-glow: 0 0 0 1px var(--border-glow), 0 8px 32px rgba(192,38,211,.35);

  --header-h: 64px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 0%, rgba(192,38,211,.10), transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(0,212,255,.08), transparent 50%);
  background-attachment: fixed;
}
a { color: var(--accent-2); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-1); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout helpers ---------- */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.section { margin: 2rem 0; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.section-title::before {
  content: '';
  width: 4px;
  height: 22px;
  background: var(--gradient);
  border-radius: 2px;
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(11, 8, 32, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.4rem;
  font-weight: 900;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -.5px;
  user-select: none;
  cursor: pointer;
}
.brand-mark {
  width: 32px; height: 32px;
  background: var(--gradient);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  -webkit-text-fill-color: white;
}
.nav-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--text-muted);
  font-weight: 600;
  padding: .35rem .8rem;
  border-radius: var(--r-sm);
  transition: all .15s;
  font-size: .95rem;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--accent-1-soft);
}
.search-wrap {
  flex: 1;
  max-width: 380px;
  position: relative;
}
.search-input {
  width: 100%;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text);
  padding: 0 2.8rem 0 1rem;
  font-family: inherit;
  font-size: .95rem;
  transition: all .2s;
  outline: none;
}
.search-input:focus {
  border-color: var(--accent-1);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--accent-1-soft);
}
.search-input::placeholder { color: var(--text-faint); }
.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ---------- Hero carousel ---------- */
.hero {
  position: relative;
  height: 64vh;
  min-height: 380px;
  max-height: 540px;
  overflow: hidden;
  border-radius: var(--r-xl);
  margin: 1.25rem auto 2.5rem;
  max-width: 1440px;
  width: calc(100% - 3rem);
  background: var(--bg-card);
}
.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity .8s ease;
}
.hero-slide.active { opacity: 1; }
.hero-slide::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, var(--bg-base) 0%, rgba(11,8,32,.7) 35%, transparent 70%),
    linear-gradient(to left, var(--bg-base) 0%, transparent 50%);
}
.hero-content {
  position: relative;
  padding: 2.5rem 3rem;
  max-width: 640px;
  z-index: 2;
}
.hero-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  margin: 0 0 .5rem;
  text-shadow: 0 2px 20px rgba(0,0,0,.6);
}
.hero-meta {
  display: flex;
  gap: .8rem;
  align-items: center;
  margin-bottom: .8rem;
  font-size: .95rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.hero-meta .chip { background: rgba(255,255,255,.08); padding: .15rem .6rem; border-radius: 999px; font-size: .85rem; }
.hero-meta .score { color: var(--gold); font-weight: 700; }
.hero-synopsis {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-dots {
  position: absolute;
  bottom: 1.25rem;
  right: 3rem;
  display: flex;
  gap: .4rem;
  z-index: 3;
}
.hero-dot {
  width: 28px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.25);
  border: none;
  cursor: pointer;
  transition: background .2s;
}
.hero-dot.active { background: var(--gradient); width: 44px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1.4rem;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: .95rem;
  border: 0;
  transition: all .15s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 16px rgba(192,38,211,.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(192,38,211,.5);
  color: white;
}
.btn-ghost {
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: var(--accent-1-soft); border-color: var(--accent-1); color: var(--text); }
.btn-sm { padding: .35rem .85rem; font-size: .85rem; }

/* ---------- Series row (carousel) ---------- */
.row-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: .5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-1-soft) transparent;
}
.row-scroll::-webkit-scrollbar { height: 6px; }
.row-scroll::-webkit-scrollbar-thumb { background: var(--accent-1-soft); border-radius: 3px; }
.row-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- Row scroll arrows (Netflix-style) ---------- */
.row-wrap { position: relative; }
.row-nav {
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 6;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(11, 8, 32, .78);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity .2s, background .2s, transform .12s;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
}
.row-wrap:hover .row-nav { opacity: 1; }
.row-nav:hover { background: var(--accent, #C026D3); transform: translateY(-50%) scale(1.08); }
.row-nav-left { left: 2px; }
.row-nav-right { right: 2px; }
@media (hover: none) { .row-nav { display: none !important; } }  /* touch → swipe */

/* ---------- Series card ---------- */
.card {
  position: relative;
  flex: 0 0 auto;
  width: 180px;
  scroll-snap-align: start;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-card);
  transition: transform .25s, box-shadow .25s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  color: inherit;
}
.card-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--bg-elevated);
  display: block;
}
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,8,32,.95) 0%, rgba(11,8,32,.4) 40%, transparent 70%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: .75rem;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.card:hover .card-overlay { opacity: 1; }
.card-title {
  font-size: .95rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  gap: .5rem;
  font-size: .75rem;
  color: var(--text-muted);
  align-items: center;
}
.card-meta .score { color: var(--gold); font-weight: 700; }

/* Episode count badge (gold corner triangle) */
.card-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--gold);
  color: #000;
  font-size: .72rem;
  font-weight: 800;
  padding: .15rem .55rem;
  border-radius: 0 var(--r-md) 0 var(--r-md);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  z-index: 2;
}
/* Dubbed / Subbed corner badge (top-left, opposite the episode count) */
.card-lang {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .66rem;
  font-weight: 800;
  padding: .15rem .5rem;
  border-radius: 0 0 var(--r-md) 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  z-index: 2;
  pointer-events: none;
}
.card-lang.dub { background: #6C2BD9; color: #fff; }          /* doublé — violet */
.card-lang.sub { background: #00D4FF; color: #06222B; }       /* sous-titré — cyan */
.card-lang i { font-size: .62rem; }

/* ---------- Like / dislike pill (series page) ---------- */
.vote-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: #11162b;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  padding: .4rem 1rem;
}
.vote-btn {
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-size: .95rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .1rem .25rem;
  transition: color .15s, transform .12s;
}
.vote-btn:hover { transform: scale(1.12); }
.vote-sep { width: 1px; height: 22px; background: rgba(255,255,255,.18); }
.vote-up.voted { color: #00D4FF; }   /* liked → cyan */
.vote-down.voted { color: #ff5d5d; } /* disliked → red */
.card-title-below {
  padding: .55rem .65rem .65rem;
  font-size: .85rem;
  font-weight: 600;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
  color: var(--text);
}

/* ---------- Grid (browse all) ---------- */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.series-grid .card { width: 100%; }

/* ---------- Series detail page ---------- */
.series-hero {
  position: relative;
  min-height: 480px;
  padding: 4rem 0 3rem;
  margin-bottom: 2rem;
}
.series-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-image: var(--backdrop);
  filter: blur(18px) saturate(1.1);
  opacity: .35;
  z-index: 0;
}
.series-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-base) 5%, transparent 60%, var(--bg-base) 100%);
  z-index: 1;
}
.series-hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  align-items: start;
}
.series-poster {
  width: 220px;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-1), 0 0 0 1px var(--border-subtle);
  background: var(--bg-card);
}
.series-poster img { width: 100%; height: 100%; object-fit: cover; }
.series-info h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 900;
  margin: 0 0 .25rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.series-info .subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1rem;
}
.series-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1rem;
}
.tag {
  background: var(--accent-1-soft);
  color: var(--text);
  border: 1px solid rgba(192,38,211,.3);
  padding: .25rem .7rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
}
.tag-score { background: rgba(255,182,39,.15); color: var(--gold); border-color: rgba(255,182,39,.4); }
.tag-status { background: rgba(16,185,129,.15); color: var(--success); border-color: rgba(16,185,129,.4); }
.series-synopsis {
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 1rem;
  max-width: 800px;
  margin: 1rem 0 1.5rem;
}
.series-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ---------- Season tabs ---------- */
.season-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: .25rem;
  flex-wrap: wrap;
}
.season-tab {
  padding: .5rem 1.1rem;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  font-weight: 700;
  font-size: .95rem;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  position: relative;
  transition: color .15s;
}
.season-tab:hover { color: var(--text); }
.season-tab.active { color: var(--text); }
.season-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--gradient);
  border-radius: 2px;
}

/* ---------- Episode grid ---------- */
.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.ep-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: all .2s;
  cursor: pointer;
}
.ep-card:hover {
  border-color: var(--accent-1);
  background: var(--bg-elevated);
  transform: translateY(-2px);
  color: inherit;
}
.ep-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated) center/cover;
  position: relative;
}
.ep-thumb::after {
  content: '\f04b';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  background: rgba(0,0,0,.35);
  opacity: 0;
  transition: opacity .2s;
}
.ep-card:hover .ep-thumb::after { opacity: 1; }
.ep-number {
  position: absolute;
  top: .5rem;
  right: .5rem;
  background: var(--gradient);
  color: white;
  font-weight: 800;
  font-size: .8rem;
  padding: .15rem .55rem;
  border-radius: var(--r-sm);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* ─── OAV badge (specials / S00) ──────────────────────────────── */
.ep-badge-oav {
  position: absolute;
  top: .5rem;
  left: .5rem;
  background: linear-gradient(135deg, #C026D3 0%, #7C3AED 100%);
  color: #fff;
  font-weight: 900;
  font-size: .7rem;
  letter-spacing: .08em;
  padding: .2rem .55rem;
  border-radius: var(--r-sm);
  box-shadow: 0 2px 10px rgba(192, 38, 211, .55), inset 0 0 0 1px rgba(255,255,255,.18);
  text-transform: uppercase;
  z-index: 2;
  animation: oav-pulse 2.4s ease-in-out infinite;
}
@keyframes oav-pulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(192, 38, 211, .55), inset 0 0 0 1px rgba(255,255,255,.18); }
  50% { box-shadow: 0 2px 16px rgba(192, 38, 211, .85), inset 0 0 0 1px rgba(255,255,255,.28); }
}
.ep-badge-oav.inline {
  position: static;
  display: inline-block;
  vertical-align: middle;
  margin-inline-end: .35rem;
  padding: .12rem .45rem;
  font-size: .65rem;
}
.ep-card.is-oav .ep-thumb { box-shadow: inset 0 0 0 2px rgba(192, 38, 211, .35); }
.ep-row.is-oav .ep-row-num {
  background: linear-gradient(135deg, #C026D3, #7C3AED);
  color: #fff;
}
.ep-body { padding: .65rem .85rem .85rem; }
.ep-title {
  font-size: .9rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ep-info {
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  gap: .8rem;
}

/* ---------- Player page ---------- */
.player-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.player-main {
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
}
.player-main video { width: 100%; height: 100%; display: block; background: #000; }
/* Hide native fullscreen/PiP/download buttons in browsers that ignore controlsList */
.player-main video::-webkit-media-controls-fullscreen-button { display: none !important; }
.player-main video::-webkit-media-controls-toggle-closed-captions-button { display: none !important; }
.player-main video::-webkit-media-controls-overflow-button { display: none !important; }
.player-main video::-webkit-media-controls-picture-in-picture-button { display: none !important; }
.player-main video::-webkit-media-controls-overflow-menu-button { display: none !important; }
.player-watermark {
  position: absolute;
  top: 14px;
  right: 14px;
  height: 36px;
  width: auto;
  opacity: 0.75;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  transition: opacity 0.3s;
  z-index: 5;
}
.player-main:hover .player-watermark { opacity: 0.55; }
@media (max-width: 640px) {
  .player-watermark { height: 26px; top: 10px; right: 10px; }
}
/* When the wrapper itself goes fullscreen (we redirect <video> fullscreen onto it),
   reset its aspect-ratio constraint and bump the watermark up. */
.player-main:fullscreen, .player-main:-webkit-full-screen { aspect-ratio: auto; width: 100vw; height: 100vh; background: #000; display: flex; align-items: center; justify-content: center; }
.player-main:fullscreen video, .player-main:-webkit-full-screen video { width: 100%; height: 100%; object-fit: contain; }
/* Keep the logo small & discreet in fullscreen (was 56px → too big/unpleasant). */
.player-main:fullscreen .player-watermark, .player-main:-webkit-full-screen .player-watermark { height: 28px; top: 16px; right: 16px; opacity: 0.4; }

/* Big centered play/pause button — appears when video is paused */
.player-big-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--gradient);
  border: 3px solid rgba(255, 255, 255, 0.9);
  color: #fff;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  z-index: 6;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 0 0 0 rgba(192, 38, 211, 0.6);
  padding-left: 6px; /* visually center the play triangle */
}
.player-big-play.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  animation: big-play-pulse 2.2s ease-in-out infinite;
}
.player-big-play:hover {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 14px 52px rgba(0, 0, 0, 0.65), 0 0 0 14px rgba(192, 38, 211, 0.15);
  animation: none;
}
.player-big-play:active { transform: translate(-50%, -50%) scale(0.96); }
@keyframes big-play-pulse {
  0%, 100% { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 0 0 0 rgba(192, 38, 211, 0.5); }
  50%      { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 0 0 18px rgba(192, 38, 211, 0); }
}
@media (max-width: 640px) {
  .player-big-play { width: 72px; height: 72px; font-size: 1.7rem; }
}

/* Custom fullscreen button — top-left to avoid covering native play/volume controls */
.player-fs-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px; height: 36px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.15s;
  z-index: 5;
}
.player-main:hover .player-fs-btn,
.player-main .player-fs-btn:focus-visible { opacity: 0.85; }
.player-fs-btn:hover { background: rgba(192,38,211,0.7); }
.player-main:fullscreen .player-fs-btn { top: 22px; left: 22px; width: 44px; height: 44px; }
.player-info {
  padding: 1rem 0;
}
.player-info h2 {
  margin: 0 0 .25rem;
  font-size: 1.3rem;
  font-weight: 800;
}
.player-info .ep-sub {
  color: var(--text-muted);
  font-size: .95rem;
}
.player-nav {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
}
.ep-side {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ep-side-head {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ep-side-list { overflow-y: auto; flex: 1; }
.ep-side-list::-webkit-scrollbar { width: 6px; }
.ep-side-list::-webkit-scrollbar-thumb { background: var(--accent-1-soft); }
.ep-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text-muted);
  font-size: .9rem;
  transition: all .15s;
  cursor: pointer;
}
.ep-row:hover { background: var(--accent-1-soft); color: var(--text); }
.ep-row.active {
  background: var(--gradient-soft);
  color: var(--text);
  font-weight: 700;
  border-right: 3px solid var(--accent-1);
}
.ep-row-num {
  font-weight: 800;
  background: var(--bg-elevated);
  padding: .2rem .55rem;
  border-radius: var(--r-sm);
  font-size: .8rem;
  min-width: 38px;
  text-align: center;
}
.ep-row.active .ep-row-num { background: var(--accent-1); color: white; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-faint);
  font-size: .85rem;
}
.footer-brand {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}
/* Viewer count badge (live cards + player title) */
.viewer-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3;
  pointer-events: none;
}
.viewer-badge.inline {
  position: static;
  margin-right: 0.5rem;
  vertical-align: middle;
}
.viewer-badge i { font-size: 0.75rem; }
.live-card { position: relative; }

.footer-disclaimer {
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  font-style: italic;
  border-top: 1px dashed var(--border-subtle);
  padding-top: 0.9rem;
}

/* ---------- States ---------- */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-ascii {
  font-family: 'JetBrains Mono', monospace;
  white-space: pre;
  color: var(--accent-1);
  font-size: .8rem;
  margin-bottom: 1rem;
  opacity: .6;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .player-wrap { grid-template-columns: 1fr; }
  .ep-side { max-height: 360px; }
  .series-hero-inner { grid-template-columns: 1fr; text-align: center; }
  .series-poster { margin: 0 auto; }
  .series-actions { justify-content: center; }
  .series-meta-row { justify-content: center; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .container { padding: 0 1rem; }
  .hero { height: 56vh; border-radius: var(--r-md); width: calc(100% - 2rem); }
  .hero-content { padding: 1.5rem; }
  .hero-dots { right: 1.5rem; }
  .card { width: 140px; }
  .ep-thumb { aspect-ratio: 16 / 9; }
  .series-hero { padding: 2rem 0 1.5rem; min-height: auto; }
}

/* ---------- Bottom Nav (Mobile only) ---------- */
.bottom-nav { display: none; }

@media (max-width: 640px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 64px;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(11, 8, 32, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    z-index: 100;
    justify-content: space-around;
    align-items: stretch;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    padding: 6px 4px;
    position: relative;
  }

  .bottom-nav-item i { font-size: 1.25rem; line-height: 1; }

  .bottom-nav-item.active {
    color: var(--text);
    background: linear-gradient(180deg, transparent 0%, var(--accent-1-soft) 100%);
  }

  .bottom-nav-item.active i { color: var(--accent-1); }

  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 3px;
    background: var(--gradient);
    border-radius: 0 0 3px 3px;
  }

  /* Re-use the existing pulse keyframes (defined in .live-dot) */
  .bottom-nav-livedot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 0 var(--danger);
    animation: pulse 1.6s infinite;
  }
}

/* ---------- Live TV ---------- */
.live-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 var(--danger);
  animation: pulse 1.6s infinite;
  vertical-align: middle;
  margin-left: .35rem;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.65); }
  70%  { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.nav-live { color: var(--text) !important; font-weight: 700; }
.nav-live:hover { background: rgba(239,68,68,.12) !important; }

/* ─── Telegram chat link (header nav + bottom nav) ──────────────────── */
.nav-telegram {
  color: #fff !important;
  font-weight: 700;
  background: linear-gradient(135deg, #229ED9 0%, #1d8cc1 100%);
  box-shadow: 0 2px 10px rgba(34, 158, 217, .35), inset 0 0 0 1px rgba(255,255,255,.12);
  transition: transform .15s ease, box-shadow .25s ease, filter .25s ease;
}
.nav-telegram i { color: #fff; }
.nav-telegram:hover {
  background: linear-gradient(135deg, #2bb1ef 0%, #229ED9 100%) !important;
  box-shadow: 0 4px 18px rgba(34, 158, 217, .65), inset 0 0 0 1px rgba(255,255,255,.22);
  transform: translateY(-1px);
  filter: brightness(1.05);
}
@keyframes tg-pulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(34, 158, 217, .35), inset 0 0 0 1px rgba(255,255,255,.12); }
  50%      { box-shadow: 0 2px 16px rgba(34, 158, 217, .70), inset 0 0 0 1px rgba(255,255,255,.20); }
}
.nav-telegram { animation: tg-pulse 3.5s ease-in-out infinite; }

.bottom-nav-telegram { color: #229ED9 !important; }
.bottom-nav-telegram i { color: #229ED9; }
.bottom-nav-telegram:hover { color: #2bb1ef !important; }

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.live-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  transition: all .2s;
  position: relative;
}
.live-card:hover {
  border-color: var(--danger);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(239,68,68,.25);
  color: inherit;
}
.live-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(239,68,68,.08), transparent 50%);
  pointer-events: none;
}
.live-card-logo-wrap {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  background: transparent;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .35rem;
  overflow: hidden;
}
.live-card-logo-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }
.live-card-logo-wrap i { font-size: 2.5rem; color: var(--text-muted); }
.live-card-body { flex: 1; min-width: 0; }
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--danger);
  color: white;
  font-size: .7rem;
  font-weight: 800;
  padding: .15rem .55rem;
  border-radius: 999px;
  margin-bottom: .35rem;
  text-transform: uppercase;
}
.live-badge .live-dot { background: white; margin: 0; box-shadow: none; animation: none; width: 6px; height: 6px; }
.live-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 .2rem;
}
.live-card-sub {
  color: var(--text-muted);
  font-size: .85rem;
  margin: 0;
}
.live-row.active { border-right-color: var(--danger); background: rgba(239,68,68,.12); }

/* ---------- Easter egg: CRT phosphor mode ---------- */
body.crt-mode {
  --bg-base: #000000;
  --bg-card: #001A0D;
  --bg-elevated: #002918;
  --accent-1: #00FF66;
  --accent-2: #00DDFF;
  --gradient: linear-gradient(135deg, #00FF66 0%, #00DDFF 100%);
  --text: #00FF66;
  --text-muted: #00AA44;
  --gold: #FFFF00;
  font-family: 'JetBrains Mono', 'Cairo', monospace;
}
body.crt-mode::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    transparent 0,
    transparent 2px,
    rgba(0,255,102,.04) 3px,
    rgba(0,255,102,.04) 3px
  );
  z-index: 9999;
  mix-blend-mode: screen;
}

/* ═════════ Legal pages (Terms / Privacy) ═════════════════════════════ */
.legal-page {
  max-width: 760px;
  margin: 3rem auto 5rem;
  padding: 0 1.25rem;
  font-family: "Cairo", system-ui, sans-serif;
  color: #E9E4FB;
  line-height: 1.95;
}

.legal-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  position: relative;
}
.legal-header::after {
  content: "";
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(135deg, #C026D3, #00D4FF);
}

.legal-eyebrow {
  display: inline-block;
  font-size: .78rem;
  letter-spacing: .15em;
  padding: .35rem .9rem;
  border: 1px solid rgba(192, 38, 211, .45);
  border-radius: 999px;
  color: #C026D3;
  background: rgba(192, 38, 211, .08);
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}

.legal-title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 900;
  margin: 0 0 .8rem;
  background: linear-gradient(135deg, #FFFFFF 0%, #C026D3 60%, #00D4FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -.01em;
}

.legal-meta {
  color: #9D90C8;
  font-size: .92rem;
  margin: 0;
  font-family: "JetBrains Mono", "Cairo", monospace;
}

.legal-section {
  margin-bottom: 2.4rem;
  padding: 1.6rem 1.8rem;
  background: linear-gradient(180deg, rgba(26, 15, 56, .55), rgba(26, 15, 56, .25));
  border: 1px solid rgba(192, 38, 211, .12);
  border-radius: 14px;
  transition: border-color .25s ease, transform .25s ease;
}
.legal-section:hover {
  border-color: rgba(192, 38, 211, .3);
}

.legal-section h2 {
  display: flex;
  align-items: center;
  gap: .8rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0 0 1rem;
}

.legal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 .55rem;
  font-family: "JetBrains Mono", monospace;
  font-size: .95rem;
  font-weight: 700;
  color: #FFB627;
  background: linear-gradient(135deg, rgba(192, 38, 211, .18), rgba(0, 212, 255, .12));
  border: 1px solid rgba(255, 182, 39, .35);
  border-radius: 10px;
}

.legal-section p,
.legal-section li {
  font-size: 1.02rem;
  color: #D4CDE8;
}

.legal-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.legal-list li {
  position: relative;
  padding-inline-start: 1.6rem;
  margin-bottom: .55rem;
}
.legal-list li::before {
  content: "◆";
  position: absolute;
  inset-inline-start: 0;
  top: .15rem;
  color: #C026D3;
  font-size: .85rem;
}
.legal-list-check li::before {
  content: "✕";
  color: #FF5577;
  font-weight: 700;
}

.legal-section strong { color: #FFFFFF; font-weight: 700; }
.legal-section em     { color: #00D4FF; font-style: normal; font-weight: 600; }
.legal-section code   {
  font-family: "JetBrains Mono", monospace;
  background: rgba(0, 212, 255, .12);
  color: #00D4FF;
  padding: .12em .45em;
  border-radius: 6px;
  font-size: .92em;
}

.legal-note {
  margin-top: .9rem;
  padding: .85rem 1rem;
  border-inline-start: 3px solid #FFB627;
  background: rgba(255, 182, 39, .07);
  border-radius: 0 8px 8px 0;
  font-size: .95rem;
}

.legal-cta {
  display: inline-block;
  margin-inline-start: .5rem;
  padding: .35rem 1rem;
  background: linear-gradient(135deg, #C026D3, #00D4FF);
  color: #0B0820 !important;
  font-weight: 700;
  border-radius: 999px;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.legal-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(192, 38, 211, .35);
}

.legal-footer {
  margin-top: 3rem;
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px dashed rgba(192, 38, 211, .25);
}
.legal-footer a {
  color: #C026D3;
  text-decoration: none;
  font-weight: 600;
  transition: color .2s ease;
}
.legal-footer a:hover { color: #00D4FF; }

/* ═════════ Footer legal links ════════════════════════════════════════ */
.footer-legal {
  margin-top: .6rem;
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.footer-legal a {
  color: #9D90C8;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  position: relative;
  transition: color .2s ease;
}
.footer-legal a::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  bottom: -3px;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, #C026D3, #00D4FF);
  transition: width .25s ease;
}
.footer-legal a:hover {
  color: #FFFFFF;
}
.footer-legal a:hover::after { width: 100%; }
.footer-legal .sep { color: rgba(157, 144, 200, .4); }

@media (max-width: 540px) {
  .legal-section { padding: 1.2rem 1.1rem; }
  .legal-section h2 { font-size: 1.15rem; }
  .legal-page { margin-top: 2rem; }
}

/* ---------- Live chat (global, polling) ---------- */
.player-wrap.live-3col {
  grid-template-columns: 1fr 240px 320px;
  align-items: start;
}
.live-chat {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.live-chat-head {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  background: var(--gradient-soft);
}
.live-chat-head i { color: var(--accent-1); }
.live-chat-online {
  font-size: .8rem;
  font-weight: 600;
  color: var(--success);
  white-space: nowrap;
}
.live-chat-online i { color: var(--success); }
.live-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: .6rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: 220px;
}
.live-chat-msgs::-webkit-scrollbar { width: 6px; }
.live-chat-msgs::-webkit-scrollbar-thumb { background: var(--accent-1-soft); border-radius: 3px; }
.live-chat-empty {
  color: var(--text-faint);
  text-align: center;
  margin: auto;
  font-size: .9rem;
}
.live-chat-msg {
  background: var(--bg-elevated);
  border-radius: var(--r-sm);
  padding: .45rem .6rem;
  border: 1px solid var(--border-subtle);
}
.live-chat-msg-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .15rem;
}
.live-chat-msg-name {
  font-weight: 700;
  font-size: .82rem;
  color: var(--accent-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}
.live-chat-msg-time { font-size: .7rem; color: var(--text-faint); flex-shrink: 0; }
.live-chat-msg-text {
  font-size: .9rem;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.4;
}
.live-chat-form {
  border-top: 1px solid var(--border-subtle);
  padding: .6rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.live-chat-name,
.live-chat-input {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: .5rem .7rem;
  font: inherit;
  font-size: .88rem;
  width: 100%;
}
.live-chat-name { font-size: .8rem; }
.live-chat-name:focus,
.live-chat-input:focus { outline: none; border-color: var(--border-glow); }
.live-chat-row { display: flex; gap: .45rem; }
.live-chat-row .live-chat-input { flex: 1; }
.live-chat-send {
  background: var(--gradient);
  border: none;
  border-radius: var(--r-sm);
  color: #fff;
  width: 42px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter .15s ease;
}
.live-chat-send:hover { filter: brightness(1.15); }
.live-chat-note { font-size: .76rem; color: var(--gold); min-height: 1em; }

@media (max-width: 1200px) {
  .player-wrap.live-3col { grid-template-columns: 1fr 300px; }
  .player-wrap.live-3col .live-chat { grid-column: 1 / -1; max-height: 50vh; }
}
@media (max-width: 992px) {
  .player-wrap.live-3col { grid-template-columns: 1fr; }
  .player-wrap.live-3col .live-chat { max-height: 60vh; }
}
