:root {
  --blue: #1d4f91;
  --blue-2: #2f7fd8;
  --blue-3: #6a8fc2;
  --shell: #f2c230;
  --sel: #ffb300;
  --start: #1f9d55;
  --end: #c0392b;
  --bg: #f4f2ec;
  --card: #ffffff;
  --ink: #1c2229;
  --ink-2: #48515b;
  --ink-3: #7b838c;
  --line: #e4e0d6;
  --hover: #f1eee6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 10, .06), 0 4px 16px rgba(20, 20, 10, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #6ea4ec;
    --blue-2: #8fbaf2;
    --bg: #15181c;
    --card: #1e2227;
    --ink: #e9ecef;
    --ink-2: #b8c0c8;
    --ink-3: #87909a;
    --line: #2f353c;
    --hover: #262b31;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 14px 0 8px; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

.app {
  display: grid;
  grid-template-columns: 410px 1fr;
  height: 100vh;
  height: 100dvh;
}

/* ---------- panel ---------- */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  z-index: 1000;
}
.sheet-handle, .peek { display: none; }
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px 12px;
}
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand h1 { font-size: 19px; letter-spacing: -.01em; }
.brand .sub { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.scroll { overflow-y: auto; padding: 0 14px 20px; flex: 1; min-height: 0; overscroll-behavior: contain; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.head-actions { display: flex; gap: 4px; }
.hint { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; }
.hint.small { font-size: 12px; margin: 4px 0 8px; }
.assist[hidden] { display: none; }
.assist { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.assist-head { font-weight: 600; font-size: 14px; }
.assist-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 17px; line-height: 1; }
.stepper b { font-size: 18px; min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.stepper span { color: var(--ink-3); font-size: 13px; margin-right: 4px; }
.assist-range-val { font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* two-handle km/day range slider: two overlaid range inputs, only the thumbs take pointer events */
.range2 { position: relative; height: 28px; }
.r2-track { position: absolute; left: 11px; right: 11px; top: 12px; height: 4px; border-radius: 2px; background: var(--line); }
.r2-fill { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: var(--blue); }
.range2 input {
  position: absolute; inset: 0; width: 100%; height: 28px; margin: 0; padding: 0;
  background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.range2 input::-webkit-slider-runnable-track { height: 28px; background: transparent; }
.range2 input::-moz-range-track { background: transparent; }
.range2 input::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; box-sizing: border-box; width: 22px; height: 22px; margin-top: 3px;
  border-radius: 50%; background: var(--card); border: 2px solid var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab;
}
.range2 input::-moz-range-thumb {
  pointer-events: auto; box-sizing: border-box; width: 22px; height: 22px;
  border-radius: 50%; background: var(--card); border: 2px solid var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab;
}
.range2 input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--blue); outline-offset: 2px; }
.r2-ticks { position: relative; height: 14px; margin-top: -2px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.r2-ticks span { position: absolute; left: calc(11px + (100% - 22px) * var(--i) / 8); transform: translateX(-50%); }
.r2-ticks span.on { color: var(--ink); font-weight: 600; }
.assist-dir { align-self: flex-start; }
.assist-check { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.assist .btn.primary { align-self: flex-start; }
.assist-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.assist-results button {
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 7px 10px; font-size: 14px;
}
.assist-results button:hover { background: var(--hover); }
.assist-results button.best { border-color: var(--blue); }
.assist-results small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.as-tag { font-size: 11px; color: #fff; background: var(--blue); border-radius: 5px; padding: 0 5px; margin-left: 4px; font-weight: 600; }
.as-note { font-size: 12.5px; color: var(--ink-3); }
.as-sub { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.as-prev { font-size: 11px; color: var(--ink-3); margin-left: 4px; }
/* "Passt das Ziel?" bar on the map after picking a suggested destination */
.pick-confirm {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 900;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: min(520px, calc(100% - 100px));
  background: var(--card); color: var(--ink); border-radius: 12px; padding: 9px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.28);
}
.pick-confirm[hidden] { display: none; }
.pc-text { display: flex; flex-direction: column; min-width: 0; }
.pc-text b { font-size: 14px; }
.pc-text small { font-size: 12px; color: var(--ink-3); }
.pc-actions { display: flex; gap: 6px; }
.pp-sleep { margin-top: 8px; }
/* "Ich übernachte hier" */
.stay-btn { font-size: 14px; }
.stay-btn.on { background: color-mix(in srgb, #6c3483 18%, transparent); border-color: transparent; }
.wp-stay { list-style: none; margin: -2px 0 4px 36px; font-size: 12.5px; color: var(--ink-2); }
.wp-stay a { color: var(--blue); }
.wp-stay .link-inline { margin-left: 4px; }
.wp-stayform { list-style: none; margin: 2px 0 8px 36px; padding: 10px; border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.stay-title { font-size: 13px; font-weight: 600; }
.stay-actions { display: flex; align-items: center; gap: 10px; }
.stay-pin div {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px;
  background: #fff; border: 3px solid #6c3483; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.placing, .placing .leaflet-interactive { cursor: crosshair !important; }
.hint.warn { color: #b03a2e; background: color-mix(in srgb, #b03a2e 10%, transparent); padding: 8px 10px; border-radius: 8px; }

.icon-btn {
  border: 1px solid var(--line); background: var(--card);
  width: 32px; height: 32px; border-radius: 8px; font-size: 16px; line-height: 1;
  display: inline-grid; place-items: center;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn.small { width: 28px; height: 28px; font-size: 15px; border-color: transparent; color: var(--ink-3); }
.icon-btn.small:hover { color: var(--ink); }
.link-btn { border: 0; background: none; color: var(--blue); padding: 6px 0 0 36px; font-size: 14px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* waypoints */
.waypoints { list-style: none; margin: 0; padding: 0; position: relative; }
.waypoints::before {
  content: ""; position: absolute; left: 13px; top: 22px; bottom: 22px;
  border-left: 2px dotted var(--line);
}
.wp { display: flex; align-items: center; gap: 8px; padding: 4px 0; position: relative; }
.badge {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  background: var(--blue); position: relative; z-index: 1; border: 2px solid var(--card);
}
.badge.start { background: var(--start); }
.badge.end { background: var(--end); }
.wp-input { position: relative; flex: 1; min-width: 0; }
.wp-input input {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg);
  outline: none; text-overflow: ellipsis;
}
.wp-input input:focus { border-color: var(--blue); background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
  list-style: none; margin: 0; padding: 4px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.16);
  max-height: 300px; overflow-y: auto;
}
.suggest li { padding: 7px 9px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.suggest li small { color: var(--ink-3); white-space: nowrap; font-size: 12px; }
.suggest li:hover, .suggest li.active { background: var(--hover); }
.suggest li.special { color: var(--blue); font-weight: 500; }
.suggest li.note { color: var(--ink-3); font-size: 13px; cursor: default; }
.suggest li.note:hover { background: none; }

/* results */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: var(--bg); border-radius: 9px; padding: 8px 6px; text-align: center; }
.stat b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat span { font-size: 11.5px; color: var(--ink-3); }
.stat select { font: inherit; font-size: 11.5px; color: var(--ink-2); background: transparent; border: 0; padding: 0; }
.via { grid-column: 1 / -1; margin: 6px 2px 0; font-weight: 600; font-size: 14px; }
.via small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.split {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 13px; color: var(--ink-2);
}
.split input {
  width: 52px; padding: 4px 6px; font: inherit; color: var(--ink); text-align: center;
  border: 1px solid var(--line); border-radius: 7px; background: var(--bg);
}
.split .btn { margin-left: auto; }
.profile-wrap { position: relative; margin: 10px -4px 4px; }
#profile { width: 100%; height: 150px; display: block; touch-action: pan-y; cursor: crosshair; }
.profile-tip {
  position: absolute; top: -6px; padding: 2px 7px; border-radius: 6px;
  background: var(--ink); color: var(--card); font-size: 12px; pointer-events: none; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}


.export { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
#exportToggle[aria-expanded="true"] { background: var(--hover); }
.export-panel { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding: 8px; border-radius: 9px; background: var(--bg); }
.export-panel[hidden] { display: none; }
.export-panel .btn[hidden] { display: none; }
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 500;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.start { border-color: var(--start); color: var(--start); }
.btn.end { border-color: var(--end); color: var(--end); }

.howto-body { margin-top: 10px; padding: 10px 12px; border-radius: 9px; background: var(--bg); font-size: 13.5px; }
.howto-body p { margin: 4px 0; color: var(--ink-2); }
.help-btn { width: 34px; height: 34px; border-radius: 50%; font-weight: 700; color: var(--ink-3); margin-left: auto; }
.help-btn[aria-expanded="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.g-actions { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.g-actions a.btn { text-decoration: none; }
/* water / food map markers + popup */
.prac-icon span {
  display: grid; place-items: center; width: 24px; height: 24px; font-size: 13px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); border: 2px solid #c25e00;
}
.prac-icon.water span { border-color: #1a73e8; }
.prac-icon.bed span { border-color: #6c3483; }
.pp { font-size: 13.5px; line-height: 1.4; min-width: 200px; }
.pp-kind { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.pp strong { font-size: 15px; display: block; }
.pp-hours { margin: 6px 0 0; }
.pp-hours b.open { color: #1e8449; }
.pp-hours b.closed { color: #b03a2e; }
.pp-hours small { color: var(--ink-3); }
.pp-links { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.pp-fix { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.pp-fix a { color: var(--ink-3); }
.link-inline { border: 0; background: none; padding: 0; color: var(--ink-3); text-decoration: underline; font-size: inherit; cursor: pointer; }
#hiddenNote { margin-top: 8px; }
#hiddenNote .link-inline { color: var(--blue); }
.gm-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.gm-head .hint { margin: 0; flex: 1; min-width: 0; }
.gm-head .seg { flex: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: none; padding: 3px 9px; font-size: 12px; color: var(--ink-3); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--blue); color: #fff; }
.gm-list { list-style: none; margin: 0; padding: 0; }
.gm-list li { border-top: 1px solid var(--line); }
.gm-list li:first-child { border-top: 0; }
.gm-list li { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.gm-main {
  flex: 1; min-width: 0; display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: baseline;
  border: 0; background: none; text-align: left; padding: 7px 4px; color: var(--ink); font-size: 13.5px; cursor: pointer; border-radius: 8px;
}
.gm-main:hover { background: var(--hover); }
.gm-list li.active .gm-main { background: color-mix(in srgb, #00c2d7 16%, transparent); }
.gm-list li.active .gm-n { background: #0097a7; }
.gm-sup { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.gm-len { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gm-maps {
  flex: none; font-size: 12px; font-weight: 600; color: var(--blue); text-decoration: none; white-space: nowrap;
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px;
}
.gm-maps:hover { background: var(--hover); }
.gm-list li.done .gm-maps { color: var(--ink-3); }
.gm-list li:not(.active) .gm-maps { display: none; } /* Google Maps link only for the tapped Abschnitt */
.gm-hint { color: var(--ink-3); font-size: 11.5px; }
.gm-long p { margin: 4px 0 8px; font-size: 13.5px; color: var(--ink-2); }
.gm-long .link-inline { margin-left: 8px; }
#thinNote { margin: 0 0 6px; }
#thinNote .link-inline, .gm-long .link-inline { color: var(--blue); }
.gm-list small { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gm-list .gm-sup, .gm-list .gm-hint { white-space: normal; }
.gm-n { width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.gm-list li.done .gm-n { background: var(--ink-3); }
.gm-list li.done .gm-t { color: var(--ink-3); }


/* routes */
#routeList h3 { margin-top: 14px; }
.route-group { display: flex; flex-direction: column; }
.route-item {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px;
  border: 0; background: none; text-align: left; padding: 7px 6px; border-radius: 8px; font-size: 14px;
}
.route-item:hover { background: var(--hover); }
.route-item small { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.route-item.whole {
  grid-template-columns: 1fr auto; width: 100%; border: 1px solid var(--line); background: var(--bg); font-weight: 600;
}
.sw { display: inline-block; width: 22px; height: 0; border-top: 4px solid var(--blue); vertical-align: middle; }
.sw.variante { border-top: 3px dashed var(--blue-2); }
.sw.weitere { border-top: 3px solid var(--blue-3); }
.sw.sel { border-top: 5px solid var(--sel); }

.foot { color: var(--ink-3); font-size: 12px; padding: 4px 4px 0; }
.foot p { margin: 6px 0; }
.imprint summary { cursor: pointer; display: inline-block; text-decoration: underline; text-underline-offset: 2px; }
.imprint[open] summary { margin-bottom: 4px; }
.imprint p { line-height: 1.5; }
.imprint strong { color: var(--ink-2); font-weight: 600; }

/* ---------- folded cards ---------- */
.count { color: var(--ink-3); font-weight: 500; font-size: 14px; }

/* ---------- Meine Pläne ---------- */
#savePlanBtn { color: var(--ink-2); }
#savePlanBtn.on { color: var(--blue); }
#savePlanBtn.on path { fill: currentColor; }
.plan-name {
  font-size: 13px; font-weight: 500; color: var(--ink-3); display: inline-block; max-width: 170px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.plan-save { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 9px; background: var(--bg); margin-bottom: 8px; }
.plan-save[hidden] { display: none; }
.plan-save p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.plan-save .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.plan-input {
  flex: 1; min-width: 140px; padding: 6px 8px; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-list li.plan { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); padding: 2px 0; }
.plan-list li.plan:first-child { border-top: 0; }
.plan-main {
  flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 8px;
  color: var(--ink); font-size: 14px; cursor: pointer;
}
.plan-main:hover { background: var(--hover); }
.plan-main small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.plan-list li.current .plan-main { background: color-mix(in srgb, var(--blue) 14%, transparent); }
.plan-badge { font-size: 11px; font-weight: 500; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; margin-left: 4px; }
.plan-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 0 10px 8px; list-style: none; }
.plan-actions button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 7px; padding: 4px 10px; font-size: 12.5px; }
.plan-actions button:hover { background: var(--hover); }
.plan-actions button.danger { color: var(--end); }
.plan-rename { display: flex; gap: 6px; flex: 1; padding: 4px 0; }

/* ---------- confirm dialog ---------- */
.dlg {
  border: 0; border-radius: 14px; padding: 18px 18px 14px; width: min(420px, calc(100vw - 32px));
  background: var(--card); color: var(--ink); box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.dlg::backdrop { background: rgba(0,0,0,.45); }
.dlg h3 { margin: 0 0 8px; font-size: 16px; text-transform: none; letter-spacing: normal; color: var(--ink); }
.dlg p { margin: 0 0 16px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
details.fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after {
  content: ""; width: 8px; height: 8px; flex: none; margin-right: 4px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform .2s;
}
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold[open] > summary { margin-bottom: 8px; }


/* ---------- Wegbeschreibung ---------- */
.day-tabs { display: flex; gap: 6px; overflow-x: auto; margin: -2px 0 10px; padding-bottom: 2px; }
.day-tabs:empty { display: none; }
.day-tab {
  flex: none; display: flex; flex-direction: column; align-items: center; padding: 5px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); font-size: 13px; line-height: 1.2;
}
.day-tab small { color: var(--ink-3); font-size: 11px; }
.day-tab.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.day-tab.on small { color: rgba(255,255,255,.8); }
.d-year { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }

/* ---------- discover ---------- */
.discover-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.discover-top .btn { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-size: 12.5px; color: var(--ink-3);
}
.chip i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--c); }
.chip small { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip.on { color: var(--ink); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); background: color-mix(in srgb, var(--c) 9%, var(--card)); }
.chip.on i { background: var(--c); }
.chip:disabled { opacity: .45; cursor: default; }
.strip {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 8px;
  margin: 0 -2px; scrollbar-width: thin;
}
.poi-card {
  flex: 0 0 132px; scroll-snap-align: start; border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 0 0 7px; text-align: left; overflow: hidden; display: flex; flex-direction: column;
  transition: transform .12s, box-shadow .12s;
}
.poi-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.poi-card .ph { display: block; height: 84px; background: var(--hover); border-bottom: 3px solid var(--c); }
.poi-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poi-card .km { font-size: 11px; color: var(--ink-3); padding: 5px 8px 0; font-variant-numeric: tabular-nums; }
.poi-card b {
  font-size: 12.5px; font-weight: 600; padding: 1px 8px 0; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.poi-track { position: relative; height: 16px; margin: -2px 10px 4px 40px; }
.poi-track::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; border-top: 1px dashed var(--line); }
.poi-track .dot {
  position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px; padding: 0;
  border-radius: 50%; border: 2px solid var(--card); background: var(--c); box-shadow: 0 0 0 1px rgba(0,0,0,.12);
  transition: transform .12s;
}
.poi-track .dot:hover { transform: scale(1.45); z-index: 2; }

/* map photo markers */
.poi-pin { background: none; border: 0; }
.poi-pin div {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: #ddd;
  border: 3px solid var(--c); box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .15s;
}
.poi-pin img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poi-pin.ort div { border-width: 2px; opacity: .9; }
.poi-pin.hl div, .poi-pin:hover div { transform: scale(1.25); }
.poi-pin.big div { border-width: 4px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 30%, transparent), 0 4px 14px rgba(0,0,0,.4); }

/* ---------- detail view (over the panel) ---------- */
.panel { position: relative; }
.detail {
  position: absolute; inset: 0; z-index: 1200; background: var(--bg);
  display: flex; flex-direction: column; min-height: 0;
  transform: translateX(-24px); opacity: 0; transition: transform .25s ease, opacity .25s ease;
}
.detail.open { transform: none; opacity: 1; }
.detail[hidden] { display: none; }
.detail-bar {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--card); flex: none;
}
.detail-pos { flex: 1; text-align: center; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.detail-pos span { color: var(--ink-3); }
.detail-bar .icon-btn { font-size: 20px; }
.detail-bar .icon-btn:disabled { opacity: .35; cursor: default; }
.detail-scroll { overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.gallery { position: relative; background: #111; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 3; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: grid; place-items: center; }
.slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.g-nav {
  position: absolute; top: calc(50% - 30px); width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.45); color: #fff; font-size: 22px; line-height: 1; display: grid; place-items: center;
}
.g-nav.prev { left: 8px; } .g-nav.next { right: 8px; }
.g-nav:hover { background: rgba(0,0,0,.65); }
.g-dots { position: absolute; left: 0; right: 0; bottom: 34px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.g-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); }
.g-dots i.on { background: #fff; }
.credit { font-size: 11px; color: #bbb; padding: 6px 12px; line-height: 1.35; background: #111; min-height: 28px; }
.credit a { color: #ddd; }
.detail-body { padding: 14px 16px 24px; }
.d-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--c); text-transform: uppercase; letter-spacing: .04em; }
.d-cat i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.d-title { font-size: 21px; margin: 4px 0 2px; letter-spacing: -.01em; }
.d-desc { margin: 0; color: var(--ink-2); font-size: 14px; }
.d-where { margin: 8px 0 0; font-size: 13px; color: var(--ink-3); }
.d-text { margin-top: 12px; font-size: 14.5px; line-height: 1.55; }
.d-text p { margin: 0 0 10px; }
.d-src { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 13px; }
.d-src small { color: var(--ink-3); }
.sk { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--hover), var(--line), var(--hover)); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 8px 0; }
.sk.short { width: 60%; }
@keyframes sk { to { background-position: -200% 0; } }
.d-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.d-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.d-step {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; text-align: left;
  font-size: 13px; font-weight: 600; line-height: 1.3; display: flex; flex-direction: column; gap: 2px;
}
.d-step small { font-weight: 400; color: var(--ink-3); font-size: 11.5px; }
.d-step.next { text-align: right; }
.d-step:hover { background: var(--hover); }

/* ---------- map ---------- */
.map-wrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #e8e4da; }
.loading {
  position: absolute; inset: 0; z-index: 900; display: grid; place-content: center; justify-items: center; gap: 12px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); font-weight: 500; color: var(--ink-2);
}
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 950;
  background: var(--ink); color: var(--card); padding: 9px 14px; border-radius: 10px;
  font-size: 14px; max-width: min(520px, calc(100% - 100px)); box-shadow: 0 6px 24px rgba(0,0,0,.25);
}

.locate-btn {
  width: 34px; height: 34px; background: #fff; border: 2px solid rgba(0,0,0,.2) !important;
  display: grid; place-items: center; color: #333; border-radius: 4px;
}
.locate-btn:hover { background: #f4f4f4; }
.layer-menu { position: relative; }
.layer-menu-btn {
  width: 34px; height: 34px; background: #fff; border: 2px solid rgba(0,0,0,.2); border-radius: 4px;
  display: grid; place-items: center; color: #333; cursor: pointer; background-clip: padding-box;
}
.layer-menu-btn:hover { background: #f4f4f4; }
.layer-menu-btn[aria-expanded="true"] { color: var(--blue); }
.layer-menu-panel {
  position: absolute; right: 42px; top: 0; width: 230px; padding: 8px 6px; border-radius: 10px;
  background: var(--card); color: var(--ink); box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 13.5px;
}
.lm-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 0 6px 4px; }
.lm-row { display: grid; grid-template-columns: 20px 22px 1fr; gap: 4px; align-items: center; padding: 5px 6px; border-radius: 7px; cursor: pointer; }
.lm-row:hover { background: var(--hover); }
.lm-row small { color: var(--ink-3); }
.lm-row.muted .lm-l { color: var(--ink-3); }
.lm-sub { display: block; font-size: 11px; }
.lm-ic { text-align: center; }
.map-hint {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 800;
  border: 0; border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: 0 3px 14px rgba(0,0,0,.25); white-space: nowrap;
}
.map-hint span { color: var(--blue); font-weight: 600; margin-left: 6px; }
.map-hint[hidden] { display: none; }

.pin { background: none; border: 0; }
.pin div {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--blue); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  display: grid; place-items: center;
}
.pin span { transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 13px; }
.pin-start div { background: var(--start); }
.pin-end div { background: var(--end); }
.zoom-far .station-icon span { transform: scale(.72); }
.station-icon span {
  display: grid; place-items: center; width: 20px; height: 20px; font-size: 12px;
  background: #fff; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.leaflet-container { font: inherit; }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--ink); }
.pt-popup strong { font-size: 15px; }
.pt-popup .hint { margin: 4px 0 0; }
.pp-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.net-tip { font-size: 12.5px; }

/* ---------- mobile: bottom sheet ---------- */
@media (max-width: 800px) {
  :root { --peek: 132px; }
  .app { display: block; }
  .map-wrap { position: fixed; inset: 0; }
  .panel {
    position: fixed; left: 0; right: 0; bottom: 0;
    height: 88dvh; border-right: 0;
    border-radius: 18px 18px 0 0; box-shadow: 0 -6px 30px rgba(0,0,0,.18);
    transform: translateY(calc(88dvh - var(--peek) - env(safe-area-inset-bottom)));
    transition: transform .3s ease;
  }
  .panel.open { transform: translateY(0); }
  .panel.detail-open { transform: translateY(calc(88dvh - 62dvh)); }
  .detail { border-radius: 18px 18px 0 0; overflow: hidden; transform: translateY(24px); }
  .detail.open { transform: none; }
  .slides { aspect-ratio: 16 / 10; }
  .sheet-handle {
    display: grid; place-items: center; border: 0; background: none; height: 22px; padding: 0; width: 100%; flex: none;
  }
  .sheet-handle span { width: 42px; height: 5px; border-radius: 3px; background: var(--line); }
  .brand { display: none; }
  .peek {
    display: flex; align-items: center; gap: 10px; padding: 2px 16px 12px; min-height: 64px; flex: none; cursor: pointer;
  }
  .peek .brand-mark { width: 38px; height: 38px; }
  .peek-text { flex: 1; min-width: 0; }
  .peek-title { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .peek-sub { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; line-height: 1.3; }
  .peek .btn { flex: none; }
  .panel.open .peek { padding-bottom: 8px; }
  .scroll { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .leaflet-top.leaflet-right { top: env(safe-area-inset-top); }
  .leaflet-bottom { bottom: calc(var(--peek) + 8px + env(safe-area-inset-bottom)); }
  .map-hint { bottom: calc(var(--peek) + 40px + env(safe-area-inset-bottom)); }
  .pick-confirm { left: 12px; right: 56px; transform: none; max-width: none; }
  .toast { top: calc(10px + env(safe-area-inset-top)); }
  .stat b { font-size: 17px; }
}
