:root {
  --bg: #000;
  --panel: #0d0d0d;
  --text: #fff;
  --muted: #b3b3b3;
  --accent: #ffb400;
  --danger: #e50914;
  --border: #2a2a2a;
  --card: #141414;
  --header-h: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(0, 0, 0, .92);
  border-bottom: 1px solid #111;
}
body.has-hero .site-header {
  position: absolute; left: 0; right: 0; top: 0;
  background: transparent;
  border-bottom: 0;
  background-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
}
.header-inner {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: .65rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.brand img {
  height: 48px;
  width: auto;
  object-fit: contain;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-left: auto;
}
.nav-desktop {
  display: none;
  align-items: center;
  gap: 1.5rem;
}
.nav-desktop a {
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: capitalize;
  opacity: .92;
}
.nav-desktop a:hover { opacity: 1; color: var(--accent); }
.nav-desktop a.active { color: #4da3ff; opacity: 1; }
.search-toggle { color: #fff; }
.search-toggle svg { display: block; }
.icon-btn {
  background: transparent; border: 0; color: #fff; cursor: pointer;
  font-size: 1.35rem; line-height: 1; padding: .35rem .45rem;
}
.menu-toggle { display: inline-flex; }
@media (min-width: 900px) {
  .nav-desktop { display: flex; }
  .menu-toggle { display: none; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Section search panel ---------- */
.section-search {
  display: none;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 1rem;
}
.section-search.is-open { display: block; }
body.has-hero .section-search {
  position: relative;
  z-index: 2;
}
.section-search-form { display: grid; gap: .65rem; }
.section-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .55rem;
}
.section-search-row--simple {
  grid-template-columns: 1fr minmax(150px, 220px) auto;
}
.section-search-input,
.section-search-filters select,
.section-search-row--simple select {
  width: 100%;
  background: #fff;
  color: #111;
  border: 2px solid #f5c518;
  border-radius: 2px;
  padding: .7rem .85rem;
  font-size: .95rem;
}
.section-search-input::placeholder { color: #888; }
.section-search-find {
  background: #f5c518;
  color: #111;
  border: 2px solid #f5c518;
  border-radius: 2px;
  padding: .7rem 1.35rem;
  font-weight: 800;
  cursor: pointer;
  text-transform: none;
  min-width: 88px;
}
.section-search-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: .55rem;
  align-items: stretch;
}
.section-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #4da3ff;
  color: #fff !important;
  border-radius: 2px;
  padding: .7rem 1rem;
  font-weight: 700;
  white-space: nowrap;
}
.section-search-clear:hover { filter: brightness(1.05); }

@media (max-width: 900px) {
  .section-search-row--simple { grid-template-columns: 1fr; }
  .section-search-filters { grid-template-columns: 1fr 1fr; }
  .section-search-clear { grid-column: 1 / -1; }
}

/* ---------- WebTV detail (player + channel grid) ---------- */
.webtv-page {
  width: min(1400px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2.5rem;
}
.webtv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, .95fr);
  gap: 1.25rem;
  align-items: start;
}
.webtv-player-wrap {
  position: relative;
  background: #000;
  border: 1px solid #222;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.webtv-player {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}
.webtv-player.is-hidden { display: none; }
.webtv-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #aaa; background: #0a0a0a; text-align: center; padding: 1rem;
}
.webtv-empty.is-hidden { display: none; }
.webtv-title {
  margin: .9rem 0 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.webtv-sidebar {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  max-height: calc(100vh - 7rem);
}
.webtv-search {
  width: 100%;
  background: #fff;
  color: #111;
  border: 0;
  border-radius: 4px;
  padding: .75rem .9rem;
  font-size: .95rem;
}
.webtv-search::placeholder { color: #777; }
.webtv-channel-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .55rem;
  overflow-y: auto;
  padding-right: .15rem;
  align-content: start;
}
.webtv-channel-tile {
  aspect-ratio: 1;
  background: #fff;
  border-radius: 8px;
  border: 2px solid transparent;
  display: grid;
  place-items: center;
  padding: .35rem;
  overflow: hidden;
  transition: border-color .15s ease, transform .15s ease;
}
.webtv-channel-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.webtv-channel-tile:hover { border-color: #7ab8ff; }
.webtv-channel-tile.active {
  border-color: #2f80ed;
  box-shadow: 0 0 0 1px #2f80ed;
}
.webtv-channel-tile.is-filtered-out { display: none; }

@media (max-width: 1000px) {
  .webtv-layout { grid-template-columns: 1fr; }
  .webtv-sidebar { max-height: none; }
  .webtv-channel-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .webtv-channel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.drawer {
  position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); background: #111;
  transform: translateX(-105%); transition: transform .25s ease; z-index: 60; padding: 1rem;
  padding-top: calc(var(--header-h) + .5rem);
}
.drawer.open { transform: translateX(0); }
.drawer a { display: block; padding: .85rem 0; border-bottom: 1px solid #222; text-transform: capitalize; }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 55;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

/* ---------- Full-bleed stage (home slider + detail) ---------- */
.stage-hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: #000;
}
.stage-slides { position: absolute; inset: 0; }
.stage-slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity .55s ease;
  background: #111 center / cover no-repeat;
}
.stage-slide.active { opacity: 1; }
.stage-shade {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.45) 42%, rgba(0,0,0,.18) 70%, rgba(0,0,0,.35) 100%),
    linear-gradient(0deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.15) 42%, rgba(0,0,0,.35) 100%);
}
.stage-content {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-end;
  padding: calc(var(--header-h) + 2rem) 0 5rem;
}
.stage-copy { max-width: 560px; }
.stage-copy h1 {
  margin: 0 0 .75rem;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.05;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .02em;
  text-shadow: 0 2px 18px rgba(0,0,0,.55);
}
.stage-copy > p {
  margin: 0;
  max-width: 520px;
  color: #ececec;
  line-height: 1.55;
  font-size: 1rem;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: .85rem;
  color: #ddd; margin: .65rem 0 1rem; align-items: center;
}
.stars { color: var(--accent); letter-spacing: 2px; font-size: 1.05rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.35rem; }
.genre-pills { gap: .5rem; }

.stage-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 3.2rem;
  line-height: 1;
  padding: .25rem .55rem;
  cursor: pointer;
  opacity: .85;
  text-shadow: 0 2px 12px rgba(0,0,0,.7);
}
.stage-arrow:hover { opacity: 1; }
.stage-prev { left: .35rem; }
.stage-next { right: .35rem; }

.stage-dots {
  position: absolute;
  left: 50%;
  bottom: 1.35rem;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: .45rem;
}
.stage-dots button {
  width: 42px;
  height: 3px;
  border: 0;
  padding: 0;
  background: rgba(255,255,255,.4);
  cursor: pointer;
}
.stage-dots button.active { background: #fff; }

.stage-hero--detail .stage-copy { max-width: 640px; }

.container { width: min(1280px, calc(100% - 2rem)); margin: 0 auto; padding: 1rem 0 3rem; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 1rem;
}
.section-head h1, .section-head h2, .section-head h4 {
  margin: 0; text-transform: uppercase; letter-spacing: .04em;
}
.section-head h1 { font-size: 1.8rem; }
.view-all { color: var(--accent); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; gap: .45rem; border: 0; border-radius: 4px;
  padding: .75rem 1.25rem; font-weight: 700; cursor: pointer; text-transform: uppercase;
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid #fff; color: #fff; }
.btn-accent { background: transparent; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: .45rem .9rem; }

.row-scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 18%);
  gap: 1rem; overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x mandatory;
}
.row-scroll > * { scroll-snap-align: start; }

.poster-card {
  background: var(--card); border: 1px solid #2c2c2c; position: relative; overflow: hidden;
}
.poster-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; background: #1a1a1a; }
.poster-card .badge {
  position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; background: #2f80ed;
  color: #000; font-weight: 800; display: grid; place-items: center; font-size: .85rem;
}
.poster-card .meta { padding: .65rem .55rem .8rem; }
.poster-card h5 { margin: 0 0 .35rem; font-size: .95rem; }
.poster-card .sub { color: var(--muted); font-size: .78rem; display: flex; gap: .5rem; flex-wrap: wrap; }

.video-grid, .poster-grid, .channel-grid, .search-grid {
  display: grid; gap: 1rem;
}
.poster-grid, .search-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.video-grid { grid-template-columns: repeat(3, 1fr); }
.channel-grid { grid-template-columns: repeat(6, 1fr); }

.video-card { position: relative; background: #111; border: 1px solid #222; overflow: hidden; }
.video-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.video-card .overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: .65rem .75rem;
  background: linear-gradient(transparent, rgba(0,0,0,.9));
  display: flex; justify-content: space-between; gap: .5rem; align-items: end;
}
.video-card h5 { margin: 0; font-size: .9rem; }
.video-card .dur { color: var(--accent); white-space: nowrap; font-weight: 700; }

.channel-card {
  background: #fff; aspect-ratio: 1; display: grid; place-items: center; padding: .75rem; border-radius: 4px;
}
.channel-card img { width: 100%; height: 100%; object-fit: contain; }

.video-list {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem 1.25rem;
}
.video-list a { display: flex; gap: .75rem; align-items: center; }
.video-list img { width: 120px; aspect-ratio: 16/9; object-fit: cover; flex-shrink: 0; }
.video-list h5 { margin: 0 0 .25rem; font-size: .92rem; }
.video-list .dur { color: var(--accent); font-size: .85rem; }

.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.cast-card { background: #151515; border: 1px solid #222; padding: .75rem; }
.cast-card strong { display: block; margin-bottom: .25rem; }
.cast-card span { color: var(--muted); font-size: .85rem; }

.pager { display: flex; gap: .5rem; align-items: center; }
.pager a, .pager span {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--accent);
  background: rgba(0,0,0,.45); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.pager .disabled { opacity: .35; pointer-events: none; border-color: #555; }

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none; position: absolute; top: 110%; left: 0; min-width: 180px;
  background: #1a1a1a; border: 1px solid #333; z-index: 5;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: block; width: 100%; text-align: left; background: transparent; border: 0; color: #fff;
  padding: .7rem .9rem; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: #292929; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.8); display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal.open { display: flex; }
.modal-dialog {
  width: min(900px, 100%); background: #000; border: 1px solid #333; position: relative;
}
.modal-dialog iframe, .modal-dialog video { width: 100%; aspect-ratio: 16/9; border: 0; background: #000; }
.modal-close {
  position: absolute; top: -12px; right: -12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--danger); color: #fff; cursor: pointer; font-size: 1.1rem;
}

.site-footer {
  border-top: 1px solid #1a1a1a; padding: 1.5rem 1rem; text-align: center; color: #888; font-size: .85rem;
}

.admin-wrap { width: min(1100px, calc(100% - 2rem)); margin: 2rem auto; }
.admin-card { background: #121212; border: 1px solid #2a2a2a; padding: 1.25rem; border-radius: 8px; }
.admin-card h1 { margin-top: 0; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { border-bottom: 1px solid #222; padding: .7rem .4rem; text-align: left; font-size: .92rem; }
.admin-form label { display: block; margin: .75rem 0 .35rem; color: #ccc; }
.admin-form input, .admin-form select, .admin-form textarea {
  width: 100%; background: #000; border: 1px solid #333; color: #fff; padding: .65rem .75rem; border-radius: 6px;
}
.admin-form textarea { min-height: 120px; }
.admin-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.error { color: #ff6b6b; margin: .5rem 0; }
.notice { color: #9ad29a; }

.empty { color: var(--muted); padding: 2rem 0; }

@media (max-width: 900px) {
  .video-grid, .video-list { grid-template-columns: 1fr 1fr; }
  .channel-grid { grid-template-columns: repeat(3, 1fr); }
  .row-scroll { grid-auto-columns: minmax(140px, 42%); }
  .stage-arrow { font-size: 2.4rem; }
  .brand img { height: 40px; }
}
@media (max-width: 600px) {
  .video-grid, .video-list, .channel-grid { grid-template-columns: 1fr; }
  .stage-content { align-items: flex-end; padding-bottom: 4.5rem; }
  .stage-copy h1 { font-size: clamp(1.8rem, 9vw, 2.6rem); }
}
