:root {
  --bg: #0a0c10;
  --panel: #12161e;
  --text: #d8dce4;
  --muted: #6a7280;
  --accent: #5a8a70;
  --pred: #c05040;
  --prey: #50a860;
  --border: #2a3040;
  --btn: #1a2030;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #e4e8ec;
    --panel: #f4f6f8;
    --text: #1a2030;
    --muted: #5a6470;
    --accent: #2a6a48;
    --pred: #a03028;
    --prey: #288038;
    --border: #c8d0d8;
    --btn: #e8ecf0;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
}

#app {
  display: grid;
  grid-template-columns: 1fr 240px;
  height: 100%;
  min-height: 100vh;
}

#stage {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

#c {
  display: block;
  width: 100%;
  height: 100%;
}

#fps {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(10, 12, 16, 0.75);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  z-index: 5;
  pointer-events: none;
}

#agent-count {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(10, 12, 16, 0.75);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  z-index: 5;
  pointer-events: none;
}

#sidebar {
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

#sidebar h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.03em;
}

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

#sidebar button {
  background: var(--btn);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

#sidebar button:hover,
#sidebar button:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#btn-prey { border-left: 3px solid var(--prey); }
#btn-pred { border-left: 3px solid var(--pred); }

.slider-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#speed {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.note {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding-top: 16px;
}

@media (max-width: 700px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  #sidebar {
    border-left: none;
    border-top: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .note { display: none; }
}

@media (prefers-color-scheme: light) {
  #fps, #agent-count {
    background: rgba(255, 255, 255, 0.85);
  }
}
