:root {
  --bg: #f5f6f8; --card: #ffffff; --ink: #1a2230; --muted: #5b6572;
  --line: #dde2e8; --accent: #2b6e4f; --warn: #a15c00; --bad: #a33;
  --chip: #eef1f4; --hill: #2b6e4f; --half: #3d6ea1; --chill: #7a4fbf; --travel: #8a8f98;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161c; --card: #1a222b; --ink: #e8ecf1; --muted: #9aa6b2;
    --line: #2a3540; --accent: #6fc39a; --warn: #e0a94f; --bad: #e07a7a;
    --chip: #232e39; --hill: #6fc39a; --half: #7fb0e0; --chill: #b48ce8; --travel: #8a919b;
  }
}
* { box-sizing: border-box; margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
header { position: sticky; top: 0; z-index: 1000; background: var(--bg); border-bottom: 1px solid var(--line); padding: .6rem .9rem 0; }
h1 { font-size: 1.15rem; }
h1 .sub { font-size: .75rem; color: var(--muted); font-weight: 400; margin-left: .4rem; }
#tabs { display: flex; gap: .25rem; margin-top: .5rem; overflow-x: auto; }
#tabs button { flex: 0 0 auto; border: 0; background: none; color: var(--muted); padding: .45rem .7rem; font-size: .9rem; border-bottom: 2px solid transparent; cursor: pointer; }
#tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
main { padding: .9rem; max-width: 900px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }

.titlerow { display: flex; align-items: baseline; gap: .6rem; }
.titlerow h1 { flex: 1 1 auto; min-width: 0; }
#splitbtn { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; cursor: pointer; }
#splitbtn.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---- split layout: map beside the active panel ---- */
#panes { display: flex; gap: .9rem; align-items: flex-start; }
#content { flex: 1 1 auto; min-width: 0; }
#sidemap { display: none; }
#mapbox { display: none; }
#mapbox.live { display: block; }
#map { height: calc(100vh - 165px); min-height: 360px; border-radius: 10px; }

body.split main { max-width: 1500px; }
body.split #sidemap { display: block; flex: 0 0 46%; position: sticky; top: 108px; }
body.split #map { height: calc(100vh - 130px); }

@media (max-width: 900px) {
  body.split #panes { flex-direction: column-reverse; }
  body.split #sidemap { flex: 0 0 auto; width: 100%; position: static; }
  body.split #map { height: 45vh; min-height: 260px; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; margin-bottom: .8rem; }
.card h2 { font-size: 1.02rem; margin-bottom: .15rem; }
.card h3 { font-size: .92rem; margin: .6rem 0 .2rem; }
.meta { color: var(--muted); font-size: .82rem; margin-bottom: .4rem; }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: .05rem .55rem; font-size: .75rem; margin: 0 .3rem .2rem 0; }
.chip.munro { color: var(--accent); font-weight: 600; }
.chip.corbett { color: var(--warn); font-weight: 600; }
.chip.walk { color: var(--muted); }
.chip.verified { color: var(--accent); }
.chip.estimate { color: var(--warn); }
.chip.bog1, .chip.bog2 { color: var(--accent); }
.chip.bog3 { color: var(--warn); }
.chip.bog4, .chip.bog5 { color: var(--bad); font-weight: 600; }
.note { font-size: .86rem; margin: .25rem 0; }
.note b { font-weight: 600; }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.good { color: var(--accent); }
a { color: var(--accent); }

.headline li { margin: .35rem 0 .35rem 1.1rem; font-size: .9rem; }

table { border-collapse: collapse; width: 100%; font-size: .84rem; }
.tablewrap { overflow-x: auto; }
th, td { padding: .35rem .45rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; }
th.sorted { color: var(--accent); }
tr.clickable { cursor: pointer; }
.rankbar { display: inline-block; height: 8px; border-radius: 4px; background: var(--accent); vertical-align: middle; margin-right: .35rem; }
.ranknum { color: var(--muted); font-size: .78rem; }

.kind { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .35rem; vertical-align: baseline; }
.kind.hill { background: var(--hill); }
.kind.half { background: var(--half); }
.kind.chill { background: var(--chill); }
.kind.travel { background: var(--travel); }

.legend { font-size: .8rem; color: var(--muted); margin-top: .4rem; }

/* ---- wizard ---- */
.wizrow { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wizrow:last-child { border-bottom: 0; }
.wizday { flex: 0 0 5.2rem; font-weight: 600; font-size: .88rem; padding-top: .3rem; }
.wizpick { flex: 1 1 260px; min-width: 0; }
.wizpick select { width: 100%; padding: .35rem .4rem; font: inherit; font-size: .84rem;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.wizinfo { flex: 1 1 100%; font-size: .8rem; color: var(--muted); padding-left: 5.8rem; }
.wizinfo.none { display: none; }
.totals { display: flex; gap: 1.1rem; flex-wrap: wrap; margin: .3rem 0 .1rem; }
.tot { font-size: .8rem; color: var(--muted); }
.tot b { display: block; font-size: 1.25rem; color: var(--ink); font-weight: 700; line-height: 1.2; }
.tot.bad b { color: var(--bad); }
.tot.good b { color: var(--accent); }
.wizbtns { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; align-items: center; }
.wizbtns button, .wizbtns select { border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: .25rem .8rem; font-size: .82rem; cursor: pointer; }
.flag { font-size: .84rem; margin: .2rem 0; padding-left: 1.1rem; text-indent: -1.1rem; }
.flag.ok::before { content: "✓ "; color: var(--accent); }
.flag.warn::before { content: "! "; color: var(--warn); font-weight: 700; }

.bearrow { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.bearrow > div:not(.bearbox) { min-width: 200px; flex: 1 1 200px; }
.bear { width: 96px; height: 96px; flex: 0 0 auto; display: block; margin: 0 auto; }
.bear.sm { width: 72px; height: 72px; }
.bearcap { font-size: .78rem; color: var(--muted); font-style: italic; text-align: center; margin-top: .1rem; max-width: 120px; }
.bearbox { flex: 0 0 auto; }
@media (max-width: 480px) {
  .bear { width: 72px; height: 72px; }
  .bear.sm { width: 56px; height: 56px; }
  .bearcap { font-size: .7rem; max-width: 96px; }
}
.chosen { border: 2px solid var(--accent); }
.chosen h2 { color: var(--accent); }
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0; }
.filters button { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; cursor: pointer; }
.filters button.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
