:root {
  /* Complementary pastels (blue ~255deg / apricot ~65deg on the OKLCH wheel).
     Kept in sync with COLORS in schelling.js — the canvas can't read CSS vars.
     Steps chosen so all three cell states stay >=17 OKLab dE apart in normal
     vision and >=15 under simulated protanopia/deuteranopia; empty is pure
     white, which is what holds the two pastels apart from the vacant cells. */
  --blue: #9dc0ee;
  --orange: #f2bd84;
  --empty: #ffffff;
  --bg: #fafafa;
  --panel: #ffffff;
  --ink: #222;
  --muted: #666;
  --line: #e2e2e2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
}

.intro {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 24px;
}

.layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.board {
  flex: 1 1 500px;
  min-width: 300px;
}

canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  image-rendering: pixelated;
  background: var(--empty);
}

.stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--muted);
}

.stats strong { color: var(--ink); }

.hint {
  margin: 10px 0 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.85rem;
}

.panel {
  flex: 1 1 280px;
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.control { margin-bottom: 18px; }

.control label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.control small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

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

.buttons {
  display: flex;
  gap: 8px;
  margin: 22px 0 18px;
}

button {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover { background: #f4f4f4; }

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--ink); /* ink, not white: white on pastel blue is 1.9:1 */
}

button.primary:hover { background: #8ab3e8; }

footer {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
