/* GPS-Art – Karte rechts (Handy: oben), Bedienfeld links (Handy: unten). */
:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #ebe8e2;
  --fg: #191714;
  --muted: #6a645b;
  --line: #ddd8cf;
  --accent: #e2531f;      /* Route */
  --accent-fg: #ffffff;
  --plan: #2f5d8a;        /* Vorlage */
  --ok: #2c7a4b;
  --warn: #b5621a;
  --shadow: 0 10px 30px rgba(20, 14, 8, 0.16);
  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110;
    --surface: #1c1a18;
    --surface-2: #272421;
    --fg: #efebe5;
    --muted: #a39b90;
    --line: #332f2b;
    --accent: #ff7043;
    --accent-fg: #1a0b04;
    --plan: #7fb2e5;
    --ok: #5cc28a;
    --warn: #f0a04b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 380px 1fr;
}
.panel {
  overflow-y: auto;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.mapwrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--surface-2); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 46dvh 1fr; }
  .mapwrap { grid-row: 1; }
  .panel { grid-row: 2; border-right: 0; border-top: 1px solid var(--line); padding: 16px; gap: 16px; }
  .brand { display: none !important; }
}

/* Kopf */
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 40px; height: 40px; padding: 6px; border-radius: 12px; background: var(--accent);
  fill: none; stroke: var(--accent-fg); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.brand h1 { font: 700 28px/1 var(--font-display); letter-spacing: .01em; margin: 0; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* Schritte */
.step { display: flex; flex-direction: column; gap: 10px; }
.step h2 { font: 700 19px/1 var(--font-display); margin: 0; display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .04em; }
.num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--fg); color: var(--bg); font-size: 13px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.hint.warn { color: var(--warn); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--plan);
  vertical-align: -1px; box-shadow: 0 0 0 2px var(--surface); }

input[type="text"], input[type="search"] {
  width: 100%; min-width: 0; padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); outline: none;
}
input[type="text"]:focus, input[type="search"]:focus { border-color: var(--plan); }
#textInput { font: 700 24px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; }

.search { display: flex; gap: 8px; }
.results { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); }
.results li button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; cursor: pointer; font-size: 13px; }
.results li button:hover { background: var(--surface-2); }
.results .empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }

/* Knöpfe */
.btn { border: 1px solid var(--line); background: var(--surface); padding: 11px 16px; border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-size: 16px; padding: 14px 16px; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.active { background: var(--plan); border-color: var(--plan); color: #fff; }
.link { border: 0; background: none; padding: 0; color: var(--plan); font-weight: 600; cursor: pointer; text-decoration: underline; font-size: 13px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px;
  background: var(--surface-2); border-radius: var(--radius-sm); }
.seg button { border: 0; background: none; padding: 9px 6px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shapes button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 13px; }
.shapes button.on { border-color: var(--plan); box-shadow: inset 0 0 0 1px var(--plan); }
.shapes svg { width: 40px; height: 40px; fill: none; stroke: var(--plan); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }

.row { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.row output { font: 700 20px/1 var(--font-display); }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }

.status { margin: -8px 0 0; min-height: 1.2em; font-size: 13px; color: var(--muted); }
.status.error { color: var(--warn); font-weight: 600; }

/* Ergebnis */
.result { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stats .big { display: block; font: 700 32px/1 var(--font-display); }
.stats .label { color: var(--muted); font-size: 13px; }
.komoot summary { cursor: pointer; font-weight: 600; }
.komoot ol { margin: 10px 0; padding-left: 20px; display: grid; gap: 4px; }

.foot { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--muted); }

/* Karte */
.legend { position: absolute; left: 12px; bottom: 22px; z-index: 500; display: flex; gap: 12px; padding: 6px 10px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); font-size: 12px; }
.legend i { display: inline-block; width: 18px; height: 0; margin-right: 6px; vertical-align: middle; }
.l-plan { border-top: 3px dashed var(--plan); }
.l-route { border-top: 4px solid var(--accent); }
.drawbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 600; display: flex; gap: 12px;
  align-items: center; padding: 8px 8px 8px 16px; background: var(--plan); color: #fff; border-radius: 999px;
  box-shadow: var(--shadow); font-weight: 600; white-space: nowrap; }
.drawbar .btn { background: rgba(255,255,255,.15); border-color: transparent; color: #fff; }
.mapwrap.drawing #map { cursor: crosshair; touch-action: none; }

.handle { width: 22px; height: 22px; border-radius: 50%; background: var(--plan); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: grab; }
.pin { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 700 13px/1 var(--font-body);
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.pin.start { background: var(--ok); }
.pin.end { background: var(--fg); color: var(--bg); }
.leaflet-container { font-family: var(--font-body); }

/* Rechtliches */
.legal-page { max-width: 720px; margin: 0 auto; padding: 32px 20px 60px; }
.legal-page h1 { font: 700 40px/1.05 var(--font-display); margin: 12px 0 16px; }
.legal-page h2 { font: 700 22px/1.2 var(--font-display); margin: 28px 0 8px; }
.legal-page .lead { font-size: 16px; }
.legal-page code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.legal-nav a, .legal-links a { color: var(--plan); }
.legal-date { color: var(--muted); font-size: 13px; margin-top: 32px; }
.logo circle { fill: var(--accent-fg); stroke: none; }
