:root {
  --green: #1d4e3f;
  --green-l: #2c6f5a;
  --sand: #f6f3ec;
  --ink: #1b1b1a;
  --muted: #6b6b66;
  --line: #ddd8cd;
  --ok: #1f7a4d;
  --no: #b03636;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Muss vor den display-Regeln stehen: sonst gewinnt display:flex gegen das
   hidden-Attribut und Feedback-Block wie Screens bleiben sichtbar. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--sand);
  color: var(--ink);
  line-height: 1.45;
}

header {
  background: var(--green);
  color: #fff;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}

header h1 { font-size: 19px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.head-text { min-width: 0; }
#head-sub {
  display: block;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .72);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

main { max-width: 640px; margin: 0 auto; padding: 20px 16px 40px; }

.lead { font-size: 20px; font-weight: 600; margin: 4px 0 16px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* ------------------------------------------------------------------ Karten */

.card {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .05s;
}
.card:hover { border-color: var(--green-l); }
.card:active { transform: scale(.995); }
.card strong { display: block; font-size: 17px; margin-bottom: 3px; }
.card span { display: block; color: var(--muted); font-size: 14px; }
.card em { display: block; color: var(--green-l); font-size: 13px; font-style: normal; margin-top: 6px; }
.card.wide strong { margin-bottom: 0; }

/* --------------------------------------------------------- Einstellungen */

.options { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 12px; }
.options summary { cursor: pointer; color: var(--muted); font-size: 15px; }
.opt-row { margin: 16px 0; }
.opt-label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 7px; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}
.seg button.on { background: var(--green); border-color: var(--green); color: #fff; }

/* ------------------------------------------------------------------- Quiz */

.bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--green-l); transition: width .25s; }

.meta {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--muted); margin: 10px 0 22px;
}

#prompt { text-align: center; margin-bottom: 24px; }

/* Zwei ISOM-Symbole sind normgemaess reinweiss — Wald (405) und Schmaler
   Sumpf (D 3.6). Auf weisser Kachel waren sie unsichtbar, die Antwortkachel
   blieb leer (07.09.2026). Der Kachelgrund ist deshalb leicht getoent: Weiss
   hebt sich ab, farbige Symbole bleiben unveraendert, und anders als ein
   Rahmen umgibt es keine Punktsymbole mit einem stoerenden Kasten. */
.sym {
  display: flex; align-items: center; justify-content: center;
  background: #eeece6; border-radius: 10px;
}
.sym img { display: block; max-width: 100%; max-height: 100%; }
/* Hülle für Grafiken mit eingekreisster Stelle: schrumpft auf das Bild, damit
   der Ring in Prozent der Bildkante sitzt und in jeder Grösse passt. */
.mit-marke {
  position: relative; display: inline-block; line-height: 0;
  max-width: 100%; max-height: 100%;
}
.mit-marke img { max-width: 100%; max-height: 100%; }
.marke {
  position: absolute; box-sizing: border-box;
  border: 2px solid var(--green); border-radius: 50%;
  pointer-events: none;
}
/* Nur der Hauptteil einer Grafik: als Hintergrundbild gesetzt, damit der
   Ausschnitt ohne Kenntnis der Bildmasse sitzt.
   Die Breite ist das Kleinere aus «passt in die Kachel» und «so breit, wie das
   Seitenverhältnis bei voller Höhe wäre»; die Höhe folgt daraus. Nur so bleibt
   das Bild in beiden Richtungen unverzerrt — mit height:100% wurden breite
   Ausschnitte gestaucht, mit width:100% die hohen. --h ist dieselbe Höhe, die
   ein <img> in dieser Kachel hätte. */
.ausschnitt {
  --h: 108px;
  position: relative; display: block;
  width: min(100%, calc(var(--ar) * var(--h)));
  height: auto; aspect-ratio: var(--ar);
  background-repeat: no-repeat;
}
.sym.big .ausschnitt { --h: 160px; }
.sym.big.karte .ausschnitt { --h: 300px; }
.answer.breit .ausschnitt, .wrong-cell .ausschnitt { --h: 60px; }
.sym.big {
  width: 190px; height: 190px; margin: 0 auto 14px;
  border: 1px solid var(--line); padding: 14px;
}
.sym.big img { max-height: 160px; }
/* Kartenausschnitt: mehr Fläche als ein Symbol, und der weisse Kartengrund
   soll nicht als Fleck auf der getönten Kachel stehen. */
.sym.big.karte {
  width: 100%; height: auto; min-height: 210px;
  background: #fff; padding: 10px;
}
.sym.big.karte img { max-height: 300px; }

.question { font-size: 17px; margin: 0; }
.question.big-q { font-size: 27px; font-weight: 600; margin: 26px 0 4px; }
.question.sub { color: var(--muted); font-size: 15px; margin-bottom: 4px; }

#answers.as-text { display: flex; flex-direction: column; gap: 10px; }
/* Postenbeschriebe sind breite Kästchen — untereinander, nicht im Gitter. */
#answers.as-breit { display: flex; flex-direction: column; gap: 10px; }
.answer.breit { padding: 10px 12px; }
.answer.breit .sym { width: 100%; height: auto; background: #fff; }
.answer.breit .sym img { max-height: 60px; width: auto; }

/* Karte und Geländeansicht nebeneinander, wie in der Norm. Der Rahmen steckt
   schon im Bild, hier kommt nur der weisse Grund dazu. */
.karte-frage img {
  max-width: 100%; max-height: 300px;
  display: block; margin: 0 auto 8px;
  background: #fff; border-radius: 8px;
}
#answers.as-sym { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.answer {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.answer:hover:not(:disabled) { border-color: var(--green-l); }
.answer:disabled { cursor: default; }

.sym-answer { display: flex; align-items: center; justify-content: center; padding: 12px; }
.sym-answer .sym { width: 100%; height: 118px; }
.sym-answer .sym img { max-height: 108px; }

/* Kräftige Markierung: Der duenne 1-px-Rand war auf dem Handy im Hellen kaum
   zu sehen. Der Rahmen liegt als Innenschatten auf, damit die Kachel beim
   Markieren nicht springt. (Gunter, 08.09.2026) */
.answer.right {
  border-color: var(--ok);
  background: #dcefe3;
  box-shadow: inset 0 0 0 4px var(--ok);
}
.answer.wrong {
  border-color: var(--no);
  background: #f7dcdc;
  box-shadow: inset 0 0 0 4px var(--no);
}

#feedback {
  position: sticky; bottom: 0;
  background: var(--sand);
  padding: 16px 0 max(16px, env(safe-area-inset-bottom));
  margin-top: 20px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
#feedback-text { font-size: 15px; }
.ok { color: var(--ok); font-weight: 600; }
.no { color: var(--no); font-weight: 600; }
.code { color: var(--muted); font-size: 13px; }

button#next-btn, button#again-btn {
  background: var(--green); color: #fff; border: 0;
  border-radius: 10px; padding: 12px 22px;
  font: inherit; font-size: 16px; cursor: pointer; flex: none;
}

.ghost {
  background: transparent; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 15px;
  font: inherit; font-size: 14px; cursor: pointer; color: var(--muted);
}
header .ghost { border-color: rgba(255,255,255,.4); color: #fff; }

/* ------------------------------------------------------------ Fortschritt */

#whoami {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 17px; margin-bottom: 18px;
}
#whoami strong { display: block; font-size: 17px; }
#whoami span { color: var(--muted); font-size: 13.5px; }

.minibar {
  position: relative;
  height: 6px; background: var(--line); border-radius: 3px;
  overflow: hidden; margin: 9px 0 5px;
}
/* u = schon gefragt (hell), i = sitzt (voll). Beide vom linken Rand her. */
.minibar u, .minibar i {
  display: block; position: absolute; left: 0; top: 0; height: 100%;
}
.minibar u { background: #adcbbd; }
.minibar i { background: var(--green-l); }
.minibar.big { height: 10px; margin: 10px 0 18px; }

.wide-ghost { width: 100%; padding: 13px; margin-top: 4px; }

#progress h3 { font-size: 16px; margin: 26px 0 0; }
#train-shaky {
  background: var(--green); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 20px; font: inherit; font-size: 15px; cursor: pointer;
  margin: 4px 0 10px;
}
#progress-back { margin-top: 22px; }

.family { margin-top: 12px; }
.family-row {
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 15px; margin-bottom: 9px;
}
.family-row strong { display: block; font-size: 15.5px; }
.family-row span { color: var(--muted); font-size: 13px; }
/* Orange statt Rot: Rot heisst im Quiz "falsch". */
.family-row .nie-da { color: #c0650f; font-style: normal; font-weight: 600; }
.family-row .live { color: var(--ok); font-style: normal; font-weight: 600; }

/* ------------------------------------------------------------ Bild grösser */

/* Symbole sind auf dem Handy klein, Details wie die Strichelung eines Pfads
   kaum zu sehen. Ein Tipp aufs Bild legt es gross über die Seite.
   (Gunter, 08.09.2026) */
#lupe {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(20, 20, 18, .82);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
#lupe img {
  max-width: 100%; max-height: 100%;
  background: #eeece6;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
}
.zoombar { cursor: zoom-in; }

/* ---------------------------------------------------------------- Zugänge */

.access-h { font-size: 16px; margin: 22px 0 8px; }

.feld {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  margin-bottom: 10px;
  color: inherit;
}
/* Der Zugangslink: zum Antippen und Kopieren, nicht zum Lesen. */
.feld.link { font-size: 12.5px; color: var(--muted); margin: 9px 0 0; }

.zeilen-label {
  display: block; margin-top: 12px;
  font-size: 12.5px; color: var(--muted);
}
.zeilen-seg { margin-top: 9px; }
.zeilen-seg button { font-size: 13px; padding: 7px 9px; }

.code-link { word-break: break-all; color: var(--green-l); }

/* ----------------------------------------------------------------- Bilanz */

#result { text-align: center; }
#result-mark { font-size: 52px; line-height: 1; margin: 18px 0 6px; }
#result-mark.good { color: var(--ok); }
#result-mark.meh { color: var(--muted); }
#result h2 { margin: 0 0 4px; font-size: 23px; }

.wrong-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px; margin: 14px 0 26px;
}
.wrong-cell { font-size: 12px; color: var(--muted); }
.wrong-cell .sym { height: 74px; border: 1px solid var(--line); padding: 7px; margin-bottom: 5px; }
.wrong-cell .sym img { max-height: 60px; }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

footer {
  border-top: 1px solid var(--line);
  padding: 16px;
  text-align: center;
}
footer p { color: var(--muted); font-size: 11.5px; margin: 0; line-height: 1.6; }
footer a { color: var(--muted); }

@media (max-width: 380px) {
  .sym.big { width: 158px; height: 158px; }
  #answers.as-sym { gap: 9px; }
}

/* ------------------------------------------------ Geländefoto nach Antwort */

#foto {
  margin: 18px 0 4px;
  text-align: center;
}
#foto img {
  max-width: 100%;
  max-height: 210px;
  border-radius: 11px;
  border: 1px solid var(--line);
  display: block;
  margin: 0 auto 6px;
}
#foto span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

/* Geländeaufnahme als Frage */
.foto-frage img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
  margin: 0 auto 10px;
}

/* Nach einer richtigen Antwort bleibt eine einzige Kachel stehen — die gehört
   mittig, nicht in die linke Spalte des Gitters. */
#answers.solo { display: flex; justify-content: center; }
#answers.as-sym.solo .answer { width: min(62%, 230px); }
#answers.as-text.solo .answer { width: 100%; text-align: center; }

/* Hinweis zum Ablegen auf dem Home-Bildschirm. Er steht unter den Sets, weil
   er einmal gebraucht wird und danach nie wieder. (Gunter, 10.09.2026) */
#hs-tipp {
  margin: 22px 0 4px;
  padding: 14px 16px;
  border: 1px solid #d8ded9;
  border-radius: 12px;
  background: #f6f9f7;
}
#hs-tipp p { margin: 0 0 6px; }
#hs-tipp .hint { margin-bottom: 10px; }

/* Rechenaufgaben aus dem PISTE-Test: Massstab, Strecke und Frage stehen
   untereinander, so wie auf dem Testblatt. */
.question.aufgabe { white-space: pre-line; line-height: 1.35; font-size: 22px; }
.weg { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }

/* Kartenausschnitte als Antwort: mehr Fläche als ein Symbol und weisser
   Grund, damit der Kartenausschnitt nicht auf getöntem Feld schwimmt. */
.sym-answer .sym.karte { height: 150px; background: #fff; }
.sym-answer .sym.karte img { max-height: 140px; }

/* Hinweis Adresswechsel (05.12.2026) */
.umzug{margin:.8rem 1rem;padding:.9rem 1rem;border-radius:12px;background:#fff4d6;border:1px solid #e8b84a;color:#4a3800;line-height:1.45}
.umzug-link{display:flex;gap:.5rem;margin:.6rem 0}
.umzug-link input{flex:1;min-width:0;padding:.45rem .6rem;border:1px solid #d9c27a;border-radius:8px;font-size:.9rem;background:#fff}
.umzug button{padding:.45rem .8rem;border-radius:8px}
