:root {
  --bg: #08111f;
  --card: rgba(12, 20, 36, 0.92);
  --ink: #e8edf5;
  --muted: #94a3b8;
  --glow: #ffe14d;
  --accent: #5aa9ff;
  --line: #22314d;
  font-family: "Inter", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 17px; line-height: 1.55; }
a { color: var(--accent); }

#map { position: fixed; inset: 0; }

.bar {
  position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 5;
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: linear-gradient(#08111fee, #08111f00);
  pointer-events: none;
}
.bar a, .bar span { pointer-events: auto; }
.home { color: var(--muted); text-decoration: none; font-size: 14px; }
.home:hover { color: var(--ink); }
.bar-title { font-size: 14px; color: var(--muted); }

/* ---------- cards */
#steps { position: relative; z-index: 2; width: min(440px, 40vw); margin-left: 28px; padding: 40vh 0 30vh; pointer-events: none; }
.step {
  pointer-events: auto;
  margin: 0 0 75vh; padding: 22px 24px 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  opacity: .35; transition: opacity .5s;
  backdrop-filter: blur(6px);
}
.step.active { opacity: 1; }
.step-intro { margin-top: -18vh; }
.step h1 { font-size: 32px; line-height: 1.15; margin: 4px 0 10px; letter-spacing: -0.01em; }
.step h2 { font-size: 22px; line-height: 1.25; margin: 2px 0 10px; }
.kicker { text-transform: uppercase; letter-spacing: .09em; font-size: 12px; color: var(--glow); margin: 0; font-weight: 600; }
.question { font-size: 20px; color: #fff; font-style: italic; margin: 0 0 12px; }
.body p { margin: 0 0 12px; }
.body strong { color: #fff; }
.look { font-size: 15px; color: #cbd5e1; border-left: 3px solid var(--glow); padding: 4px 0 4px 12px; margin: 14px 0 0; }
.look span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--glow); }
.scroll-hint { color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.step-credit { opacity: 1; font-size: 13px; color: var(--muted); margin-bottom: 30vh; }
.step-credit h3 { color: var(--ink); font-size: 15px; margin: 0 0 6px; }
.step-explore { margin-bottom: 40vh; }

.key { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin: 0 4px 2px 0; }
.key.dash { background: repeating-linear-gradient(90deg, currentColor 0 5px, transparent 5px 9px) !important; height: 3px; }

.toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.toggles button, #explore button {
  font: inherit; font-size: 14px; color: var(--ink); background: #16233b; border: 1px solid #2c3f63;
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.toggles button[aria-pressed="true"] { background: var(--glow); color: #111; border-color: var(--glow); }
.toggles button:focus-visible, #explore button:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }

.widget { margin-top: 14px; }
.widget input[type=range] { width: 100%; }
.widget .readout { font-size: 14px; color: #cbd5e1; margin-top: 6px; }

/* ---------- explore panel */
#explore {
  position: fixed; z-index: 4; right: 16px; top: 56px; width: 300px; max-height: calc(100vh - 80px); overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; font-size: 14px;
}
#explore h3 { margin: 0 0 6px; font-size: 17px; }
#explore .hint { color: var(--muted); margin: 0 0 10px; }
#explore fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 8px 12px 10px; }
#explore legend { color: var(--glow); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding: 0 4px; }
#explore label { display: block; margin: 4px 0; cursor: pointer; }
#explore .row { margin: 8px 0; }
#explore input[type=range] { width: 100%; }
.tl-label { margin: 6px 0 0; color: #cbd5e1; min-height: 3.2em; }
.tl-label b { color: #fff; font-size: 16px; margin-right: 4px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend p { margin: 4px 0; }
.legend summary { cursor: pointer; color: var(--muted); }
#quiz-out.right { color: #8be36b; }
#quiz-out.wrong { color: #ffb4a2; }

/* ---------- popups */
.info-pop .maplibregl-popup-content { background: #0f1a2e; color: var(--ink); border: 1px solid #2c3f63; border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.info-pop .maplibregl-popup-tip { border-top-color: #0f1a2e !important; border-bottom-color: #0f1a2e !important; }
.info-pop h3 { margin: 0 0 6px; font-size: 15px; color: #fff; }
.info-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 8px; }
.info-pop dt { color: var(--muted); }
.info-pop dd { margin: 0; }
.info-pop p { margin: 0; }
.maplibregl-popup-close-button { color: #94a3b8; font-size: 18px; }
.maplibregl-ctrl-attrib { background: rgba(8,17,31,.7) !important; color: #64748b; font-size: 11px; }
.maplibregl-ctrl-attrib a { color: #94a3b8; }
.maplibregl-ctrl-group { background: #0f1a2e; }
.maplibregl-ctrl-group button span { filter: invert(.85); }

.err { padding: 40px; }

body.exploring #steps .step:not(.step-explore):not(.step-credit) { opacity: .15; }

@media (max-width: 799px) {
  body { font-size: 16px; }
  #steps { width: auto; margin: 0 10px; padding-top: 55vh; }
  .step { margin-bottom: 70vh; padding: 16px 18px; }
  .step-intro { margin-top: 0; }
  .step h1 { font-size: 26px; }
  #explore { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; max-height: 45vh; }
}
@media (prefers-reduced-motion: reduce) { .step { transition: none; } }
