:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #0b0b0d;
  color: #f2f2f2;
  padding: 24px;
}

#stage {
  position: relative;
  width: min(960px, 100%);
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#background,
#avatar-source,
#avatar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#background {
  object-fit: cover;
  z-index: 0;
}

#avatar-source {
  object-fit: contain;
  visibility: hidden;
  z-index: 1;
}

#avatar-canvas {
  object-fit: contain;
  z-index: 2;
}

#status-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  font-size: 13px;
}

#status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d33;
}
#status-dot[data-state="connecting"] {
  background: #e0a400;
  animation: pulse 1.2s infinite;
}
#status-dot[data-state="live"] {
  background: #2ecc71;
}
#status-dot[data-state="error"] {
  background: #d33;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

#start-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
}

#start-btn,
#unmute-btn {
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  background: #f2f2f2;
  color: #111;
  cursor: pointer;
}
#start-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

#unmute-btn {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 8px 18px;
  font-size: 13px;
}

#controls-panel {
  width: min(960px, 100%);
}

#controls-toggle {
  background: none;
  border: 1px solid #444;
  color: #f2f2f2;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

#controls {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 16px;
  border: 1px solid #333;
  border-radius: 12px;
}

#controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #ccc;
}

#controls input[type="range"] {
  width: 220px;
}

[hidden] {
  display: none !important;
}
