/* ==============================================================================
   BiliTV Player - Pure Dark Mode Design System
   Obsidian & Electric Cyan Theme
   ============================================================================== */

:root {
  --bg-dark: #090b10;
  --bg-surface: #10141d;
  --bg-card: #151b27;
  --bg-card-hover: #1c2435;
  --bg-overlay: rgba(9, 11, 16, 0.85);

  --accent: #00aeec;
  --accent-hover: #2acaff;
  --accent-light: #67d6ff;
  --accent-glow: rgba(0, 174, 236, 0.35);
  --accent-badge: rgba(0, 174, 236, 0.16);
  --accent-gradient: linear-gradient(135deg, #00aeec 0%, #0077d9 100%);
  --accent-gradient-glow: linear-gradient(135deg, #2acaff 0%, #00aeec 100%);

  --text-main: #f0f4fc;
  --text-muted: #8c9cb5;
  --text-dim: #5a6880;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(0, 174, 236, 0.38);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --max-w: 1240px;
  --header-height: 64px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==============================================================================
   Layout & Container (PLATFORM MEMORY RULE)
   ============================================================================== */

.main-wrapper {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 20px 48px;
  flex: 1;
}

@media (max-width: 768px) {
  .main-wrapper {
    padding: 12px 14px 64px; /* Space for mobile bottom dock */
  }
}

/* ==============================================================================
   Site Header & Slide-Down Search Panel
   ============================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 11, 16, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  height: var(--header-height);
}

.header-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--accent-glow);
}

.brand-badge svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}

.brand-name span {
  color: var(--accent);
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }
}

.nav-link {
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-badge);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Language selector dropdown */
.lang-dropdown-wrap {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.lang-btn:hover {
  color: #fff;
  border-color: var(--border-accent);
}

.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  padding: 6px;
  min-width: 140px;
  z-index: 110;
  backdrop-filter: blur(14px);
}

.lang-menu.show {
  display: block;
  animation: fadeIn 0.18s ease-out;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.lang-option:hover, .lang-option.active {
  background: var(--accent-badge);
  color: var(--accent-light);
}

/* Header search toggle button */
.header-search-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.header-search-btn:hover {
  color: #ffffff;
  border-color: var(--border-accent);
  background: rgba(0, 174, 236, 0.1);
}

/* Slide-Down Search Panel (Frosted Glass) */
.header-search-panel {
  position: absolute;
  top: var(--header-height);
  left: 0;
  width: 100%;
  background: rgba(16, 20, 29, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s;
  z-index: 99;
}

.header-search-panel.open {
  max-height: 220px;
  opacity: 1;
  visibility: visible;
}

.header-search-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 18px 20px 22px;
}

.header-search-form {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px 6px 14px;
  gap: 10px;
  transition: var(--transition);
}

.header-search-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.search-input-icon {
  color: var(--text-dim);
  flex-shrink: 0;
}

.header-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1rem;
  color: #ffffff;
}

.header-search-input::placeholder {
  color: var(--text-dim);
}

.header-search-submit-btn {
  padding: 8px 18px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  box-shadow: 0 0 12px var(--accent-glow);
}

.header-search-submit-btn:hover {
  filter: brightness(1.15);
}

.header-search-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.header-search-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.header-search-popular {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.85rem;
}

.popular-label {
  color: var(--text-dim);
  font-weight: 600;
}

.popular-chip {
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.82rem;
  transition: var(--transition);
}

.popular-chip:hover {
  color: var(--accent-light);
  border-color: var(--border-accent);
  background: var(--accent-badge);
}

/* ==============================================================================
   Cinematic Hero Showcase Slider (PLATFORM MEMORY RULE)
   ============================================================================== */

.hero-slider {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  min-height: 400px;
}

.banner-item {
  display: none;
  position: relative;
  width: 100%;
  min-height: 400px;
  padding: 36px 40px;
}

.banner-item.active {
  display: flex;
  align-items: center;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.banner-backdrop-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.banner-backdrop-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  filter: brightness(0.65) saturate(1.1);
  transform: scale(1.03);
  transition: transform 6s ease;
}

.banner-item.active .banner-backdrop-img {
  transform: scale(1);
}

.banner-backdrop-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #090b10 0%, rgba(9, 11, 16, 0.94) 40%, rgba(9, 11, 16, 0.55) 75%, rgba(9, 11, 16, 0.85) 100%),
              linear-gradient(0deg, #090b10 0%, transparent 60%);
}

.hero-content-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 32px;
  align-items: center;
  width: 100%;
}

@media (max-width: 820px) {
  .hero-content-grid {
    grid-template-columns: 1fr;
  }
  .hero-poster-col {
    display: none;
  }
  .banner-item {
    padding: 24px 20px;
    min-height: 320px;
  }
}

.hero-text-col {
  max-width: 600px;
}

.hero-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.hero-pill-exclusive {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
  box-shadow: 0 0 14px var(--accent-glow);
}

.hero-pill-hd {
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 1.55rem;
  }
}

.hero-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hero-meta-item svg {
  color: var(--accent);
}

.hero-synopsis {
  font-size: 0.95rem;
  color: rgba(240, 244, 252, 0.85);
  line-height: 1.55;
  margin-bottom: 22px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-primary-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  font-size: 0.96rem;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 4px 18px var(--accent-glow);
  transition: var(--transition);
}

.btn-primary-play:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-secondary-frosted {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  font-size: 0.96rem;
  font-weight: 600;
  color: #ffffff;
  transition: var(--transition);
}

.btn-secondary-frosted:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 3D Floating Poster */
.hero-poster-col {
  perspective: 900px;
}

.hero-poster-card {
  position: relative;
  width: 190px;
  height: 270px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 0 0 20px var(--accent-glow);
  transform: rotateY(-8deg) rotateX(4deg);
  transition: transform 0.4s ease;
  border: 1px solid var(--border-accent);
}

.hero-poster-card:hover {
  transform: rotateY(0deg) rotateX(0deg) scale(1.03);
}

.hero-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-poster-ribbon {
  position: absolute;
  top: 10px;
  right: -30px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 30px;
  transform: rotate(45deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Hero Controls */
.hero-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(16, 20, 29, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: var(--transition);
}

.hero-nav-arrow:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.hero-nav-arrow.prev { left: 14px; }
.hero-nav-arrow.next { right: 14px; }

.hero-indicators-bar {
  position: absolute;
  bottom: 14px;
  left: 40px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

@media (max-width: 768px) {
  .hero-indicators-bar {
    left: 20px;
  }
}

.hero-bar {
  width: 28px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.hero-bar.active {
  width: 48px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ==============================================================================
   Post-Slider Featured Search Section (PLATFORM MEMORY RULE)
   ============================================================================== */

.home-search-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.home-search-section::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.5;
}

.home-search-header {
  margin-bottom: 16px;
}

.home-search-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-search-title span {
  color: var(--accent);
}

.home-search-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.home-search-bar {
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 14px;
  transition: var(--transition);
}

.home-search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.home-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.98rem;
  color: #ffffff;
}

.home-search-input::placeholder {
  color: var(--text-dim);
}

.home-search-submit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  box-shadow: 0 0 12px var(--accent-glow);
}

.home-search-submit:hover {
  filter: brightness(1.15);
}

.home-search-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.85rem;
}

.tags-label {
  color: var(--text-dim);
  font-weight: 600;
}

.search-tag-chip {
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.82rem;
  transition: var(--transition);
}

.search-tag-chip:hover {
  color: #fff;
  border-color: var(--border-accent);
  background: var(--accent-badge);
}

/* ==============================================================================
   Horizontal Shelves & Pixel-Perfect Cards (PLATFORM MEMORY FORMULA)
   ============================================================================== */

.shelf-section {
  margin-bottom: 38px;
}

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

.shelf-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.shelf-title-icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.shelf-view-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  transition: var(--transition);
}

.shelf-view-all:hover {
  color: var(--accent-light);
  transform: translateX(3px);
}

.shelf-carousel-wrap {
  position: relative;
  width: 100%;
}

.horizontal-shelf {
  display: flex;
  gap: 16px;
  align-items: stretch; /* Forces equal height across all shelf items */
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  padding: 4px 2px 14px;
}

.horizontal-shelf::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Shelf Navigation Arrows */
.shelf-nav-arrow {
  position: absolute;
  top: 40%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: rgba(16, 20, 29, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.shelf-nav-arrow:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.shelf-nav-arrow.prev { left: -14px; }
.shelf-nav-arrow.next { right: -14px; }

@media (max-width: 768px) {
  .shelf-nav-arrow { display: none; }
}

/* Fixed Card Proportions Formula */
.shelf-card-item {
  flex: 0 0 172px;
  width: 172px;
  min-width: 172px;
  max-width: 172px;
  display: flex;
}

@media (max-width: 600px) {
  .shelf-card-item {
    flex: 0 0 148px;
    width: 148px;
    min-width: 148px;
    max-width: 148px;
  }
}

.card-drama {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.card-drama:hover {
  transform: translateY(-5px);
  border-color: var(--border-accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6), 0 0 16px var(--accent-glow);
}

/* Absolute 2:3 vertical crop container */
.card-cover-wrap {
  position: relative;
  width: 100%;
  padding-top: 144%; /* Guarantees identical 2:3 vertical poster proportions */
  height: 0;
  overflow: hidden;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.card-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.4s ease;
}

.card-drama:hover .card-cover {
  transform: scale(1.06);
}

.card-badge-ep {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(9, 11, 16, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
}

.card-badge-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.rank-1 { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #111; }
.rank-2 { background: linear-gradient(135deg, #e0e0e0, #a0a0a0); color: #111; }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #8b4513); color: #fff; }
.rank-other { background: rgba(9, 11, 16, 0.85); border: 1px solid rgba(255, 255, 255, 0.2); }

.card-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-width: 0; /* Critical for ellipsis truncation */
}

.card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-tag-free {
  color: #2ed573;
  font-weight: 700;
}

/* Multi-Column Grid (For Browse, Ranking, Search) */
.drama-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 18px;
}

@media (max-width: 600px) {
  .drama-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* ==============================================================================
   Video Player Engine & Control Dock (PLATFORM MEMORY RULE)
   ============================================================================== */

.watch-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}

@media (max-width: 980px) {
  .watch-layout {
    grid-template-columns: 1fr;
  }
}

.player-main-column {
  min-width: 0;
}

.player-stage-wrap {
  position: relative;
  width: 100%;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  aspect-ratio: 9 / 16;
  max-width: 480px;
  margin: 0 auto 16px;
}

@media (max-width: 600px) {
  .player-stage-wrap {
    max-width: 100%;
    border-radius: var(--radius-md);
  }
}

.drama-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Floating top badge (pointer-events: none) */
.player-top-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(9, 11, 16, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  pointer-events: none;
  z-index: 10;
}

/* Vertically centered side navigation arrows (Zero collision with bottom scrubber) */
.side-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: rgba(9, 11, 16, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  transition: var(--transition);
  opacity: 0.65;
}

.side-nav-arrow:hover:not(:disabled) {
  opacity: 1;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.side-nav-arrow:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.side-nav-arrow.prev { left: 10px; }
.side-nav-arrow.next { right: 10px; }

/* Spinner loader */
.player-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 20;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.player-spinner.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner-circle {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Autoplay Countdown Overlay (Hidden by default, displayed only when video finishes) */
.autoplay-overlay {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(9, 11, 16, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 25;
  text-align: center;
  padding: 24px;
}

.autoplay-overlay.show {
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

.countdown-badge {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--accent-badge);
  border: 2px solid var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-light);
  margin-bottom: 16px;
}

.autoplay-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.autoplay-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

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

/* Dedicated Player Control Dock (Beneath video stage) */
.player-dock {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 480px;
  margin: 0 auto 24px;
}

.dock-left, .dock-center, .dock-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.dock-btn:hover:not(:disabled) {
  color: #fff;
  border-color: var(--border-accent);
  background: var(--accent-badge);
}

.dock-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.dock-btn.active {
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--accent-badge);
}

.dock-ep-indicator {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
}

/* Subtitle & Quality Menus */
.menu-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  padding: 6px;
  min-width: 130px;
  z-index: 50;
  backdrop-filter: blur(14px);
}

.menu-popover.show {
  display: block;
}

.menu-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.menu-option:hover, .menu-option.active {
  background: var(--accent-badge);
  color: var(--accent-light);
}

/* Custom Subtitles (CC) Cue Styling */
video::cue {
  background-color: rgba(9, 11, 16, 0.88);
  color: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  border-radius: 4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  padding: 3px 8px;
}

/* Episode Sidebar & Selector */
.episode-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.episode-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.episode-sidebar-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
}

.episode-sidebar-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.episode-btn {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
  position: relative;
}

.episode-btn:hover {
  color: #ffffff;
  border-color: var(--border-accent);
  background: rgba(0, 174, 236, 0.1);
}

.episode-btn.active {
  background: var(--accent-gradient);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 14px var(--accent-glow);
}

.episode-btn.locked::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffaa00;
}

/* Drama Details Info Section */
.drama-detail-meta {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 10px;
}

.detail-stats-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.stat-item svg {
  color: var(--accent);
}

.detail-description {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(240, 244, 252, 0.88);
}

/* ==============================================================================
   Pagination Controls
   ============================================================================== */

.pagination-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 36px;
}

.page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}

.page-btn:hover:not(.disabled) {
  color: #fff;
  border-color: var(--border-accent);
  background: var(--accent-badge);
}

.page-btn.active {
  background: var(--accent-gradient);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}

.page-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ==============================================================================
   Static & Legal Pages (DMCA, Terms, Privacy, Contact)
   ============================================================================== */

.legal-article {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .legal-article {
    padding: 24px 20px;
  }
}

.legal-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}

.legal-updated {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.legal-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin: 24px 0 10px;
}

.legal-body p, .legal-body li {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(240, 244, 252, 0.85);
  margin-bottom: 12px;
}

.legal-body ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.legal-card-notice {
  background: rgba(0, 174, 236, 0.08);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 20px 0;
  color: var(--accent-light);
  font-size: 0.92rem;
}

/* Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-textarea {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* ==============================================================================
   Site Footer & Mobile Bottom Dock
   ============================================================================== */

.site-footer {
  background: rgba(16, 20, 29, 0.98);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  padding: 48px 20px 32px;
}

.footer-container {
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 36px;
}

@media (max-width: 840px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand-p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 12px;
  max-width: 320px;
}

.footer-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--accent-light);
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Mobile Sticky Bottom Dock */
.mobile-bottom-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(9, 11, 16, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding: 0 6px;
}

@media (max-width: 768px) {
  .mobile-bottom-dock {
    display: flex;
  }
}

.dock-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  flex: 1;
  padding: 6px 0;
}

.dock-nav-item svg {
  width: 20px;
  height: 20px;
}

.dock-nav-item.active, .dock-nav-item:hover {
  color: var(--accent);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==============================================================================
   Top Network Bar (All Platforms Link Strip)
   ============================================================================== */
.top-network-bar {
  background: #060911;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 0;
  font-size: 0.76rem;
  line-height: 1.6;
  position: relative;
  z-index: 101;
  width: 100%;
}

.top-network-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 7px;
  text-align: center;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1rem;
}

.top-network-link {
  color: #8b9cb3;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
  padding: 1px 3px;
  white-space: nowrap;
}

.top-network-link:hover {
  color: #ffffff;
}

.top-network-link.active {
  color: #3b82f6;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.top-network-sep {
  color: rgba(255, 255, 255, 0.16);
  user-select: none;
  font-size: 0.72rem;
  margin: 0 1px;
}

@media (max-width: 820px) {
  .top-network-bar {
    padding: 6px 4px;
  }
  .top-network-links {
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 6px;
    gap: 2px 5px;
    line-height: 1.55;
  }
  .top-network-link {
    font-size: 0.70rem;
    padding: 1px 2px;
  }
  .top-network-sep {
    font-size: 0.65rem;
    opacity: 0.35;
  }
}

@media (max-width: 768px) {
  .desktop-nav {
    display: none !important;
  }
  .site-header {
    height: 56px;
  }
  .brand-logo {
    font-size: 1.25rem;
  }
}

