/* ============================================================
   DRAMALUXE — Premium Telegram Mini App Styles
   Modern, luxurious dark theme with gold/amber accents
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Space+Grotesk:wght@700&display=swap');

:root {
  /* Brand colors */
  --brand-gold: #F5A623;
  --brand-gold-rgb: 245, 166, 35;
  --brand-amber: #FFCB6B;
  --brand-dark: #08080E;
  --brand-surface: #0E0E16;
  --brand-surface-2: #14141F;

  /* Source color (overridden per source page) */
  --source-color: #F5A623;
  --source-color-rgb: 245, 166, 35;

  /* Core palette */
  --bg-primary: #08080E;
  --bg-secondary: #0E0E16;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.08);
  --border-color: rgba(255,255,255,0.06);
  --border-glow: rgba(var(--source-color-rgb), 0.15);
  --text-primary: #F0F0F5;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --transition-spring: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Subtitle */
  --vp-subtitle-bottom: 35%;

  /* Telegram theme vars (overridden by telegram.js at runtime) */
  --tg-bg: #08080E;
  --tg-secondary-bg: #0E0E16;
  --tg-text: #F0F0F5;
  --tg-hint: #5A5F6B;
  --tg-button: #F5A623;
  --tg-button-text: #000000;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ── Page transition ──────────────────────────────────────── */
.main-content, .drama-grid {
  animation: pageEnter .35s ease both;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Episode group (batched) ─────────────────────────────── */
.ep-group-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.ep-group-tabs::-webkit-scrollbar { display: none; }
.ep-group-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.ep-group-tab.active {
  background: rgba(var(--source-color-rgb), .12);
  border-color: rgba(var(--source-color-rgb), .3);
  color: var(--source-color);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(var(--source-color-rgb), .3); border-radius: 3px; }

/* ============================================================
   TELEGRAM MINI APP — LANDING PAGE (DRAMALUXE HOME)
   ============================================================ */
.tg-landing {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(var(--brand-gold-rgb), .06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, .04) 0%, transparent 40%),
    linear-gradient(180deg, #0a0a12 0%, var(--bg-primary) 100%);
  display: flex;
  flex-direction: column;
  padding: 0 16px calc(20px + var(--safe-bottom));
  padding-top: calc(12px + var(--safe-top));
  gap: 0;
}

/* ── App Header ─────────────────────────────────────────────── */
.tg-landing-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0 20px;
}

.tg-landing-logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(var(--brand-gold-rgb), .2) 0%, rgba(var(--brand-gold-rgb), .05) 100%);
  border: 1px solid rgba(var(--brand-gold-rgb), .25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(var(--brand-gold-rgb), .1);
}

.tg-landing-logo svg {
  width: 30px;
  height: 30px;
}

.tg-landing-title-wrap { flex: 1; min-width: 0; }

.tg-landing-app-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #FFCB6B 0%, #F5A623 50%, #E8912D 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.tg-landing-tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 0.3px;
}

/* ── Header Actions (share + reload) ──────────────────────── */
.tg-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tg-header-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.tg-header-btn:active {
  transform: scale(0.9);
  background: var(--bg-card-hover);
}

.tg-header-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Section Label ──────────────────────────────────────────── */
.tg-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-color) 0%, transparent 100%);
}

/* ── Source List ────────────────────────────────────────────── */
.tg-source-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tg-source-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.tg-source-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: radial-gradient(circle at 0% 50%, rgba(var(--card-color-rgb, var(--source-color-rgb)), .08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .3s;
}

.tg-source-card::after {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--card-color, var(--source-color));
  border-radius: 0 3px 3px 0;
  opacity: 0.9;
}

.tg-source-card:active {
  transform: scale(0.98);
  background: var(--bg-card-hover);
}

.tg-source-card:active::before { opacity: 1; }

@media (hover: hover) {
  .tg-source-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(var(--card-color-rgb, var(--source-color-rgb)), .2);
    transform: translateX(2px);
  }
  .tg-source-card:hover::before { opacity: 1; }
}

.tg-source-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--card-color-rgb, var(--source-color-rgb)), .1);
  border: 1px solid rgba(var(--card-color-rgb, var(--source-color-rgb)), .15);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.tg-source-icon svg {
  width: 26px;
  height: 26px;
  color: var(--card-color, var(--source-color));
}

.tg-source-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.tg-source-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.tg-source-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tg-source-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.4;
  position: relative;
  z-index: 1;
}

.tg-source-chevron svg {
  width: 18px;
  height: 18px;
}

/* ── Landing Footer ────────────────────────────────────────── */
.tg-landing-footer {
  margin-top: auto;
  padding-top: 28px;
  text-align: center;
}

.tg-landing-footer .footer-brand {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, #FFCB6B, #F5A623);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  margin-bottom: 4px;
}

.tg-landing-footer .footer-legal {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
  line-height: 1.6;
}

.tg-landing-footer .footer-handle {
  font-size: 11px;
  color: rgba(var(--brand-gold-rgb), .5);
  margin-top: 2px;
  display: block;
}

/* ============================================================
   SOURCE HEADER — Redesigned for Telegram Mini App
   ============================================================ */
.source-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 8, 14, .98);
  border-bottom: 1px solid var(--border-color);
  padding: 0 14px;
  padding-top: var(--safe-top);
}

/* Back button — always hidden, using Telegram BackButton */
.back-btn {
  display: none !important;
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 12px;
}

.header-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.header-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--source-color-rgb), .1);
  border: 1px solid rgba(var(--source-color-rgb), .15);
  flex-shrink: 0;
}

.header-icon svg {
  width: 20px;
  height: 20px;
  color: var(--source-color);
}
.header-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.header-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Header action buttons (share + reload) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.header-action-btn:active {
  transform: scale(0.88);
  background: rgba(var(--source-color-rgb), .1);
  color: var(--source-color);
}

.header-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Search bar */
.header-search {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 11px 36px 11px 42px;
  border-radius: var(--radius-md);
  font-size: 16px;
  line-height: 1.2;
  outline: none;
  transition: var(--transition);
  touch-action: manipulation;
}

.search-input::placeholder { color: var(--text-muted); font-size: 14px; }

.search-input:focus {
  border-color: rgba(var(--source-color-rgb), .4);
  background: rgba(var(--source-color-rgb), .04);
  box-shadow: 0 0 0 3px rgba(var(--source-color-rgb), .08);
}

/* Search clear button */
.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  border: none;
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.search-clear-btn.visible { display: flex; }

/* Search result count */
.search-result-count {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0 4px;
  font-weight: 500;
}

/* ============================================================
   TAB NAVIGATION
   ============================================================ */
.tab-nav {
  padding: 0 14px;
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(8, 8, 14, .6);
}

.tab-nav::-webkit-scrollbar { display: none; }

/* Tab scroll fade hint — indicates more tabs available */
.tab-nav {
  -webkit-mask-image: linear-gradient(to right, #000 85%, transparent 100%);
  mask-image: linear-gradient(to right, #000 85%, transparent 100%);
}
.tab-nav.scrolled-end {
  -webkit-mask-image: linear-gradient(to left, #000 85%, transparent 100%);
  mask-image: linear-gradient(to left, #000 85%, transparent 100%);
}
.tab-nav.scrolled-mid {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 8%, #000 85%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 8%, #000 85%, transparent 100%);
}
.tab-nav.no-overflow {
  -webkit-mask-image: none;
  mask-image: none;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  bottom: -1px;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn:active { opacity: 0.7; }
.tab-btn.active {
  color: var(--source-color);
  border-bottom-color: var(--source-color);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  padding: 14px 12px calc(70px + env(safe-area-inset-bottom, 0px));
}

/* ============================================================
   DRAMA GRID
   ============================================================ */
.drama-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 8px; /* fallback for old browsers */
  gap: 8px;
}

@media (min-width: 400px) { .drama-grid { grid-gap: 10px; gap: 10px; } }
@media (min-width: 480px) { .drama-grid { grid-template-columns: repeat(3, 1fr); grid-gap: 10px; gap: 10px; } }
@media (min-width: 600px) { .drama-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .drama-grid { grid-template-columns: repeat(4, 1fr); grid-gap: 12px; gap: 12px; } }
@media (min-width: 1024px) { .drama-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1280px) { .drama-grid { grid-template-columns: repeat(6, 1fr); } }

/* ============================================================
   DRAMA CARD — Compact, elegant
   ============================================================ */
.drama-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.drama-card:active { transform: scale(.97); }

@media (hover: hover) {
  .drama-card:hover {
    transform: translateY(-3px);
    background: var(--bg-card-hover);
    border-color: rgba(var(--source-color-rgb), .25);
    box-shadow: 0 8px 24px rgba(0,0,0,.4), 0 0 0 1px rgba(var(--source-color-rgb), .1);
  }
  .drama-card:hover .card-thumb img { transform: scale(1.05); }
}

.card-thumb {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #111118;
}
/* Fallback for browsers without aspect-ratio (iOS<15, Chrome<88) */
@supports not (aspect-ratio: 3/4) {
  .card-thumb { height: 0; padding-top: 133.33%; }
  .card-thumb img { position: absolute; top: 0; left: 0; }
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease, opacity .3s ease;
  opacity: 0;
}
.card-thumb img.loaded,
.card-thumb img[complete] { opacity: 1; }
/* Ensure images that load from cache show immediately */
.card-thumb img[src]:not([src=""]) { animation: imgFadeIn .3s ease forwards; }
@keyframes imgFadeIn { from { opacity: 0; } to { opacity: 1; } }

.card-eps {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.2px;
}

.card-hot {
  position: absolute;
  top: 6px;
  left: 6px;
  background: linear-gradient(135deg, #EF4444, #F97316);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.card-info {
  padding: 8px 8px 10px;
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.tag {
  background: rgba(var(--source-color-rgb), .1);
  color: var(--source-color);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(var(--source-color-rgb), .12);
}

/* ── Play overlay ─────────────────────────────────────────── */
.card-play-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s ease;
  pointer-events: none;
}

.card-play-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(var(--source-color-rgb), 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

@media (hover: hover) {
  .drama-card:hover .card-play-overlay { background: rgba(0,0,0,0.35); }
  .drama-card:hover .card-play-icon { opacity: 1; transform: scale(1); }
}

.drama-card:active .card-play-overlay { background: rgba(0,0,0,0.45); }
.drama-card:active .card-play-icon { opacity: 1; transform: scale(1); }

/* ── Loading overlay ──────────────────────────────────────── */
.card-loading-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 5;
}

.card-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--source-color);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.drama-card.card-loading .card-loading-overlay { display: flex; }
.drama-card.card-loading { pointer-events: none; }

/* ── Locked card ──────────────────────────────────────────── */
.drama-card-locked {
  cursor: not-allowed !important;
  border-color: rgba(239,68,68,.25);
  background: rgba(239,68,68,.04);
}
.drama-card-locked .card-thumb img { filter: grayscale(.25) brightness(.65); }
.drama-card-locked .card-play-overlay { background: rgba(0,0,0,.55); }
.drama-card-locked .card-play-icon { opacity: 0 !important; transform: scale(.7) !important; }
.drama-card-locked .card-info { opacity: .9; }

.card-lock-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 6;
  background: rgba(15,15,25,.9);
  border: 1px solid rgba(239,68,68,.45);
  color: #fecaca;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.card-coming-soon-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 6;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 2px 6px rgba(245,158,11,0.4);
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.skeleton-img {
  aspect-ratio: 3/4;
  background: #111118;
  position: relative;
  overflow: hidden;
}
.skeleton-img::after, .skeleton-line::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,.04) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}
@supports not (aspect-ratio: 3/4) {
  .skeleton-img { height: 0; padding-top: 133.33%; }
}

.skeleton-line {
  height: 10px;
  border-radius: 5px;
  background: #111118;
  position: relative;
  overflow: hidden;
  margin: 8px 8px 0;
}

.skeleton-tags {
  display: flex;
  gap: 4px;
  padding: 6px 8px 8px;
}
.skeleton-tag {
  height: 14px;
  width: 40px;
  border-radius: 4px;
  background: #111118;
  position: relative;
  overflow: hidden;
}
.skeleton-tag::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,.04) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================================
   EMPTY / ERROR STATE
   ============================================================ */
.empty-state, .error-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.empty-state .empty-icon,
.error-state .error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 8px;
}

.empty-state p, .error-state p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 260px;
}
.empty-state .empty-sub, .error-state .error-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.retry-btn {
  background: rgba(var(--source-color-rgb), .12);
  border: 1px solid rgba(var(--source-color-rgb), .25);
  color: var(--source-color);
  padding: 10px 24px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  margin-top: 14px;
}

/* ============================================================
   LOAD MORE / INFINITE SCROLL
   ============================================================ */
.load-more-container { text-align: center; margin-top: 24px; }

.load-more-btn {
  background: rgba(var(--source-color-rgb), .08);
  border: 1px solid rgba(var(--source-color-rgb), .2);
  color: var(--source-color);
  padding: 12px 36px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.load-more-btn:hover { background: rgba(var(--source-color-rgb), .15); }
.load-more-btn:disabled { opacity: .5; cursor: not-allowed; }

.scroll-sentinel { height: 1px; margin-top: 20px; }

.loading-more {
  grid-column: 1/-1;
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.loading-more::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(var(--source-color-rgb), .2);
  border-top-color: var(--source-color);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   DETAIL MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s ease;
}

.modal-overlay.show { opacity: 1; }

.modal-container {
  background: var(--bg-surface-2, #12121C);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  padding-bottom: var(--safe-bottom);
}

.modal-overlay.show .modal-container { transform: translateY(0); }

.modal-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,.12);
  border-radius: 2px;
  margin: 12px auto 0;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
}

.modal-close:hover { background: rgba(239,68,68,.15); color: #ef4444; }

.modal-content { padding: 16px 16px 24px; }

.modal-hero { display: flex; gap: 16px; margin-bottom: 20px; }

.modal-thumb {
  width: 110px;
  min-width: 110px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
@supports not (aspect-ratio: 3/4) {
  .modal-thumb { height: 147px; /* 110 * 4/3 */ }
}

.modal-info { flex: 1; min-width: 0; }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 8px;
}

.modal-status {
  display: inline-block;
  background: rgba(var(--source-color-rgb), .12);
  color: var(--source-color);
  border: 1px solid rgba(var(--source-color-rgb), .2);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 6px;
  margin-bottom: 6px;
}

.modal-eps-count {
  display: inline-block;
  background: rgba(255,255,255,.05);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.modal-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }

.modal-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.modal-desc.expanded {
  -webkit-line-clamp: unset;
  line-clamp: unset;
}
.modal-desc-toggle {
  background: none;
  border: none;
  color: var(--source-color);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  margin-top: 4px;
}
.modal-desc-toggle:active { opacity: .6; }

.modal-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 14px 7px 11px;
  background: linear-gradient(135deg,
    rgba(var(--source-color-rgb), 0.95),
    rgba(var(--source-color-rgb), 0.7));
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(var(--source-color-rgb), 0.35),
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.15s ease,
              background 0.15s ease;
  position: relative;
  overflow: hidden;
}
.modal-share-btn::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.18) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.modal-share-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 18px rgba(var(--source-color-rgb), 0.45),
    0 2px 4px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.modal-share-btn:hover::before { transform: translateX(100%); }
.modal-share-btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow:
    0 2px 6px rgba(var(--source-color-rgb), 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.modal-share-btn svg {
  width: 14px; height: 14px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
}
.modal-share-btn.copied {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  animation: vpShareCopiedPulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes vpShareCopiedPulse {
  0%   { transform: scale(0.94); }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.modal-synopsis {
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}
.modal-actions {
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.modal-loading-eps {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 0;
}
.modal-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(var(--source-color-rgb), .2);
  border-top-color: var(--source-color);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.modal-total-eps {
  font-size: 12px;
  color: var(--text-muted);
}

.modal-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  margin-bottom: 16px;
  background: var(--source-color);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.modal-play-btn:active { transform: scale(.97); opacity: .85; }

.modal-episodes { border-top: 1px solid var(--border-color); padding-top: 18px; }

.episodes-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 7px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 2px;
}

.ep-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 9px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
  text-align: center;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ep-btn:hover, .ep-btn.active {
  background: rgba(var(--source-color-rgb), .12);
  border-color: rgba(var(--source-color-rgb), .3);
  color: var(--source-color);
}

.ep-btn-locked, .ep-btn[disabled] {
  background: rgba(239,68,68,.06) !important;
  border-color: rgba(239,68,68,.3) !important;
  color: #fca5a5 !important;
  cursor: not-allowed !important;
  opacity: .78;
}

.ep-btn-locked:hover, .ep-btn[disabled]:hover,
.ep-btn-locked:active, .ep-btn[disabled]:active {
  transform: none !important;
}

/* ============================================================
   VIDEO PLAYER — REDESIGNED (Modern Streaming UI)
   ============================================================ */

/* ── Base overlay ─────────────────────────────────────────── */
.vp-overlay {
  position: fixed !important;
  top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;
  inset: 0 !important;
  background: #000 !important;
  z-index: 2000;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}

.vp-overlay.show { transform: translateY(0); }

.vp-touch-layer {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  z-index: 5;
  background: transparent;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── Video fills entire overlay ───────────────────────────── */
#vp-video {
  position: absolute;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain;
  background: #000;
  z-index: 1;
  display: block;
}

/* ── Subtitle overlay ─────────────────────────────────────── */
.vp-subtitle-overlay {
  position: absolute;
  bottom: var(--vp-subtitle-bottom, 35%);
  left: 0;
  right: 0;
  text-align: center;
  padding: 0 16px;
  pointer-events: none;
  z-index: 8;
}

.vp-subtitle-overlay span {
  background: transparent;
  color: #ffffff;
  font-family: 'Inter', 'Roboto', 'Noto Sans', sans-serif;
  font-size: 30px; /* fallback for browsers without clamp() */
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 4px;
  line-height: 1.5;
  display: inline-block;
  max-width: min(94vw, 1050px);
  letter-spacing: 0.03em;
  word-break: break-word;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
     0    2px 4px rgba(0,0,0,.8),
     0    0   6px rgba(0,0,0,.5);
  -webkit-text-stroke: 0.5px rgba(0,0,0,.6);
}

/* ── Landscape video mode ─────────────────────────────────── */
/* Subtitle: smaller font, closer to bottom for landscape */
.vp-landscape .vp-subtitle-overlay {
  bottom: 8% !important;
}
.vp-landscape .vp-subtitle-overlay span {
  font-size: clamp(18px, 3vw, 26px);
  padding: 4px 12px;
  line-height: 1.4;
  max-width: min(85vw, 900px);
}

/* Portrait video mode (default — larger subtitle, centered) */
.vp-portrait .vp-subtitle-overlay {
  bottom: 35% !important;
}
.vp-portrait .vp-subtitle-overlay span {
  font-size: clamp(26px, 5vw, 36px);
}

/* Landscape fullscreen: controls tighter to edges */
.vp-landscape .vp-bottom-overlay {
  padding-bottom: 8px;
}
.vp-landscape .vp-top-overlay {
  padding-top: 8px;
}

/* ── Landscape Fullscreen Rotation ────────────────────────── */
/* When video is landscape but phone is portrait: rotate entire player 90deg */
/* Only applies in CSS fullscreen mode (not native fullscreen which handles rotation) */
@media (orientation: portrait) {
  .vp-overlay.vp-css-fullscreen.vp-landscape {
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh !important;
    height: 100vw !important;
    top: 50% !important;
    left: 50% !important;
    margin-top: calc(-50vw) !important;
    margin-left: calc(-50vh) !important;
  }
  /* Subtitle adjusted for rotated view */
  .vp-overlay.vp-css-fullscreen.vp-landscape .vp-subtitle-overlay {
    bottom: 6% !important;
  }
  .vp-overlay.vp-css-fullscreen.vp-landscape .vp-subtitle-overlay span {
    font-size: clamp(18px, 3vw, 24px);
    max-width: 80vh;
  }
  /* Controls fit rotated dimensions */
  .vp-overlay.vp-css-fullscreen.vp-landscape .vp-bottom-overlay {
    padding-bottom: 6px;
    padding-left: env(safe-area-inset-top, 0px);
    padding-right: env(safe-area-inset-bottom, 0px);
  }
  .vp-overlay.vp-css-fullscreen.vp-landscape .vp-top-overlay {
    padding-top: 6px;
    padding-left: env(safe-area-inset-top, 0px);
    padding-right: env(safe-area-inset-bottom, 0px);
  }
}
/* When phone is already landscape — no rotation needed */
@media (orientation: landscape) {
  .vp-overlay.vp-css-fullscreen.vp-landscape {
    transform: none;
  }
}

/* ── Loading spinner ──────────────────────────────────────── */
.vp-loading {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  z-index: 15;
}

.vp-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--source-color);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Controls auto-hide ───────────────────────────────────── */
.vp-top-overlay,
.vp-center-controls,
.vp-bottom-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s cubic-bezier(.4,0,.2,1);
}

.vp-right-panel {
  opacity: 1;
  pointer-events: auto;
}

.vp-overlay.controls-visible .vp-top-overlay,
.vp-overlay.controls-visible .vp-center-controls,
.vp-overlay.controls-visible .vp-bottom-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* ── Center controls ──────────────────────────────────────── */
.vp-center-controls {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
}

/* ── Top overlay ──────────────────────────────────────────── */
.vp-top-overlay {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  padding: 14px 14px 40px;
  padding-top: calc(14px + var(--safe-top));
  background: linear-gradient(to bottom, rgba(0,0,0,.85) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.vp-back-btn {
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
  -webkit-tap-highlight-color: transparent;
}

.vp-back-btn:active { background: rgba(255,255,255,.2); }

/* Telegram: hide internal back button */
body.tg-app .vp-back-btn { display: none !important; }

.vp-header-info { flex: 1; min-width: 0; }

.vp-drama-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}

.vp-ep-title {
  font-size: 12px;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 2px;
}

/* ── Right panel: hidden ──────────────────────────────────── */
.vp-right-panel { display: none !important; }

/* ── Bottom overlay ───────────────────────────────────────── */
.vp-bottom-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  padding: 24px 14px 8px;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.95) 0%, rgba(0,0,0,.6) 60%, transparent 100%);
}

.vp-seek-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.vp-time-cur, .vp-time-dur {
  font-size: 12px;
  color: rgba(255,255,255,.9);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  min-width: 36px;
}

.vp-time-dur { text-align: right; }

.vp-progress-bar-wrap {
  flex: 1;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

.vp-progress-bar {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 2px;
  overflow: hidden;
  pointer-events: none;
}

.vp-progress-buffered {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  right: 0;
  background: rgba(255,255,255,.3);
  border-radius: 2px;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform .3s linear;
  will-change: transform;
}

.vp-progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  right: 0;
  background: var(--source-color);
  border-radius: 2px;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform .1s linear;
  will-change: transform;
}

.vp-seek {
  position: absolute;
  left: 0; right: 0;
  width: 100%;
  height: 20px;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  z-index: 2;
  -webkit-appearance: none;
  appearance: none;
}

/* ── Controls row ─────────────────────────────────────────── */
.vp-ctrl-row {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  padding: 4px 0 2px !important;
}

.vp-time-display {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: rgba(255,255,255,.9);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  margin-right: 4px;
}

.vp-time-sep { color: rgba(255,255,255,.5); font-weight: 400; }
.vp-ctrl-spacer { flex: 1; min-width: 0; }

.vp-bottom-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.9);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
}

.vp-bottom-btn svg { width: 22px; height: 22px; }
.vp-bottom-btn:active { background: rgba(255,255,255,.12); transform: scale(.88); }
.vp-bottom-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.vp-bottom-btn:disabled {
  opacity: .38;
  cursor: not-allowed;
  pointer-events: none;
}
.vp-bottom-btn:disabled:hover,
.vp-bottom-btn:disabled:active {
  background: none;
  color: rgba(255,255,255,.9);
  transform: none;
}

/* ── Fullscreen button ─────────────────────────────────────── */
.vp-fs-btn {
  position: relative;
}
.vp-fs-btn svg {
  transition: transform .2s ease;
}
.vp-fs-btn:active svg {
  transform: scale(1.15);
}
/* Highlight saat non-fullscreen agar user tahu bisa expand */
.tg-app:not(.tg-fullscreen) .vp-fs-btn {
  color: rgba(255,255,255,1);
}
.tg-fullscreen .vp-fs-btn {
  color: rgba(255,255,255,.75);
}

/* ── Ctrl buttons ─────────────────────────────────────────── */
.vp-ctrl-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  transition: transform .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
  padding: 4px;
}

.vp-ctrl-btn:active { transform: scale(.88); opacity: .7; }

.vp-rewind-btn, .vp-forward-btn { position: relative; }

.vp-seek-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  line-height: 1;
  margin-top: 1px;
}

.vp-play-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(var(--source-color-rgb), .85);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 20px rgba(var(--source-color-rgb), .4);
}

.vp-play-btn:active {
  background: rgba(var(--source-color-rgb), 1);
  transform: scale(.92);
}

/* ── Settings popup ───────────────────────────────────────── */
.vp-settings-popup {
  position: absolute;
  right: 10px;
  bottom: 80px;
  z-index: 30;
  background: rgba(12,12,22,.97);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 16px 14px;
  min-width: 200px;
  max-width: 260px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.96);
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

.vp-settings-popup.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.vp-settings-section { margin-bottom: 4px; }
.vp-settings-section:last-child { margin-bottom: 0; }

.vp-settings-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.vp-settings-sep {
  height: 1px;
  background: rgba(255,255,255,.06);
  margin: 10px 0;
}

.vp-speed-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.vp-speed-opt {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: background .15s, color .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}

.vp-speed-opt:active, .vp-speed-opt.active {
  background: rgba(var(--source-color-rgb), .2);
  border-color: rgba(var(--source-color-rgb), .4);
  color: var(--source-color);
}

/* ── Pill options (resolution & subtitle) ────────────────── */
.vp-pill-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.vp-pill-opt {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: background .15s, color .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.vp-pill-opt:active, .vp-pill-opt.active {
  background: rgba(var(--source-color-rgb), .2);
  border-color: rgba(var(--source-color-rgb), .4);
  color: var(--source-color);
}
.vp-pill-opt:disabled {
  opacity: .4;
  cursor: wait;
}

/* ── Subtitle custom dropdown (stays inside rotated overlay) ─ */
.vp-sub-dropdown-btn {
  width: 100%;
  text-align: left;
}
.vp-sub-dropdown-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(15,15,25,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 6px;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
/* Landscape: panel opens to the left (settings popup is at right edge) */
.vp-landscape .vp-sub-dropdown-panel {
  bottom: 0;
  top: 0;
  left: auto;
  right: 100%;
  margin-bottom: 0;
  margin-right: 6px;
  width: 180px;
  max-height: none;
  overflow-y: auto;
}
.vp-sub-dropdown-panel::-webkit-scrollbar { width: 3px; }
.vp-sub-dropdown-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.vp-sub-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.vp-sub-dropdown-item:hover {
  background: rgba(255,255,255,0.08);
}
.vp-sub-dropdown-item.active {
  background: rgba(var(--source-color-rgb, 245,166,35), 0.15);
  color: rgb(var(--source-color-rgb, 245,166,35));
  font-weight: 600;
}
.device-low .vp-sub-dropdown-panel {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ── Settings indicator dot ──────────────────────────────── */
.vp-settings-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--source-color);
  box-shadow: 0 0 6px rgba(var(--source-color-rgb), .6);
  pointer-events: none;
  display: none;
}
.vp-settings-dot.visible { display: block; }

/* ── Progress thumb (visible knob) ───────────────────────── */
.vp-progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--source-color);
  transform: translate(-50%, -50%);
  z-index: 3;
  box-shadow: 0 0 6px rgba(0,0,0,.5);
  pointer-events: none;
  transition: left .1s linear;
}
/* Enlarge on controls visible for easier visual tracking */
.vp-overlay.controls-visible .vp-progress-thumb {
  width: 16px;
  height: 16px;
  box-shadow: 0 0 8px rgba(var(--source-color-rgb), .5);
}

/* ── Zoom prevention on seek area ────────────────────────── */
.vp-bottom-overlay,
.vp-progress-bar-wrap,
.vp-seek,
.vp-overlay {
  touch-action: manipulation;
}

/* ── Swipe Hints (redesigned pill style) ─────────────────── */
.vp-swipe-hint {
  position: absolute;
  left: 50%;
  z-index: 18;
  pointer-events: none;
  opacity: 0;
  transition: all .25s cubic-bezier(.4, 0, .2, 1);
}
.vp-swipe-hint-up {
  top: 24px;
  transform: translateX(-50%) translateY(-20px) scale(0.9);
}
.vp-swipe-hint-down {
  bottom: 24px;
  transform: translateX(-50%) translateY(20px) scale(0.9);
}
.vp-swipe-hint.active {
  opacity: 1;
}
.vp-swipe-hint-up.active {
  transform: translateX(-50%) translateY(0) scale(1);
}
.vp-swipe-hint-down.active {
  transform: translateX(-50%) translateY(0) scale(1);
}
.vp-swipe-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* ── Swipe Transition Overlay (TikTok-style) ────────────── */
.vp-swipe-transition {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

/* Active states: slide-up for next, slide-down for prev */
.vp-swipe-transition.active-up {
  opacity: 1;
  visibility: visible;
  animation: vp-swipe-slide-up .5s cubic-bezier(.16, 1, .3, 1) forwards;
}
.vp-swipe-transition.active-down {
  opacity: 1;
  visibility: visible;
  animation: vp-swipe-slide-down .5s cubic-bezier(.16, 1, .3, 1) forwards;
}
.vp-swipe-transition.exit-up {
  animation: vp-swipe-exit-up .35s cubic-bezier(.4, 0, 1, 1) forwards;
}
.vp-swipe-transition.exit-down {
  animation: vp-swipe-exit-down .35s cubic-bezier(.4, 0, 1, 1) forwards;
}

.vp-swipe-transition-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 40px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 80px rgba(var(--source-color-rgb, 139,92,246), 0.15);
}

.vp-swipe-transition-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--source-color-rgb, 139,92,246), 0.2);
  border: 1px solid rgba(var(--source-color-rgb, 139,92,246), 0.3);
  border-radius: 50%;
  color: rgb(var(--source-color-rgb, 139,92,246));
  animation: vp-swipe-icon-pulse 1s ease-in-out infinite alternate;
}

.vp-swipe-transition-text {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.vp-swipe-transition-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  max-width: 260px;
  line-height: 1.3;
}

/* Video slide-out during swipe transition */
.vp-overlay.vp-video-exit-up #vp-video {
  animation: vp-video-slide-up .4s cubic-bezier(.4, 0, 1, 1) forwards;
}
.vp-overlay.vp-video-exit-down #vp-video {
  animation: vp-video-slide-down .4s cubic-bezier(.4, 0, 1, 1) forwards;
}
.vp-overlay.vp-video-enter #vp-video {
  animation: vp-video-enter .35s cubic-bezier(.16, 1, .3, 1) forwards;
}

/* ── Swipe Keyframes ─────────────────────────────────────── */
@keyframes vp-swipe-slide-up {
  0%   { opacity: 0; transform: translateY(60px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes vp-swipe-slide-down {
  0%   { opacity: 0; transform: translateY(-60px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes vp-swipe-exit-up {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.95); }
}
@keyframes vp-swipe-exit-down {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(40px) scale(0.95); }
}
@keyframes vp-video-slide-up {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-8%) scale(0.96); }
}
@keyframes vp-video-slide-down {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(8%) scale(0.96); }
}
@keyframes vp-video-enter {
  0%   { opacity: 0; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes vp-swipe-icon-pulse {
  0%   { transform: scale(1); }
  100% { transform: scale(1.1); }
}

#vp-ep-list-btn {
  pointer-events: auto !important;
  position: relative;
  z-index: 100;
}

/* ── Episode panel ────────────────────────────────────────── */
.vp-ep-panel {
  display: none;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 5100;
  pointer-events: auto !important;
  background: var(--bg-surface-2, #12121C);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255,255,255,.08);
  max-height: 55vh;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

.vp-ep-panel.open {
  display: flex;
  animation: ep-slide-up .3s cubic-bezier(.4,0,.2,1) both;
  pointer-events: auto !important;
}

@keyframes ep-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.vp-ep-panel-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.vp-ep-panel-hdr span:first-child {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.vp-ep-count {
  font-size: 12px;
  color: rgba(255,255,255,.5);
}

.vp-ep-panel-close {
  background: rgba(255,255,255,.08);
  border: none;
  color: rgba(255,255,255,.7);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  -webkit-tap-highlight-color: transparent;
}

.vp-ep-panel-close:active { background: rgba(239,68,68,.25); color: #ef4444; }

.vp-episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 7px;
  padding: 12px 14px;
  overflow-y: auto;
  flex: 1;
}

.vp-ep-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.75);
  padding: 10px 4px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
  text-align: center;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.vp-ep-btn:active { transform: scale(.93); }

.vp-ep-btn.active {
  background: rgba(var(--source-color-rgb), .18);
  border-color: rgba(var(--source-color-rgb), .45);
  color: var(--source-color);
  box-shadow: 0 0 0 1px rgba(var(--source-color-rgb), .2);
}

.vp-ep-btn-loading {
  background: rgba(255,255,255,.08);
  border-color: rgba(var(--source-color-rgb), .3);
  color: #fff;
}

.vp-ep-btn:disabled:not(.vp-ep-btn-locked) {
  cursor: wait;
  opacity: .72;
}

.vp-ep-btn-locked {
  background: rgba(239,68,68,.08) !important;
  border-color: rgba(239,68,68,.3) !important;
  color: #fca5a5 !important;
  cursor: not-allowed !important;
  opacity: .82;
  box-shadow: none !important;
}

.vp-ep-btn-locked:active {
  transform: none !important;
}

.vp-ep-btn.vp-ep-watched {
  position: relative;
}
.vp-ep-dot {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--source-color);
  opacity: .7;
}

/* ── Double-tap seek feedback ─────────────────────────────── */
.vp-dtap-feedback {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
}

.vp-dtap-feedback.active { opacity: 1; }
.vp-dtap-left  { left: 10px; }
.vp-dtap-right { right: 10px; }

.vp-dtap-feedback span {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
}

.vp-dtap-ripple {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  transform: scale(0);
  animation: none;
}

.vp-dtap-feedback.active .vp-dtap-ripple {
  animation: dtap-ripple .6s ease-out forwards;
}

@keyframes dtap-ripple {
  0%   { transform: scale(0); opacity: .6; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ── Player bar (resolution + subtitle) ───────────────────── */
.vp-player-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 22;
  background: rgba(8,8,14,.97);
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.vp-bar-item {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.vp-bar-svg {
  color: var(--source-color);
  flex-shrink: 0;
  opacity: 0.9;
}

.vp-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.vp-bar-sep {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,.08);
  flex-shrink: 0;
}

.vp-select-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.vp-select {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  color: #fff;
  padding: 8px 28px 8px 10px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: background .2s, border-color .2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: manipulation;
}

.vp-select:focus {
  border-color: rgba(var(--source-color-rgb), .4);
  background: rgba(var(--source-color-rgb), .08);
  box-shadow: 0 0 0 2px rgba(var(--source-color-rgb), .1);
}

.vp-select:disabled { opacity: 0.5; cursor: not-allowed; }

.vp-select option {
  background: #12121C;
  color: #fff;
  font-weight: 500;
}

.vp-select-wrap::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255,255,255,.4);
  pointer-events: none;
}

.vp-resolution-bar, .vp-subtitle-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

/* ── Autoplay overlay ─────────────────────────────────────── */
.vp-autoplay-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: rgba(0,0,0,.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 7;
}

.vp-autoplay-overlay p {
  font-size: 14px;
  color: rgba(255,255,255,.8);
  text-align: center;
}

.vp-autoplay-countdown {
  font-size: 36px;
  font-weight: 800;
  color: var(--source-color);
}

.vp-autoplay-btn {
  background: var(--source-color);
  border: none;
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.vp-autoplay-cancel {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast-notification {
  position: fixed;
  bottom: calc(74px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(14, 14, 22, .95);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 11px 22px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  z-index: 5200;
  opacity: 0;
  transition: all .3s ease;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  max-width: calc(100vw - 40px);
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-notification.toast-error {
  border-color: rgba(239,68,68,.3);
  background: rgba(239,68,68,.1);
  color: #fca5a5;
}

.toast-notification.toast-success {
  border-color: rgba(16,185,129,.3);
  background: rgba(16,185,129,.1);
  color: #6ee7b7;
}

/* ============================================================
   CSS FULLSCREEN (Telegram mini-app)
   ============================================================ */
.vp-overlay.vp-css-fullscreen {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 5000 !important;
  background: #000 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

.vp-overlay.vp-css-fullscreen .vp-video-section {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  position: relative !important;
}

.vp-overlay.vp-css-fullscreen .vp-video-wrap {
  position: absolute !important;
  top: 0 !important; left: 0 !important;
  right: 0 !important; bottom: 0 !important;
  width: auto !important; height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.vp-overlay.vp-css-fullscreen #vp-video {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
}

.vp-overlay.vp-css-fullscreen .vp-episodes-section,
.vp-overlay.vp-css-fullscreen .vp-player-bar {
  display: none !important;
}

.vp-overlay.vp-css-fullscreen .vp-header {
  flex-shrink: 0 !important;
  padding-top: calc(8px + var(--safe-top));
  padding-bottom: 8px;
}

/* Native fullscreen */
#vp-overlay:fullscreen,
#vp-overlay:-webkit-full-screen {
  display: flex !important;
  flex-direction: column !important;
  background: #000 !important;
  overflow: hidden !important;
}

#vp-overlay:fullscreen .vp-video-section,
#vp-overlay:-webkit-full-screen .vp-video-section {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  position: relative !important;
}

#vp-overlay:fullscreen .vp-video-wrap,
#vp-overlay:-webkit-full-screen .vp-video-wrap {
  position: absolute !important;
  top: 0 !important; left: 0 !important;
  right: 0 !important; bottom: 0 !important;
  width: auto !important; height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#vp-overlay:fullscreen #vp-video,
#vp-overlay:-webkit-full-screen #vp-video {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
}

#vp-overlay:fullscreen .vp-episodes-section,
#vp-overlay:-webkit-full-screen .vp-episodes-section,
#vp-overlay:fullscreen .vp-player-bar,
#vp-overlay:-webkit-full-screen .vp-player-bar {
  display: none !important;
}

/* Legacy fullscreen compat */
.vp-video-wrap:fullscreen,
.vp-video-wrap:-webkit-full-screen {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vp-video-wrap:fullscreen #vp-video,
.vp-video-wrap:-webkit-full-screen #vp-video {
  max-height: 100vh;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Bottom control buttons: always interactive */
.vp-ctrl-row .vp-bottom-btn {
  pointer-events: auto !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 600px) {
  .modal-container {
    border-radius: var(--radius-xl);
    margin: auto;
    max-height: 85vh;
  }
  .modal-overlay { align-items: center; }
  .modal-overlay .modal-container { transform: translateY(20px) scale(.97); }
  .modal-overlay.show .modal-container { transform: translateY(0) scale(1); }
}

@media (min-width: 768px) {
  .main-content { padding: 20px 20px 80px; }
  .drama-grid { gap: 12px; }
  .card-title { font-size: 12px; }
  .card-eps { font-size: 10px; }
}

/* ============================================================
   POWERED BY FOOTER (Source Pages)
   ============================================================ */
.source-footer {
  text-align: center;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  margin-top: 0;
}

.source-footer .footer-brand {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(135deg, #FFCB6B, #F5A623);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  margin-bottom: 2px;
}

.source-footer .footer-legal {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ── Unmute Overlay (shown when video plays muted after ad gate) ── */
.vp-unmute-overlay {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5200;
  animation: vp-unmute-slide-in 0.3s ease-out;
}

.vp-unmute-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

.vp-unmute-btn:active {
  transform: scale(0.95);
  background: rgba(245, 166, 35, 0.3);
}

.vp-unmute-btn svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.vp-unmute-hiding {
  animation: vp-unmute-slide-out 0.3s ease-in forwards;
}

@keyframes vp-unmute-slide-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes vp-unmute-slide-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ── Play Overlay Prompt (last resort when autoplay completely blocked) ── */
.vp-play-overlay-prompt {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  z-index: 5100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: vp-play-prompt-fade-in 0.3s ease-out;
}

.vp-play-prompt-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 40px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(245, 166, 35, 0.4);
  border-radius: 20px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vp-play-prompt-btn:active {
  transform: scale(0.95);
  border-color: rgba(245, 166, 35, 0.8);
  background: rgba(245, 166, 35, 0.15);
}

.vp-play-prompt-btn svg {
  color: var(--brand-gold, #F5A623);
}

.vp-play-prompt-btn span {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
}

@keyframes vp-play-prompt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Anti Screenshot/Screen Recording Protection ─────────── */
/* Prevent user selection and drag on video and overlay */
.vp-overlay,
.vp-overlay * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
  -webkit-touch-callout: none !important;
}

/* Screen capture protection overlay — shown when page loses visibility */
.vp-capture-shield {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  z-index: 5100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.vp-capture-shield.active {
  opacity: 1;
  pointer-events: auto;
}

.vp-capture-shield-icon {
  width: 48px;
  height: 48px;
  color: rgba(255,255,255,.4);
}

.vp-capture-shield-text {
  color: rgba(255,255,255,.5);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 0 32px;
}

/* ============================================================
   CONTINUE WATCHING — Section di index.html
   ============================================================ */

/* Row horizontal scroll */
.cw-row {
  display: flex;
  gap: 10px;
  padding: 4px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cw-row::-webkit-scrollbar { display: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* Card */
.cw-card {
  flex: 0 0 120px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px) scale(.97);
  animation: rise .45s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: calc(.05s + var(--i, 0) * .06s);
  -webkit-tap-highlight-color: transparent;
}
.cw-card:active { transform: scale(.94) !important; }

/* Thumbnail wrap */
.cw-thumb-wrap {
  position: relative;
  width: 120px;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 7px;
}
.cw-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cw-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}

/* Play icon overlay */
.cw-play-icon {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  opacity: 0;
  transition: opacity .2s;
  color: #fff;
}
.cw-card:hover .cw-play-icon,
.cw-card:active .cw-play-icon { opacity: 1; }

/* Progress bar di bawah thumbnail */
.cw-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,.18);
}
.cw-progress-fill {
  height: 100%;
  width: 100%;
  background: var(--brand-gold);
  border-radius: 2px;
  transform-origin: left center;
  transition: transform .3s;
}

/* Card info text */
.cw-card-info { padding: 0 1px; }
.cw-card-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.88);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}
.cw-card-ep {
  font-size: 10px;
  color: rgba(255,255,255,.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cw-card-src {
  font-size: 9px;
  color: var(--brand-gold);
  opacity: .7;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Clear button di sebelah label section */
.cw-clear-btn {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.35);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .2s, color .2s;
}
.cw-clear-btn:active {
  color: rgba(255,255,255,.7);
  border-color: rgba(255,255,255,.25);
}

/* ============================================================
   RESUME DIALOG — Bottom sheet
   ============================================================ */
.cw-resume-sheet {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  z-index: 5500;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.cw-resume-sheet.show {
  pointer-events: auto;
  opacity: 1;
}
.cw-resume-backdrop {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cw-resume-content {
  position: relative;
  z-index: 1;
  width: 100%;
  background: #13131F;
  border-top: 1px solid rgba(255,255,255,.08);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(40px);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.cw-resume-sheet.show .cw-resume-content {
  transform: translateY(0);
}

/* Header: thumbnail + meta */
.cw-resume-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.cw-resume-thumb-wrap {
  position: relative;
  flex: 0 0 72px;
  height: 96px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
}
.cw-resume-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cw-resume-bar-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,.2);
}
.cw-resume-bar-fill {
  height: 100%;
  background: var(--brand-gold);
}
.cw-resume-meta { flex: 1; min-width: 0; padding-top: 2px; }
.cw-resume-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cw-resume-ep {
  font-size: 12px;
  color: rgba(255,255,255,.5);
  margin-bottom: 5px;
}
.cw-resume-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--brand-gold);
  opacity: .85;
}

/* Action buttons */
.cw-resume-actions {
  display: flex;
  gap: 10px;
}
.cw-resume-btn {
  flex: 1;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s, transform .15s;
}
.cw-resume-btn:active { opacity: .8; transform: scale(.97); }
.cw-btn-start {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.1);
}
.cw-btn-continue {
  background: linear-gradient(135deg, #F5A623, #E8912D);
  color: #000;
}

/* ============================================================
   CONTINUE WATCHING — Source Page (di atas drama grid)
   ============================================================ */

.cw-source-section {
  padding: 8px 0 4px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  margin-bottom: 4px;
}

.cw-source-header {
  display: flex;
  align-items: center;
  padding: 0 14px 8px;
  gap: 8px;
}

.cw-source-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.35);
}

.cw-source-clear {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.28);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, border-color .15s;
}
.cw-source-clear:active {
  color: rgba(255,255,255,.6);
  border-color: rgba(255,255,255,.2);
}

/* Horizontal scroll row */
.cw-source-row {
  display: flex;
  gap: 10px;
  padding: 0 14px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cw-source-row::-webkit-scrollbar { display: none; }

/* Card — reuse .cw-card style tapi dengan class berbeda agar tidak konflik */
.cw-source-card {
  flex: 0 0 100px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  animation: rise .4s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: calc(.04s + var(--i,0) * .05s);
  -webkit-tap-highlight-color: transparent;
}
.cw-source-card:active { transform: scale(.93) !important; }
.cw-source-card .cw-thumb-wrap {
  width: 100px;
  height: 134px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.cw-source-card .cw-card-title {
  font-size: 10.5px;
}
.cw-source-card .cw-card-ep {
  font-size: 9.5px;
}
.cw-card-time {
  font-size: 9px;
  color: rgba(255,255,255,.2);
  margin-top: 1px;
}
.cw-source-card .cw-card-time {
  font-size: 8.5px;
}

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */

/* Body padding agar konten tidak tertutup nav bar */
body.bn-ready {
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ── Nav Bar ── */
.bn-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 900;
  display: flex;
  align-items: stretch;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(10, 10, 16, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 -2px 12px rgba(0,0,0,.35);
}
.bn-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  color: rgba(255,255,255,.28);
  cursor: pointer;
  padding: 8px 4px;
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  outline: none;
}
.bn-tab:active { transform: scale(.88); transition: transform .1s; }
.bn-tab.bn-tab-active  { color: var(--source-color, #8B5CF6); }
.bn-tab.bn-tab-panel-active { color: var(--source-color, #8B5CF6); }
.bn-tab.bn-tab-panel-active::after {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--source-color, #8B5CF6);
}
.bn-icon { width: 22px; height: 22px; flex-shrink: 0; }
.bn-label { font-size: 10px; font-weight: 600; letter-spacing: .02em; line-height: 1; }

/* ── Backdrop ── */
.bn-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 910;
  background: rgba(0,0,0,0);
  pointer-events: none;
  transition: background .3s;
}
.bn-backdrop.show {
  background: rgba(0,0,0,.6);
  pointer-events: all;
}

/* ── Panel (slide-up sheet) ── */
.bn-panel {
  position: fixed;
  top: auto !important;
  bottom: 0 !important; left: 0; right: 0;
  z-index: 920;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: #0f0f18;
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255,255,255,.07);
  border-bottom: none;
  transform: translateY(100%);
  transition: transform .38s cubic-bezier(.32,.72,0,1);
  will-change: transform;
}
.bn-panel.open { transform: translateY(0); }
.bn-panel-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.1);
  margin: 10px auto 0;
  flex-shrink: 0;
}
.bn-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.bn-panel-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 700;
  color: rgba(255,255,255,.88);
}
.bn-panel-title svg { opacity: .65; flex-shrink: 0; }
.bn-panel-clear {
  font-size: 11px; font-weight: 600;
  color: rgba(239,68,68,.75);
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}
.bn-panel-clear:active { background: rgba(239,68,68,.1); }
.bn-panel-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0 calc(12px + env(safe-area-inset-bottom,0px));
}

/* ── Empty state ── */
.bn-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 24px; gap: 12px;
  color: rgba(255,255,255,.25);
}
.bn-empty-icon { font-size: 36px; opacity: .45; }
.bn-empty-text  { font-size: 14px; font-weight: 600; text-align: center; line-height: 1.6; color: rgba(255,255,255,.6); }
.bn-empty-sub   { font-size: 12px; text-align: center; color: rgba(255,255,255,.3); margin-top: 2px; }

/* ── History items ── */
.bn-history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.bn-history-item:active { background: rgba(255,255,255,.04); }
.bn-history-thumb {
  position: relative;
  width: 62px; height: 83px;
  border-radius: 8px; overflow: hidden;
  background: rgba(255,255,255,.05);
  flex-shrink: 0;
}
.bn-history-thumb img { width:100%;height:100%;object-fit:cover;display:block; }
.bn-history-progress {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,.12);
}
.bn-history-progress-fill {
  height: 100%;
  background: var(--source-color, #8B5CF6);
  border-radius: 0 1px 1px 0;
  min-width: 2px;
}
.bn-history-info   { flex: 1; min-width: 0; }
.bn-history-title  { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.88); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.bn-history-ep     { font-size: 11.5px; color: rgba(255,255,255,.42); margin-bottom: 2px; }
.bn-history-source { font-size: 10.5px; color: rgba(255,255,255,.22); }

/* ── Favorites grid ── */
.bn-fav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  padding: 10px 14px;
}
.bn-fav-item { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bn-fav-item:active { opacity: .7; }
.bn-fav-thumb {
  position: relative;
  aspect-ratio: 3/4;
  border-radius: 8px; overflow: hidden;
  background: rgba(255,255,255,.05);
  margin-bottom: 4px;
}
/* Fallback for browsers without aspect-ratio support (older WebViews) */
@supports not (aspect-ratio: 3/4) {
  .bn-fav-thumb { height: 0; padding-bottom: 133.33%; }
  .bn-fav-thumb img { position: absolute; top: 0; left: 0; }
}
.bn-fav-thumb img { width:100%;height:100%;object-fit:cover;display:block; }
.bn-fav-remove {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  border: none; color: rgba(255,255,255,.7);
  cursor: pointer; font-size: 11px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  z-index: 2; -webkit-tap-highlight-color: transparent;
}
.bn-fav-title  { font-size: 10.5px; font-weight: 600; color: rgba(255,255,255,.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-fav-source { font-size: 9.5px; color: rgba(255,255,255,.3); }

/* ── Profile panel ── */
.bn-profile-user {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.bn-profile-avatar {
  width: 56px; height: 56px;
  border-radius: 50%; overflow: hidden;
  background: rgba(255,255,255,.08);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.bn-profile-avatar img { width:100%;height:100%;object-fit:cover; }
.bn-profile-name     { font-size: 16px; font-weight: 700; color: rgba(255,255,255,.92); margin-bottom: 2px; }
.bn-profile-username { font-size: 12px; color: rgba(255,255,255,.42); margin-bottom: 1px; }
.bn-profile-id       { font-size: 11px; color: rgba(255,255,255,.22); }

.bn-vip-card {
  margin: 12px 16px;
  padding: 13px 15px;
  border-radius: 14px;
  display: flex; align-items: center; gap: 12px;
}
.bn-vip-active   { background: linear-gradient(135deg,rgba(245,158,11,.15),rgba(234,88,12,.08)); border: 1px solid rgba(245,158,11,.22); }
.bn-vip-inactive { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); }
.bn-vip-icon     { font-size: 28px; flex-shrink: 0; }
.bn-vip-status   { font-size: 14px; font-weight: 700; color: rgba(255,255,255,.88); margin-bottom: 2px; }
.bn-vip-active .bn-vip-status { color: #fbbf24; }
.bn-vip-expiry   { font-size: 12px; color: rgba(255,255,255,.42); }
.bn-vip-hint     { font-size: 12px; color: rgba(255,255,255,.35); }
.bn-vip-active .bn-vip-expiry { color: rgba(251,191,36,.65); }

.bn-stats-section { margin: 4px 16px 8px; }
.bn-stats-title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.22);
  margin-bottom: 8px; padding: 0 2px;
}
.bn-stats-grid { display: flex; gap: 8px; }
.bn-stat {
  flex: 1;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 11px 6px;
  text-align: center;
}
.bn-stat-num   { font-size: 18px; font-weight: 800; color: rgba(255,255,255,.82); margin-bottom: 3px; font-family: 'Space Grotesk','Inter',sans-serif; }
.bn-stat-label { font-size: 9.5px; color: rgba(255,255,255,.28); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.bn-profile-loading { display: flex; align-items: center; justify-content: center; padding: 52px; }
.bn-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: rgba(255,255,255,.45);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Profile settings section ── */
.bn-settings-section {
  margin: 4px 16px 12px;
  border-top: 1px solid rgba(255,255,255,.05);
  padding-top: 12px;
}
.bn-setting-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 14px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background .2s;
  -webkit-tap-highlight-color: transparent;
}
.bn-setting-item:active { background: rgba(255,255,255,.08); }

/* ── Favorite button on drama card ── */
.card-fav-btn {
  position: absolute;
  top: 6px; right: 6px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: none;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  transition: color .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.card-fav-btn:active  { transform: scale(.82); }
.card-fav-btn.is-fav  { color: #ef4444; }
.card-fav-btn svg     { width: 13px; height: 13px; pointer-events: none; }

/* ── Language Dropdown (unified for all sources) ─────────── */
.fr-lang-dropdown,
.sm-lang-dropdown {
  min-width: 160px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-secondary, #0E0E16);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: lang-dd-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes lang-dd-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.fr-lang-dropdown::-webkit-scrollbar,
.sm-lang-dropdown::-webkit-scrollbar { width: 3px; }
.fr-lang-dropdown::-webkit-scrollbar-thumb,
.sm-lang-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.fr-lang-item,
.sm-lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary, #9CA3AF);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.fr-lang-item:hover,
.sm-lang-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary, #F0F0F5);
}
.fr-lang-item:active,
.sm-lang-item:active {
  transform: scale(0.97);
}
.fr-lang-item.active,
.sm-lang-item.active {
  background: rgba(var(--source-color-rgb, 245,166,35), 0.12);
  color: rgb(var(--source-color-rgb, 245,166,35));
  font-weight: 600;
}
.fr-lang-item .lang-flag,
.sm-lang-item .lang-flag {
  font-size: 18px;
  line-height: 1;
}
.fr-lang-item .lang-name,
.sm-lang-item .lang-name {
  flex: 1;
}

/* Low-end: no blur on dropdown */
.device-low .fr-lang-dropdown,
.device-low .sm-lang-dropdown {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: #12121A;
}

/* ── Page Settled — matikan SEMUA animasi berat setelah halaman stabil ──── */
/* Ambient sweep + grid → stop (full-screen repaint) */
.page-settled .ambient-bg::before,
.page-settled .ambient-bg::after { animation: none !important; }

/* Orbs → hide entirely (blur(44px) sangat berat di HP lama) */
.page-settled .orb               { animation: none !important; opacity: .3 !important; }

/* Hero-title background-position (non-GPU-composited) → stop */
.page-settled .hero-title        { animation: none !important; background-position: 50% 50% !important; }

/* Hero-logo glow (box-shadow animation = non-GPU-composited) → stop */
.page-settled .hero-logo         { animation: none !important; }

/* Hero-badge pulse → stop */
.page-settled .hero-badge::before { animation: none !important; opacity: 1 !important; }

/* Hero-logo halo → stop */
.page-settled .hero-logo::before { animation: none !important; }

/* Featured/source tile rise (one-shot, sudah selesai) → cleanup */
.page-settled .featured-tile,
.page-settled .source-tile       { animation: none !important; opacity: 1 !important; transform: none !important; }

/* ============================================================
   FLEXBOX GAP FALLBACK (Safari <14.1, Chrome <84)
   Flex containers that use `gap` need margin-based fallbacks.
   Grid `gap` (via grid-gap) is already handled above.
   ============================================================ */
@supports not (gap: 0px) {
  /* ── Landing page ─────────────────────────────────────────── */
  .tg-landing-header > * + *   { margin-left: 14px; }
  .tg-header-actions > * + *   { margin-left: 6px; }
  .tg-section-label > * + *    { margin-left: 8px; }
  .tg-source-list > * + *      { margin-top: 10px; }
  .tg-source-card > * + *      { margin-left: 14px; }

  /* ── Source header ────────────────────────────────────────── */
  .header-inner > * + *        { margin-top: 10px; }
  .header-top-row > * + *      { margin-left: 10px; }
  .header-brand > * + *        { margin-left: 10px; }
  .header-actions > * + *      { margin-left: 6px; }

  /* ── Tabs ─────────────────────────────────────────────────── */
  .tab-nav > * + *             { margin-left: 2px; }

  /* ── Drama cards ──────────────────────────────────────────── */
  .card-tags > * + *           { margin-left: 3px; }
  .loading-more > * + *        { margin-left: 8px; }

  /* ── Detail modal ─────────────────────────────────────────── */
  .modal-hero > * + *          { margin-left: 16px; }
  .modal-tags > * + *          { margin-left: 4px; }

  /* ── Video player ─────────────────────────────────────────── */
  .vp-center-controls > * + *  { margin-left: 36px; }
  .vp-top-overlay > * + *      { margin-left: 10px; }
  .vp-seek-row > * + *         { margin-left: 8px; }
  .vp-ctrl-row > * + *         { margin-left: 8px; }
  .vp-time-display > * + *     { margin-left: 2px; }
  .vp-ctrl-btn > * + *         { margin-top: 2px; }
  .vp-pill-options > * + *     { margin-left: 5px; }
  .vp-speed-options > * + *    { margin-left: 5px; }
  .vp-swipe-hint > * + *       { margin-top: 4px; }

  /* ── Video player bar ─────────────────────────────────────── */
  .vp-player-bar-row > * + *   { margin-left: 10px; }
  .vp-bar-item > * + *         { margin-left: 7px; }
  .vp-resolution-bar > * + *   { margin-left: 7px; }
  .vp-subtitle-bar > * + *     { margin-left: 7px; }

  /* ── Autoplay overlay ─────────────────────────────────────── */
  .vp-autoplay-content > * + * { margin-top: 6px; }

  /* ── Bottom nav ───────────────────────────────────────────── */
  .bn-profile-user > * + *     { margin-left: 14px; }
  .bn-vip-card > * + *         { margin-left: 12px; }
}

/* ============================================================
   ADAPTIVE PERFORMANCE — Device Tier Overrides
   Classes set by device-detect.js on <body>:
     .device-low  → old/weak devices (Android <8, iOS <14, low RAM/GPU)
     .device-mid  → mid-range devices
     .device-high → modern/powerful devices (default experience)
     .device-old  → explicitly old OS
     .no-backdrop-filter → browser doesn't support blur
   ============================================================ */

/* ── LOW-END: Strip all heavy effects ────────────────────── */

/* Kill ALL animations */
.device-low *,
.device-low *::before,
.device-low *::after {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0.1s !important;
}

/* Remove all blur (backdrop-filter very heavy on weak GPU) */
.device-low [style*="backdrop-filter"],
.device-low .modal-overlay,
.device-low .vp-unmute-prompt,
.device-low .vp-play-prompt,
.device-low .bn-overlay,
.device-low .detail-overlay,
.device-low .search-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0,0,0,0.85) !important;
}

/* Remove heavy box-shadows, keep only minimal */
.device-low .drama-card,
.device-low .modal-body,
.device-low .source-tile,
.device-low .featured-tile,
.device-low .bn-panel {
  box-shadow: none !important;
}

/* Simplify gradients → solid colors */
.device-low .ambient-bg,
.device-low .ambient-bg::before,
.device-low .ambient-bg::after {
  display: none !important;
}
.device-low .orb { display: none !important; }

/* Simpler card hover (no transform/scale) */
.device-low .drama-card:active { transform: none !important; }
.device-low .source-tile:active { transform: none !important; }

/* Simpler skeleton loading (no shimmer animation) */
.device-low .skeleton { animation: none !important; background: var(--bg-card) !important; }

/* Reduce border-radius on old devices (cheaper to render) */
.device-low .drama-card { border-radius: 8px !important; }
.device-low .modal-body { border-radius: 12px !important; }

/* Hide decorative elements */
.device-low .hero-logo::before,
.device-low .hero-logo::after { display: none !important; }
.device-low .hero-badge::before { display: none !important; }

/* Simpler video player controls */
.device-low .vp-dtap-ripple { display: none !important; }
.device-low .vp-swipe-hint { display: none !important; }
.device-low .vp-swipe-transition { display: none !important; }
.device-low .vp-swipe-pill { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }

/* Mid-tier: simpler swipe transition (no blur) */
.device-mid .vp-swipe-transition-content { backdrop-filter: blur(8px) !important; -webkit-backdrop-filter: blur(8px) !important; }
.device-mid .vp-swipe-pill { backdrop-filter: blur(6px) !important; -webkit-backdrop-filter: blur(6px) !important; }

/* Simpler drama cards — hide overlays that cause extra GPU layers */
.device-low .card-play-overlay { display: none !important; }
.device-low .card-loading-overlay { display: none !important; }
.device-low .card-fav-btn { display: none !important; }
.device-low .card-hot { display: none !important; }

/* Disable image lazy-load animation */
.device-low .card-thumb img { opacity: 1 !important; transition: none !important; }

/* Google Font → use system font (saves bandwidth + render time) */
.device-low body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* ── MID-RANGE: Reduce but don't eliminate ───────────────── */

/* Reduce blur intensity (half of default) */
.device-mid .modal-overlay,
.device-mid .bn-overlay {
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

.device-mid .vp-unmute-prompt,
.device-mid .vp-play-prompt {
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
}

/* Reduce animation duration (snappier) */
.device-mid .drama-card,
.device-mid .source-tile,
.device-mid .modal-overlay {
  transition-duration: 0.15s !important;
}

/* Hide heaviest orbs, keep 1-2 */
.device-mid .orb:nth-child(n+3) { display: none !important; }
.device-mid .orb { filter: blur(12px) !important; }

/* Simpler shadows */
.device-mid .modal-body {
  box-shadow: 0 4px 16px rgba(0,0,0,.4) !important;
}

/* ── HIGH-END: Full experience (no overrides needed) ─────── */
/* .device-high gets the default styles.css behavior */

/* ── NO BACKDROP-FILTER SUPPORT ──────────────────────────── */
.no-backdrop-filter .modal-overlay,
.no-backdrop-filter .vp-unmute-prompt,
.no-backdrop-filter .vp-play-prompt,
.no-backdrop-filter .bn-overlay,
.no-backdrop-filter .detail-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0,0,0,0.88) !important;
}

/* ── OLD ANDROID SPECIFIC ────────────────────────────────── */
.android-old video {
  /* Force hardware decode path */
  transform: translateZ(0);
}
/* Android <8: WebView may not support CSS gap */
.android-old .drama-grid { display: block !important; }
.android-old .drama-grid .drama-card { display: inline-block; width: 48%; margin: 1%; vertical-align: top; }

/* ── OLD iOS SPECIFIC ────────────────────────────────────── */
.ios-old .modal-overlay {
  /* iOS <14: backdrop-filter causes blank screen on some devices */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0,0,0,0.9) !important;
}

/* ── SLOW CONNECTION ─────────────────────────────────────── */
.connection-slow img {
  /* Hint browser to deprioritize below-fold images */
  content-visibility: auto;
}

/* ── COMPACT SCREEN (360-399px) ──────────────────────────── */
@media (max-width: 399px) {
  .source-header { padding: 0 10px; }
  .header-name { font-size: 0.95rem !important; }
  .search-input { font-size: 13px; padding: 8px 10px 8px 34px; }
  .drama-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .drama-card .card-title { font-size: 11px; }
  .drama-card .card-meta { font-size: 9px; }
  .tab-btn { font-size: 12px; padding: 7px 10px; }
  .source-footer { font-size: 10px; }
  .vp-ep-panel { width: 70% !important; }
  .vp-settings-popup { width: 85% !important; }
}

/* ── VERY SMALL SCREEN (<360px) ─────────────────────────── */
@media (max-width: 359px) {
  .drama-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; }
  .drama-card { border-radius: 6px !important; }
  .drama-card .card-title { font-size: 10px; }
  .modal-body { padding: 10px !important; }
  .tab-btn { font-size: 11px !important; padding: 6px 8px !important; }
  .vp-ctrl-btn { width: 28px !important; height: 28px !important; }
  .search-input { font-size: 12px; }
  .header-name { font-size: 0.85rem !important; }
  .vp-ep-panel { width: 80% !important; }
}
