:root {
  --bg: #05070d;
  --panel: rgba(10, 14, 28, 0.78);
  --border: rgba(120, 180, 255, 0.18);
  --text: #d8e6ff;
  --accent: #6fb4ff;
  --muted: #8aa0c6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: grab;
  /* the canvas handles drag and pinch itself: keep the browser from
     scrolling / page-zooming on touch */
  touch-action: none;
}
#gl:active { cursor: grabbing; }

#notice {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 20;
}
#notice.fatal {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  border-color: rgba(255, 140, 120, 0.45);
}
#notice pre {
  margin: 8px 0 0;
  max-height: 40vh;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: #ffb9a8;
}
#notice code { color: var(--accent); }

#panel {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 260px;
  max-height: calc(100vh - 32px);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 10;
}
#panel.collapsed #controls { display: none; }
#panel.collapsed { width: auto; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
header h1 {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
  color: var(--accent);
  font-weight: 600;
}
#panel.collapsed header { margin-bottom: 0; }
#panel.collapsed header h1 { display: none; }

button, select {
  background: rgba(30, 50, 90, 0.55);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover, select:hover { background: rgba(60, 100, 170, 0.55); }

#controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
label span {
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #1a3a70, #4a90e2);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffd27a;
  border: 2px solid #0a1428;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(255, 210, 122, 0.6);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffd27a;
  border: 2px solid #0a1428;
  cursor: pointer;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.row button {
  flex: 1 1 auto;
  min-width: 54px;
  padding: 6px 6px;
}

.hint {
  font-size: 10px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.5;
  opacity: 0.8;
}

select {
  width: 100%;
}
