:root {
  --bg: #07090e;
  --bg-subtle: #0d121a;
  --panel: #131924;
  --panel-hover: #1a2232;
  --panel-active: #222d40;
  --border: #212c3d;
  --border-active: #e50914;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #e50914;
  --accent-hover: #f40612;
  --accent-glow: rgba(229, 9, 20, 0.3);
  --gold: #f59e0b;
  --cyan: #06b6d4;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------------- Topbar Header ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 9, 14, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  /* Push down below status bar in TG fullscreen mode */
  padding-top: var(--tg-safe-top, env(safe-area-inset-top, 0px));
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.brand-text {
  color: var(--text);
}

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

.main-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

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

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--panel);
}

.nav-link.active {
  border: 1px solid var(--border);
}

.search-form {
  margin-left: auto;
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  overflow: hidden;
}

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

.search-form select {
  background: transparent;
  color: var(--text-muted);
  border: 0;
  border-right: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.search-form select option {
  background: var(--panel);
  color: var(--text);
}

.search-form input {
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  width: 220px;
  transition: width 0.2s;
}

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

.search-form button {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.search-form button:hover {
  color: var(--accent);
}

/* ---------------- Main Container ---------------- */
#app {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ---------------- Hero Section ---------------- */
.hero {
  margin: 28px 0 44px;
  padding: 48px 44px;
  background: radial-gradient(circle at 80% 20%, rgba(229, 9, 20, 0.12) 0%, transparent 60%),
              linear-gradient(180deg, var(--bg-subtle) 0%, var(--panel) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
}

.hero-copy {
  max-width: 580px;
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -1.2px;
  margin-bottom: 16px;
}

.hero h1 span {
  color: var(--accent);
}

.lead {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.cta-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

/* ---------------- Shelf & Grid ---------------- */
.shelf {
  margin-bottom: 48px;
}

.shelf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.shelf-head h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.shelf-head a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.shelf-head a:hover {
  color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(0, 190px));
  justify-content: start;
  gap: 20px;
}

.catalogue-grid {
  grid-template-columns: repeat(auto-fill, minmax(0, 190px));
  align-items: start;
}

/* ---------------- Movie / Series Card ---------------- */
.card {
  cursor: pointer;
  min-width: 0;
  border-radius: var(--radius-md);
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
}

.poster {
  width: 100%;
  aspect-ratio: 2/3;
  background-color: var(--panel);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.poster.shimmer {
  background: linear-gradient(90deg, #0d121c 0%, #1b2434 50%, #0d121c 100%);
  background-size: 200% 100%;
  animation: shimmerSweep 1.5s infinite ease-in-out;
}

@keyframes shimmerSweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.poster-img.loaded {
  opacity: 1;
}

.card:hover .poster {
  border-color: rgba(229, 9, 20, 0.6);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.poster-overlay-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(7, 9, 14, 0.8) 0%, transparent 100%);
  z-index: 2;
}

.poster-overlay-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(0deg, rgba(7, 9, 14, 0.9) 0%, transparent 100%);
  z-index: 2;
}

.badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-quality {
  background: rgba(7, 9, 14, 0.85);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.badge-series {
  background: rgba(229, 9, 20, 0.85);
  color: #fff;
}

.badge-rating {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(7, 9, 14, 0.85);
  color: var(--gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-rating svg {
  fill: var(--gold);
}

.badge-year {
  background: rgba(7, 9, 14, 0.85);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.card-info {
  margin-top: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------------- Detail View ---------------- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 24px 0 16px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.back-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.detail-layout {
  display: block;
  min-height: 0;
  margin-top: 16px;
  position: relative;
  isolation: isolate;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: #050609;
  overflow: hidden;
}

.detail-layout.has-backdrop::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 610px;
  z-index: -1;
  border-radius: inherit;
  background-image: linear-gradient(90deg, rgba(5, 6, 9, 0.9) 0%, rgba(5, 6, 9, 0.72) 38%, rgba(5, 6, 9, 0.97) 100%), var(--detail-backdrop);
  background-size: cover;
  background-position: center 20%;
  filter: saturate(1.08);
  opacity: 0.72;
}

.detail-poster {
  position: absolute;
  inset: 0 0 auto;
  height: 610px;
  z-index: 0;
  overflow: hidden;
}

.detail-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 5, 8, 0.08) 0%, rgba(4, 5, 8, 0.12) 28%, rgba(4, 5, 8, 0.88) 72%, #050609 100%);
  pointer-events: none;
}

.detail-poster .poster {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: cover;
  object-position: center top;
}

.detail-poster .poster-overlay-bottom {
  display: none;
}

.detail-poster .detail-metadata {
  position: absolute;
  z-index: 2;
  left: 32px;
  bottom: 112px;
  max-width: min(720px, calc(100% - 64px));
  margin: 0;
}

.detail-body {
  position: relative;
  z-index: 1;
  padding: 610px 32px 34px;
}

.detail-summary {
  max-width: 760px;
  margin-top: -170px;
  margin-bottom: 72px;
}

.detail-summary .detail-metadata {
  margin: 12px 0 0;
}

.detail-content {
  max-width: 820px;
}

.detail-body h1 {
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 8px;
  color: #fff;
  text-shadow: 0 3px 24px rgba(0, 0, 0, 0.8);
}

.detail-submeta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
}

.detail-overview {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-line;
  margin-bottom: 24px;
  max-width: 760px;
}

.specs-section {
  margin-bottom: 28px;
}

.detail-metadata {
  margin: 0 0 24px;
}

.metadata-label {
  display: block;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 9px;
}

.detail-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.detail-chip {
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
}

.detail-chip:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
}

.detail-chip-tag {
  color: #b7f5ff;
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.34);
}

.detail-summary .detail-submeta .badge-rating {
  color: #ffd45a;
  border: 0;
  background: transparent;
  padding: 0;
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  max-width: 760px;
}

.spec-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition);
}

.spec-card:hover {
  border-color: rgba(229, 9, 20, 0.4);
  background: var(--panel);
}

.spec-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.spec-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ---------------- Video Player Frame ---------------- */
#player {
  margin: 24px 0 28px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-layout.theater-active {
  grid-template-columns: 1fr;
  max-width: 1400px;
}

.detail-layout.theater-active .detail-poster {
  display: none;
}

.detail-layout.theater-active #player {
  margin-top: 10px;
}

.detail-layout.theater-active video {
  max-height: 80vh;
}

.player-media-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
}



video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 560px;
  background: #000;
  object-fit: contain;
  cursor: pointer;
}

.player-status {
  padding: 16px 20px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.player-status.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.player-status.error {
  background: rgba(229, 9, 20, 0.12);
  border-color: rgba(229, 9, 20, 0.4);
  color: #f87171;
}

.player-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}

.player-actions-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(229, 9, 20, 0.08);
}

.action-btn.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.action-btn kbd {
  display: inline-block;
  font-size: 10px;
  font-family: inherit;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.player-shortcuts-hint {
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 16px;
  background: rgba(7, 9, 14, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.player-shortcuts-hint kbd {
  font-family: inherit;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

/* ---------------- Sources / Mirrors ---------------- */
.sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.source-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.source-btn span {
  font-size: 11px;
  opacity: 0.65;
}

.source-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.source-btn.active {
  background: rgba(229, 9, 20, 0.16);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}

.source-btn.recommended {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
  color: #e2e8f0;
}

.source-btn.recommended:hover {
  border-color: #10b981;
  color: #fff;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
}

.source-btn.recommended.active {
  background: rgba(229, 9, 20, 0.2);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 14px var(--accent-glow);
}

.badge-rec {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  margin-left: 2px;
}

/* ---------------- Series Episodes & Highlighting ---------------- */
.seasons-container {
  margin-top: 20px;
}

.season-block {
  margin-bottom: 24px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.season-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.episode-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--panel-hover);
}

/* HIGHLIGHT SELECTED EPISODE */
.episode-btn.active {
  background: rgba(229, 9, 20, 0.2);
  border-color: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 14px var(--accent-glow);
}

.episode-sources-box {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* ---------------- Page Headers & Infinite Scroll ---------------- */
.page-header {
  padding: 36px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 800;
  letter-spacing: -1px;
}

.page-subtitle {
  color: var(--text-muted);
  margin-top: 8px;
}

.genre-section {
  margin: 0 0 30px;
  padding: 18px 0 4px;
  border-bottom: 1px solid var(--border);
}

.discovery-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  max-width: 460px;
  margin: 0 0 22px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.discovery-tab {
  min-width: 0;
  min-height: 38px;
  padding: 7px 12px;
  border: 0;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.discovery-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.discovery-tab.active {
  color: #fff;
  background: var(--accent);
}

[data-discovery-panel][hidden] {
  display: none;
}

.genre-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.genre-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.genre-chip:hover {
  color: #fff;
  border-color: var(--accent);
  background: rgba(229, 9, 20, 0.12);
}

.infinite-loader {
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.infinite-loader.hidden {
  display: none;
}

.end-message {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px 0;
  color: var(--text-muted);
  gap: 16px;
}

/* ---------------- Site Footer ---------------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 32px 24px;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.footer-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------------- Responsive Media Queries ---------------- */
@media (max-width: 900px) {
  .topbar-inner {
    padding: 0 16px;
    gap: 16px;
  }
  
  .search-form input {
    width: 150px;
  }

  .hero {
    padding: 32px 24px;
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-layout {
    display: block;
  }

  .detail-poster {
    position: absolute;
    max-width: none;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 14px;
  }

  .catalogue-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .topbar-inner {
    height: 64px;
  }

  .brand-text {
    display: inline;
    font-size: 17px;
  }

  .search-form input {
    width: 120px;
    padding: 8px 10px;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .catalogue-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .hero {
    margin: 16px 0 28px;
    padding: 24px 18px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .episodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* Desktop detail layout: preserve poster quality with a compact poster column. */
@media (min-width: 901px) {
  .detail-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
    gap: 36px;
    padding: 28px;
  }

  .detail-layout.has-backdrop::before {
    inset: 0;
    height: auto;
    background-image: linear-gradient(90deg, rgba(5, 6, 9, 0.92) 0%, rgba(5, 6, 9, 0.84) 55%, rgba(5, 6, 9, 0.96) 100%), var(--detail-backdrop);
    background-position: center top;
    opacity: 0.58;
  }

  .detail-poster {
    position: sticky;
    inset: auto;
    top: 96px;
    width: 280px;
    height: auto;
    z-index: 1;
    overflow: visible;
  }

  .detail-poster::after {
    display: none;
  }

  .detail-poster .poster {
    width: 280px;
    height: auto;
    aspect-ratio: 2 / 3;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.78), 0 0 0 5px rgba(255, 255, 255, 0.04);
  }

  .detail-poster .poster-overlay-bottom {
    display: flex;
  }

  .detail-poster .detail-metadata {
    position: static;
    max-width: 280px;
    margin: 14px 0 0;
  }

  .detail-body {
    min-width: 0;
    padding: 18px 0 34px;
  }

  .detail-summary {
    max-width: 760px;
    margin: 0 0 28px;
  }

  .detail-content {
    max-width: 820px;
  }
}

/* ---------------- Mobile Fit & Vertical Scroll ---------------- */
html {
  overflow-y: scroll;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
}

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

.detail-overview, .detail-body h1, .spec-card, .spec-value, .card-title {
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ---------------- Video Fullscreen & Mobile Landscape ---------------- */
body.fs-open {
  overflow: hidden;
}

.player-media-wrapper.pseudo-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999999 !important;
  background: #000 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.player-media-wrapper.pseudo-fullscreen video {
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  object-fit: contain !important;
  border-radius: 0 !important;
}

:fullscreen video,
:-webkit-full-screen video,
:-moz-full-screen video {
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  object-fit: contain !important;
  background: #000 !important;
}

/* Telegram Mini App Mobile Fit */
@media (max-width: 600px) {
  #app {
    padding: 12px 10px;
  }

  .topbar {
    height: auto;
  }

  .topbar-inner {
    padding: 0 10px;
    gap: 8px;
    height: auto;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .brand {
    flex-shrink: 0;
  }

  .main-nav {
    gap: 2px;
    flex-shrink: 0;
  }

  .nav-link {
    padding: 5px 6px;
    font-size: 11px;
  }

  /* Search bar drops to its own full-width row */
  .search-form {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .search-form select {
    max-width: 72px;
    padding: 7px 4px;
    font-size: 10px;
  }

  .search-form input {
    width: 100%;
    font-size: 13px;
    padding: 8px 10px;
  }

  .detail-layout {
    min-height: 0;
    border-radius: 14px;
  }

  .detail-poster {
    height: 500px;
    max-width: none;
  }

  .detail-poster .detail-metadata {
    left: 16px;
    bottom: 86px;
    max-width: calc(100% - 32px);
  }

  .detail-poster .detail-chip-list {
    width: 100%;
    gap: 5px;
  }

  .detail-poster .detail-chip {
    padding: 4px 7px;
    font-size: 10px;
  }

  .detail-body {
    padding: 500px 16px 24px;
  }

  .detail-summary {
    max-width: none;
    margin-top: -145px;
    margin-bottom: 42px;
  }

  .detail-summary .detail-metadata {
    margin-top: 10px;
  }

  .detail-summary h1 {
    margin-bottom: 8px;
    font-size: 21px;
    overflow-wrap: anywhere;
  }

  .detail-summary .detail-submeta {
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 0;
  }

  .detail-content { max-width: none; }

  .discovery-tabs {
    width: 100%;
    max-width: none;
    margin-bottom: 16px;
  }

  .discovery-tab {
    min-height: 36px;
    padding: 6px 4px;
    font-size: 11px;
  }

  .detail-body h1 {
    font-size: 22px;
  }

  .detail-overview {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 16px;
  }

  .sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .source-btn {
    flex: 1 1 calc(50% - 8px);
    padding: 9px 6px;
    font-size: 12px;
    text-align: center;
    justify-content: center;
  }

  .specs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .episodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
  }

  .episode-btn {
    padding: 8px 4px;
    font-size: 11px;
    text-align: center;
  }

  .hide-mobile {
    display: none !important;
  }

  .player-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .player-actions-group {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .player-actions-group .action-btn {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    padding: 8px 6px;
    font-size: 11px;
  }

  .player-shortcuts-hint {
    font-size: 10px;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    padding: 6px 10px;
  }
}
