:root {
  color-scheme: dark;
  --bg: #0e1117;
  --panel: #161b22;
  --border: #2a2f3a;
  --text: #e6e6e6;
  --muted: #8b93a1;
  --accent: #6ea8fe;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#layout {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: 300px;
  flex-shrink: 0;
  padding: 20px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

#sidebar h1 {
  font-size: 1.1rem;
  margin: 0 0 4px;
}

#sidebar .subtitle {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 20px;
}

.field {
  margin-bottom: 18px;
}

.field label.field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

select, input[type="range"] {
  width: 100%;
}

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 0.9rem;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.control-value {
  min-width: 3.5em;
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 6px 0 0;
}

button {
  width: 100%;
  padding: 8px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
button:hover { border-color: var(--accent); }

#stats {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.8;
}
#stats b { color: var(--text); font-weight: 500; }

#status {
  margin-top: 12px;
  font-size: 0.78rem;
  color: #ff8080;
  white-space: pre-wrap;
}

#hint {
  margin-top: 24px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
}

#canvas-wrap {
  flex: 1;
  position: relative;
}

#canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#canvas.dragging { cursor: grabbing; }
