:root {
  --bg: #0b0f14;
  --panel: rgba(18, 24, 32, 0.88);
  --border: #223041;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --accent: #38bdf8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

#canvas-host { position: fixed; inset: 0; }
#canvas-host canvas { display: block; }

.panel {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
}

#controls { top: 16px; left: 16px; width: 268px; }

#controls h1 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
#controls h1 span { color: var(--accent); }

label {
  display: block;
  margin: 10px 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

select, button {
  width: 100%;
  padding: 7px 9px;
  background: #0f1720;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}

button { cursor: pointer; }
button:hover { border-color: var(--accent); }

.seg { display: flex; gap: 6px; }
.seg button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #06121c;
  font-weight: 600;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.row input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.row input[type="range"] { flex: 1; accent-color: var(--accent); }

#stats {
  bottom: 16px;
  left: 16px;
  min-width: 268px;
  font-variant-numeric: tabular-nums;
}
#stats .kv { display: flex; justify-content: space-between; gap: 16px; }
#stats .kv span:first-child { color: var(--muted); }

#legend { bottom: 16px; right: 16px; width: 190px; }
#legend .bar {
  height: 12px;
  border-radius: 6px;
  margin: 6px 0 4px;
  background: linear-gradient(90deg,
    rgb(239,68,68) 0%, rgb(249,115,22) 20%,
    rgb(250,204,21) 42%, rgb(163,230,53) 67%, rgb(34,197,94) 100%);
}
#legend .ends {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

#status {
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 8px 12px;
}
#dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.18);
}
#dot.on  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
#dot.err { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
