:root {
  /* --accent and --wash are re-set per biome from panel.js */
  --accent: #4a7a3a;
  --wash: #9db3a8;
  --panel-bg: rgba(18, 22, 20, 0.82);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8ede9;
  --text-dim: #9aa79f;
  --panel-w: 330px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1210;
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: #0d1210;
  z-index: 20;
}

/* --- Panel ---------------------------------------------------------------- */

#panel {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--panel-w);
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 18px 40px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--panel-border);
  z-index: 10;
  transition: transform 0.28s ease;
}

body.panel-collapsed #panel,
body.walk-mode #panel {
  transform: translateX(calc(-1 * var(--panel-w) - 4px));
}

.panel-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel-header .sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.panel-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
}

.panel-section h2 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* --- Biome buttons -------------------------------------------------------- */

#biome-buttons {
  display: grid;
  gap: 6px;
}

.biome-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.biome-btn:hover { background: rgba(255, 255, 255, 0.075); }

.biome-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.biome-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
}

.biome-blurb {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-dim);
}

/* --- Parameters ----------------------------------------------------------- */

.param { margin-bottom: 15px; }

.param-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.param-head label {
  font-size: 12.5px;
  font-weight: 500;
}

.param-head output {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  filter: brightness(1.5);
  font-weight: 600;
}

.param-hint {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--text-dim);
  opacity: 0.72;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

/* --- Readouts ------------------------------------------------------------- */

.readouts {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.readouts > div {
  padding: 7px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.readouts dt {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.readouts dd {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- Species -------------------------------------------------------------- */

#species-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
}

.species {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  transition: opacity 0.3s ease, background 0.3s ease;
  /* --suit is the habitat suitability, written per-row by panel.js */
  opacity: calc(0.28 + 0.72 * var(--suit, 1));
}

.species.absent {
  opacity: 0.24;
  filter: grayscale(1);
}

.species svg {
  width: 19px;
  height: 19px;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: brightness(1.5);
}

.species-name {
  flex: 1;
  font-size: 12px;
}

.species-count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.note {
  margin: 9px 0 0;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-dim);
}

kbd {
  display: inline-block;
  padding: 1px 4px;
  margin: 0 1px;
  border-radius: 3px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.07);
  font: 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- Mode toggle ---------------------------------------------------------- */

#mode-toggle {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text);
  font: 600 13px/1 inherit;
  cursor: pointer;
  transition: background 0.16s ease;
}

#mode-toggle:hover {
  background: color-mix(in srgb, var(--accent) 48%, transparent);
}

/* --- Panel collapse handle ------------------------------------------------ */

#panel-toggle {
  position: fixed;
  top: 14px;
  left: calc(var(--panel-w) + 14px);
  width: 34px;
  height: 34px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  cursor: pointer;
  z-index: 11;
  transition: left 0.28s ease;
}

#panel-toggle span {
  display: block;
  width: 15px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
}

body.panel-collapsed #panel-toggle,
body.walk-mode #panel-toggle {
  left: 14px;
}

/* --- Walk mode HUD -------------------------------------------------------- */

#walk-hint {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%) translateY(10px);
  display: grid;
  gap: 3px;
  justify-items: center;
  padding: 11px 20px;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: rgba(18, 22, 20, 0.86);
  backdrop-filter: blur(10px);
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 12;
}

#walk-hint strong {
  color: var(--text);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#walk-hint.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 12;
}

body.walk-mode #crosshair { opacity: 1; }

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0d1210;
  color: var(--text);
  z-index: 40;
}

/* --- Narrow viewports ----------------------------------------------------- */

@media (max-width: 720px) {
  :root { --panel-w: 86vw; }

  #panel {
    padding-top: 56px;
  }
}
