/* Petri Dish — theme tokens.
   Dark is the default palette; the light block below overrides it.
   The *-rgb variables are consumed by the canvas renderer, so canvas
   colours and page colours stay in one place. */

:root {
  color-scheme: dark light;

  --bg: #0a0e11;
  --panel: #111922;
  --panel-2: #161f29;
  --ink: #dde6ea;
  --muted: #8496a1;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --focus: #7fd2ff;

  --prey: #69aa7d;
  --pred: #c98a5a;
  --prey-rgb: 105, 170, 125;
  --pred-rgb: 201, 138, 90;

  --dish-inner-rgb: 26, 38, 42;
  --dish-outer-rgb: 10, 17, 20;
  --dish-speckle-rgb: 150, 190, 185;
  --dish-edge-rgb: 0, 0, 0;
  --dish-border: rgba(190, 214, 214, 0.34);
  --dish-glow: rgba(120, 190, 190, 0.06);

  --food-rgb: 226, 234, 236;

  --hud-ink: rgba(216, 230, 232, 0.72);
  --hud-dim: rgba(216, 230, 232, 0.42);
  --hud-bg: rgba(8, 13, 16, 0.55);

  --chart-bg: rgba(7, 12, 15, 0.86);
  --chart-border: rgba(255, 255, 255, 0.14);
  --chart-grid: rgba(255, 255, 255, 0.07);
  --chart-prey: #2fe07a;
  --chart-pred: #ff4d4d;
  --chart-prey-rgb: 47, 224, 122;
  --chart-pred-rgb: 255, 77, 77;

  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1ef;
    --panel: #ffffff;
    --panel-2: #f4f7f5;
    --ink: #16211d;
    --muted: #5d6f68;
    --line: rgba(20, 40, 34, 0.12);
    --line-strong: rgba(20, 40, 34, 0.24);
    --focus: #0b64c0;

    --prey: #3d7a52;
    --pred: #a4642d;
    --prey-rgb: 61, 122, 82;
    --pred-rgb: 164, 100, 45;

    --dish-inner-rgb: 247, 250, 247;
    --dish-outer-rgb: 214, 226, 219;
    --dish-speckle-rgb: 90, 118, 108;
    --dish-edge-rgb: 60, 84, 76;
    --dish-border: rgba(40, 70, 60, 0.32);
    --dish-glow: rgba(40, 80, 70, 0.08);

    --food-rgb: 74, 88, 84;

    --hud-ink: rgba(20, 34, 30, 0.78);
    --hud-dim: rgba(20, 34, 30, 0.5);
    --hud-bg: rgba(255, 255, 255, 0.55);

    --chart-bg: rgba(16, 24, 22, 0.9);
    --chart-border: rgba(255, 255, 255, 0.16);
    --chart-grid: rgba(255, 255, 255, 0.08);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  align-items: stretch;
  height: 100%;
  min-height: 100vh;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.dish-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.sidebar {
  flex: 0 0 268px;
  width: 268px;
  padding: 20px 18px 24px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.tagline {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.panel {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px 13px;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.counts { display: grid; gap: 8px; }

.count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.count-label { flex: 1 1 auto; font-size: 13px; color: var(--muted); }

.count-value {
  font-family: var(--mono);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  transform: translateY(-1px);
}

.dot-prey { background: var(--prey); }
.dot-pred { background: var(--pred); }

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}

.btn-wide { justify-content: center; }

.btn:hover { border-color: var(--focus); }

.btn:active { transform: translateY(1px); }

.btn-sub { color: var(--muted); font-size: 12px; }

.btn-count {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  min-width: 40px;
  text-align: center;
}

#toggle-pause[aria-pressed="true"] {
  border-color: var(--focus);
  color: var(--focus);
}

.field { display: block; }

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field-value {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.slider {
  width: 100%;
  margin: 0;
  accent-color: var(--focus);
  background: transparent;
}

.note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.legend li { display: flex; align-items: center; gap: 8px; }

.legend-value {
  margin-left: auto;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.swatch-prey { background: var(--chart-prey); }
.swatch-pred { background: var(--chart-pred); }

.keys {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.noscript {
  position: absolute;
  inset: auto 0 0 0;
  margin: 0;
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  text-align: center;
}

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .stage { flex: 0 0 auto; height: 62vh; }
  .sidebar {
    flex: 1 1 auto;
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
