:root {
  --bg: #f3f5f8; --card: #ffffff; --ink: #141a22; --muted: #6b7684; --faint: #9aa3ae; --line: #e6e9ee;
  --soft: #f6f7f9; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --good: #12805c; --good-bg: #e2f5ec; --bad: #d03b3b; --bad-bg: #fde8e8;
  --warn: #a86300; --warn-bg: #fdf1d8; --accent: #2f7d4f; --accent-bg: #e3f3e9; --on-accent: #fff;
  --trail: #c026d3; --sky: #2a78d6; --rain: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --card: #161b22; --ink: #e6edf3; --muted: #8b96a3; --faint: #5d6772; --line: #262d36;
    --soft: #1c222b; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --good: #3fcf8e; --good-bg: #0f2e22; --bad: #ff6b6b; --bad-bg: #3a1618;
    --warn: #f2b84b; --warn-bg: #33270f; --accent: #5cc98a; --accent-bg: #13301f; --on-accent: #0d1117;
    --trail: #e879f9; --sky: #5aa2f0; --rain: #5aa2f0;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 28px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

header { padding: 26px 0 18px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff;
        background: linear-gradient(135deg, #2f7d4f, #2a78d6); }
h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 13px; }
h2 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }

.layout { display: grid; grid-template-columns: minmax(380px, 460px) 1fr; gap: 20px; align-items: start; padding-bottom: 36px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
        padding: 20px 22px; min-width: 0; }
.side { display: grid; gap: 16px; }

/* Form */
.form { display: grid; gap: 14px; }
.field > label, .field > .label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
.input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 8px 11px; }
.input:focus { border-color: var(--accent); outline: none; }
.where { position: relative; flex: 1; }
.list { position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line);
        border-radius: 10px; box-shadow: var(--shadow); padding: 4px; max-height: 260px; overflow: auto; }
.list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.list button:hover, .list button:focus { background: var(--soft); }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 8px 12px; cursor: pointer;
       display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; justify-content: center; padding: 10px 14px; }
.btn.primary:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn:disabled { opacity: .6; cursor: wait; }
.seg { display: flex; flex-wrap: wrap; background: var(--soft); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); padding: 6px 10px; border-radius: 7px; cursor: pointer;
              font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.cantons summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; list-style: none; }
.cantons summary::-webkit-details-marker { display: none; }
.cantons summary .label { font-size: 12px; font-weight: 500; color: var(--muted); }
.cantons summary .picked { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cantons summary::after { content: "▾"; color: var(--muted); font-size: 12px; }
.cantons[open] summary::after { content: "▴"; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 3px; background: var(--soft);
         border-radius: 9px; padding: 3px; margin: 8px 0 6px; }
.chips button { border: 0; background: none; color: var(--muted); padding: 5px 0; border-radius: 7px; cursor: pointer; font-size: 12.5px; font-weight: 500; }
.chips button:hover { color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.link:hover { text-decoration: underline; }
.seg.off { opacity: .45; pointer-events: none; }
.hutpin { display: grid !important; place-items: center; background: #b45309; color: #fff; border: 2px solid #fff; border-radius: 8px;
          box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.spot.hut svg { color: #b45309; }
.daydot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.origin { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.origin b { color: var(--ink); font-weight: 600; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px;
        border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* Results */
.results { display: grid; gap: 10px; }
.hike { text-align: left; width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 14px 16px;
        cursor: pointer; display: grid; gap: 9px; box-shadow: var(--shadow); }
.hike:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.hike[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.hike .top { display: flex; gap: 12px; align-items: flex-start; }
.hike .name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.hike .route { color: var(--muted); font-size: 12.5px; }
.score { margin-left: auto; flex: none; width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
         font-weight: 700; font-size: 16px; line-height: 1; text-align: center; }
.score small { display: block; font-size: 9.5px; font-weight: 500; opacity: .8; margin-top: 2px; }
.score.good { background: var(--good-bg); color: var(--good); }
.score.warn { background: var(--warn-bg); color: var(--warn); }
.score.bad { background: var(--bad-bg); color: var(--bad); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 600; }
.facts span { display: inline-flex; align-items: center; gap: 4px; }
.travel { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); background: var(--soft); border-radius: 9px; padding: 8px 10px; }
.travel b { color: var(--ink); font-weight: 600; }
.travel div { display: flex; align-items: center; gap: 6px; }
.note { color: var(--muted); font-size: 12.5px; }
.none { display: grid; place-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 40px 16px;
        border: 1px dashed var(--line); border-radius: 14px; }
.none b { color: var(--ink); font-size: 15px; }
.error-box { background: var(--bad-bg); color: var(--bad); padding: 12px 14px; border-radius: 10px; }

/* Detail */
.detail { min-width: 0; }
.dhead { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; margin-bottom: 14px; }
.dhead .links { margin-left: auto; display: flex; gap: 8px; }
.dhead a { color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 500; }
.dhead a:hover { text-decoration: underline; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--soft); border-radius: 10px; padding: 9px 11px; }
.stat .k { color: var(--muted); font-size: 11.5px; }
.stat .v { font-size: 17px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
#map { height: 380px; border-radius: 11px; border: 1px solid var(--line); background: var(--soft); }
.leaflet-container { font: inherit; }
.profile { position: relative; margin-top: 12px; background: var(--soft); border-radius: 11px; padding: 10px 12px 6px; }
.profile svg { display: block; width: 100%; height: 150px; overflow: visible; }
.profile .axis { fill: var(--faint); font-size: 11px; }
.tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
       border-radius: 8px; padding: 4px 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); display: none; }
.wx { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.wx table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.wx th, .wx td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wx th:first-child, .wx td:first-child { text-align: left; color: var(--muted); font-weight: 500; position: sticky; left: 0; background: var(--card); }
.wx tr:last-child td { border-bottom: 0; }
.wx .on { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.wx .hdr th { color: var(--muted); font-weight: 500; }
.wx svg { vertical-align: middle; }
.conns { display: grid; gap: 8px; }
.conn { border: 1px solid var(--line); border-radius: 10px; }
.conn summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 9px 12px; }
.conn summary::-webkit-details-marker { display: none; }
.conn summary .t { font-weight: 600; font-variant-numeric: tabular-nums; }
.conn summary .m { color: var(--muted); font-size: 12.5px; }
.conn summary .prod { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.legs { border-top: 1px solid var(--line); padding: 8px 12px; display: grid; gap: 5px; font-size: 12.5px; }
.leg { display: grid; grid-template-columns: 92px 1fr; gap: 8px; }
.leg .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.line { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 4px; background: var(--soft);
        border: 1px solid var(--line); color: var(--ink); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.warns { display: grid; gap: 6px; margin-bottom: 12px; }
.warnline { display: flex; gap: 8px; align-items: center; background: var(--warn-bg); color: var(--warn); border-radius: 9px; padding: 7px 11px; font-size: 13px; }
.placeholder { display: grid; place-items: center; text-align: center; gap: 8px; color: var(--muted); min-height: 420px; }
.placeholder svg { color: var(--faint); }
.foot-meta { color: var(--faint); font-size: 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.foot-meta a { color: inherit; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .wrap { padding: 0 16px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .cols { grid-template-columns: 1fr; }
  #map { height: 300px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* Car */
.spot { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
        color: inherit; text-decoration: none; font-size: 13px; }
.spot:hover { border-color: var(--accent); }
.spot svg { flex: none; margin-top: 2px; color: var(--sky); }
.travel a, .note a { color: var(--accent); }
h3 svg { vertical-align: -2px; }

/* Photos */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.shot { position: relative; padding: 0; border: 0; border-radius: 9px; overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3;
        background: var(--soft); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.shot:hover img { transform: scale(1.05); }
.shot .km { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,.55);
            padding: 1px 6px; border-radius: 5px; }
@media (prefers-reduced-motion: reduce) { .shot img { transition: none; } }
.viewer { border: 0; padding: 0; background: transparent; max-width: min(1100px, 94vw); max-height: 94vh; overflow: visible; }
.viewer::backdrop { background: rgba(8, 12, 18, .82); }
.viewer figure { margin: 0; background: var(--card); color: var(--ink); border-radius: 12px; overflow: hidden; }
.viewer img { display: block; max-width: 100%; max-height: 74vh; margin: 0 auto; background: #000; }
.viewer figcaption { padding: 12px 16px; font-size: 13px; line-height: 1.5; }
.viewer figcaption a { color: var(--accent); }
.viewer button { position: absolute; border: 0; border-radius: 50%; width: 40px; height: 40px; font-size: 26px; line-height: 1;
                 background: rgba(255,255,255,.92); color: #141a22; cursor: pointer; box-shadow: var(--shadow); }
.viewer button:disabled { opacity: .3; cursor: default; }
.viewer .close { top: -14px; right: -14px; font-size: 22px; }
.viewer .prev { left: -20px; top: 37vh; }
.viewer .next { right: -20px; top: 37vh; }
@media (max-width: 700px) {
  .viewer .prev { left: 6px; } .viewer .next { right: 6px; } .viewer .close { top: 6px; right: 6px; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}
