* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
}

#container {
  width: 100%;
  height: 100%;
}

#container canvas {
  display: block;
  touch-action: none;
}

/* Overlay styles */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.overlay.hidden {
  display: none;
}

/* Loading spinner */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #6366f1;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.overlay p {
  color: white;
  font-size: 18px;
  margin-top: 16px;
}

/* Error popup */
.popup {
  background: #1e1e2e;
  border: 1px solid #444;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  margin: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.popup h2 {
  color: #ef4444;
  font-size: 20px;
  margin-bottom: 12px;
}

.popup p {
  color: #9ca3af;
  margin-bottom: 16px;
  line-height: 1.5;
}

.popup button {
  width: 100%;
  padding: 10px 16px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.popup button:hover {
  background: #4f46e5;
}

/* Bottom controls container */
.bottom-controls {
  position: fixed;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
}

.bottom-controls.hidden {
  display: none;
}

/* Panel styles */
.panel {
  background: rgba(30, 30, 46, 0.95);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  min-width: 240px;
  position: relative;
}

.panel.hidden {
  display: none;
}

.panel h3 {
  color: #f1f5f9;
  font-size: 14px;
  margin-bottom: 8px;
}

.panel ul {
  list-style: none;
}

.panel li {
  color: #9ca3af;
  padding: 4px 0;
  line-height: 1.4;
}

.panel li strong {
  color: #f1f5f9;
  font-weight: 500;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid #555;
  border-radius: 4px;
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #444;
  color: #fff;
  border-color: #666;
}

/* Button styles */
.buttons {
  display: flex;
  gap: 8px;
}

.buttons.hidden {
  display: none;
}

.buttons button {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #444;
  background: rgba(30, 30, 46, 0.95);
  color: #f1f5f9;
}

.buttons button:hover {
  background: rgba(50, 50, 66, 0.95);
}

.buttons button.active {
  background: #6366f1;
  border-color: #6366f1;
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
