:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #f4f7f6;
  --muted: #aeb9b5;
  --panel: rgba(8, 15, 18, 0.8);
  --line: rgba(255, 255, 255, 0.14);
  --accent: #7cf7c4;
  --accent-2: #ffbf69;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050809;
}

button, input { font: inherit; }
button { color: inherit; }

#stage, #viewport {
  position: fixed;
  inset: 0;
}

#viewport {
  width: 100%;
  height: 100%;
  outline: 0;
}

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#enter-overlay, #fallback {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 35% 25%, rgba(37, 120, 110, 0.22), transparent 38%),
    linear-gradient(145deg, rgba(4, 8, 11, 0.93), rgba(8, 17, 20, 0.98));
}

.entry-card {
  width: min(560px, 100%);
  padding: clamp(28px, 6vw, 48px);
  border-radius: 24px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.8rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.entry-copy {
  max-width: 42ch;
  margin: 20px auto 24px;
  color: var(--muted);
  line-height: 1.6;
}

.headphones {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 22px;
  padding: 8px 13px;
  border: 1px solid rgba(124, 247, 196, 0.35);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.88rem;
}

.primary-button, .quiet-button, .source-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.primary-button {
  min-width: 220px;
  padding: 14px 22px;
  background: var(--accent);
  color: #062219;
  font-weight: 800;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

#load-status {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.topbar, .controls-card, .sources-card {
  position: absolute;
  pointer-events: auto;
  border-radius: 16px;
}

.topbar {
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(124, 247, 196, 0.12);
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quiet-button {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.8rem;
}

.quiet-button[aria-pressed="true"] {
  background: var(--accent);
  color: #062219;
}

.controls-card {
  left: 14px;
  bottom: 14px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 13px 15px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.controls-card strong { color: var(--ink); }

.pointer-lock-hint {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.sources-card {
  top: 76px;
  right: 14px;
  width: min(310px, calc(100vw - 28px));
  max-height: calc(100vh - 100px);
  overflow: auto;
  padding: 12px;
}

.sources-card h2 {
  margin: 2px 4px 9px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sources-card .attribution {
  margin: 10px 4px 2px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.66rem;
  line-height: 1.45;
  color: var(--muted);
}

.source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  padding: 7px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.source-name {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-button {
  width: 34px;
  height: 27px;
  padding: 0;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.67rem;
  font-weight: 800;
}

.source-button.active {
  background: var(--accent-2);
  color: #281608;
}

#labels {
  position: fixed;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

.source-label {
  position: absolute;
  transform: translate(-50%, calc(-100% - 15px));
  padding: 5px 8px;
  border: 1px solid rgba(124, 247, 196, 0.5);
  border-radius: 7px;
  background: rgba(4, 11, 13, 0.82);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

#fallback {
  display: none;
  z-index: 60;
  overflow: auto;
}

.fallback-card {
  width: min(820px, 100%);
  padding: 16px;
  border-radius: 22px;
}

.fallback-card video {
  display: block;
  width: 100%;
  border-radius: 14px;
}

.fallback-copy {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 4px 3px;
}

.fallback-copy h2, .fallback-copy p { margin: 0; }
.fallback-copy p { margin-top: 5px; color: var(--muted); font-size: 0.86rem; }

#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: none;
  pointer-events: none;
}

.touch-pad {
  position: absolute;
  bottom: 22px;
  width: 116px;
  height: 116px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(8, 15, 18, 0.45);
  pointer-events: auto;
  touch-action: none;
}

#move-pad { left: 20px; }
#look-pad { right: 20px; }
.touch-pad::after {
  position: absolute;
  inset: 41px;
  border: 1px solid rgba(124, 247, 196, 0.5);
  border-radius: 50%;
  content: "";
}

.hidden { display: none !important; }

@media (max-width: 760px), (pointer: coarse) {
  .sources-card { display: none; }
  .controls-card { display: none; }
  .topbar { right: 10px; left: 10px; }
  #touch-controls.active { display: block; }
  .fallback-copy { align-items: flex-start; flex-direction: column; }
}
