:root {
  --bg: #0f1311;
  --panel: #171c19;
  --panel2: #1f2622;
  --ink: #e7ece8;
  --muted: #9bb0a4;
  --accent: #3fae6a;
  --line: #2b332e;
  --header-h: 56px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 132px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 18px;
  padding: 0 18px; height: var(--header-h);
  background: #131816ee; backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-link { color: var(--ink); font-weight: 700; font-size: 15px; }
.brand-link:hover { text-decoration: none; }
.brand-sub { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--muted); padding: 7px 11px; border-radius: 7px; font-weight: 600; font-size: 13px;
}
.nav a:hover { color: var(--ink); background: var(--panel2); text-decoration: none; }
.nav a.active { color: #fff; background: var(--accent); }
.langswitch a {
  border: 1px solid var(--line); padding: 6px 10px; border-radius: 7px;
  color: var(--ink); font-weight: 700; font-size: 12px;
}
.langswitch a:hover { background: var(--panel2); text-decoration: none; }

/* ---------- filter bar (sticky under header) ---------- */
.filterbar {
  position: sticky; top: var(--header-h); z-index: 90;
  background: #11161490; backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 8px 16px;
}
.filterbar-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 7px;
}
.filter-hint { color: var(--muted); font-size: 12.5px; }
.filter-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 12.5px;
}
.btn:hover { border-color: var(--accent); }
.opacity-ctl { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line);
  padding: 4px 9px; border-radius: 14px; cursor: pointer;
  color: var(--ink); font-size: 12.5px; font-weight: 600;
}
.chip .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; }
.chip:hover { border-color: var(--c); }
.chip.off { opacity: 0.4; }
.chip.off .sw { background: transparent; border: 1px solid var(--muted); }
.chip-link { text-decoration: none; }
.chip-link:hover { text-decoration: none; }

/* ---------- content ---------- */
.content { padding: 22px 18px 60px; }
.prose { max-width: 900px; margin: 0 auto; }
.prose.narrow { max-width: 900px; margin: 0 auto 8px; }
.prose h1 { font-size: 26px; margin: 6px 0 12px; }
.prose h2 { font-size: 19px; margin: 26px 0 8px; }
.lead { font-size: 17px; color: var(--ink); }
.step p, .prose p { color: #d3ddd6; }
.step { border-left: 3px solid var(--accent); padding-left: 16px; margin: 18px 0; }
.confident .named-list { list-style: none; padding: 0; margin: 10px 0 0; }
.confident .named-list li { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.confident .named-list li:last-child { border-bottom: 0; }
.confident .named-list i { color: var(--accent); }

.explore { margin-top: 30px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; color: var(--ink);
}
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); transition: .15s; }
.card h3 { margin: 0 0 6px; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; }

.footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 22px; border-top: 1px solid var(--line);
}

/* ---------- maps (overview + closeup) ---------- */
.route-block { max-width: 1400px; margin: 0 auto 34px; }
.route-block h2 { font-size: 18px; margin: 20px 0 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.route-block h2 small { color: var(--muted); font-weight: 400; font-size: 13px; }

.map-stack { position: relative; line-height: 0; background: #000; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; }
.map-base { width: 100%; height: auto; display: block; }
.map-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-overlay polygon { stroke: none; }
/* click an image to show/hide its crown overlay */
.map-stack.ov-off .map-overlay { display: none; }
/* both pages: crown fill opacity follows the opacity slider */
.map-overlay.fill polygon { fill-opacity: var(--ov-op, 0.62); }
.tile-overlay polygon { fill-opacity: var(--ov-op, 0.65); stroke: #000; stroke-opacity: .25; stroke-width: 2; }

.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 640px) { .tile-grid { grid-template-columns: 1fr; } }
.tile { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }

/* ---------- species page ---------- */
.part-head { margin: 26px auto 6px; }
.part-head h2 { font-size: 21px; margin: 0 0 4px; border-bottom: 2px solid var(--accent); padding-bottom: 6px; display: inline-block; }
.part-head p { color: var(--muted); margin: 8px 0 0; }
.part-head-muted h2 { border-bottom-color: var(--line); color: var(--muted); }
.group-block { max-width: 1200px; margin: 0 auto 30px; padding-top: 8px; }
.group-head { font-size: 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.group-dot { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.group-name { color: var(--muted); font-weight: 500; font-size: 17px; }
.group-name i { color: var(--accent); }
.group-body { margin-top: 14px; }
.group-images { margin-top: 22px; }
.group-images h3, .group-naming h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 10px; }
.img-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 560px) { .img-grid { grid-template-columns: 1fr; } }
.img-grid img { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--line); }

.summary { color: #d3ddd6; background: var(--panel); padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.unnamed { color: var(--muted); font-style: italic; margin: 0 0 8px; }
.candidates { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (max-width: 560px) { .candidates { grid-template-columns: 1fr; } }
.cand { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.cand-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cand-name { font-weight: 700; }
.cand-name i { color: var(--accent); font-weight: 500; }
.cand-prob { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.bar { width: 64px; height: 7px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.reasons { margin: 7px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.8px; }
.reasons li { margin: 2px 0; }
.pending { color: var(--muted); font-style: italic; }

/* ---------- login / access page ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px; width: 100%; max-width: 360px; text-align: center; }
.login-card h1 { font-size: 22px; margin: 0 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.login-card input { width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); font-size: 15px; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button { width: 100%; margin-top: 14px; padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; }
.login-card button:hover { filter: brightness(1.08); }
.login-err { color: #ff6b6b !important; margin: 12px 0 0 !important; font-size: 13px; }
