html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

:root, html[data-theme="dark"] {
  --bg-main: #121418;
  --bg-side: #0e1014;
  --bg-card: #1b1e26;
  --bg-card-hover: #232733;
  --bg-elevated: #1c2028;
  --bg-translucent: rgba(14, 16, 20, 0.88);
  --bg-modal: #171a21;
  --bg-player: #101318;
  --border-color: rgba(214, 196, 168, 0.16);
  --border-focus: rgba(196, 165, 116, 0.7);
  --primary: #c6a36a;
  --primary-hover: #d4b57e;
  --primary-glow: rgba(198, 163, 106, 0.28);
  --on-primary: #1a1612;
  --amber: #d8c4a2;
  --mint: #9aab9c;
  --ink: #121418;
  --text-primary: #f6f1e8;
  --text-secondary: #c9c1b4;
  --text-muted: #8f877c;
  --star-gold: #d8c4a2;
  --fhd-blue: #b7c4c8;
  --side-active: rgba(214, 196, 168, 0.14);
  --overlay: rgba(8, 9, 12, 0.72);
  --font-display: 'Fraunces', Georgia, serif;
  --font-family: 'Outfit', system-ui, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-hard: none;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] {
  --bg-main: #f3eee6;
  --bg-side: #fbf8f3;
  --bg-card: #fffdfb;
  --bg-card-hover: #ffffff;
  --bg-elevated: #ffffff;
  --bg-translucent: rgba(251, 248, 243, 0.92);
  --bg-modal: #fffdfb;
  --bg-player: #f7f2eb;
  --border-color: rgba(48, 38, 26, 0.1);
  --border-focus: rgba(122, 84, 52, 0.55);
  --primary: #8a5a38;
  --primary-hover: #73492c;
  --primary-glow: rgba(138, 90, 56, 0.18);
  --on-primary: #fffaf4;
  --amber: #8a5a38;
  --mint: #4d6a56;
  --ink: #f3eee6;
  --text-primary: #1d1915;
  --text-secondary: #4d463e;
  --text-muted: #7a7268;
  --star-gold: #8a5a38;
  --fhd-blue: #3d555c;
  --side-active: rgba(138, 90, 56, 0.1);
  --overlay: rgba(29, 25, 21, 0.42);
  --shadow: 0 16px 36px rgba(60, 42, 24, 0.08);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
}

body.nav-open { overflow: hidden; }

button, a, input, select { touch-action: manipulation; }

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(1.15rem + env(safe-area-inset-top)) max(0.85rem, env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) max(0.85rem, env(safe-area-inset-left));
  background: var(--bg-side);
  border-right: 1px solid var(--border-color);
}

.side-label {
  margin: 1.15rem 0.7rem 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.side-nav,
.side-cats {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar .nav-link,
.sidebar .genre-pill {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 500;
  padding: 0.58rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: none;
}

.sidebar .nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar .nav-link:hover,
.sidebar .genre-pill:hover {
  color: var(--text-primary);
  background: var(--side-active);
}

.sidebar .nav-link.active,
.sidebar .genre-pill.active {
  color: var(--text-primary);
  background: var(--side-active);
  box-shadow: inset 2px 0 0 var(--primary);
}

.stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.75rem max(1rem, env(safe-area-inset-left));
  background: var(--bg-translucent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.menu-btn,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}

.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
}

.menu-btn svg,
.theme-toggle svg { width: 18px; height: 18px; }

.theme-toggle {
  margin-left: auto;
  height: 40px;
  padding: 0 0.85rem 0 0.7rem;
}

.theme-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

html[data-theme="dark"] .theme-icon-sun,
html[data-theme="light"] .theme-icon-moon { display: none; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 50;
}

.sidebar-backdrop[hidden] { display: none; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
}

.orb-magenta {
  top: -80px;
  right: 8%;
  background: #ff2e88;
}

.orb-amber {
  bottom: 8%;
  left: -80px;
  background: #ffb000;
  opacity: 0.22;
}

.sprocket {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  background:
    radial-gradient(circle at 50% 14px, transparent 5px, #10080d 5.5px) 0 0 / 18px 28px,
    #ffb000;
  opacity: 0.55;
}

.sprocket-left { left: 0; }
.sprocket-right { right: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #6d6458; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.navbar,
.main-content,
.footer {
  position: relative;
  z-index: 1;
}

.navbar {
  position: sticky;
  top: 14px;
  z-index: 100;
  width: min(1360px, calc(100% - 48px));
  margin: 14px auto 0;
  background: rgba(20, 10, 16, 0.78);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  padding: 0.75rem 1.1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  user-select: none;
}

.logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.logo-svg {
  width: 46px;
  height: 46px;
  color: var(--primary);
}

.logo-face,
.logo-reel {
  fill: var(--bg-side);
}

.logo-hub { fill: var(--primary); }
.logo-windows { opacity: 0.9; }

.brand {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0.2rem 0.35rem 0.6rem;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.brand-name::first-letter {
  color: var(--amber);
}

.nav-links {
  display: flex;
  gap: 0.4rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 176, 0, 0.08);
}

.nav-link.active {
  color: #1a0c10;
  background: linear-gradient(135deg, var(--amber), #ffe08a);
  box-shadow: 0 6px 16px rgba(255, 176, 0, 0.28);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  width: auto;
  max-width: 460px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.68rem 2.4rem 0.68rem 2.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.clear-search-btn {
  position: absolute;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.main-content {
  flex: 1;
  width: min(1180px, 100%);
  margin: 0;
  padding: 1.25rem 1.4rem 2.2rem;
}

.hero-section {
  position: relative;
  min-height: 460px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  transform: scale(1.04);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(12, 13, 16, 0.88) 0%, rgba(12, 13, 16, 0.35) 70%);
}

.hero-sprockets { display: none; }

.hero-content {
  position: relative;
  z-index: 3;
  padding: 2.4rem 2.4rem 2.4rem 3rem;
  max-width: 740px;
  color: #f6f1e8;
}

.hero-title { color: #f6f1e8; }

.hero-content .hero-description { color: #e4dcd0; }

.hero-content .badge-meta { color: #f6f1e8; background: rgba(255, 255, 255, 0.12); }

.hero-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mint);
  font-weight: 700;
  margin-bottom: 0.7rem;
}

.hero-badges,
.modal-tags {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
}

.badge-featured {
  background: var(--primary);
  color: var(--on-primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-rating {
  background: rgba(255, 176, 0, 0.16);
  color: var(--amber);
  border: 1px solid rgba(255, 176, 0, 0.35);
}

.badge-meta,
.badge-country {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.badge-country {
  border: 1px solid rgba(46, 230, 166, 0.35);
  color: var(--mint);
}

.badge-fhd {
  background: rgba(122, 240, 255, 0.12);
  color: var(--fhd-blue);
  border: 1px solid rgba(122, 240, 255, 0.28);
  letter-spacing: 0.04em;
}

.hero-title,
.modal-title,
.section-title {
  font-family: var(--font-display);
  letter-spacing: -0.04em;
}

.hero-title {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  font-weight: 800;
  line-height: 0.95;
  margin-bottom: 0.8rem;
}

.hero-description,
.modal-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
}

.hero-description {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.4rem;
  max-width: 58ch;
}

.hero-actions,
.modal-actions-row {
  display: flex;
  gap: 0.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.78rem 1.4rem;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-play-large {
  padding: 0.95rem 1.6rem;
  font-size: 1rem;
}

.btn-secondary,
.btn-outline,
.btn-sm {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-secondary:hover,
.btn-outline:hover {
  border-color: var(--amber);
  color: var(--amber);
  transform: translateY(-2px);
}

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }

.region-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.region-copy {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.region-flag {
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.25));
}

.region-kicker {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--amber);
}

.region-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(46, 230, 166, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(46, 230, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 230, 166, 0); }
}

.region-hint {
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.region-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.country-select,
.filter-select,
.player-select,
.subtitle-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  max-width: 100%;
  outline: none;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.country-select { min-width: min(220px, 100%); width: 100%; }

.country-select:focus,
.filter-select:focus,
.player-select:focus,
.subtitle-select:focus {
  border-color: var(--primary);
}

.filter-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}

.filter-scroll {
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.genres-list,
.filter-controls,
.quality-pills,
.player-quality-options,
.player-controls-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  max-width: 100%;
}

.genre-pill {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.genre-pill:hover { color: #fff; border-color: var(--amber); }

.genre-pill.active {
  background: var(--side-active);
  color: var(--text-primary);
  border-color: transparent;
  box-shadow: none;
}

.section-header { margin-bottom: 1.1rem; }

.section-title {
  font-size: clamp(1.6rem, 2vw, 2.1rem);
  font-weight: 800;
}

.section-subtitle {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.15rem;
}

.media-card {
  position: relative;
  background: var(--bg-card);
  border-radius: 18px 18px 14px 14px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.media-card::after {
  content: "";
  height: 10px;
  background:
    radial-gradient(circle at 8px 0, transparent 6px, var(--bg-card) 6.5px) left top / 16px 10px repeat-x;
  border-top: 1px dashed rgba(255, 176, 0, 0.35);
}

.media-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.card-poster-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #2a1520;
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.media-card:hover .card-poster { transform: scale(1.06); }

.card-badges {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  right: 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 0.3rem;
  pointer-events: none;
}

.card-rating,
.card-series-tag,
.card-country {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
}

.card-rating {
  background: rgba(16, 8, 13, 0.78);
  color: var(--amber);
}

.card-series-tag {
  background: var(--primary);
  color: var(--on-primary);
  text-transform: uppercase;
}

.card-country {
  position: absolute;
  left: 0.55rem;
  bottom: 0.55rem;
  background: rgba(16, 8, 13, 0.8);
  color: var(--mint);
}

.card-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(16, 8, 13, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.media-card:hover .card-play-overlay { opacity: 1; }

.card-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.card-play-btn svg { width: 22px; height: 22px; }
.media-card:hover .card-play-btn { transform: scale(1); }

.card-info { padding: 0.85rem 0.9rem 0.7rem; }

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 720;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.loader-container,
.video-loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--text-muted);
}

.loader-container { padding: 3rem; }

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--amber);
  border-right-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.load-more-container {
  display: flex;
  justify-content: center;
  margin: 2rem 0 1rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 3, 6, 0.82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(0.75rem + env(safe-area-inset-top))
    calc(0.75rem + env(safe-area-inset-right))
    calc(0.75rem + env(safe-area-inset-bottom))
    calc(0.75rem + env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal-card {
  position: relative;
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  max-width: 960px;
  width: 100%;
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1.5rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 30;
}

.modal-close:hover { background: var(--primary); }

.player-container {
  background: #000;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.player-header,
.stream-actions {
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  background: var(--bg-player);
}

.playing-info h4 { font-family: var(--font-display); font-size: 1.05rem; }
.playing-info span { font-size: 0.8rem; color: var(--text-muted); }

.player-quality-bar,
.player-subtitle-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.45rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
}

.pq-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pq-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}

.pq-btn.active {
  background: var(--amber);
  color: #1a0c10;
}

.video-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  aspect-ratio: 16 / 9;
}

video { width: 100%; height: 100%; object-fit: contain; }

.video-loading-indicator {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
}

.stream-note {
  font-size: 0.8rem;
  color: var(--mint);
  font-weight: 600;
}

.modal-body {
  padding: 1.6rem;
  display: flex;
  gap: 1.5rem;
}

.modal-left { flex-shrink: 0; width: 220px; }

.modal-poster {
  width: 100%;
  border-radius: 16px;
  box-shadow: 6px 6px 0 var(--amber);
}

.modal-right { flex: 1; min-width: 0; }

.badge-genre {
  background: rgba(255, 46, 136, 0.14);
  color: #ff9cc4;
  border: 1px solid rgba(255, 46, 136, 0.3);
}

.modal-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 0.7rem;
}

.modal-desc { margin-bottom: 1.2rem; }

.quality-selector-group,
.series-controls {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1.1rem;
}

.group-label,
.episodes-container label,
.season-selector-row label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}

.quality-pill,
.ep-btn {
  background: #241018;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.quality-pill {
  padding: 0.55rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.quality-pill:hover,
.ep-btn:hover { border-color: var(--amber); }

.quality-pill.active,
.ep-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  box-shadow: none;
}

.q-badge {
  font-size: 0.66rem;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
}

.q-badge-fhd { color: #ffe08a; }

.season-selector-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.season-selector-row label { margin: 0; }

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.ep-btn { padding: 0.55rem; font-size: 0.8rem; }

.footer {
  border-top: 1px solid rgba(255, 176, 0, 0.16);
  padding: 1.4rem 1rem calc(1.4rem + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.footer code {
  color: var(--amber);
  font-weight: 700;
}

@media (max-width: 1080px) {
  .menu-btn { display: inline-flex; width: 44px; height: 44px; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(300px, 88vw);
    height: auto;
    height: 100svh;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .hero-section { min-height: 320px; }
  .modal-body { flex-direction: column; align-items: stretch; }
  .modal-left { width: min(180px, 46vw); margin: 0 auto; }
  .main-content { padding: 1rem max(1rem, env(safe-area-inset-right)) 1.4rem max(1rem, env(safe-area-inset-left)); }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 760px) {
  .region-bar,
  .player-header,
  .player-controls-top,
  .hero-actions,
  .modal-actions-row { flex-direction: column; align-items: stretch; }
  .search-box,
  .country-select,
  .region-field { width: 100%; max-width: none; min-width: 0; }
  .theme-label { display: none; }
  .theme-toggle { margin-left: auto; padding: 0; width: 44px; height: 44px; flex-shrink: 0; }
  .hero-content { padding: 1.1rem; }
  .hero-title { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .hero-section { min-height: 0; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
  .card-title { font-size: 0.92rem; }
  .section-title { font-size: 1.45rem; }
  .modal-title { font-size: clamp(1.4rem, 6vw, 2rem); }
  .modal-body { padding: 1rem; }
  .btn, .quality-pill, .pq-btn, .ep-btn, .sidebar .nav-link, .sidebar .genre-pill { min-height: 44px; }
  .modal-close { width: 44px; height: 44px; }
  .search-box, .search-box input { min-width: 0; }
  .playing-info { min-width: 0; flex: 1; }
  .playing-info h4, .card-title, .hero-title { overflow-wrap: anywhere; }
  .player-quality-bar { max-width: 100%; overflow-x: auto; }
  .player-quality-bar, .player-subtitle-bar { width: 100%; }
  .stream-actions { align-items: stretch; }
  .stream-note { text-align: left; }
  .footer { font-size: 0.78rem; padding-left: 0.8rem; padding-right: 0.8rem; }
}

@media (max-width: 380px) {
  .topbar { gap: 0.45rem; }
  .brand-name { font-size: 1.35rem; }
  .media-grid { gap: 0.45rem; }
}
