:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: #0d1118;
  --line: #1d242f;
  --text: #e8edf4;
  --muted: #8a94a3;
  --live: #ff3b30;
  --accent: #4da3ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
  min-height: 100vh;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #05070a;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-link:hover {
  color: var(--text);
  border-color: var(--line);
}

.nav-link.active {
  color: #05070a;
  background: var(--text);
  border-color: var(--text);
  font-weight: 700;
}

.stage {
  flex: 1;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 20px 22px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.stage-main {
  min-width: 0;
}

.stage-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stage-solo {
  grid-column: 1 / -1;
  max-width: 1100px;
}

.player-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.player-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(13, 17, 24, 0.72), rgba(0, 0, 0, 0.9));
  text-align: center;
  pointer-events: none;
  z-index: 5;
}

.overlay[hidden] {
  display: none;
}

.overlay-label {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.overlay-status {
  font-size: 14px;
  color: var(--text);
  max-width: 34ch;
}

.overlay-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.overlay-spinner[hidden] {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.65));
  z-index: 10;
  pointer-events: none;
}

.hud-gap {
  flex: 1;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
}

.badge[hidden] {
  display: none;
}

.badge-live {
  background: var(--live);
  color: #fff;
}

.badge-wait {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.btn {
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: rgba(8, 10, 14, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 11px;
  cursor: pointer;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

.btn[hidden] {
  display: none;
}

.vol-range {
  pointer-events: auto;
  width: 96px;
  height: 4px;
  accent-color: var(--live);
  cursor: pointer;
}

.btn-full {
  padding: 6px 9px;
  font-size: 15px;
  line-height: 1;
}

.btn-play {
  pointer-events: auto;
  padding: 12px 22px;
  font-size: 13px;
  background: var(--text);
  color: #05070a;
  border-color: var(--text);
}

.btn-activate {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  padding: 12px 20px;
}

.player-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.player-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.player-note {
  font-family: Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
}

.player-secondary .player-frame {
  aspect-ratio: 16 / 9;
}

.player-secondary .overlay-label {
  color: var(--text);
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px 18px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
}

.foot-status {
  font-family: Consolas, monospace;
}

@media (max-width: 1100px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage-side {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .player-secondary {
    flex: 1 1 300px;
  }
}

@media (max-width: 620px) {
  .topbar,
  .stage,
  .foot {
    padding-left: 12px;
    padding-right: 12px;
  }

  .stage {
    padding-top: 12px;
  }

  .nav-link {
    padding: 5px 9px;
  }
}