* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

:root {
  --bg: #0d0d1a;
  --sidebar-bg: #111124;
  --card-bg: #1a1a2e;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --text: #e0e0f0;
  --text-muted: #666688;
  --card-radius: 12px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ─── Sidebar ─── */
.sidebar {
  width: 160px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 28px 16px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  font-style: italic;
  margin-bottom: 40px;
  text-shadow: 0 0 20px var(--accent);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-item i {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.nav-item:hover {
  background: rgba(108, 92, 231, 0.15);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

/* ─── Sidebar bottom ─── */
.sidebar-bottom {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(108,92,231,0.15);
}

/* ─── Skeleton loading ─── */
.card-skeleton {
  flex-shrink: 0;
  border-radius: var(--card-radius);
  background: linear-gradient(90deg, var(--card-bg) 25%, #1f1f38 50%, var(--card-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.card-skeleton.large    { width: 300px; height: 180px; }
.card-skeleton.small    { width: 160px; height: 108px; }
.card-skeleton.top-card { width: 155px; height: 210px; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ─── Main ─── */
.main-content {
  margin-left: 160px;
  flex: 1;
  min-width: 0;
  padding: 28px 32px 48px;
  min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; overflow-x: hidden; }

/* ─── Header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
}

.page-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
}

.avatar img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
}

/* ─── Sections ─── */
.section { margin-bottom: 36px; }

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-header .section-title { margin-bottom: 0; }

.see-all-btn {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  opacity: 0.8;
  white-space: nowrap;
  flex-shrink: 0;
}
.see-all-btn:hover,
.see-all-btn:focus { opacity: 1; text-decoration: underline; outline: none; }

/* ─── Cards Row ─── */
.cards-row {
  display: flex;
  gap: 14px;
  overflow-x: scroll;
  padding-bottom: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.cards-row::-webkit-scrollbar { display: none; }

/* ─── Card Base ─── */
.card {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--card-bg);
}

.card:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.4);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Large Cards (Continue Watching Hero) ─── */
.large-cards { gap: 16px; }

.card.large {
  width: 300px;
  height: 180px;
}

/* ─── Small Cards (Continue Watching Row) ─── */
.card.small {
  width: 160px;
  height: 108px;
}

/* ─── Top Cards (portrait) ─── */
.top-cards .card.top-card {
  width: 155px;
  height: 210px;
}

/* ─── Card Overlay ─── */
.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 10px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, transparent 100%);
}

.card-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-year {
  display: block;
  font-size: 10px;
  color: #aaa;
  margin-top: 2px;
}

/* ─── Badge ─── */
.card-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 22px;
  height: 22px;
  background: rgba(108, 92, 231, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
}

.card-badge.new { background: rgba(253, 203, 110, 0.95); color: #222; }

/* ─── Progress Bar ─── */
.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.15);
}

.progress {
  height: 100%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* ─── Rank ─── */
.rank {
  position: absolute;
  bottom: 36px;
  left: 8px;
  font-size: 44px;
  font-weight: 900;
  color: rgba(255,255,255,0.1);
  line-height: 1;
  z-index: 1;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
  -webkit-text-stroke: 1px rgba(255,255,255,0.18);
}

/* ─── Genre Page ─── */
.genre-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.genre-btn {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1.5px solid rgba(108, 92, 231, 0.35);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  font-family: 'Inter', sans-serif;
}

.genre-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(108, 92, 231, 0.12);
}

.genre-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Genre Pagination ─── */
.genre-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.pg-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1.5px solid rgba(108, 92, 231, 0.35);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(108, 92, 231, 0.12);
}

.pg-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pg-btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  color: var(--text);
}

.pg-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.pg-ellipsis {
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 4px;
}

/* ─── Genre Grid ─── */
.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

/* ─── Watch Search ─── */
.watch-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg, #1a1a2e);
  border: 1px solid #2a2a40;
  border-radius: 12px;
  padding: 0 16px;
  margin-bottom: 24px;
  transition: border-color .2s;
}
.watch-search-wrap:focus-within { border-color: #2a2a40; }
.watch-search-icon { color: #4a5568; font-size: .9rem; flex-shrink: 0; }
.watch-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none !important;
  box-shadow: none !important;
  color: var(--text);
  font-size: 1rem;
  padding: 14px 0;
  font-family: inherit;
}
.watch-search-input::placeholder { color: #4a5568; }
.watch-search-clear {
  background: none;
  border: none;
  color: #4a5568;
  cursor: pointer;
  padding: 4px;
  font-size: .9rem;
  flex-shrink: 0;
}
.watch-search-clear:hover { color: var(--text); }
.search-count {
  font-size: .85rem;
  color: #64748b;
  margin-bottom: 16px;
}

.card.grid-card {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  border-radius: var(--card-radius);
  overflow: hidden;
}

.card.grid-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  flex-shrink: 0;
}

.card-info {
  padding: 10px 12px;
  background: var(--card-bg);
  flex: 1;
}

.card-info .card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: normal;
}

.card-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}


/* ─── Detail Page ─── */
.detail-header { margin-bottom: 20px; }

.back-btn {
  background: rgba(108, 92, 231, 0.2);
  border: none;
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.back-btn:hover { background: var(--accent); }

.detail-content { max-width: 720px; }

.detail-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  height: 340px;
  margin-bottom: 22px;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent);
  transition: transform 0.2s, box-shadow 0.2s;
}

.play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 28px rgba(255,255,255,0.3);
}

.detail-info { margin-bottom: 28px; }

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.detail-title-row h2 {
  font-size: 22px;
  font-weight: 700;
}

.detail-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stars { display: flex; gap: 3px; color: #fdcb6e; font-size: 14px; }

.detail-rating span {
  font-weight: 700;
  font-size: 16px;
  color: #fdcb6e;
}

.detail-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.detail-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.detail-desc {
  color: #b0b0c8;
  font-size: 14px;
  line-height: 1.75;
}

/* ─── Universal Focus Ring (keyboard / TV remote) ─── */
:focus-visible {
  outline: 3px solid var(--accent2);
  outline-offset: 3px;
}

.card:focus-visible {
  outline: 3px solid var(--accent2);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--accent2), 0 8px 30px rgba(108,92,231,0.5);
  transform: scale(1.05);
}

/* ─── Server Setup / Settings Screen ─── */
.setup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,13,26,0.97);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.setup-overlay.show { display: flex; }

.setup-box {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  border: 1px solid rgba(108,92,231,0.25);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.setup-logo {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  font-style: italic;
  text-shadow: 0 0 30px var(--accent);
  margin-bottom: 22px;
}

.setup-box h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.setup-box p  { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }

.setup-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(108,92,231,0.3);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}
.setup-input:focus { border-color: var(--accent); }

.setup-hint {
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 22px;
  text-align: left;
}

.setup-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.2s, transform 0.1s;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.setup-btn:hover { background: #7c6ff0; }
.setup-btn:active { transform: scale(0.98); }

.setup-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-decoration: underline;
  padding: 4px 8px;
}
.setup-link:hover { color: var(--text); }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */

/* ─── Tablet  481px – 1024px ─── */
@media (min-width: 481px) and (max-width: 1024px) {
  .sidebar {
    width: 68px;
    padding: 24px 10px;
  }

  .logo {
    font-size: 10px;
    letter-spacing: 1px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin-bottom: 32px;
    text-align: center;
  }

  .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 13px; }

  .main-content {
    margin-left: 68px;
    padding: 22px 20px 48px;
  }

  .page-header h1 { font-size: 20px; }

  /* cards */
  .card.large          { width: 240px; height: 148px; }
  .card.small          { width: 140px; height: 94px; }
  .top-cards .card.top-card { width: 135px; height: 188px; }
  .rank                { font-size: 36px; bottom: 34px; }

  /* genre grid 3 columns */
  .genre-grid { grid-template-columns: repeat(3, 1fr); }
  .card.grid-card img  { height: 180px; }

  /* detail */
  .detail-hero         { height: 280px; }
  .detail-content      { max-width: 100%; }
}

/* ─── Mobile  ≤ 480px ─── */
@media (max-width: 480px) {
  /* Hide sidebar — use bottom nav instead */
  .sidebar { display: none; }

  /* Bottom navigation */
  body::after { content: ''; display: block; height: 68px; } /* spacer */

  .bottom-nav {
    display: flex !important;
  }

  .main-content {
    margin-left: 0;
    padding: 16px 14px 80px;
  }

  .page-header h1 { font-size: 18px; }
  .page-header p  { font-size: 12px; }
  .avatar img     { width: 34px; height: 34px; }

  /* cards */
  .card.large          { width: 220px; height: 136px; }
  .card.small          { width: 120px; height: 82px; }
  .top-cards .card.top-card { width: 120px; height: 170px; }
  .rank                { font-size: 32px; bottom: 30px; }
  .card-label          { font-size: 11px; }
  .card-year           { font-size: 9px; }

  /* genre grid 2 columns */
  .genre-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card.grid-card img  { height: 150px; }
  .genre-filters       { gap: 7px; }
  .genre-btn           { padding: 6px 14px; font-size: 12px; }

  /* detail */
  .detail-hero         { height: 210px; border-radius: 12px; }
  .play-btn            { width: 48px; height: 48px; font-size: 16px; }
  .detail-title-row h2 { font-size: 17px; }
  .detail-meta         { font-size: 12px; }
  .detail-desc         { font-size: 13px; }
  .detail-content      { max-width: 100%; }
}

/* ─── Bottom Nav (mobile only, hidden on larger screens) ─── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(108,92,231,0.2);
  z-index: 200;
  justify-content: space-around;
  align-items: center;
  padding: 0 12px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: 10px;
  transition: all 0.18s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
}

.bottom-nav-item i    { font-size: 18px; }
.bottom-nav-item.active { color: var(--accent2); }

.bottom-nav-item.active i {
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent));
}

/* ─── Large Desktop / Android TV HD  1280px – 1919px ─── */
@media (min-width: 1280px) and (max-width: 1919px) {
  .sidebar        { width: 180px; padding: 32px 18px; }
  .logo           { font-size: 24px; margin-bottom: 48px; }
  .nav-item       { padding: 12px 16px; font-size: 15px; }
  .main-content   { margin-left: 180px; padding: 32px 40px 60px; }
  .page-header h1 { font-size: 28px; }
  .section-title  { font-size: 18px; margin-bottom: 16px; }

  .card.large                 { width: 360px; height: 216px; }
  .card.small                 { width: 190px; height: 128px; }
  .top-cards .card.top-card   { width: 185px; height: 252px; }
  .rank                       { font-size: 54px; bottom: 46px; }
  .cards-row                  { gap: 18px; }
  .genre-grid                 { grid-template-columns: repeat(4, 1fr); gap: 18px; }
  .card.grid-card img         { height: 240px; }
  .detail-hero                { height: 380px; }
  .detail-content             { max-width: 820px; }
  .genre-btn                  { padding: 10px 24px; font-size: 14px; }

  /* TV focus ring */
  .card:focus-visible,
  .nav-item:focus-visible,
  .genre-btn:focus-visible,
  .back-btn:focus-visible,
  .play-btn:focus-visible,
  .ep-item:focus-visible,
  .season-trigger:focus-visible,
  .season-option:focus-visible,
  .vp-btn:focus-visible {
    outline: 3px solid var(--accent2);
    outline-offset: 4px;
  }
}

/* ─── Smart TV  ≥ 1920px ─── */
@media (min-width: 1920px) {
  :root { --card-radius: 16px; }

  .sidebar {
    width: 210px;
    padding: 36px 22px;
  }

  .logo            { font-size: 28px; margin-bottom: 56px; }
  .nav-item        { padding: 14px 18px; font-size: 17px; gap: 13px; }
  .nav-item i      { font-size: 18px; }

  .main-content    { margin-left: 210px; padding: 40px 56px 80px; }
  .page-header h1  { font-size: 34px; }
  .page-header p   { font-size: 16px; }
  .avatar img      { width: 54px; height: 54px; }
  .section-title   { font-size: 22px; margin-bottom: 18px; }
  .section         { margin-bottom: 52px; }

  /* cards */
  .card.large                  { width: 440px; height: 260px; }
  .card.small                  { width: 220px; height: 148px; }
  .top-cards .card.top-card    { width: 220px; height: 300px; }
  .rank                        { font-size: 64px; bottom: 54px; left: 12px; }
  .card-label                  { font-size: 16px; }
  .card-year                   { font-size: 13px; }
  .cards-row                   { gap: 20px; }

  /* genre grid 5 columns */
  .genre-grid                  { grid-template-columns: repeat(5, 1fr); gap: 22px; }
  .card.grid-card img          { height: 280px; }
  .card-info .card-label       { font-size: 16px; }
  .card-meta                   { font-size: 13px; }
  .genre-btn                   { padding: 12px 28px; font-size: 16px; }

  /* detail */
  .detail-hero                 { height: 480px; border-radius: 22px; }
  .play-btn                    { width: 80px; height: 80px; font-size: 28px; }
  .detail-title-row h2         { font-size: 30px; }
  .detail-meta                 { font-size: 16px; }
  .detail-info h3              { font-size: 19px; }
  .detail-desc                 { font-size: 17px; line-height: 1.8; }
  .detail-content              { max-width: 960px; }
  .stars                       { font-size: 20px; }
  .detail-rating span          { font-size: 22px; }

  /* TV focus ring for keyboard/remote navigation */
  .card:focus-visible,
  .nav-item:focus-visible,
  .genre-btn:focus-visible,
  .back-btn:focus-visible,
  .play-btn:focus-visible,
  .bottom-nav-item:focus-visible,
  .ep-item:focus-visible,
  .season-trigger:focus-visible,
  .season-option:focus-visible,
  .vp-btn:focus-visible {
    outline: 4px solid var(--accent2);
    outline-offset: 5px;
  }

  .card:focus-visible {
    transform: scale(1.07);
    box-shadow: 0 0 0 4px var(--accent2), 0 12px 40px rgba(108,92,231,0.6);
  }

  /* Hide mouse cursor when using remote */
  body.tv-cursor-hidden * { cursor: none !important; }
}

/* ════════════════════════════════════════
   VIDEO PLAYER
   ════════════════════════════════════════ */

/* Overlay */
.vp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.vp-overlay.open { display: flex; }

/* Container */
.vp-container {
  position: relative;
  width: min(92vw, 1100px);
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
}

/* Video element */
#vp-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: pointer;
}

/* ─── Top bar ─── */
.vp-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 14px 18px 40px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10;
}

.vp-container.show-ui .vp-topbar { opacity: 1; }

.vp-close {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.vp-close:hover { background: rgba(255,255,255,0.28); }

.vp-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ─── Controls bar ─── */
.vp-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 40px 16px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10;
}
.vp-container.show-ui .vp-controls { opacity: 1; }

/* Seek bar */
.vp-seek-wrap { padding: 0 2px 8px; }

.vp-seek-bar {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: height 0.15s;
}
.vp-seek-bar:hover { height: 6px; }

.vp-seek-buf,
.vp-seek-prog {
  position: absolute;
  top: 0; left: 0; height: 100%;
  border-radius: 4px;
  pointer-events: none;
}
.vp-seek-buf  { background: rgba(255,255,255,0.25); width: 0; }
.vp-seek-prog { background: var(--accent); width: 0; z-index: 1; }

.vp-seek-thumb {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  transition: transform 0.15s;
  z-index: 2;
  left: 0;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}
.vp-seek-bar:hover .vp-seek-thumb { transform: translate(-50%, -50%) scale(1); }

.vp-seek-tooltip {
  position: absolute;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
}
.vp-seek-bar:hover .vp-seek-tooltip { opacity: 1; }

/* Bottom row */
.vp-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vp-left, .vp-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Subtitle cue styling ─── */
#vp-video::cue {
  font-family: 'Inter', sans-serif;
  font-size: 1em;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.72);
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  line-height: 1.4;
}

/* PC — layar ≥ 1024px */
@media (min-width: 1024px) {
  #vp-video::cue {
    font-size: 1.2em;
  }
}

/* Smart TV — layar ≥ 1280px */
@media (min-width: 1280px) {
  #vp-video::cue {
    font-size: 1.35em;
  }
}

/* Generic button */
.vp-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 16px;
  width: 38px; height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  position: relative;
  flex-shrink: 0;
}
.vp-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.vp-btn.active { color: var(--accent2); }

/* Subtitle button states */
#vp-sub-btn.sub-found { color: var(--accent2); }
#vp-sub-btn.sub-searching { opacity: 0.6; animation: sub-pulse 1s ease-in-out infinite; }
@keyframes sub-pulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }
#vp-sub-upload-btn { opacity: 0.7; }
#vp-sub-upload-btn:hover { opacity: 1; }

/* Prev / Next episode buttons — hidden by default, shown via JS */
#vp-prev-btn, #vp-next-btn { display: none; }

/* Skip labels */
.vp-skip-label {
  position: absolute;
  font-size: 8px;
  font-weight: 700;
  bottom: 5px;
  color: inherit;
  pointer-events: none;
}

/* Play/pause bigger */
.vp-playpause { font-size: 18px; width: 44px; height: 44px; }

/* Volume */
.vp-vol-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}
.vp-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 4px;
  border-radius: 4px;
  background: rgba(255,255,255,0.3);
  outline: none;
  cursor: pointer;
  transition: width 0.2s;
  overflow: hidden;
}
.vp-vol-wrap:hover .vp-vol-slider { width: 72px; }
.vp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.vp-vol-slider::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--accent) var(--val, 100%), rgba(255,255,255,0.3) var(--val, 100%));
  height: 4px;
  border-radius: 4px;
}

/* Time display */
.vp-time {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

/* ─── Subtitle toggle indicator ─── */
.vp-sub-on::after {
  content: '';
  position: absolute;
  bottom: 4px; right: 6px;
  width: 5px; height: 5px;
  background: var(--accent2);
  border-radius: 50%;
}

/* ─── Spinner ─── */
.vp-spinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.vp-spinner.active { display: flex; }

.spinner-ring {
  width: 52px; height: 52px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Flash animation (center play/pause) ─── */
.vp-flash {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 72px; height: 72px;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: #fff;
  pointer-events: none;
  transition: transform 0.1s, opacity 0.3s;
  opacity: 0;
}
.vp-flash.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Double-tap skip indicators */
.vp-tap-skip {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: #fff; font-size: 10px; font-weight: 600;
  opacity: 0; pointer-events: none; z-index: 20;
}
#vp-tap-left  { left: 12%; }
#vp-tap-right { right: 12%; }
.vp-tap-skip i { font-size: 20px; }
@keyframes tapSkipAnim {
  0%   { opacity: 1; transform: translateY(-50%) scale(0.85); }
  40%  { opacity: 1; transform: translateY(-50%) scale(1.1);  }
  100% { opacity: 0; transform: translateY(-50%) scale(1);    }
}
.vp-tap-skip.show { animation: tapSkipAnim 0.6s ease forwards; }

/* ─── Mobile player ─── */
@media (max-width: 480px) {
  .vp-container { width: 100vw; border-radius: 0; aspect-ratio: 16/9; }
  .vp-overlay   { align-items: center; }
.vp-title     { font-size: 13px; }
  .vp-btn       { width: 32px; height: 32px; font-size: 14px; }
  .vp-playpause { width: 38px; height: 38px; font-size: 16px; }
  .vp-time      { font-size: 10px; }
  .vp-vol-slider { display: none; }
}

/* ─── Tablet player ─── */
@media (min-width: 481px) and (max-width: 1024px) {
  .vp-container { width: 96vw; }
}

/* ─── Smart TV player ─── */
@media (min-width: 1920px) {
  .vp-container   { width: min(88vw, 1600px); border-radius: 20px; }
  .vp-btn         { width: 52px; height: 52px; font-size: 22px; }
  .vp-playpause   { width: 60px; height: 60px; font-size: 26px; }
  .vp-time        { font-size: 15px; }
  .vp-title       { font-size: 20px; }
  .vp-seek-bar    { height: 6px; }
  .vp-seek-bar:hover { height: 9px; }
  .spinner-ring   { width: 70px; height: 70px; border-width: 5px; }
}

/* ════════════════════════════════════════
   EPISODES
   ════════════════════════════════════════ */

.eps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.eps-header .section-title { margin-bottom: 0; }

/* Season dropdown (custom, TV-safe) */
.season-tabs { display: flex; align-items: center; }

.season-dropdown { position: relative; }

.season-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(108,92,231,0.45);
  background: var(--card-bg);
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: border-color 0.18s;
  white-space: nowrap;
}
.season-trigger:hover,
.season-trigger:focus { border-color: var(--accent); outline: none; }

.season-chevron {
  font-size: 10px;
  color: var(--accent);
  transition: transform 0.2s;
}
.season-chevron.open { transform: rotate(180deg); }

.season-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--card-bg);
  border: 1.5px solid rgba(108,92,231,0.45);
  border-radius: 10px;
  overflow: hidden;
  z-index: 50;
  min-width: 100%;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.season-menu.open { display: flex; flex-direction: column; }

.season-option {
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.season-option:hover,
.season-option:focus  { background: rgba(108,92,231,0.15); color: var(--text); outline: none; }
.season-option.active { color: var(--accent2); font-weight: 600; }

/* Episode list */
.eps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.eps-list::-webkit-scrollbar       { width: 4px; }
.eps-list::-webkit-scrollbar-track { background: transparent; }
.eps-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

/* Episode item */
.ep-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card-bg);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border-color 0.18s, background 0.18s;
}
.ep-item:hover   { background: #1f1f38; border-color: rgba(108,92,231,0.3); }
.ep-item.active  { border-color: var(--accent); background: rgba(108,92,231,0.12); }

/* Thumbnail */
.ep-thumb {
  position: relative;
  width: 130px;
  height: 76px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.ep-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ep-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 20px;
  color: #fff;
}
.ep-item:hover .ep-thumb-overlay,
.ep-item.active .ep-thumb-overlay { opacity: 1; }

.ep-num {
  position: absolute;
  bottom: 5px;
  left: 7px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.65);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Text */
.ep-body  { flex: 1; min-width: 0; }
.ep-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-dur {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ─── Responsive episodes ─── */
@media (max-width: 480px) {
  .eps-header   { flex-direction: column; align-items: flex-start; }
  .ep-thumb     { width: 100px; height: 60px; }
  .ep-title     { font-size: 13px; }
  .eps-list     { max-height: 320px; }
}

@media (min-width: 1920px) {
  .ep-thumb     { width: 180px; height: 102px; }
  .ep-title     { font-size: 17px; }
  .ep-dur       { font-size: 14px; }
  .ep-item      { padding: 14px 16px; gap: 20px; }
  .season-trigger { font-size: 15px; padding: 9px 18px; }
  .season-option  { font-size: 15px; padding: 13px 22px; }
  .eps-list     { max-height: 560px; gap: 14px; }

  /* setup screen scaled for TV */
  .setup-box    { max-width: 560px; padding: 64px 56px; }
  .setup-logo   { font-size: 52px; }
  .setup-box h2 { font-size: 26px; }
  .setup-box p  { font-size: 17px; }
  .setup-input  { font-size: 17px; padding: 18px 20px; }
  .setup-btn    { font-size: 18px; padding: 18px; }
}
