:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1d2320;
  --muted: #66706b;
  --line: #dedbd2;
  --accent: #2f5d50;
  --sev0: #2e7d4f;
  --sev1: #b7791f;
  --sev2: #c2410c;
  --sev3: #b91c1c;
  --c-clear: #3f9b5a;
  --c-wet_mud: #8a6a3b;
  --c-ice: #1fa5b8;
  --c-patchy_snow: #7aa7e0;
  --c-snow: #3266c8;
  --c-deep_snow: #6b3fb5;
  --c-unknown: #8b8f8d;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131615;
    --panel: #1b1f1d;
    --ink: #e6e9e7;
    --muted: #9aa39e;
    --line: #2c3330;
    --accent: #7cc2a8;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent); }
.muted { color: var(--muted); font-weight: 400; font-size: 0.9em; }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h1 .sub { font-size: 0.8rem; color: var(--muted); font-weight: 500; margin-left: 6px; letter-spacing: .02em; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }

.top { padding: 18px 20px 6px; border-bottom: 1px solid var(--line); background: var(--panel); }
.map-link { margin: 0 0 12px; font-size: 0.9rem; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--muted); }
.field em { font-style: normal; opacity: .8; }
.field.grow { flex: 1 1 280px; }
.field input, .field select {
  width: 100%;
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
button {
  font: inherit; font-weight: 600; color: #fff; background: var(--accent);
  border: 0; border-radius: 8px; padding: 9px 16px; min-height: 38px; cursor: pointer;
}
@media (prefers-color-scheme: dark) { button { color: #0d1411; } }
button:disabled { opacity: .55; cursor: progress; }
.search { position: relative; }
.suggest {
  position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px;
  list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 340px; overflow: auto;
}
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--bg); }
.suggest li .muted { margin-left: 6px; }
.tag { font-size: 0.75rem; font-weight: 600; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }

.peak { margin: 16px auto 0; padding: 14px 20px; max-width: 1400px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.peak-head h2 { font-size: 1.25rem; margin: 0; }
.peak-head h2:focus { outline: none; }
.peak-head p { margin: 2px 0 12px; }
.peak-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.peak-map { height: 560px; border-radius: var(--radius); overflow: hidden; }
.peak-list { max-height: 560px; overflow-y: auto; padding: 2px; }
.peak-list h3 { font-size: 0.92rem; margin: 14px 0 4px; }
.peak-list ul { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.peak-list a.active { font-weight: 700; }
.peak-list summary { cursor: pointer; padding: 8px 0; }
.peak-foot { margin: 12px 0 0; }
.routes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.route-card { display: flex; gap: 10px; width: 100%; padding: 10px; text-align: left; font-weight: 400; color: var(--ink); background: var(--bg); border: 2px solid var(--line); }
.route-card:hover, .route-card:focus-visible { border-color: var(--muted); }
.route-card.active { border-color: var(--accent); }
.route-num { flex: none; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 0.85rem; display: grid; place-items: center; }
.route-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 0.9rem; }
.route-body b { font-size: 1rem; }
.route-body .badges { margin: 2px 0; }
.route-use { color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.route-warn { color: var(--sev2); font-size: 0.85rem; }
.th-marker { padding: 1px 7px; border-radius: 999px; background: #1d2320; color: #fff; border: 2px solid #fff; font: 700 11px/1.4 system-ui, sans-serif; }
.summit-marker { color: #1d2320; font-size: 22px; line-height: 1; text-shadow: 0 0 3px #fff, 0 0 3px #fff; pointer-events: none; }
@media (max-width: 800px) {
  .peak { padding: 14px 16px; border-left: 0; border-right: 0; border-radius: 0; }
  .peak-grid { grid-template-columns: minmax(0, 1fr); }
  .peak-map { height: 320px; }
  .peak-list { max-height: none; }
}
.add-hike { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.add-hike > div:first-child { flex: 1 1 100%; }
.add-hike .field { flex: 1 1 140px; }
.add-hike .add-error { flex: 1 1 100%; color: var(--sev3); }
.button-secondary { color: var(--ink); background: var(--bg); border: 1px solid var(--line); }
.secondary { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 0.85rem; color: var(--muted); margin: 10px 0 8px; }
.gpx-label { cursor: pointer; }
.link { color: var(--accent); text-decoration: underline; }
.recent a { margin-right: 8px; }
.route-note { grid-column: 1 / -1; font-size: 0.85rem; background: rgba(0,0,0,.18); border-radius: 8px; padding: 6px 10px; }
.summary a { color: inherit; }

main { padding: 16px 20px 8px; display: flex; flex-direction: column; gap: 16px; max-width: 1400px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }

.summary {
  border-radius: var(--radius); padding: 14px 18px; color: #fff;
  display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: start;
}
.summary .lvl { font-size: 1.5rem; font-weight: 750; line-height: 1.1; }
.summary .meta { font-size: 0.85rem; opacity: .9; margin-top: 4px; }
.summary ul { margin: 0; padding-left: 18px; }
.sev-0 { background: var(--sev0); } .sev-1 { background: var(--sev1); }
.sev-2 { background: var(--sev2); } .sev-3 { background: var(--sev3); }
/* Missing or out-of-date data with no hazard found: never green. */
.summary.incomplete.sev-0 { background: var(--c-unknown); }

.grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
.map { min-height: 520px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.waypoints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 720px; overflow: auto; }

.wp { background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--c-unknown); border-radius: var(--radius); padding: 10px 14px; cursor: pointer; }
.wp.active { outline: 2px solid var(--accent); }
.wp-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.wp-name { font-weight: 650; }
.wp-name .num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 0.72rem; margin-right: 6px; }
.wp-meta { color: var(--muted); font-size: 0.85rem; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.badge { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; color: #fff; }
.badge.outline { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.reasons { margin: 4px 0 6px; padding-left: 18px; }
.reasons li { margin: 2px 0; }
.conflict { color: var(--sev2); }
.gear { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.gear span { font-size: 0.75rem; border: 1px dashed var(--line); border-radius: 6px; padding: 1px 7px; }
details { margin-top: 6px; font-size: 0.86rem; }
details summary { cursor: pointer; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
table.st { border-collapse: collapse; width: 100%; font-size: 0.82rem; margin: 4px 0 8px; }
table.st th, table.st td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line); }
.wp-report { border-left: 3px solid var(--line); padding-left: 8px; margin: 6px 0; }

.chart-wrap { position: relative; height: 320px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }

.reports { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.reports li { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.reports .excerpt { color: var(--muted); font-size: 0.88rem; margin: 4px 0; }
.chip { display: inline-block; font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; color: #fff; margin: 2px 4px 2px 0; }

.sources { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 16px; font-size: 0.88rem; }
.sources .ok::before { content: "●"; color: var(--sev0); margin-right: 6px; }
.sources .bad::before { content: "●"; color: var(--sev3); margin-right: 6px; }

.status { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 0.9rem; max-width: min(92vw, 560px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.status.error { background: var(--sev3); color: #fff; }

.wp-marker { width: 22px; height: 22px; border-radius: 50%; color: #fff; font: 700 11px/22px system-ui; text-align: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: pointer; }
.hover-dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid #111; }

.foot { max-width: 1400px; margin: 8px auto 24px; padding: 0 20px; font-size: 0.82rem; color: var(--muted); }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .map { min-height: 340px; }
  .waypoints { max-height: none; }
  .top, main, .foot { padding-left: 16px; padding-right: 16px; }
  .summary { grid-template-columns: 1fr; }
}
.foot .credit { margin: 6px 0 0; }
