* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100dvh;
    color: #222;
    background: #f4f6f8;
    transition: background 0.5s;
    -webkit-tap-highlight-color: transparent;
}
/* Die Farbe des Kindes: ein Klassenname je Farbe der Plattform (FARBKLASSEN in lernen.js), nie ein Rohwert */
body.farbe-blau { background: linear-gradient(135deg, #89CFF0 0%, #B8E2FF 100%); }
body.farbe-rosa { background: linear-gradient(135deg, #FFB6C1 0%, #FFD6E0 100%); }
body.farbe-rot { background: linear-gradient(135deg, #FF8A80 0%, #FFB4AB 100%); }
body.farbe-orange { background: linear-gradient(135deg, #FFC27A 0%, #FFDDB0 100%); }
body.farbe-gelb { background: linear-gradient(135deg, #FFE680 0%, #FFF3B8 100%); }
body.farbe-gruen { background: linear-gradient(135deg, #A8E6A1 0%, #D2F5CC 100%); }
body.farbe-tuerkis { background: linear-gradient(135deg, #7FE0D6 0%, #B5F0EA 100%); }
body.farbe-lila { background: linear-gradient(135deg, #CBA6F0 0%, #E3D0F8 100%); }
body.farbe-braun { background: linear-gradient(135deg, #D2B48C 0%, #E8D5BC 100%); }
body.farbe-grau { background: linear-gradient(135deg, #CFD4D9 0%, #E6E9EC 100%); }

main {
    max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px;
    padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.view[hidden] { display: none; }
/* Testumgebung: Streifen oben, Teil des Seitenaufbaus (bleibt beim Scrollen oben, die Tippflächen darunter rutschen nur nach unten) */
#testStreifen {
    position: sticky; top: 0; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px;
    background: #e8590c; color: #fff; border-bottom: 4px solid #212529; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
    font-weight: 800; font-size: 13px; letter-spacing: 0;
}
#testStreifen[hidden] { display: none; }
#testStreifen button { margin: 2px 6px 2px 0; padding: 7px 12px; min-height: 36px; font-size: 14px; border-radius: 12px; background: #fff; border-color: #fff; color: #212529; }
.testbox { border: 3px solid #e8590c; }
h1 { font-size: 30px; margin-bottom: 6px; }
h2 { font-size: 22px; margin: 4px 0 12px; }
.lead { color: rgba(0,0,0,0.6); margin-bottom: 20px; }
.center { text-align: center; }

button {
    font: inherit; font-weight: 600; border: 2px solid rgba(0,0,0,0.12); border-radius: 16px;
    background: rgba(255,255,255,0.85); color: #333; padding: 12px 20px; margin: 4px 4px 4px 0; cursor: pointer;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: #1a7a3a; border-color: #1a7a3a; color: #fff; }
button.bad { background: #c92a2a; border-color: #c92a2a; color: #fff; }
button.big { display: block; width: 100%; padding: 22px; font-size: 26px; margin: 12px 0; }
a.link { display: inline-block; margin-top: 18px; color: #1a5fb4; font-weight: 600; text-decoration: none; }
.elternzeile { margin-top: 18px; font-size: 15px; color: rgba(0,0,0,0.65); }
.elternzeile a.link { margin-top: 0; }
.gateknoepfe { margin-top: 18px; }
label.dateizeile { display: block; margin-top: 8px; }
#editBox { background: #fff9db; border-radius: 12px; padding: 10px; margin-bottom: 10px; }
#rfTitel { margin-top: 18px; }
b.wahl-titel { display: block; }

.card {
    background: rgba(255,255,255,0.9); border-radius: 20px; padding: 24px 16px; text-align: center;
    font-size: 30px; font-weight: 800; margin: 14px 0; box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}
.card .sub { display: block; font-size: 15px; font-weight: 500; color: #666; margin-top: 8px; }
.box { background: rgba(255,255,255,0.9); border-radius: 16px; padding: 14px; margin: 12px 0; }
.stat { flex: 1; min-width: 90px; text-align: center; background: rgba(255,255,255,0.85); border-radius: 14px; padding: 10px 6px; font-size: 13px; color: #555; }
.stat b { display: block; font-size: 26px; color: #222; }
.problem { font-size: 36px; font-weight: 800; text-align: center; margin: 16px 0; }
input[type=number] {
    display: block; margin: 0 auto; width: 140px; font-size: 28px; font-weight: 700; text-align: center;
    border: 3px solid #ddd; border-radius: 16px; padding: 10px; outline: none;
}
input.wrong { border-color: #e74c3c; animation: shake 0.4s; }
textarea, input[type=text], select {
    width: 100%; font: inherit; padding: 10px; border: 2px solid #ddd; border-radius: 12px; margin: 6px 0; background: #fff;
}
textarea { height: 140px; }

.row { display: flex; align-items: center; gap: 8px; padding: 10px 4px; border-bottom: 1px solid rgba(0,0,0,0.08); flex-wrap: wrap; }
.row .w { font-size: 24px; font-weight: 700; flex: 1; min-width: 150px; }
.row .res { font-size: 14px; color: #444; flex-basis: 100%; }
.abschreiben { color: #c92a2a; font-weight: 700; }
.card .frage { display: block; font-size: 28px; color: #1a5fb4; margin-top: 8px; }
mark { background: #ffe066; padding: 0 4px; border-radius: 6px; }
.ok { color: #1a7a3a; font-weight: 700; } .no { color: #c92a2a; font-weight: 700; }

.tabs button.on { background: #222; color: #fff; border-color: #222; }
input.gross { width: 28px; height: 28px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; background: rgba(255,255,255,0.9); border-radius: 12px; }
td, th { padding: 6px 8px; border-bottom: 1px solid rgba(0,0,0,0.07); text-align: left; vertical-align: top; }
td button { padding: 2px 10px; margin: 0; border-radius: 10px; }
.meldung { font-size: 14px; margin: 8px 0; }
.scroll { max-height: 420px; overflow: auto; border-radius: 12px; }
ol.neuliste { margin: 8px 0 8px 24px; font-size: 18px; }
ol.neuliste li { margin: 4px 0; }
ol.neuliste button { padding: 0 8px; margin-left: 6px; border-radius: 8px; }

/* Die Kinderansichten füllen den Bildschirm (iPad quer und hoch); der Eltern-Bereich bleibt eine lesbare Spalte */
#vHinweis:not([hidden]), #vKind:not([hidden]), #vGate:not([hidden]), #vMenue:not([hidden]), #vLeer:not([hidden]), #vDiktat:not([hidden]), #vFortschritt:not([hidden]),
#vRechnen:not([hidden]), #vTraining:not([hidden]), #vNest:not([hidden]) {
    display: flex; flex-direction: column; justify-content: center; min-height: calc(100dvh - 80px);
}
#vNest:not([hidden]) { justify-content: flex-start; }
#vHinweis > *, #vKind > *, #vGate > *, #vMenue > *, #vLeer > *, #vFortschritt > *, #vRechnen > *, #vTraining > *, #vNest > * { width: 100%; max-width: 640px; margin-left: auto; margin-right: auto; }
#vDiktat:not([hidden]) { justify-content: flex-start; }
#vDiktat .card {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin: 8px 0 12px; padding: 16px; font-size: clamp(56px, 14vmin, 160px); overflow-wrap: anywhere;
}
#vDiktat .card .frage { font-size: clamp(32px, 8vmin, 84px); line-height: 1.2; }
#vDiktat .card .sub { font-size: clamp(18px, 3.2vmin, 34px); }
#vDiktat .leiste button { font-size: clamp(18px, 3vmin, 28px); padding: 16px 24px; }
#vBewerten .row .w { font-size: clamp(24px, 4vmin, 40px); }

/* Fortschritt: drei Zonen, Regal, Sterne, Verlauf */
.heutesatz { font-size: 22px; font-weight: 700; margin: 16px 0; }
.zonen { display: flex; gap: 10px; margin: 14px 0; }
.zone { flex: 1; min-width: 0; background: rgba(255,255,255,0.9); border-radius: 18px; padding: 14px 6px; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.zone .sym { display: block; font-size: 34px; line-height: 1.2; }
.zone b { display: block; font-size: 40px; line-height: 1.1; color: #222; }
.zone span.name { display: block; font-size: 16px; font-weight: 700; color: #444; overflow-wrap: anywhere; }
.zone span.klein { font-size: 13px; font-weight: 500; color: #666; }
.zone.sicher { background: #fff3c4; }
.nochnicht { font-size: 17px; color: #555; margin: 6px 0 14px; }
.sterne { font-size: 30px; color: #e6a700; font-weight: 800; margin: 10px 0; overflow-wrap: anywhere; }
.sterne small { display: block; font-size: 14px; font-weight: 500; color: #666; }
.regal { margin: 12px 0; text-align: left; }
.regal .fach { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 4px solid #b08a5a; background: rgba(255,255,255,0.7); min-height: 40px; }
.regal .fach .nm { flex: 0 0 150px; font-size: 15px; font-weight: 700; }
.regal .fach .sy { flex: 1; display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.regal .fach .sy i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.regal .fach .zahl { flex: 0 0 auto; font-size: 18px; font-weight: 800; min-width: 28px; text-align: right; }
@media (max-width: 480px) { .regal .fach .nm { flex-basis: 96px; } }
.regal-info { font-size: 14px; color: #555; margin: 8px 0; }
.kennzahlen { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.kennzahlen .stat { min-width: 100px; }
.zwei { display: flex; gap: 16px; flex-wrap: wrap; }
.zwei > div { flex: 1 1 300px; min-width: 0; }
.verlauf svg { display: block; width: 100%; max-width: 760px; height: auto; background: #fff; border-radius: 12px; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; margin: 8px 0; }
.legende i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.heutezeile { padding: 10px 4px; border-bottom: 1px solid rgba(0,0,0,0.1); font-size: 15px; }
.heutezeile .kopf { font-size: 13px; color: #666; }
.heutezeile .gross { font-weight: 700; font-size: 17px; }
.heutezeile .rueck { background: #fff3bf; border-radius: 12px; padding: 8px 10px; margin-top: 6px; }
.heutezeile button { padding: 6px 14px; margin: 4px 6px 0 0; border-radius: 10px; }
select.tag { width: auto; min-width: 200px; }

/* Rechnen und 1×1 lernen (Kind): eine Aufgabe, ein großes Feld, große Tasten */
#vRechnen [hidden], #vTraining [hidden] { display: none !important; } /* display:flex/block der Klassen darf hidden nicht aufheben */
.punkte { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 0 8px; min-height: 14px; }
.punkte i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #7a8794; background: transparent; }
.punkte i.d { background: #1a7a3a; border-color: #1a7a3a; }
.punkte i.c { background: #1a5fb4; border-color: #1a5fb4; }
.rtext { font-size: clamp(34px, 9vmin, 84px); font-weight: 800; line-height: 1.25; text-align: center; margin: 12px 0 18px; overflow-wrap: anywhere; }
input.zahlfeld {
    display: block; width: 100%; font: inherit; font-size: 44px; font-weight: 800; text-align: center; padding: 18px 12px; margin: 0 0 8px;
    border: 3px solid #ccc; border-radius: 18px; outline: none; background: #fff;
}
input.zahlfeld:focus { border-color: #1a5fb4; }
.vergleich { display: flex; gap: 10px; margin: 8px 0; }
.vergleich button { flex: 1; margin: 0; padding: 24px 0; font-size: 52px; line-height: 1; border-radius: 20px; }
#vMenue [hidden] { display: none !important; } /* button.big setzt display:block und würde hidden aufheben */
/* Richtig/Falsch nach einer Antwort: großes Feld mit Symbol UND Text (nicht nur Farbe), Mindesthöhe für das iPad */
.urteil { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 170px; margin: 8px 0 12px; padding: 14px 12px; border-radius: 22px; border: 6px solid; overflow-wrap: anywhere; }
.urteil .sym { font-size: clamp(64px, 16vmin, 120px); line-height: 1; font-weight: 900; }
.urteil .wort { font-size: clamp(30px, 7vmin, 56px); line-height: 1.15; font-weight: 800; margin-top: 4px; }
.urteil .loesung { font-size: clamp(24px, 5.5vmin, 44px); font-weight: 700; margin-top: 8px; }
.urteil.ok { background: #1a7a3a; border-color: #0b4a20; color: #fff; }
.urteil.no { background: #c92a2a; border-color: #5c0f0f; color: #fff; border-style: dashed; }
.rueck { text-align: center; font-size: 30px; font-weight: 800; margin: 8px 0; overflow-wrap: anywhere; }
.rueck.ok { color: #1a7a3a; } .rueck.no { color: #c92a2a; }
.wahl { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.wahl button { flex: 1 1 140px; margin: 0; padding: 16px 12px; font-size: 20px; }
.wahl button.on { background: #222; color: #fff; border-color: #222; }
.wahl button.an { background: #1a5fb4; border-color: #1a5fb4; color: #fff; }
.wahl.reihen button { flex: 1 1 56px; font-size: 24px; padding: 18px 4px; }
.wahl-titel { font-size: 18px; font-weight: 700; text-align: left; margin-top: 6px; }
.kaesten { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-size: 16px; min-height: 44px; }
.kaesten input { width: 28px; height: 28px; flex: 0 0 auto; }
table.schalter td, table.schalter th { vertical-align: middle; }
table.schalter td.k { text-align: center; padding: 0; }
table.schalter td.k label { display: flex; justify-content: center; align-items: center; min-height: 44px; }
#ruUebersicht { max-height: none; }
table.uebersicht { font-size: 11px; table-layout: fixed; }
table.uebersicht td, table.uebersicht th { padding: 5px 1px; text-align: center; }
table.uebersicht th { white-space: nowrap; font-size: 10px; }
table.uebersicht td:first-child, table.uebersicht th:first-child { width: 22%; overflow-wrap: normal; }
table.uebersicht td:first-child, table.uebersicht th:first-child { text-align: left; }

/* Rechen-Nest (Kind) und Fortschritt der Eltern: Tafeln als Raster; ein Platz ist ein Knopf (Kind: mindestens 32 Punkte breit) */
#vNest [hidden] { display: none !important; }
#vNest h1 { font-size: 26px; }
.nestreiter { margin: 4px 0 8px; gap: 6px; }
.wahl.nestreiter button { flex: 1 1 52px; padding: 14px 2px; font-size: 15px; white-space: nowrap; }
.tafelbox { margin: 6px -6px; }
.tafel { display: grid; gap: 2px; }
.tafel .kopf { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #4b5563; min-height: 18px; }
.tafel .feld { display: flex; min-width: 0; aspect-ratio: 1 / 1; min-height: 32px; border-radius: 8px; }
.tafel .feld.mit { background: rgba(214, 150, 0, 0.38); }
.tafel .feld.mit .platz { background: #fff0c2; }
.tafel .platz {
    position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-width: 0; min-height: 32px;
    margin: 0; padding: 0; border-radius: 8px; border: 2px solid transparent; background: rgba(255,255,255,0.9);
    font-size: clamp(17px, 5.4vw, 34px); line-height: 1; overflow: hidden;
}
.tafel .platz.gewaehlt { border-color: #1a5fb4; box-shadow: 0 0 0 2px #1a5fb4; }
.tafel .platz .nest { display: block; width: 52%; height: 52%; border-radius: 50%; border: 2px dashed #a3adb9; }
.tafel .platz .baby { font-size: 70%; }
.tafel .platz .kr { position: absolute; top: 1px; right: 1px; font-size: 50%; line-height: 1; }
.rechnung { font-size: clamp(30px, 8vw, 56px); font-weight: 800; text-align: center; min-height: 1.4em; margin: 14px 0; overflow-wrap: anywhere; }
.hoehlen { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.hoehle { background: rgba(255,255,255,0.9); border-radius: 18px; padding: 12px 8px; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.hoehle .hname { font-size: 22px; font-weight: 800; margin-bottom: 4px; overflow-wrap: anywhere; }
.hoehle .krz { height: 24px; font-size: 22px; line-height: 24px; }
.hoehle .tier { display: flex; align-items: flex-end; justify-content: center; height: 84px; line-height: 1; }
.hoehle .tier.ei { font-size: 44px; } .hoehle .tier.baby { font-size: 32px; } .hoehle .tier.jungtier { font-size: 52px; } .hoehle .tier.gross { font-size: 76px; }
.rftafeln { padding: 14px 8px; }
.rftafeln .zwei > div { flex: 1 1 300px; max-width: 460px; }
.rftafeln .tafel .kopf { min-height: 16px; }
.tafel .platz.rfplatz { font-size: 14px; font-weight: 700; border-width: 1px; border-bottom-width: 4px; border-color: rgba(0,0,0,0.15); background: transparent; border-radius: 6px; }
.tafel .platz.rfplatz.wart { border-bottom-width: 1px; }
.tafel .platz.rfplatz.aus { opacity: 0.45; border-style: dashed; border-bottom-width: 2px; }
.tafel .platz.rfplatz.gewaehlt { border-color: #1a5fb4; opacity: 1; }
#rfKennzahlen { gap: 4px; }
#rfKennzahlen .stat { min-width: 0; padding: 8px 1px; font-size: 10px; overflow-wrap: anywhere; }
#rfKennzahlen .stat b { font-size: 22px; }
table.rfhoehlen tr[data-act] { cursor: pointer; }
table.rfhoehlen tr.gewaehlt td { background: #dbe8fb; }
table.rfhoehlen tr.aus td { opacity: 0.5; }
table.rfhoehlen td, table.rfhoehlen th { padding: 10px 3px; font-size: 12px; overflow-wrap: break-word; }
table.rfhoehlen th, table.rfkarte th { white-space: nowrap; font-size: 11px; }
table.rfkarte td, table.rfkarte th { padding: 6px 3px; font-size: 12px; overflow-wrap: break-word; }

#fehler { display: none; background: #c92a2a; color: #fff; padding: 10px 14px; margin: 10px 16px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
