:root {
  color-scheme: dark;
  --bg: #090a0f;
  --panel: #141722;
  --panel-2: #191d2a;
  --ink: #f8fafc;
  --muted: #9aa3b4;
  --line: rgba(255, 255, 255, 0.1);
  --brand: #ff3f58;
  --brand-2: #ffd166;
  --aqua: #27c7a6;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 4%, rgba(255, 63, 88, 0.22), transparent 24rem),
    radial-gradient(circle at 85% 0%, rgba(39, 199, 166, 0.12), transparent 22rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
  margin-bottom: 14px;
}

h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

p {
  line-height: 1.65;
}

.shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: rgba(9, 10, 15, 0.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 13px clamp(14px, 4vw, 42px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 9px;
  font-size: 17px;
  font-weight: 950;
  min-width: max-content;
}

.brand-mark {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 9px;
  display: inline-block;
  height: 26px;
  width: 26px;
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  justify-content: flex-end;
}

.nav a,
.text-link {
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 850;
}

.main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px clamp(14px, 4vw, 42px) 58px;
}

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

.account-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #dbe3ef;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}

.inline-form {
  display: inline;
}

.hero {
  align-items: stretch;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.04fr) minmax(280px, 0.96fr);
  min-height: min(72vh, 650px);
}

.hero-copy {
  align-content: end;
  display: grid;
  padding: clamp(24px, 6vw, 70px) 0;
}

.hero-copy p {
  color: #cbd5e1;
  font-size: 17px;
  max-width: 620px;
}

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

.hero-stage,
.detail-art,
.room-thumb {
  background:
    linear-gradient(to top, rgba(9, 10, 15, 0.9), rgba(9, 10, 15, 0.08) 58%),
    radial-gradient(circle at 58% 18%, rgba(255, 255, 255, 0.3), transparent 18%),
    linear-gradient(145deg, #3d1262, #e84a5f 56%, #f3bb50);
}

.hero-stage {
  border-radius: 8px;
  min-height: 520px;
  overflow: hidden;
  position: relative;
}

.live-preview {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  bottom: 18px;
  display: grid;
  gap: 3px;
  left: 18px;
  padding: 13px 14px;
  position: absolute;
  right: 18px;
}

.live-preview strong {
  font-size: 18px;
}

.live-preview span {
  color: #d7dce7;
  font-size: 13px;
}

.live-dot {
  background: var(--brand);
  border-radius: 999px;
  height: 9px;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 9px;
}

.section-head {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 8px 0 18px;
}

.section-head h1,
.section-head h2 {
  margin-bottom: 5px;
}

.room-grid,
.stats-grid,
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
}

.panel,
.auth-card,
.room-card,
.stat {
  background: rgba(20, 23, 34, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel,
.auth-card,
.stat {
  padding: 18px;
}

.auth-card {
  margin: 8vh auto 0;
  max-width: 430px;
}

.room-card {
  overflow: hidden;
}

.room-thumb {
  align-items: start;
  display: flex;
  height: 178px;
  padding: 12px;
}

.room-card:nth-child(2n) .room-thumb {
  background:
    linear-gradient(to top, rgba(9, 10, 15, 0.88), rgba(9, 10, 15, 0.04) 58%),
    radial-gradient(circle at 60% 18%, rgba(255, 255, 255, 0.24), transparent 18%),
    linear-gradient(145deg, #123c5a, #27c7a6);
}

.room-card:nth-child(3n) .room-thumb {
  background:
    linear-gradient(to top, rgba(9, 10, 15, 0.88), rgba(9, 10, 15, 0.04) 58%),
    radial-gradient(circle at 60% 18%, rgba(255, 255, 255, 0.24), transparent 18%),
    linear-gradient(145deg, #3b2a13, #f2c15c);
}

.room-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.room-body h2 {
  font-size: 18px;
  line-height: 1.25;
  margin: 0;
}

.room-body p {
  margin-bottom: 0;
}

.badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #f8fafc;
  display: inline-flex;
  font-size: 12px;
  font-weight: 950;
  padding: 5px 9px;
  width: fit-content;
}

.badge.hot {
  background: var(--brand);
  border-color: var(--brand);
}

.badge.danger {
  background: rgba(255, 107, 107, 0.18);
  border-color: rgba(255, 107, 107, 0.35);
  color: #ffd1d1;
}

.button,
button {
  align-items: center;
  background: var(--brand);
  border: 0;
  border-radius: 999px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 900;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  width: fit-content;
}

.button.compact,
button.compact {
  min-height: 38px;
  padding: 8px 13px;
}

.button.secondary,
button.secondary,
.ghost-button {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

form {
  display: grid;
  gap: 12px;
}

label {
  color: #dbe3ef;
  display: grid;
  font-size: 14px;
  font-weight: 800;
  gap: 7px;
}

input,
textarea,
select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 43px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.flash {
  background: rgba(255, 209, 102, 0.14);
  border: 1px solid rgba(255, 209, 102, 0.36);
  border-radius: 8px;
  color: #ffe0a3;
  margin-bottom: 16px;
  padding: 10px 12px;
}

.detail-hero {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
}

.detail-art {
  border-radius: 8px;
  min-height: 520px;
}

.detail-content {
  align-content: end;
  display: grid;
}

.detail-meta {
  color: #cbd5e1;
}

.ticket-panel {
  background: rgba(20, 23, 34, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-column: 2;
  padding: 16px;
}

.ticket-panel span {
  color: var(--muted);
  font-weight: 850;
}

.ticket-panel strong {
  font-size: 32px;
}

video {
  background: #05060a;
  display: block;
  width: 100%;
}

.watch-shell {
  margin: -28px calc(clamp(14px, 4vw, 42px) * -1) -58px;
}

.live-surface {
  background: #05060a;
  min-height: calc(100vh - 58px);
  overflow: hidden;
  position: relative;
}

.live-surface #remote-video {
  height: calc(100vh - 58px);
  min-height: 640px;
  object-fit: contain;
}

.watch-top {
  align-items: center;
  display: flex;
  gap: 10px;
  left: 14px;
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 3;
}

.close-button {
  align-items: center;
  background: rgba(0, 0, 0, 0.42);
  border-radius: 999px;
  display: inline-flex;
  font-size: 26px;
  font-weight: 800;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.anchor-pill {
  align-items: center;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  display: flex;
  gap: 9px;
  min-width: 0;
  padding: 7px 12px 7px 7px;
}

.avatar {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border-radius: 999px;
  display: block;
  height: 34px;
  width: 34px;
}

.anchor-pill strong,
.anchor-pill span {
  display: block;
}

.anchor-pill strong {
  font-size: 13px;
}

.anchor-pill span {
  color: #d6d9e1;
  font-size: 11px;
}

.watch-title {
  bottom: 210px;
  display: grid;
  gap: 6px;
  left: 16px;
  max-width: 520px;
  position: absolute;
  right: 16px;
  z-index: 3;
}

.watch-title h1 {
  font-size: clamp(23px, 4vw, 40px);
  margin: 0;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.48);
}

.watch-title p {
  color: #e5e7eb;
  margin: 0;
}

.rtc-status {
  background: rgba(0, 0, 0, 0.42);
  border-radius: 999px;
  color: #e5e7eb;
  font-size: 12px;
  margin: 0;
  padding: 7px 10px;
  width: fit-content;
}

.live-surface > .rtc-status {
  bottom: 142px;
  left: 16px;
  position: absolute;
  z-index: 3;
}

.float-connect {
  bottom: 88px;
  position: absolute;
  right: 14px;
  z-index: 4;
}

.chat-overlay-panel {
  bottom: 14px;
  display: grid;
  gap: 8px;
  left: 14px;
  max-width: min(520px, calc(100% - 28px));
  position: absolute;
  right: 14px;
  z-index: 3;
}

.chat-box {
  display: grid;
  gap: 6px;
  max-height: 146px;
  overflow: auto;
}

.chat-line {
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  color: #f8fafc;
  font-size: 13px;
  line-height: 1.35;
  padding: 7px 9px;
  width: fit-content;
}

.chat-line strong {
  color: var(--brand-2);
  margin-right: 6px;
}

#chat-form {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

#chat-input {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  border-radius: 999px;
}

.chat-side .chat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 330px;
  max-height: none;
  padding: 10px;
}

.studio-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.studio-video {
  background: rgba(20, 23, 34, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.studio-video video {
  aspect-ratio: 16 / 9;
}

.studio-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 14px;
}

.stat {
  display: grid;
  gap: 8px;
}

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

.stat strong {
  font-size: 28px;
}

.table {
  border-collapse: collapse;
  width: 100%;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .main {
    padding-bottom: 44px;
  }

  .hero,
  .detail-hero,
  .studio-layout {
    grid-template-columns: 1fr;
  }

  .hero-stage {
    min-height: 360px;
    order: -1;
  }

  .hero-copy {
    padding: 8px 0 16px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-art {
    min-height: 380px;
  }

  .ticket-panel {
    grid-column: auto;
  }

  .watch-shell {
    margin-top: -28px;
  }

  .live-surface,
  .live-surface #remote-video {
    height: calc(100vh - 116px);
    min-height: 620px;
  }

  .live-surface #remote-video {
    object-fit: cover;
  }

  .watch-title {
    bottom: 218px;
  }

  .float-connect {
    bottom: 86px;
    min-height: 40px;
    padding: 8px 12px;
  }

  .chat-overlay-panel {
    bottom: 12px;
  }

  .chat-box {
    max-height: 136px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 34px;
  }

  .topbar {
    display: none;
  }

  .main {
    padding: 18px 14px 42px;
  }

  .watch-shell {
    margin: -18px -14px -42px;
  }

  .live-surface,
  .live-surface #remote-video {
    height: 100vh;
    min-height: 100vh;
  }

  .watch-title {
    bottom: 210px;
  }

  .watch-title h1 {
    font-size: 21px;
  }

  .live-surface > .rtc-status {
    bottom: 150px;
  }

  .float-connect {
    bottom: 82px;
  }

  .chat-line {
    font-size: 12px;
    max-width: 88%;
  }

  #chat-form button {
    min-height: 42px;
    padding: 8px 13px;
  }
}
