:root {
  --bg: #0b1020;
  --panel: #131a2e;
  --panel-border: #253052;
  --text: #e6ebff;
  --muted: #9aa5c9;
  --accent: #7fb3ff;
  --accent-strong: #a8ccff;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
}

header {
  padding: 1rem 1.25rem 0.5rem;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  align-items: start;
  gap: 1rem;
  padding: 0.5rem 1.25rem 1.25rem;
}

.controls {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.control-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.control-row output {
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font: inherit;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.button-row {
  flex-direction: row;
  gap: 0.5rem;
}

button {
  flex: 1;
  background: var(--accent);
  color: #08122b;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button[aria-pressed="true"] {
  background: var(--panel-border);
  color: var(--text);
}

button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

kbd {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 0 0.3em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
}

.stage {
  position: relative;
  height: calc(100vh - 8rem);
  min-height: 360px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.status {
  position: absolute;
  left: 0.75rem;
  bottom: 0.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

@media (max-width: 760px) {
  main {
    grid-template-columns: 1fr;
  }

  /* On phones the flock is the point of the page, so it comes first. */
  .stage {
    order: -1;
    min-height: 320px;
    height: 60vh;
  }
}
