:root {
  color-scheme: dark;
  --bg: #0f0f0f;
  --bg-soft: #18181d;
  --panel: rgba(20, 20, 27, 0.82);
  --panel-border: rgba(255, 255, 255, 0.08);
  --accent: #6c63ff;
  --accent-soft: rgba(108, 99, 255, 0.18);
  --accent-bright: #8ea1ff;
  --danger: #ff4d6d;
  --danger-soft: rgba(255, 77, 109, 0.14);
  --text: #f6f7fb;
  --muted: #a8acc5;
  --success: #42d392;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(108, 99, 255, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(68, 102, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #0f0f0f, #09090b 70%);
  color: var(--text);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent);
  pointer-events: none;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.page-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.page-header h1 {
  margin: 6px 0 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

.eyebrow,
.section-label,
.field-label {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-bright);
}

.ghost-link {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.ghost-link:hover {
  border-color: rgba(108, 99, 255, 0.45);
  transform: translateY(-1px);
}

.dashboard-grid,
.watch-layout {
  display: grid;
  gap: 20px;
}

.dashboard-grid {
  grid-template-columns: 1.25fr 0.9fr;
  align-items: start;
}

.watch-layout {
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(24, 24, 29, 0.92), rgba(16, 16, 20, 0.9));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.08), transparent 45%);
  pointer-events: none;
}

.hero-panel,
.join-panel {
  min-height: 360px;
}

.hero-title {
  max-width: 14ch;
  margin: 18px 0 16px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
}

.hero-copy,
.subtle-text,
.feedback {
  color: var(--muted);
}

.hero-copy {
  max-width: 56ch;
  line-height: 1.65;
}

.panel-top,
.button-row,
.password-card,
.stats-grid,
.cast-card,
.stacked-inline,
.option-card {
  position: relative;
  z-index: 1;
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.option-checkbox {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.option-copy {
  display: grid;
  gap: 4px;
}

.option-copy strong {
  font-size: 0.98rem;
}

.option-copy small {
  color: var(--muted);
  line-height: 1.55;
}

.button-row-tight {
  margin-top: 0;
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), #526dff);
}

.button-secondary {
  background: rgba(108, 99, 255, 0.12);
  border: 1px solid rgba(108, 99, 255, 0.28);
}

.button-danger {
  background: linear-gradient(135deg, #ff4d6d, #d7264f);
}

.button-xl {
  min-width: 220px;
  min-height: 62px;
  font-size: 1.02rem;
  font-weight: 700;
}

.info-panel,
.preview-panel,
.player-panel {
  min-height: 300px;
}

.password-card,
.cast-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 18px 20px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
}

.list-card {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
}

.password-code {
  font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: 0.14em;
}

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

.stat-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  font-size: 1.7rem;
}

.stat-text {
  font-size: 1.05rem;
  line-height: 1.4;
}

.preview-panel video,
.player-panel video {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 16px;
  border-radius: 20px;
  background: #050507;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-panel video {
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.player-panel video {
  min-height: 58vh;
  object-fit: contain;
}

.text-input {
  width: 100%;
  margin-top: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.text-input-name {
  letter-spacing: normal;
  text-transform: none;
}

.text-input:focus {
  outline: 2px solid rgba(108, 99, 255, 0.42);
  border-color: rgba(108, 99, 255, 0.52);
}

.feedback {
  min-height: 24px;
  margin: 14px 0 0;
}

.feedback-error {
  color: #ff9fb0;
}

.feedback-success {
  color: var(--success);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 77, 109, 0.14);
  border: 1px solid rgba(255, 77, 109, 0.24);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.live-indicator::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ff5d7d;
  box-shadow: 0 0 0 0 rgba(255, 93, 125, 0.8);
  animation: pulse 1.6s infinite;
}

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

.user-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.user-row strong {
  display: block;
  margin-bottom: 4px;
}

.user-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.user-meta {
  flex: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.pill-mic-on {
  color: #9cf3ce;
  background: rgba(66, 211, 146, 0.14);
}

.pill-mic-off {
  color: #ffb4c1;
  background: rgba(255, 77, 109, 0.14);
}

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

.viewer-volume {
  width: min(220px, 100%);
}

.volume-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.volume-control {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.volume-control span {
  color: var(--muted);
  font-size: 0.92rem;
}

.range-input {
  width: 100%;
  accent-color: var(--accent);
}

.range-value {
  font-size: 0.92rem;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 93, 125, 0.78);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(255, 93, 125, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 93, 125, 0);
  }
}

@media (max-width: 960px) {
  .dashboard-grid,
  .watch-layout {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-title {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 18px;
  }

  .panel {
    padding: 20px;
    border-radius: 24px;
  }

  .password-card,
  .cast-card,
  .panel-top,
  .user-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .viewer-volume {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .button,
  .button-xl {
    width: 100%;
  }

  .player-panel video {
    min-height: 42vh;
  }
}
