/* Rätselrallye Korneuburg – mobile first, kindgerecht, ohne externe Ressourcen */

:root {
  --hintergrund: #fff8e1;
  --text: #1f1f1f;
  --text-leise: #4a4a4a;
  --karte: #ffffff;
  --rand: #eadfbf;
  --lila: #6a1b9a;
  --blau: #1565c0;
  --blau-dunkel: #0d3c80;
  --gruen: #2e7d32;
  --gruen-dunkel: #1b4d1f;
  --rot: #c62828;
  --gelb: #ffd54f;
  --orange: #ef6c00;
  --radius: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--hintergrund);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blau); }
h1, h2 { line-height: 1.25; }
h1 { font-size: 1.6rem; margin: .4em 0 .5em; }
h2 { font-size: 1.3rem; margin: 0 0 .3em; }
p { margin: 0 0 .8em; }

:focus-visible {
  outline: 4px solid var(--orange);
  outline-offset: 3px;
}

/* ---------- Kopf, Inhalt, Fuß ---------- */

.kopf {
  background: var(--lila);
  color: #fff;
  box-shadow: 0 4px 0 #4a1270;
}
.kopf-innen {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 16px;
}
.logo {
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
}

.inhalt {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 24px;
}

.fuss {
  text-align: center;
  padding: 8px 16px 32px;
  font-size: .9rem;
  color: var(--text-leise);
}
.fuss a {
  display: inline-block;
  padding: 12px 8px;
  color: var(--text-leise);
}

/* ---------- Karten & Boxen ---------- */

.karte {
  background: var(--karte);
  border: 3px solid var(--rand);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.box {
  border-radius: 14px;
  padding: 12px 16px;
  margin: 0 0 16px;
  border: 3px solid;
}
.box p:last-child { margin-bottom: 0; }
.box-fehler { background: #ffebee; border-color: var(--rot); color: #7f1010; }
.box-erfolg { background: #e8f5e9; border-color: var(--gruen); color: #12401a; }
.box-info   { background: #fff3c4; border-color: #e6c200; }
.klein { font-size: .85rem; }

.debug {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .8rem;
  background: #f5f5f5;
  padding: 10px;
  border-radius: 8px;
}

/* ---------- Knöpfe ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  width: 100%;
  min-height: 56px;
  padding: 12px 20px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--blau);
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--blau-dunkel);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--blau-dunkel); }
.btn-gruen { background: var(--gruen); box-shadow: 0 5px 0 var(--gruen-dunkel); }
.btn-gruen:active { box-shadow: 0 1px 0 var(--gruen-dunkel); }
.btn-hell {
  background: #fff;
  color: var(--blau);
  border: 3px solid var(--blau);
}
.btn[disabled] { opacity: .6; cursor: default; }

.knoepfe { display: grid; gap: 14px; }
.knoepfe form { margin: 0; }

.wechsel { text-align: center; margin-top: 8px; }
.wechsel .btn { margin-top: 8px; }

.abmelden { margin-top: 28px; }

/* ---------- Formulare ---------- */

.formular label {
  display: block;
  font-weight: 800;
  margin: 18px 0 6px;
}
.formular .optional { font-weight: 400; color: var(--text-leise); }

.formular input[type="text"],
.formular input[type="password"],
.formular input[type="email"] {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  font: inherit;
  font-size: 18px; /* mind. 16px, damit iOS beim Antippen nicht hineinzoomt */
  color: var(--text);
  background: #fff;
  border: 3px solid #bdb398;
  border-radius: 14px;
}
.formular input:focus { border-color: var(--blau); }
.formular .btn { margin-top: 22px; }
.formular + .feldhinweis { margin-top: 18px; }

.feldhinweis {
  font-size: .85rem;
  color: var(--text-leise);
  margin: 6px 0 0;
}
.zentriert { text-align: center; }

/* ---------- Rallye-Übersicht ---------- */

.rallye-karte {
  background: var(--karte);
  border: 3px solid var(--rand);
  border-top: 10px solid var(--orange);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.rallye-karte:nth-of-type(3n+2) { border-top-color: var(--blau); }
.rallye-karte:nth-of-type(3n+3) { border-top-color: var(--gruen); }

.rallye-bild {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #eee;
}
.rallye-text { padding: 16px 18px 20px; }
.startort { font-weight: 700; color: var(--text-leise); }

.status {
  font-weight: 800;
  margin: 12px 0 8px;
}
.status-fertig {
  display: inline-block;
  color: #fff;
  background: var(--gruen);
  padding: 4px 14px;
  border-radius: 99px;
}
.abzeichen {
  font-size: .7rem;
  vertical-align: middle;
  background: #ddd;
  padding: 2px 8px;
  border-radius: 99px;
}

/* ---------- Fortschrittsbalken ---------- */

.fortschritt {
  height: 20px;
  background: #ffe9a8;
  border: 2px solid #e8c95c;
  border-radius: 99px;
  overflow: hidden;
}
.fortschritt.klein { height: 14px; margin-bottom: 16px; }
.fortschritt-balken {
  height: 100%;
  background: linear-gradient(90deg, #66bb6a, var(--gruen));
  border-radius: 99px;
  transition: width .4s;
}
.fortschritt-text {
  text-align: center;
  font-weight: 800;
  color: var(--text-leise);
  margin: 6px 0 14px;
}

/* ---------- Fragen ---------- */

.wegweiser {
  background: var(--gelb);
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
}

.karte-ort { display: grid; gap: 12px; margin-bottom: 18px; }
.karte-rahmen {
  display: block;
  width: 100%;
  height: 260px;
  border: 3px solid var(--rand);
  border-radius: var(--radius);
}

.frage-bild {
  width: 100%;
  border-radius: var(--radius);
  border: 3px solid var(--rand);
  margin-bottom: 8px;
}

.frage {
  font-size: 1.45rem;
  margin: 16px 0;
}

.antworten { display: grid; gap: 16px; }
.antworten-farben { grid-template-columns: repeat(3, 1fr); gap: 12px; }

.antwort {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 64px;
  padding: 14px;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  background: #fff;
  border: 4px solid #cfc3a3;
  border-radius: var(--radius);
  box-shadow: 0 5px 0 #b5a77f;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .08s, box-shadow .08s, opacity .3s;
}
.antwort:active:not([disabled]) { transform: translateY(4px); box-shadow: 0 1px 0 #b5a77f; }
.antwort[disabled] { cursor: default; }

.antwort-farbe { padding: 10px; }
.farbfeld {
  display: block;
  width: 100%;
  height: 84px;
  border-radius: 10px;
  border: 2px solid rgba(0, 0, 0, .25);
}
.antwort-label { font-size: .95rem; }

.antwort-bild { padding: 8px; }
.antwort-bild img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 10px;
}

/* Richtig / falsch */
.antwort.richtig {
  border-color: var(--gruen);
  background: #e8f5e9;
  box-shadow: 0 5px 0 var(--gruen-dunkel);
  animation: hupfen .7s ease;
}
.antwort.falsch {
  border-color: var(--rot);
  background: #ffebee;
  box-shadow: none;
  opacity: .5;
}
.antwort.richtig::after,
.antwort.falsch::after {
  position: absolute;
  top: -14px;
  right: -10px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  border: 3px solid #fff;
}
.antwort.richtig::after { content: "✓"; background: var(--gruen); }
.antwort.falsch::after  { content: "✗"; background: var(--rot); }
.antwort.wackeln { animation: wackeln .5s ease; }
.antworten.geloest .antwort:not(.richtig) { opacity: .35; }

.meldung {
  min-height: 1.6em;
  margin: 18px 0 10px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
}
.meldung.gut { color: var(--gruen); }
.meldung.schlecht { color: var(--rot); }

.tipp {
  background: #e3f2fd;
  border: 3px dashed var(--blau);
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
}

.erklaerung {
  background: #e8f5e9;
  border: 3px solid var(--gruen);
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
}

.btn-weiter { margin-top: 8px; animation: hereinschweben .4s ease; }

.zurueck { margin-top: 24px; text-align: center; }
.zurueck a { display: inline-block; padding: 12px; }

/* ---------- Abschluss & Urkunde ---------- */

.abschluss-titel {
  text-align: center;
  font-size: 2rem;
  color: var(--lila);
  animation: hupfen 1s ease;
}
.abschluss-text { text-align: center; font-size: 1.15rem; font-weight: 700; }

.urkunde {
  margin: 24px 0 12px;
  padding: 28px 20px;
  text-align: center;
  background: #fffdf3;
  border: 8px double #c9a227;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}
.urkunde p { margin: 0 0 .5em; }
.urkunde h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.3rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #8a6a00;
  margin: 4px 0 14px;
}
.urkunde-sterne { font-size: 1.6rem; }
.urkunde-name {
  display: inline-block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--lila);
  border-bottom: 3px solid #c9a227;
  padding: 0 12px;
  word-break: break-word;
}
.urkunde-rallye { font-size: 1.3rem; font-weight: 800; }
.urkunde-datum { margin-top: 16px !important; font-weight: 700; }
.urkunde-fuss { font-size: .85rem; color: var(--text-leise); }

/* ---------- Rechtliche Seiten ---------- */

.text-seite h2 { font-size: 1.15rem; margin-top: 1.4em; }
.text-seite ul { padding-left: 1.2em; }
.text-seite li { margin-bottom: .4em; }
.ausfuellen { background: #ffeb3b; font-weight: 800; padding: 0 4px; }

/* ---------- Animationen ---------- */

@keyframes wackeln {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-2deg); }
  40% { transform: translateX(10px) rotate(2deg); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(7px); }
}

@keyframes hupfen {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.1); }
  50%  { transform: scale(.96); }
  70%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes hereinschweben {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sterne, die bei einer richtigen Antwort herausfliegen */
.stern {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  font-size: 1.7rem;
  transform: translate(-50%, -50%);
  animation: fliegen .9s ease-out forwards;
}
@keyframes fliegen {
  to {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.4);
    opacity: 0;
  }
}

/* Konfetti auf der Abschluss-Seite */
.konfetti {
  position: fixed;
  top: -24px;
  z-index: 50;
  width: 10px;
  height: 16px;
  pointer-events: none;
  animation: fallen 4s linear forwards;
}
@keyframes fallen {
  to { transform: translate(var(--drift), 110vh) rotate(var(--dreh)); }
}

/* Wer weniger Bewegung eingestellt hat, bekommt keine Animationen */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
}

/* ---------- Ratzi-Szene (nach der richtigen Antwort, Feld "ratzi") ---------- */

.ratzi-buehne { margin: 18px 0 8px; }
.ratzi-szene {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 4.6;
  background: #ddf0f4;
  border: 3px solid var(--rand);
  border-radius: var(--radius);
}
.ratzi-hintergrund { position: absolute; inset: 0; width: 100%; height: 100%; }
.ratzi-figur { position: absolute; left: 50%; bottom: 6%; width: 62%; transform: translateX(-50%); }
.ratzi-figur svg { display: block; width: 100%; height: auto; overflow: visible; }
.ratzi-pose { display: none; }
.ratzi-pose.an { display: inline; }
.ratzi-wippen { animation: ratzi-wippen 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
.ratzi-figur.spricht .ratzi-wippen { animation-duration: .45s; }
@keyframes ratzi-wippen { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-4px) scaleY(.985); } }

.ratzi-blase {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 5%;
  min-height: 3.2em;
  padding: 12px 14px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: #16393b;
  background: #fff;
  border: 3px solid #127e83;
  border-radius: 18px;
  opacity: 0;
  transform: translateY(-6px) scale(.97);
  transition: opacity .2s, transform .2s;
}
.ratzi-blase.an { opacity: 1; transform: none; }
.ratzi-blase::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-right: 3px solid #127e83;
  border-bottom: 3px solid #127e83;
  transform: translateX(-50%) rotate(45deg);
}

.ratzi-welle { animation: ratzi-welle 3s ease-in-out infinite; }
.ratzi-welle2 { animation: ratzi-welle 3.6s ease-in-out infinite reverse; }
@keyframes ratzi-welle { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-18px); } }
.ratzi-schiff { animation: ratzi-schiff 14s linear infinite; }
@keyframes ratzi-schiff { from { transform: translateX(-120px); } to { transform: translateX(520px); } }
#ratzi-spritzer { opacity: 0; }
#ratzi-spritzer.los { animation: ratzi-spritzer .9s ease-out forwards; }
@keyframes ratzi-spritzer {
  0% { opacity: 0; transform: translateY(60px) scale(.6); }
  35% { opacity: 1; transform: translateY(-10px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-40px) scale(1); }
}

.ratzi-knoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.ratzi-knoepfe .btn { min-height: 48px; font-size: 1rem; }

@media (prefers-reduced-motion: reduce) {
  .ratzi-wippen, .ratzi-welle, .ratzi-welle2, .ratzi-schiff { animation: none; }
}

/* ---------- Fußzeile: Projekt & Sponsor ---------- */

.fuss-projekt { margin: 0 0 4px; }

/* ---------- Startseite (body.breit) ---------- */

.breit .kopf-innen,
.breit .inhalt { max-width: 1040px; }
.kopf-innen { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kopf-link {
  flex-shrink: 0;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  padding: 6px 16px;
  border: 2px solid rgba(255, 255, 255, .7);
  border-radius: 99px;
}
.kopf-link:hover { background: rgba(255, 255, 255, .15); }

.held {
  display: grid;
  gap: 24px;
  margin: 8px 0 40px;
}
.dachzeile {
  display: inline-block;
  margin: 0 0 6px;
  padding: 4px 14px;
  font-size: .85rem;
  font-weight: 800;
  color: #0c5e62;
  background: #c9ecea;
  border-radius: 99px;
}
.held h1 {
  font-size: clamp(1.75rem, 6vw, 2.6rem);
  line-height: 1.15;
  margin: .2em 0 .45em;
  color: #3d0f5c;
}
.held-einleitung { font-size: 1.1rem; color: var(--text-leise); }
.merkmale {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 4px 0 22px;
  list-style: none;
}
.merkmale li {
  padding: 6px 14px;
  font-weight: 700;
  font-size: .95rem;
  background: #fff;
  border: 2px solid var(--rand);
  border-radius: 99px;
}
.held-knoepfe { display: grid; gap: 14px; }
.held-ratzi { order: -1; margin: 0; width: 100%; max-width: 300px; justify-self: center; }

.abschnitt { margin: 0 0 48px; }
.abschnitt-titel {
  font-size: clamp(1.4rem, 4.5vw, 1.9rem);
  color: #3d0f5c;
  margin-bottom: 18px;
}
.abschnitt h3 { font-size: 1.1rem; margin: 0 0 .3em; line-height: 1.3; }

/* So funktioniert's */
.schritte {
  display: grid;
  gap: 16px;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: schritt;
}
.schritt {
  position: relative;
  counter-increment: schritt;
  background: var(--karte);
  border: 3px solid var(--rand);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
}
.schritt::before {
  content: counter(schritt);
  position: absolute;
  top: -12px;
  left: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: var(--orange);
  border-radius: 50%;
  border: 3px solid var(--hintergrund);
}
.schritt:nth-child(2)::before { background: var(--blau); }
.schritt:nth-child(3)::before { background: #127e83; }
.schritt:nth-child(4)::before { background: var(--gruen); }
.schritt-bild { display: block; font-size: 2.2rem; line-height: 1; margin: 4px 0 10px; }
.schritt p { margin: 0; color: var(--text-leise); }

/* Rallye-Vorschau */
.vorschau-liste { display: grid; gap: 20px; }
.vorschau { margin: 0; }
.abzeichen-gross {
  display: inline-block;
  margin: 0;
  padding: 4px 14px;
  font-weight: 800;
  background: #fff3c4;
  border-radius: 99px;
}
.vorschau-bald {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 20px;
  text-align: center;
  border: 3px dashed #cfc3a3;
  border-radius: var(--radius);
  color: var(--text-leise);
}
.vorschau-bald span { font-size: 2.6rem; }
.vorschau-bald p { margin: 0; }

/* Wie alles begann + Sponsor */
.geschichte {
  display: grid;
  gap: 20px;
  padding: 24px 20px;
  background: #ddf0f4;
  border-radius: 24px;
}
.geschichte-text p { font-size: 1.05rem; }
.unterschrift {
  margin: 16px 0 0;
  font-weight: 800;
  font-style: italic;
  color: #0c5e62;
}
.sponsor {
  align-self: start;
  padding: 20px;
  background: #fff;
  border: 3px solid #127e83;
  border-radius: var(--radius);
}
.sponsor p { margin: 0 0 .5em; }
.sponsor p:last-child { margin: 0; color: var(--text-leise); font-size: .95rem; }
.sponsor-dach {
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-leise);
}
.sponsor-name { font-size: 1.5rem; font-weight: 800; color: #0c5e62; }

/* Eltern */
.eltern-raster { display: grid; gap: 14px; }
.eltern-punkt {
  padding: 16px 18px;
  background: var(--karte);
  border-left: 6px solid var(--lila);
  border-radius: 12px;
}
.eltern-punkt p { margin: 0; color: var(--text-leise); }

/* Anmelden */
.anmelden { max-width: 480px; margin-left: auto; margin-right: auto; scroll-margin-top: 16px; }
.anmelden h2 { font-size: 1.5rem; margin-top: .2em; }

@media (min-width: 600px) {
  .held-knoepfe { display: flex; flex-wrap: wrap; }
  .held-knoepfe .btn { width: auto; flex: 1 1 auto; white-space: nowrap; }
  .schritte, .eltern-raster, .vorschau-liste { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 860px) {
  .held { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 40px; margin-top: 24px; }
  .held-ratzi { order: 0; max-width: 420px; }
  .schritte { grid-template-columns: repeat(4, 1fr); }
  .geschichte { grid-template-columns: 1.6fr 1fr; padding: 36px; gap: 36px; }
  .vorschau-liste { grid-template-columns: repeat(3, 1fr); }
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
