:root {
  --papier: #f3ead8;
  --karte: #fffaf0;
  --tinte: #2b2118;
  --tinte-leise: #6d5f52;
  --pflaume: #5a2650;
  --pflaume-dunkel: #43193b;
  --gold: #d99a00;
  --gold-hell: #fbe9b5;
  --gruen: #2f7d4f;
  --rot: #b3261e;
  --linie: #e2d5bd;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--tinte);
  background:
    radial-gradient(120% 60% at 50% 0%, #fbf5e6 0%, transparent 70%),
    var(--papier);
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
h2 { font-size: clamp(1.5rem, 6.5vw, 2rem); }
p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 5;
  background: var(--pflaume);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + .5rem) 1rem .6rem;
  box-shadow: 0 2px 10px rgb(43 33 24 / .18);
}
.kopf-zeile { display: flex; align-items: center; gap: .75rem; max-width: 34rem; margin: 0 auto; }
.kopf-titel { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf-punkte { font-variant-numeric: tabular-nums; font-weight: 600; background: rgb(255 255 255 / .16); padding: .15rem .6rem; border-radius: 99px; font-size: .95rem; white-space: nowrap; }
.kopf-menue { background: none; border: 0; color: inherit; padding: .5rem; margin: -.5rem -.5rem -.5rem 0; min-width: 44px; min-height: 44px; display: grid; place-items: center; cursor: pointer; border-radius: 10px; }
.fortschritt { list-style: none; display: flex; gap: 5px; padding: 0; margin: .55rem auto 0; max-width: 34rem; }
.fortschritt li { flex: 1; height: 5px; border-radius: 3px; background: rgb(255 255 255 / .25); }
.fortschritt li.fertig { background: var(--gold); }
.fortschritt li.jetzt { background: #fff; }

/* ---------- Bühne ---------- */
.buehne {
  max-width: 34rem; margin: 0 auto;
  padding: 1.25rem 1rem calc(env(safe-area-inset-bottom) + 2.5rem);
}
.laden { text-align: center; color: var(--tinte-leise); padding: 4rem 0; }
.szene { display: grid; gap: 1.1rem; animation: rein .35s ease-out both; }
@keyframes rein { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .szene, .wackeln { animation: none !important; } }

.dach { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--pflaume); font-weight: 700; }
.geschichte { font-family: var(--serif); font-style: italic; font-size: 1.12rem; color: var(--tinte-leise); }
.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: 0 6px 20px rgb(43 33 24 / .07);
  display: grid; gap: 1rem;
}
.aufgabe { font-size: 1.15rem; font-weight: 600; text-wrap: pretty; }
.bild { margin: 0; border-radius: 14px; overflow: hidden; background: var(--linie); border: 1px solid var(--linie); }
.bild img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #1d1712; }
.bild.platz { aspect-ratio: 4 / 3; }

/* ---------- Eingaben ---------- */
.feld {
  width: 100%; font: inherit; font-size: 1.2rem; color: var(--tinte);
  padding: .85rem 1rem; border-radius: 12px;
  border: 2px solid var(--linie); background: #fff;
}
.feld:focus { outline: none; border-color: var(--pflaume); box-shadow: 0 0 0 3px rgb(90 38 80 / .18); }
.feld.falsch { border-color: var(--rot); }
.knopf {
  text-decoration: none;
  appearance: none; width: 100%; min-height: 54px;
  font: inherit; font-weight: 700; font-size: 1.08rem;
  padding: .8rem 1.1rem; border-radius: 14px; border: 2px solid transparent;
  background: var(--pflaume); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-align: center;
  transition: transform .08s, background .15s;
}
.knopf:active { transform: scale(.98); background: var(--pflaume-dunkel); }
.knopf:disabled { opacity: .55; cursor: default; }
.knopf-zweit { background: transparent; color: var(--pflaume); border-color: var(--pflaume); }
.knopf-zweit:active { background: rgb(90 38 80 / .08); }
.knopf-gold { background: var(--gold); color: #2b2118; }
.knopf-gold:active { background: #c38a00; }
.knopf-leise { background: none; border: 0; color: var(--tinte-leise); font-weight: 500; font-size: .98rem; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.knopf-leise:active { background: none; color: var(--tinte); }
.reihe { display: grid; gap: .7rem; }
.reihe.zwei { grid-template-columns: 1fr 1fr; }
.meldung { min-height: 1.5em; font-weight: 600; color: var(--rot); }
.meldung.gut { color: var(--gruen); }
.wackeln { animation: wackeln .35s; }
@keyframes wackeln { 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

.optionen { display: grid; gap: .6rem; }
.option { background: #fff; color: var(--tinte); border-color: var(--linie); justify-content: flex-start; text-align: left; font-weight: 600; }
.option:active { background: var(--gold-hell); }
.option.daneben { opacity: .5; text-decoration: line-through; border-color: var(--rot); }

/* ---------- Tipps ---------- */
.tipps { display: grid; gap: .6rem; }
.tipp { background: var(--gold-hell); border-radius: 12px; padding: .75rem .9rem; border-left: 4px solid var(--gold); }
.tipp b { display: block; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: #7a5600; }
.hilfe { display: grid; gap: .2rem; justify-items: center; margin-top: .3rem; }

/* ---------- Ort ---------- */
.ort { border-top: 1px dashed var(--linie); padding-top: .9rem; display: grid; gap: .6rem; }
.ort-name { font-weight: 700; }
.ort-wert { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--pflaume); font-variant-numeric: tabular-nums; }
.ort-klein { font-size: .9rem; color: var(--tinte-leise); }

/* ---------- Rückblick / Finale ---------- */
.stempel { justify-self: start; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; padding: .3rem .8rem; border-radius: 99px; background: var(--gruen); color: #fff; }
.stempel.neutral { background: var(--tinte-leise); }
.loesung { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; }
.punkteplus { font-weight: 700; color: var(--gruen); }
.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: clamp(1.4rem, 7vw, 2rem); font-weight: 700;
  letter-spacing: .12em; text-align: center; padding: 1rem .5rem; border-radius: 14px;
  background: var(--pflaume); color: var(--gold-hell); overflow-wrap: anywhere;
}
.werte { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; text-align: center; }
.werte div { background: #fff; border: 1px solid var(--linie); border-radius: 12px; padding: .7rem .3rem; }
.werte b { display: block; font-family: var(--serif); font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.werte span { font-size: .8rem; color: var(--tinte-leise); }
.galerie { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.galerie a { display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--linie); }
.galerie img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vorschau { border-radius: 14px; overflow: hidden; }
.vorschau img { width: 100%; display: block; max-height: 55vh; object-fit: contain; background: #1d1712; }
.klein { font-size: .88rem; color: var(--tinte-leise); }
.klein li { margin-bottom: .3rem; }
.klein ul { padding-left: 1.1rem; margin: .3rem 0 0; }

/* ---------- Start ---------- */
.start { padding-top: 8vh; text-align: center; justify-items: center; }
.start .karte { text-align: left; width: 100%; }
.emblem { width: 92px; height: 92px; }

/* ---------- Menü ---------- */
.menue { border: 0; border-radius: 18px; padding: 1.3rem; width: min(92vw, 26rem); color: var(--tinte); background: var(--karte); }
.menue::backdrop { background: rgb(43 33 24 / .55); }
.menue h2 { margin-bottom: .8rem; }
.menue .knopf { margin-top: .7rem; }
.menue-info { color: var(--tinte-leise); font-size: .95rem; }
