:root {
  --bg: #0a0a0a;
  --bg-soft: #121212;
  --panel: #171717;
  --panel-soft: #1d1d1d;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --muted: #b4b4b4;
  --gold: #f3c95b;
  --gold-strong: #d8a321;
  --danger: #df5f5f;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --container: 1280px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Tahoma, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("/logo-thlive.webp");
  background-repeat: repeat;
  background-size: 92px 92px;
  background-position: 18px 18px;
  filter: saturate(0.8);
}

body[data-page="admin"]::before {
  display: none;
}

body > * {
  position: relative;
  z-index: 1;
}

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

button,
input,
select {
  font: inherit;
}

.container {
  width: min(var(--container), calc(100% - 24px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 8, 8, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.site-header__top,
.site-header__actions,
.site-header__nav,
.nav-strip__inner,
.search-panel__fields,
.hero-banner__actions,
.admin-actions,
.video-detail__meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header__top {
  justify-content: space-between;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand__logo {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
}

.brand__logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.hint,
.search-panel__hint,
.video-card__meta,
.video-detail__meta,
.hero-banner__copy,
.metric-card span,
.hero-stat span,
.admin-item .hint {
  color: var(--muted);
}

.nav-strip {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.nav-strip__inner {
  overflow-x: auto;
  white-space: nowrap;
  padding: 10px 0;
}

.nav-strip__inner a {
  padding: 8px 14px;
  border-radius: 999px;
  background: #161616;
  border: 1px solid transparent;
}

.nav-strip__inner a:hover {
  border-color: var(--gold-strong);
  color: var(--gold);
}

.page,
.admin-shell {
  padding: 20px 0 40px;
}

.page--home {
  display: grid;
  gap: 18px;
}

.hero-banner {
  display: grid;
  grid-template-columns: 1.2fr 0.55fr;
  gap: 18px;
  margin-top: 20px;
}

.hero-simple {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
}

.hero-simple__main,
.hero-simple__side,
.quick-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-simple__main {
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(243, 201, 91, 0.12), rgba(18, 18, 18, 0.96)),
    #131313;
}

.hero-simple__main h1 {
  margin: 0 0 12px;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  line-height: 1.08;
}

.hero-simple__copy {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.7;
}

.hero-simple__side {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.hero-simple__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.quick-card {
  padding: 18px;
}

.quick-card strong {
  display: block;
  margin-bottom: 8px;
}

.quick-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-banner__content,
.hero-banner__side,
.search-panel,
.metric-card,
.video-card,
.player-section,
.video-detail,
.related-list,
.panel,
.popup__card,
.preroll__card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-banner__content {
  min-height: 280px;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.74), rgba(0, 0, 0, 0.18)),
    url("https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.hero-banner__content h1 {
  max-width: 760px;
  margin: 0 0 12px;
  font-size: clamp(2rem, 3.6vw, 3.7rem);
  line-height: 1.04;
}

.hero-banner__copy {
  max-width: 700px;
  font-size: 1rem;
  line-height: 1.7;
}

.hero-banner__side {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.hero-stat,
.metric-card {
  padding: 18px;
  background: var(--panel-soft);
  border-radius: 14px;
}

.hero-stat strong,
.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
}

.button--primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-strong));
  color: #111;
  font-weight: 700;
}

.button--ghost {
  background: #1a1a1a;
  color: var(--text);
  border-color: var(--border);
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #101010;
  color: var(--text);
}

.input--area {
  min-height: 120px;
  padding: 14px;
  resize: vertical;
}

.search-panel {
  padding: 16px;
  margin-bottom: 20px;
}

.search-panel--clean {
  margin-bottom: 0;
}

.browse-panel {
  padding: 22px;
}

.browse-panel__top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.browse-panel__title {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  line-height: 1.1;
}

.browse-panel__copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.browse-panel__filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
  max-width: 520px;
}

.search-panel__fields {
  flex-wrap: wrap;
}

.search-panel__fields > * {
  flex: 1 1 260px;
}

[data-video-source],
#source-filter {
  display: none !important;
}

.stats-row,
.admin-grid,
.content-columns {
  display: grid;
  gap: 18px;
}

.stats-row {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 14px;
}

.section-head--tight {
  margin-bottom: 12px;
}

.section-head h2,
.related-list h2,
.panel h2 {
  margin: 0;
  font-size: 1.4rem;
}

.video-grid {
  display: grid;
  gap: 18px;
}

.video-grid--poster {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.video-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.video-card {
  overflow: hidden;
}

.video-card__thumb-wrap {
  position: relative;
  overflow: hidden;
  background: #0f0f0f;
}

.video-card__thumb-wrap--poster {
  aspect-ratio: 3 / 4;
}

.video-card__thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.video-card:hover .video-card__thumb-wrap img {
  transform: scale(1.04);
}

.video-card__rank,
.video-card__badge,
.video-card__duration {
  position: absolute;
  z-index: 1;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.76rem;
  font-weight: 700;
}

.video-card__rank {
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.82);
}

.video-card__badge {
  right: 10px;
  bottom: 10px;
  background: rgba(243, 201, 91, 0.92);
  color: #111;
}

.video-card__duration {
  right: 10px;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.84);
  color: #fff;
  letter-spacing: 0.02em;
}

.video-card__body {
  padding: 12px 13px 14px;
}

.video-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.78rem;
}

.video-card h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.loading {
  width: fit-content;
  margin: 22px auto 0;
  padding: 12px 16px;
  border-radius: 999px;
  background: #181818;
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.pagination__info {
  width: 100%;
  text-align: center;
  color: var(--muted);
}

.button.is-active {
  background: linear-gradient(135deg, var(--gold), var(--gold-strong));
  color: #111;
  font-weight: 700;
}

.page--video-portal {
  display: grid;
  gap: 22px;
}

.home-sections,
.category-sections {
  display: grid;
  gap: 20px;
}

.home-sections {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-pills,
.category-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.category-pill {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #171717;
  color: var(--text);
  cursor: pointer;
}

.category-pill.is-active {
  background: linear-gradient(135deg, var(--gold), var(--gold-strong));
  color: #111;
  border-color: transparent;
  font-weight: 700;
}

.category-group {
  display: grid;
  gap: 12px;
}

.category-tab-panel {
  min-height: 120px;
}

.featured-category-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.category-showcase .video-grid {
  margin-top: 10px;
}

.video-stage--index {
  margin-bottom: 20px;
}

.video-stage {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: start;
}

.video-main,
.ad-rail,
.ad-column,
.ad-strip {
  display: grid;
  gap: 14px;
}

.ad-rail {
  position: sticky;
  top: 88px;
}

.ad-strip--inline {
  margin-top: 2px;
}

.ad-slot:empty {
  display: block;
}

.ad-slot--placeholder {
  min-height: 140px;
  display: grid;
  place-items: center;
  border: 1px dashed #4b4b4b;
  border-radius: 14px;
  background: #111;
  color: #8e8e8e;
  font-size: 0.92rem;
}

.ad-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.ad-card__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  cursor: pointer;
}

.ad-card__link {
  display: block;
}

.ad-card__media {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  background: #0b0b0b;
}

.ad-slot--banner .ad-card__media,
.ad-column .ad-card__media {
  aspect-ratio: 5 / 1.2;
}

.ad-card__body {
  padding: 0;
}

.player-section {
  overflow: hidden;
  position: relative;
}

.artplayer-shell {
  width: 100%;
  background: #000;
}

.artplayer-app {
  width: 100%;
  min-height: 620px;
  aspect-ratio: 16 / 9;
}

.player-frame {
  width: 100%;
  min-height: 620px;
  border: 0;
  background: #000;
  display: block;
}

.player-frame--cropped {
  overflow: hidden;
}

.player-note {
  margin: 0;
  padding: 14px 18px;
  color: var(--muted);
  background: #111;
  border-top: 1px solid var(--border);
  line-height: 1.7;
}

.player-fallback {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 18px 20px;
  background: #111;
  border-top: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

.content-columns {
  grid-template-columns: 1.45fr 0.75fr;
}

.video-detail,
.related-list,
.panel {
  padding: 22px;
}

.player-section--portal {
  overflow: hidden;
}

.panel--empty {
  padding: 18px;
  text-align: center;
}

.panel--empty p {
  margin: 0;
  color: var(--muted);
}

.affiliate-banner {
  margin: 20px 0 16px;
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(243, 201, 91, 0.18), rgba(216, 163, 33, 0.12));
  border: 1px solid rgba(243, 201, 91, 0.25);
}

.related-item,
.admin-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-soft);
  border: 1px solid #242424;
  margin-bottom: 10px;
}

.preroll {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.74);
}

.preroll.hidden,
.popup.hidden,
.admin-dashboard.hidden,
.admin-login.hidden {
  display: none;
}

.preroll__card,
.popup__card {
  width: min(420px, calc(100% - 24px));
  padding: 24px;
}

.preroll__card {
  width: min(520px, calc(100% - 24px));
}

.preroll__media {
  overflow: hidden;
  border-radius: 12px;
  margin: 8px 0 16px;
  background: #080808;
  cursor: pointer;
}

.preroll__media video,
.preroll__media img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
}

.preroll__titleless h2,
.preroll__titleless p {
  display: none;
}

.o1-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
}

.o1-overlay__hitbox {
  position: absolute;
  inset: 0;
  display: block;
  background: rgba(255, 255, 255, 0.01);
}

.o1-overlay__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.72);
  color: #fff;
  cursor: pointer;
}

.popup {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.popup__card {
  position: relative;
  z-index: 1;
}

.popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #262626;
  color: var(--text);
  cursor: pointer;
}

.admin-login {
  display: flex;
  justify-content: center;
  padding-top: 30px;
}

.panel--admin-login {
  width: min(460px, 100%);
}

.stack-form {
  display: grid;
  gap: 12px;
}

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

.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.admin-list {
  display: grid;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.admin-tab {
  border: 1px solid #2d2d2d;
  background: #131313;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.admin-tab.is-active {
  background: var(--accent);
  color: #1a1306;
  border-color: var(--accent);
}

.admin-section {
  display: none;
  gap: 18px;
}

.admin-section.is-active {
  display: grid;
}

.admin-card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-card-grid--wide {
  grid-template-columns: 1.5fr 1fr;
}

.admin-actions--stack {
  flex-direction: column;
  align-items: flex-end;
}

.admin-session-card {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.admin-form-grid {
  display: grid;
  gap: 12px;
}

.admin-form-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-form-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.admin-button-grid,
.admin-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 14px 0;
}

.admin-pagination {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-item--stretch {
  align-items: stretch;
}

.admin-item__media {
  width: 96px;
  min-width: 96px;
  border-radius: 12px;
  overflow: hidden;
  background: #090909;
}

.admin-item__media img {
  width: 100%;
  height: 100%;
  min-height: 96px;
  display: block;
  object-fit: cover;
}

.admin-item__content {
  display: grid;
  gap: 6px;
  flex: 1;
}

.panel--nested {
  background: rgba(255, 255, 255, 0.02);
}

.slot-summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.slot-summary-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-soft);
  border: 1px solid #2b2b2b;
}

.preview-card {
  margin-top: 14px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #2d2d2d;
}

.preview-card__body {
  display: grid;
  gap: 14px;
  grid-template-columns: 180px 1fr;
  align-items: start;
}

.preview-thumb {
  position: relative;
  min-height: 220px;
  border-radius: 16px;
  overflow: hidden;
  background: #090909;
}

.preview-thumb--ad {
  min-height: 160px;
}

.preview-thumb img,
.preview-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-thumb__empty {
  min-height: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.preview-duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  font-size: 0.78rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(243, 201, 91, 0.16);
  border: 1px solid rgba(243, 201, 91, 0.3);
  color: var(--accent);
  font-size: 0.86rem;
}

.checkbox-line {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.input--compact {
  min-width: 180px;
  width: auto;
}

.admin-empty {
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed #393939;
  color: var(--muted);
}

.admin-log {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #2d2d2d;
  color: var(--muted);
}

.danger {
  background: rgba(223, 95, 95, 0.16);
  color: #ffc8c8;
  border-color: rgba(223, 95, 95, 0.32);
}

@media (max-width: 980px) {
  .hero-banner,
  .hero-simple,
  .video-stage,
  .content-columns,
  .admin-grid,
  .admin-card-grid,
  .admin-card-grid--wide,
  .home-sections,
  .featured-category-stack {
    grid-template-columns: 1fr;
  }

  .admin-form-grid--two,
  .admin-form-grid--three,
  .admin-form-grid--four {
    grid-template-columns: 1fr;
  }

  .slot-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .browse-panel__filters {
    grid-template-columns: 1fr;
  }

  .ad-rail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-main {
    order: 1;
  }

  .ad-rail--left {
    order: 2;
  }

  .ad-rail--right {
    order: 3;
  }

  .page--home .ad-rail--left {
    order: 1;
  }

  .page--home .ad-rail--right {
    order: 2;
  }

  .page--home .video-main {
    order: 3;
  }

  .player-frame {
    min-height: 62svh;
  }

  .artplayer-app {
    min-height: 62svh;
  }

  .player-frame--cropped {
    min-height: calc(62svh + var(--embed-crop, 0px));
    height: calc(62svh + var(--embed-crop, 0px));
    margin-top: calc(var(--embed-crop, 0px) * -1);
  }
}

@media (max-width: 1180px) and (pointer: coarse) {
  .player-frame {
    min-height: 82svh;
  }

  .artplayer-app {
    min-height: 82svh;
  }

  .player-frame--cropped {
    min-height: calc(82svh + var(--embed-crop, 0px));
    height: calc(82svh + var(--embed-crop, 0px));
  }
}

@media (max-width: 640px) {
  .site-header__top,
  .site-header__actions,
  .hero-banner__actions {
    flex-wrap: wrap;
  }

  .ad-rail {
    grid-template-columns: 1fr;
  }

  .page--home .ad-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-grid--poster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .slot-summary-grid,
  .preview-card__body,
  .admin-toolbar,
  .admin-pagination {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .admin-item,
  .admin-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-item__media {
    width: 100%;
    min-width: 0;
  }

  .site-header__nav {
    width: 100%;
    flex-wrap: wrap;
  }

  .player-frame {
    min-height: 74svh;
  }

  .artplayer-app {
    min-height: 74svh;
  }

  .player-frame--cropped {
    min-height: calc(74svh + var(--embed-crop, 0px));
    height: calc(74svh + var(--embed-crop, 0px));
  }
}
