:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: #141414;
  --panel-2: #1e1e1e;
  --text: #f8f8f2;
  --muted: #a7a7a0;
  --line: rgba(255,255,255,.12);
  --red: #e3293b;
  --teal: #15b8a6;
  --amber: #f5b84b;
  --violet: #8a6cff;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(8,8,8,.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0;
}

.brand-name {
  position: relative;
  display: inline-block;
  color: #fff;
  font-size: clamp(1.28rem, 2vw, 1.7rem);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: 0;
}

.brand-name::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -8px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--teal));
  opacity: .9;
}

.topnav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-btn,
.ghost,
.soft,
.text-button {
  color: var(--text);
  background: transparent;
}

.nav-btn {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
}

.nav-btn.active,
.nav-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.09);
}

.account {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 10px;
  min-width: 0;
}

.account-avatar,
.creator-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #222;
}

.account-name {
  max-width: 160px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary,
.soft,
.ghost {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 800;
}

.primary {
  color: #fff;
  background: var(--red);
}

.primary:hover { background: #f2384b; }

.soft {
  color: #101010;
  background: #fff;
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
}

.small {
  min-height: 36px;
  padding-inline: 12px;
}

.page {
  padding-bottom: 80px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, .95fr);
  align-items: end;
  gap: clamp(24px, 5vw, 64px);
  min-height: clamp(480px, 78vh, 760px);
  padding: clamp(40px, 7vw, 96px) clamp(16px, 5vw, 64px) clamp(32px, 7vw, 72px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8,8,8,.98) 0%, rgba(8,8,8,.72) 47%, rgba(8,8,8,.4) 100%),
    radial-gradient(circle at 70% 25%, rgba(227,41,59,.36), transparent 36%),
    radial-gradient(circle at 82% 76%, rgba(21,184,166,.18), transparent 30%);
  pointer-events: none;
}

.hero-copy,
.hero-poster {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--amber);
  font-size: .85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.6rem, 6.5vw, 6.8rem);
  line-height: .95;
  letter-spacing: 0;
}

.hero p {
  max-width: 680px;
  color: #deded7;
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-poster {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  min-height: 250px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,0)),
    linear-gradient(150deg, #2d0d13 0%, #3b1a1d 36%, #0b3a34 70%, #151515 100%);
  box-shadow: var(--shadow);
}

.hero-poster.has-image {
  background-size: cover;
  background-position: center;
}

.hero-poster span {
  color: rgba(255,255,255,.88);
  font-size: clamp(3rem, 9vw, 8rem);
  font-weight: 1000;
}

.ad-rail,
.subscription-band,
.creator-page,
.share-panel,
.content-zone,
.admin {
  width: min(1480px, calc(100% - 32px));
  margin-inline: auto;
}

.ad-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.ad-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171717;
  color: var(--text);
  text-decoration: none;
}

.ad-image,
.poster-art {
  background:
    linear-gradient(145deg, rgba(227,41,59,.88), rgba(245,184,75,.74)),
    #2b2b2b;
  background-size: cover;
  background-position: center;
}

.ad-image {
  border-radius: 6px;
}

.ad-card strong,
.tile-title,
.admin-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.ad-card p,
.tile-meta,
.admin-row p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.subscription-band {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(21,184,166,.16), rgba(245,184,75,.08));
}

.subscription-band h2,
.section-title h2,
.admin h2 {
  margin: 0;
  letter-spacing: 0;
}

.subscription-band p {
  margin: 6px 0 0;
  color: var(--muted);
}

.content-zone {
  margin-top: 30px;
}

.share-panel {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121212;
}

.creator-page {
  margin-top: 28px;
}

.creator-page .share-panel {
  width: 100%;
  margin-top: 0;
}

.creator-panel {
  display: none;
}

.creator-panel.active {
  display: block;
}

.creator-tabs {
  margin-bottom: 12px;
}

.share-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.section-title span {
  color: var(--muted);
}

.rows {
  display: grid;
  gap: 28px;
}

.row-title {
  margin: 0 0 12px;
  font-size: 1.18rem;
}

.tile-strip {
  display: grid;
  grid-auto-columns: minmax(190px, 260px);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
}

.tile {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #151515;
  color: inherit;
  text-align: left;
  scroll-snap-align: start;
  transition: transform .18s ease, border-color .18s ease;
}

.tile:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,.22);
}

.poster-art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
}

.poster-art span {
  color: rgba(255,255,255,.9);
  font-size: 2rem;
  font-weight: 1000;
}

.lock {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(0,0,0,.72);
  font-size: .78rem;
  font-weight: 900;
}

.tile-body {
  display: grid;
  gap: 4px;
  min-height: 96px;
  padding: 12px;
}

.tile-title {
  font-weight: 900;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty h2 {
  margin: 0 0 6px;
  color: var(--text);
}

.admin {
  margin-top: 42px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.admin-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.tab {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: #1b1b1b;
  color: var(--muted);
  white-space: nowrap;
}

.tab.active {
  color: #111;
  background: var(--amber);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat,
.panel,
.admin-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat {
  padding: 14px;
}

.stat b {
  display: block;
  font-size: 1.7rem;
}

.stat span {
  color: var(--muted);
}

.panel {
  display: none;
  padding: 16px;
}

.panel.active {
  display: block;
}

.earnings-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 193, 77, .28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255,193,77,.12), rgba(21,184,166,.08));
}

.earnings-panel h2 {
  margin: 0 0 6px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: #dadad4;
  font-size: .92rem;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 7px;
  color: #dadad4;
  font-size: .92rem;
  font-weight: 800;
}

.field-label {
  display: block;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f0f0f;
}

.segmented button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.segmented button.active {
  color: #111;
  background: var(--amber);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: 0;
  background: #0f0f0f;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(21,184,166,.18);
}

.wide {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.row-actions button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: #272727;
  color: #fff;
}

.dialog,
.player-dialog {
  width: min(460px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.dialog::backdrop,
.player-dialog::backdrop {
  background: rgba(0,0,0,.78);
}

.dialog-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 8px;
  background: #161616;
}

.dialog-card h2 {
  margin: 0;
}

.icon-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  color: #fff;
}

.text-button {
  min-height: 36px;
  color: var(--teal);
  font-weight: 900;
}

.player-dialog {
  width: min(1040px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
}

.player-shell {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #080808;
}

.player-shell video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 58dvh;
  object-fit: contain;
  background: #000;
}

.player-shell iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}

.player-error {
  margin: 12px;
  padding: 12px;
  border: 1px solid rgba(245,184,75,.38);
  border-radius: 8px;
  background: rgba(245,184,75,.1);
  color: #fff;
  line-height: 1.45;
}

.player-info {
  padding: 16px;
}

.player-info h2 {
  margin: 0;
}

.player-info p {
  color: var(--muted);
}

.creator-line {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--teal);
  color: #061311;
  font-size: .78rem;
  font-weight: 1000;
}

.pre-roll-ad {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(245,184,75,.38);
  border-radius: 8px;
  background: rgba(245,184,75,.08);
}

.pre-roll-ad strong {
  display: block;
}

.engagement {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  color: var(--muted);
}

.review-form {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.reviews-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.review-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}

.review-card strong {
  display: block;
}

.review-card p {
  margin: 6px 0 0;
}

.room-card {
  position: relative;
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #151515;
  color: inherit;
  text-align: left;
}

.room-open {
  display: grid;
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.room-poster {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(145deg, rgba(21,184,166,.78), rgba(227,41,59,.72)),
    #242424;
  background-size: cover;
  background-position: center;
}

.room-poster span {
  color: rgba(255,255,255,.92);
  font-size: 2rem;
  font-weight: 1000;
}

.room-poster b {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(227,41,59,.9);
  color: #fff;
  font-size: .76rem;
}

.room-copy {
  padding: 12px;
}

.room-delete {
  position: absolute;
  right: 8px;
  top: 8px;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-weight: 900;
}

.room-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.room-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

#theaterPlayerMount {
  margin-top: 14px;
}

#theaterPlayerMount iframe,
#theaterPlayerMount video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  background: #000;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202020;
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topnav {
    grid-column: 1 / -1;
    order: 3;
  }

  .account-name {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-poster {
    min-height: 210px;
  }

  .subscription-band,
  .section-title,
  .admin-head {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .compact-form,
  .review-form,
  .admin-row,
  .earnings-panel {
    grid-template-columns: 1fr;
  }

  .player-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
  }

  .player-info {
    padding: 14px;
  }

  .player-info h2 {
    font-size: 1.55rem;
    line-height: 1.15;
  }

  .player-shell video,
  .player-shell iframe,
  #theaterPlayerMount video {
    max-height: 42dvh;
  }

  .row-actions {
    justify-content: start;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 10px;
    padding-inline: 12px;
  }

  .brand-name {
    font-size: 1.22rem;
  }

  .hero {
    padding-inline: 16px;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .tile-strip {
    grid-auto-columns: minmax(170px, 78vw);
  }

  .ad-card {
    grid-template-columns: 72px 1fr;
  }
}
