/* Wissenstest Station 2 – große Schrift, große Knöpfe, gut mit dem Finger bedienbar */
:root {
    --rot: #c0392b;
    --rot-dunkel: #a93226;
    --rot-hell: #fdecea;
    --gruen: #1e8449;
    --gruen-hell: #e3f5ea;
    --orange: #d35400;
    --text: #1f2933;
    --grau: #6b7280;
    --linie: #e5e7eb;
    --flaeche: #ffffff;
    --hintergrund: #f4f4f5;
    --radius: 16px;
    --schatten: 0 2px 10px rgba(0, 0, 0, .07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--hintergrund); color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 19px; line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Kopfzeilen */
.kopf {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 8px;
    background: var(--rot); color: #fff; padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
}
.kopf h1 { flex: 1; margin: 0; font-size: 1.1rem; text-align: center; font-weight: 700; }
.zurueck, .zurueck-platz { width: 44px; height: 44px; flex: none; }
.zurueck {
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; line-height: 1; text-decoration: none; border-radius: 12px; padding-bottom: 4px;
}
.zurueck:active { background: rgba(255, 255, 255, .2); }

.start-kopf {
    background: linear-gradient(160deg, var(--rot) 0%, #8e2a1f 100%); color: #fff;
    text-align: center; padding: 28px 16px 36px; padding-top: max(28px, env(safe-area-inset-top));
    border-radius: 0 0 28px 28px;
}
.start-kopf h1 { margin: 6px 0 2px; font-size: 1.7rem; }
.start-kopf p { margin: 0; opacity: .9; }
.start-logo { font-size: 3rem; line-height: 1; }

.inhalt { max-width: 760px; margin: 0 auto; padding: 18px 16px 48px; padding-bottom: max(48px, env(safe-area-inset-bottom)); }

/* Knöpfe */
.knopf {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 58px; margin: 10px 0; padding: 12px 18px;
    background: var(--rot); color: #fff; border: 0; border-radius: var(--radius);
    font-size: 1.05rem; font-weight: 700; text-decoration: none; text-align: center; cursor: pointer;
    box-shadow: var(--schatten); transition: transform .08s, background .15s;
    touch-action: manipulation;
}
.knopf:active { transform: scale(.98); }
.knopf:hover { background: var(--rot-dunkel); }
.knopf:disabled { background: #d1d5db; color: #6b7280; cursor: default; box-shadow: none; transform: none; }
.knopf.hell { background: var(--flaeche); color: var(--text); border: 2px solid var(--linie); box-shadow: none; }
.knopf.hell:hover { background: #fafafa; }
.knopf.gruen { background: var(--gruen); }
.knopf.orange { background: var(--orange); }
.knopf.rot { background: var(--rot); }
.knopf.rot-text { color: var(--rot); }
.knopfreihe { display: flex; gap: 10px; }
.knopfreihe > * { flex: 1; }
.knopf:focus-visible, .stufe-kachel:focus-visible, .modus-kachel:focus-visible, .zuo-item:focus-visible, .reihe-item:focus-visible, .helm-wahl:focus-visible, .karteikarte:focus-visible {
    outline: 3px solid #2563eb; outline-offset: 2px;
}

/* Startseite */
.gruss { text-align: center; font-weight: 700; font-size: 1.15rem; margin: 6px 0 14px; }
.stufen-raster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 420px) { .stufen-raster { grid-template-columns: repeat(2, 1fr); } }
.stufe-kachel {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 130px; padding: 12px 8px; text-align: center; text-decoration: none;
    background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten);
    border: 3px solid transparent; transition: transform .08s;
}
.stufe-kachel:active { transform: scale(.97); }
.stufe-kachel:hover { border-color: var(--rot-hell); }
.stufe-kachel.aus { opacity: .5; box-shadow: none; }
.stufe-nr { font-size: 2.6rem; font-weight: 800; color: var(--rot); line-height: 1; }
.stufe-titel { font-weight: 700; font-size: .95rem; margin-top: 4px; }
.stufe-alter { font-size: .78rem; color: var(--grau); }
.stufe-stern { position: absolute; top: 6px; right: 8px; font-size: .85rem; }
.fuss { text-align: center; font-size: .8rem; color: var(--grau); margin-top: 24px; }

/* Stufen-Menü */
.beschreibung { text-align: center; color: var(--grau); margin-top: 0; }
.modus-liste { display: grid; gap: 12px; margin: 14px 0; }
.modus-kachel {
    display: flex; align-items: center; gap: 16px; padding: 18px;
    background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten);
    text-decoration: none; border: 3px solid transparent;
}
.modus-kachel:hover { border-color: var(--rot-hell); }
.modus-kachel:active { transform: scale(.99); }
.modus-kachel.aus { opacity: .45; box-shadow: none; }
.modus-kachel strong { display: block; font-size: 1.2rem; }
.modus-kachel small { display: block; color: var(--grau); font-size: .9rem; }
.modus-icon { font-size: 2.3rem; flex: none; }

/* Texte & Meldungen */
.hinweis { text-align: center; font-weight: 600; margin: 4px 0 12px; }
.klein { font-size: .85rem; color: var(--grau); }
.mitte { text-align: center; }
.meldung { background: #fff7e6; border: 2px solid #f6d48b; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.meldung.fehler { background: var(--rot-hell); border-color: #f1a9a0; }
.info-box { background: var(--flaeche); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--schatten); display: grid; gap: 6px; }
.unterueberschrift { font-size: 1.1rem; margin: 26px 0 10px; }

/* Bilder */
.kartenbild {
    display: block; width: 100%; max-height: 42vh; object-fit: contain;
    background: #fff; border-radius: 12px; margin: 0 auto 10px; user-select: none; -webkit-user-select: none;
}
.kartenbild.gross { max-height: 50vh; }
.kartenbild.klein { max-height: 22vh; }
.helm-klein { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 10px; flex: none; }

/* Karteikarte */
.karteikarte {
    display: block; width: 100%; min-height: 50vh; padding: 16px;
    background: var(--flaeche); border: 0; border-radius: 22px; box-shadow: 0 6px 22px rgba(0, 0, 0, .1);
    cursor: pointer; animation: rein .25s ease;
}
.karteikarte.umgedreht { background: #fffaf0; animation: drehen .3s ease; }
@keyframes rein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes drehen { from { transform: rotateY(90deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .karteikarte, .karteikarte.umgedreht { animation: none; } }
.karte-seite { display: flex; flex-direction: column; justify-content: center; min-height: calc(50vh - 32px); }
.karte-tipp { color: var(--grau); font-size: .9rem; }
.loesung { text-align: left; margin: 6px 0; }
.karte-seite .loesung { text-align: center; }
.loesung-zeile { display: flex; gap: 12px; align-items: center; }
.karte-seite .loesung-zeile { justify-content: center; text-align: left; }
.loesung-haupt { font-size: 1.3rem; font-weight: 800; }
.loesung-neben { color: var(--grau); font-size: .95rem; }
ol.loesung { padding-left: 1.4em; font-weight: 700; }

.uebersicht { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 12px; }
.uebersicht.klein-raster { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.uebersicht-karte { background: var(--flaeche); border-radius: 12px; padding: 10px; box-shadow: var(--schatten); text-align: center; font-size: .9rem; }
.uebersicht-karte img { width: 100%; height: 120px; object-fit: contain; }
.uebersicht.klein-raster img { height: 80px; }
.uebersicht-karte small { display: block; color: var(--grau); }
.uebersicht-karte .loesung-haupt { font-size: 1rem; }
.uebersicht-karte .loesung-zeile { flex-direction: column; text-align: center; }

/* Aufgaben */
.fortschritt { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--grau); margin-bottom: 12px; }
.balken { position: relative; flex: 1; height: 10px; background: var(--linie); border-radius: 99px; overflow: hidden; }
.balken.gross { height: 18px; margin: 14px 0 6px; overflow: visible; }
.balken-voll { height: 100%; background: var(--rot); border-radius: 99px; transition: width .3s; }
.balken-voll.gut { background: var(--gruen); }
.balken-marke { position: absolute; top: -5px; bottom: -5px; width: 3px; background: var(--text); border-radius: 2px; }
.aufgabe { animation: rein .2s ease; }
.frage { font-size: 1.25rem; text-align: center; margin: 4px 0 12px; }
.optionen { display: grid; gap: 4px; }
.knopf.option { background: var(--flaeche); color: var(--text); border: 3px solid var(--linie); box-shadow: none; margin: 4px 0; }
.knopf.option:hover { border-color: var(--rot); background: var(--flaeche); }
.knopf.option:disabled { opacity: .55; color: var(--text); }
.knopf.option.richtig { border-color: var(--gruen); background: var(--gruen-hell); opacity: 1; }
.knopf.option.falsch { border-color: var(--rot); background: var(--rot-hell); opacity: 1; }

.freitext { display: grid; gap: 10px; margin-top: 6px; }
.eingabe {
    width: 100%; min-height: 58px; padding: 12px 16px; font-size: 1.1rem;
    background: #fff; border: 3px solid var(--linie); border-radius: var(--radius); outline: none;
}
.eingabe:focus { border-color: var(--rot); }
.freitext.ok .eingabe { border-color: var(--gruen); background: var(--gruen-hell); }
.freitext.falsch .eingabe { border-color: var(--rot); background: var(--rot-hell); }
.freitext .knopf { margin: 0; }
.feld-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .feld-paar { grid-template-columns: 1fr; } }

.rueckmeldung { margin-top: 16px; padding: 16px; border-radius: var(--radius); border: 3px solid; animation: rein .2s ease; }
.rueckmeldung.ok { background: var(--gruen-hell); border-color: var(--gruen); }
.rueckmeldung.falsch { background: var(--rot-hell); border-color: var(--rot); }
.rueckmeldung-text { font-size: 1.2rem; font-weight: 800; margin-bottom: 6px; }
.rueckmeldung .knopf { margin-bottom: 0; }

/* Zuordnen */
.zuordnen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.zuo-spalte { display: grid; gap: 10px; align-content: start; }
.zuo-item, .reihe-item {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 92px; padding: 10px; background: var(--flaeche); border: 3px solid var(--linie); border-radius: 14px;
    cursor: pointer; font-weight: 700; text-align: center; touch-action: manipulation;
}
.zuo-item small { display: block; font-weight: 400; color: var(--grau); }
.zuo-item.gewaehlt { border-color: #2563eb; background: #eff6ff; }
.zuo-item[data-nr], .reihe-item[data-nr] { border-color: #6366f1; background: #eef2ff; }
.zuo-item[data-nr]::after, .reihe-item[data-nr]::after {
    content: attr(data-nr); position: absolute; top: -10px; left: -10px;
    width: 30px; height: 30px; border-radius: 50%; background: #4f46e5; color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: .95rem; font-weight: 800;
}
.zuo-item.richtig, .reihe-item.richtig { border-color: var(--gruen); background: var(--gruen-hell); }
.zuo-item.falsch, .reihe-item.falsch { border-color: var(--rot); background: var(--rot-hell); }
.zuo-bild { width: 100%; height: 90px; object-fit: contain; }
.reihe { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 12px 0; }
.reihe-bild { width: 100%; height: 80px; object-fit: contain; }

/* Prüfung */
.pruefer-loesung { background: #fffaf0; border: 2px dashed #f0b27a; border-radius: 14px; padding: 12px 16px; margin: 6px 0 10px; }
.helm-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-top: 6px; }
.helm-wahl { background: #fff; border: 3px solid var(--linie); border-radius: 14px; padding: 6px; cursor: pointer; }
.helm-wahl.gewaehlt { border-color: #2563eb; background: #eff6ff; }
.helm-bild { width: 100%; height: 70px; object-fit: contain; }
.abbrechen { display: block; text-align: center; color: var(--grau); font-size: .9rem; margin-top: 18px; }

.ergebnis-gross { background: var(--flaeche); border-radius: 22px; box-shadow: var(--schatten); padding: 22px 18px; text-align: center; }
.ergebnis-emoji { font-size: 3.2rem; line-height: 1.1; }
.ergebnis-zahl { font-size: 1.7rem; font-weight: 800; margin: 6px 0; }
.stern-neu { margin-top: 12px; font-weight: 800; color: #b7791f; }
.ergebnis-liste { display: grid; gap: 10px; }
.ergebnis-karte {
    display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--flaeche);
    border-radius: 14px; border-left: 6px solid var(--linie); box-shadow: var(--schatten);
}
.ergebnis-karte.ok { border-left-color: var(--gruen); }
.ergebnis-karte.falsch { border-left-color: var(--rot); }
.ergebnis-bild { width: 72px; height: 72px; object-fit: contain; flex: none; background: #fff; border-radius: 8px; }
.ergebnis-text { flex: 1; min-width: 0; }
.ergebnis-text .loesung-haupt { font-size: 1.05rem; }
.ergebnis-text .helm-klein { width: 44px; height: 44px; }
.ergebnis-punkte { font-weight: 800; font-size: 1.2rem; min-width: 36px; text-align: right; }
.teile { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.teil { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--gruen-hell); color: var(--gruen); font-weight: 700; }
.teil.falsch { background: var(--rot-hell); color: var(--rot); }

/* Statistik */
.stat-block { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 14px 16px; margin-bottom: 12px; }
.stat-block.leer { color: var(--grau); box-shadow: none; }
.stat-titel { font-weight: 800; margin-bottom: 8px; }
.stat-zahlen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
@media (max-width: 420px) { .stat-zahlen { grid-template-columns: repeat(2, 1fr); } }
.stat-zahl { background: var(--hintergrund); border-radius: 12px; padding: 8px; text-align: center; }
.stat-zahl strong { display: block; font-size: 1.25rem; color: var(--rot); }
.stat-zahl small { color: var(--grau); font-size: .75rem; }
hr { border: 0; border-top: 2px solid var(--linie); margin: 20px 0; }
.lade { text-align: center; padding: 30vh 16px; color: var(--grau); }

/* Drag & Drop-Zuordnung */
.dz { margin: 8px 0 12px; }
.dz-ziele { display: grid; gap: 12px; }
.dz-ziel { display: flex; gap: 12px; align-items: stretch; background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 10px; }
.dz-kopf { flex: 0 0 34%; max-width: 180px; display: flex; align-items: center; justify-content: center; }
.dz-bild { width: 100%; max-height: 160px; object-fit: contain; border-radius: 10px; background: #fff; user-select: none; -webkit-user-select: none; }
.dz-bild.gross { max-height: 210px; }
.dz-nr-kopf { position: relative; width: 100%; }
.dz-nr { position: absolute; top: -4px; left: -4px; width: 28px; height: 28px; border-radius: 50%; background: var(--rot); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: .9rem; }
.dz-person { text-align: center; font-size: .9rem; }
.dz-text-kopf { font-weight: 800; font-size: 1.1rem; text-align: center; }
.dz-felder { flex: 1; display: grid; gap: 8px; align-content: center; min-width: 0; }
.dz-zone {
    min-height: 54px; border: 3px dashed #cbd5e1; border-radius: 12px; padding: 4px;
    display: flex; align-items: center; justify-content: center; background: #f8fafc; cursor: pointer;
    transition: background .12s, border-color .12s;
}
.dz-zone.belegt { border-style: solid; border-color: #c7d2fe; background: #eef2ff; }
.dz-zone.bereit { border-color: #2563eb; background: #eff6ff; }
.dz-zone.drueber, .dz-ablage.drueber { border-color: #2563eb; background: #dbeafe; }
.dz-zone.falsche-art { border-color: #fca5a5; }
.dz-zone.richtig { border-style: solid; border-color: var(--gruen); background: var(--gruen-hell); }
.dz-zone.falsch { border-style: solid; border-color: var(--rot); background: var(--rot-hell); }
.dz-zone.falsch:not(.belegt)::after { content: 'fehlt'; color: var(--rot); font-size: .8rem; font-weight: 700; }
.dz-platzhalter { color: #94a3b8; font-size: .85rem; text-align: center; pointer-events: none; }
.dz-zone.falsch:not(.belegt) .dz-platzhalter { display: none; }
.dz-ablage {
    position: sticky; bottom: 0; z-index: 4; margin-top: 12px;
    background: rgba(255, 255, 255, .97); border: 3px solid var(--linie); border-radius: var(--radius);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .1); padding: 8px 10px;
    max-height: 38vh; overflow-y: auto; padding-bottom: max(8px, env(safe-area-inset-bottom));
    transition: opacity .15s;
}
.dz-ablage.durchsichtig { opacity: .3; }
.dz-gruppe + .dz-gruppe { margin-top: 6px; }
.dz-gruppe-titel { font-size: .75rem; font-weight: 800; color: var(--grau); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.dz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dz-leer { color: var(--gruen); font-size: .85rem; font-weight: 700; }
.dz-chip {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 46px; padding: 6px 12px; border: 2px solid #a5b4fc; border-radius: 12px; background: #fff;
    font-weight: 700; font-size: .95rem; line-height: 1.2; cursor: grab; text-align: center;
    touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.dz-chip small { font-weight: 400; font-size: .7rem; color: var(--grau); }
.dz-chip.mit-bild { padding: 4px; }
.dz-chip img { width: 64px; height: 50px; object-fit: contain; pointer-events: none; }
.dz-zone .dz-chip { width: 100%; border-color: transparent; background: transparent; box-shadow: none; }
.dz-chip.gewaehlt { border-color: #2563eb; background: #dbeafe; box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.dz-chip.wird-gezogen { opacity: .35; }
.dz-geist { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; opacity: .92; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); border-color: #2563eb; transform-origin: center; }
body.dz-zieht { cursor: grabbing; user-select: none; -webkit-user-select: none; }
@media (max-width: 420px) {
    .dz-ziel { padding: 8px; gap: 8px; }
    .dz-kopf { flex-basis: 36%; }
    .dz-chip { font-size: .88rem; padding: 6px 9px; }
}
