:root {
  --bg: #f6f4ef; --surface: #ffffff; --ink: #1d2420; --muted: #5d6a62; --line: #dfe3dd;
  --primary: #1b5e3b; --primary-ink: #ffffff; --accent: #c76b00; --warn: #b3261e;
  --radius: 16px; --shadow: 0 6px 24px rgba(0,0,0,.16);
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121714; --surface: #1c231f; --ink: #e8ece9; --muted: #a3b0a8; --line: #2e3833; --primary: #7fd3a4; --primary-ink: #0b2417; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
.hidden { display: none !important; }
.small { font-size: 13px; color: var(--muted); line-height: 1.45; }
a { color: var(--primary); }
.kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.btn { display: block; width: 100%; padding: 14px 18px; margin: 10px 0; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 500; cursor: pointer; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border: 0; font-size: 17px; padding: 16px; }
.btn.danger { color: var(--warn); }
.row { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 15px; }
.row.gap .btn { margin: 0; }
input[type=range] { width: 100%; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }

/* intro */
#intro { min-height: 100%; display: flex; flex-direction: column; }
.intro-img { height: 34vh; min-height: 200px; background-size: cover; background-position: center 40%; filter: grayscale(.2); }
.intro-body { padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; width: 100%; }
.intro-body h1 { font-size: 28px; line-height: 1.15; margin: 4px 0 10px; font-weight: 600; }
.intro-body p { line-height: 1.5; }
.facts { display: flex; gap: 8px; padding: 0; list-style: none; margin: 14px 0; flex-wrap: wrap; }
.facts li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
#sim-opts { background: var(--surface); border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); }

/* run */
#run { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; }
#hud { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; z-index: 500; display: flex; gap: 6px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 6px 6px 12px; align-items: center; }
.hud-cell { flex: 1; display: flex; flex-direction: column; }
.hud-cell span { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hud-cell small { font-size: 11px; color: var(--muted); }
.icon-btn { border: 0; background: transparent; color: var(--ink); font-size: 22px; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; }
.icon-btn.big { background: var(--primary); color: var(--primary-ink); width: 52px; height: 52px; font-size: 20px; flex: none; }
.nav-banner { position: absolute; top: calc(76px + env(safe-area-inset-top)); left: 8px; right: 8px; z-index: 500; display: flex; gap: 12px; align-items: center;
  background: var(--primary); color: var(--primary-ink); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); font-size: 18px; font-weight: 500; }
.nav-banner.warn { background: var(--warn); color: #fff; }
#nav-arrow { font-size: 30px; line-height: 1; width: 32px; text-align: center; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 600; background: var(--surface); border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 24px rgba(0,0,0,.18); padding: 6px 16px calc(14px + env(safe-area-inset-bottom)); max-height: 72vh; overflow-y: auto; transition: max-height .25s; }
.sheet.collapsed { max-height: 118px; overflow: hidden; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 8px; cursor: pointer; }
#story-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; }
#story-head h2 { margin: 0; font-size: 19px; line-height: 1.2; }
#s-progress { height: 4px; background: var(--line); border-radius: 2px; margin: 10px 0; overflow: hidden; }
#s-bar { height: 100%; width: 0; background: var(--accent); }
.photos { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.photos figure { margin: 0; flex: 0 0 78%; scroll-snap-align: start; cursor: zoom-in; }
.photos img { width: 100%; height: 190px; object-fit: cover; border-radius: 12px; background: var(--line); display: block; }
.photos figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.story-text { line-height: 1.55; font-size: 16px; }
#sim-bar { position: absolute; z-index: 550; right: 8px; bottom: 130px; display: flex; gap: 6px; align-items: center; background: var(--surface);
  border-radius: 999px; padding: 4px 6px 4px 12px; box-shadow: var(--shadow); font-size: 12px; font-weight: 700; color: var(--accent); }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 10px; font-size: 13px; }

/* modals */
.modal { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal-card { background: var(--surface); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
.modal-card h3 { margin-top: 0; }
#poi-list { padding-left: 22px; }
#poi-list li { margin: 8px 0; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font-size: 16px; text-align: left; cursor: pointer; }
#credits ul { padding-left: 18px; font-size: 13px; line-height: 1.5; }
#lightbox { position: fixed; inset: 0; z-index: 1000; background: #000; display: flex; flex-direction: column; justify-content: center; }
#lightbox img { max-width: 100%; max-height: 82vh; object-fit: contain; }
#lightbox p { color: #ddd; padding: 10px 16px; font-size: 14px; }
.poi-ic { background: var(--accent); color: #fff; border: 2px solid #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font: 700 13px/1 Roboto, system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.leaflet-control-attribution { font-size: 10px; }
