:root {
  --gruen: #2f5d34;
  --gruen-hell: #e8f0e4;
  --text: #1f2a1f;
  --text-leise: #5b665a;
  --flaeche: #ffffff;
  --hintergrund: #f6f5ef;
  --rand: #d9dccf;
  --fehler: #b3261e;
  --schatten: 0 2px 10px rgba(0, 0, 0, .18);
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--hintergrund); font-size: 16px; line-height: 1.45; }
a { color: var(--gruen); }

/* ---------- Kopf & Fuß ---------- */
.kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--gruen); color: #fff;
}
.marke { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 34px; height: 34px; color: #f4f1e6; flex: none; }
.kopf h1 { margin: 0; font-size: 1.25rem; letter-spacing: .01em; }
.unterzeile { margin: 0; font-size: .85rem; opacity: .85; }
.knopf-text {
  background: rgba(255, 255, 255, .15); color: #fff; border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap;
}
.knopf-text:hover { background: rgba(255, 255, 255, .25); }
.demo-band { background: #fff3c4; color: #5a4300; text-align: center; font-size: .85rem; padding: 4px 16px; }

.fuss {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 6px 16px; font-size: .8rem; color: var(--text-leise); background: var(--flaeche); border-top: 1px solid var(--rand);
}

/* ---------- Karte ---------- */
.seite-karte { display: flex; flex-direction: column; height: 100dvh; }
.karten-rahmen { position: relative; flex: 1; min-height: 0; }
#karte { position: absolute; inset: 0; background: #dfe3d8; }
body.zeichnet #karte { cursor: crosshair; }

.suche {
  position: absolute; z-index: 1000; top: 10px; left: 56px; right: 64px; max-width: 360px;
  display: flex; background: var(--flaeche); border-radius: 999px; box-shadow: var(--schatten); overflow: hidden;
}
.suche input { flex: 1; min-width: 0; border: 0; padding: 10px 14px; font: inherit; background: transparent; color: var(--text); }
.suche input:focus { outline: none; }
.suche:focus-within { outline: 3px solid #8fb98a; }
.suche button { border: 0; background: transparent; padding: 0 14px; color: var(--gruen); cursor: pointer; }

.legende {
  position: absolute; z-index: 1000; left: 10px; bottom: 84px;
  display: flex; flex-direction: column; gap: 3px; padding: 8px 10px;
  background: rgba(255, 255, 255, .94); border-radius: 10px; box-shadow: var(--schatten); font-size: .82rem;
}
.legende span { display: flex; align-items: center; gap: 7px; }
.legende i, .popup-status i, .punkt { display: inline-block; width: 13px; height: 13px; border-radius: 3px; flex: none; }

.aktion-leiste, .zeichen-leiste {
  position: absolute; z-index: 1000; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
}
.aktion-leiste { display: flex; justify-content: center; }
.zeichen-leiste {
  background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 12px 14px;
}
.zeichen-leiste p { margin: 0 0 10px; text-align: center; }

/* ---------- Knöpfe ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 10px 16px; min-height: 44px;
  background: var(--gruen); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.knopf:hover { filter: brightness(1.1); }
.knopf:disabled { opacity: .45; cursor: default; filter: none; }
.knopf.zweitrangig { background: var(--gruen-hell); color: var(--gruen); }
.knopf.gross { font-size: 1.05rem; padding: 14px 24px; border-radius: 999px; box-shadow: var(--schatten); }
.knopf.klein { min-height: 34px; padding: 6px 12px; font-size: .9rem; }
.knopf.gefahr { background: #fbe9e7; color: var(--fehler); }
.knopf-reihe { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.zeichen-leiste .knopf-reihe { justify-content: center; }
.zeichen-leiste .knopf { flex: 1 1 auto; }

/* ---------- Dialoge ---------- */
dialog {
  border: 0; border-radius: 16px; padding: 20px; width: min(520px, calc(100% - 24px));
  max-height: calc(100dvh - 24px); overflow: auto; color: var(--text); background: var(--flaeche);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(20, 30, 20, .45); }
dialog h2 { margin: 0 0 12px; font-size: 1.25rem; }
.schritte { padding-left: 20px; }
.schritte li { margin-bottom: 8px; }

.auswahl { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.auswahl legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.wahl { position: relative; display: block; cursor: pointer; }
.wahl input { position: absolute; opacity: 0; }
.wahl span {
  display: block; padding: 12px 14px 12px 44px; border: 2px solid var(--rand); border-radius: 10px; font-weight: 600;
  position: relative;
}
.wahl span::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border-radius: 50%; border: 2px solid var(--rand); background: #fff;
}
.wahl.ja { --c: #2e7d32; } .wahl.bedingt { --c: #b07d00; } .wahl.nein { --c: #c62828; }
.wahl input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); }
.wahl input:checked + span::before { border-color: var(--c); background: var(--c); box-shadow: inset 0 0 0 3px #fff; }
.wahl input:focus-visible + span { outline: 3px solid #8fb98a; outline-offset: 2px; }

.feld { display: block; margin-bottom: 12px; }
.feld > span { display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem; }
.feld em { font-weight: 400; color: var(--text-leise); font-style: normal; }
.feld input, .feld textarea, .feld select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1.5px solid var(--rand); border-radius: 8px;
  background: #fff; color: var(--text);
}
.feld input:focus, .feld textarea:focus, .feld select:focus { outline: 3px solid #8fb98a; border-color: var(--gruen); }
.feld-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.haken { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; margin: 4px 0 14px; color: var(--text-leise); }
.haken input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--gruen); }
.fehler { color: var(--fehler); background: #fdecea; padding: 8px 12px; border-radius: 8px; font-size: .9rem; }
.hinweis-klein { font-size: .88rem; background: #fff3c4; padding: 8px 12px; border-radius: 8px; margin: 0 0 12px; }

/* ---------- Popup & Hinweis ---------- */
.popup p { margin: 0 0 6px; }
.popup-status { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; }
.popup-datum { color: var(--text-leise); font-size: .85rem; }

.hinweis {
  position: fixed; z-index: 3000; left: 50%; top: 76px; transform: translate(-50%, -20px);
  background: #1f2a1f; color: #fff; padding: 10px 18px; border-radius: 999px; box-shadow: var(--schatten);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
.hinweis.sichtbar { opacity: 1; transform: translate(-50%, 0); }
.hinweis.fehler { background: var(--fehler); }

@media (max-width: 520px) {
  .unterzeile { display: none; }
  .feld-reihe { grid-template-columns: 1fr; gap: 0; }
  .legende { bottom: 80px; font-size: .78rem; }
  .zeichen-leiste .knopf { flex: 1 1 40%; }
  #zeichnen-fertig { flex-basis: 100%; }
}
