:root {
  --bg-dark: #0f172a;
  --panel-bg: rgba(15, 23, 42, 0.7);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --success: #10b981;
}

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

body, html {
  font-family: 'Inter', sans-serif;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#ui-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10;
  pointer-events: none; /* Let clicks pass through to canvas by default */
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 16px;
}

.panel {
  pointer-events: auto; /* Catch clicks for UI elements */
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.header-panel {
  max-width: 400px;
}

.header-panel h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-panel p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.controls-panel {
  max-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls-panel h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

button.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.tool-btn {
  border-color: rgba(56, 189, 248, 0.3);
}

.tool-btn:hover {
  background: var(--accent);
  color: #fff;
}

.divider {
  height: 1px;
  background: var(--panel-border);
  margin: 4px 0;
}

.toast {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--success);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Three.js Loading State */
#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-main);
  font-size: 1.2rem;
  font-weight: 600;
  transition: opacity 0.5s;
}
