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

:root {
  --bg-1: #1a1c22;
  --bg-2: #0c0d11;
  --panel: rgba(22, 24, 30, 0.72);
  --border: rgba(255, 255, 255, 0.10);
  --text: #f2f3f5;
  --muted: #9aa0aa;
  --accent: #2da3c4;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(120% 120% at 50% 0%, var(--bg-1) 0%, var(--bg-2) 70%);
}

#app { position: fixed; inset: 0; }
#scene { display: block; width: 100%; height: 100%; }

/* Loader */
#loader {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: var(--bg-2); z-index: 20;
  transition: opacity .5s ease; color: var(--muted); font-size: 14px;
}
#loader.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.12); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Panel */
#panel {
  position: absolute; top: 20px; left: 20px; width: 260px;
  background: var(--panel); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; z-index: 10;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
#panel h1 { font-size: 16px; font-weight: 600; letter-spacing: .2px; }
.hint { font-size: 11px; color: var(--muted); margin: 6px 0 16px; line-height: 1.5; }

.control { margin-bottom: 16px; }
.control > label {
  display: block; font-size: 12px; color: var(--muted);
  margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center;
}
.control > label span { color: var(--text); font-weight: 500; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  background: rgba(255,255,255,0.14); border-radius: 4px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; box-shadow: 0 0 0 4px rgba(45,163,196,0.18);
}

/* Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0; background: rgba(255,255,255,0.16);
  border-radius: 22px; transition: .2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Swatches */
.swatches { display: flex; gap: 8px; align-items: center; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25);
  cursor: pointer; padding: 0; transition: transform .12s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,163,196,0.25); }
#color-custom {
  width: 26px; height: 26px; border: none; border-radius: 50%; background: none;
  cursor: pointer; padding: 0;
}
#color-custom::-webkit-color-swatch-wrapper { padding: 0; }
#color-custom::-webkit-color-swatch { border: 2px solid rgba(255,255,255,0.25); border-radius: 50%; }

.btn {
  width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255,255,255,0.06); color: var(--text); font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: rgba(255,255,255,0.12); }

@media (max-width: 600px) {
  #panel { width: calc(100% - 40px); top: auto; bottom: 20px; }
}
