/* Look A2 "Rechenheft bunt": Karopapier, blaue Tinte, kräftige Farben */
@font-face { font-family: 'Andika'; src: url('/fonts/andika-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Andika'; src: url('/fonts/andika-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Playpen Sans'; src: url('/fonts/playpen-sans.woff2') format('woff2'); font-weight: 400 800; font-display: swap; }

:root {
  --gelb: #ffd23f; --orange: #ff9f1c; --pink: #ff5d8f; --gruen: #2bb673; --tuerkis: #00b4c6; --blau: #3a86ff;
  --tinte: #1c3a9e; --text: #14213d; --karo: #d3e2f3; --hell: #8aa0cc; --rot: #e5484d;
  --schrift: 'Andika', system-ui, sans-serif; --hand: 'Playpen Sans', 'Comic Sans MS', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--schrift); color: var(--text); background: #fff; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font-family: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: 0.45; cursor: default; }
.laden { padding: 40px; text-align: center; }

.karo { background-color: #fff; background-image: linear-gradient(var(--karo) 1px, transparent 1px), linear-gradient(90deg, var(--karo) 1px, transparent 1px); background-size: 20px 20px; background-position: -1px -1px; }
.seite { min-height: 100vh; min-height: 100dvh; max-width: 640px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.seite.mitte { justify-content: center; align-items: center; text-align: center; }

.titel { margin: 0; font-family: var(--hand); font-size: 34px; font-weight: 700; color: var(--tinte); line-height: 1.15; }
.marker { align-self: flex-start; background: linear-gradient(transparent 58%, var(--gelb) 58%, var(--gelb) 92%, transparent 92%); padding: 0 4px; }
.mitte .marker { align-self: center; }
.unter { margin: 0; font-size: 18px; background: #fff; padding: 2px 4px; }
.hinweis { margin: 0; font-size: 16px; background: #fff; padding: 4px 6px; border-radius: 6px; }
.klein { font-size: 14px; margin: 4px 0; }

.knopf { min-height: 48px; padding: 0 18px; border: 2px solid var(--tinte); border-radius: 12px; background: #fff; color: var(--tinte); font-size: 18px; font-weight: 700; box-shadow: 0 3px 0 var(--tinte); }
.knopf:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--tinte); }
.knopf.haupt { min-height: 62px; font-family: var(--hand); font-size: 24px; background: var(--tinte); color: #fff; }
.knopf.haupt.gelb { background: var(--gelb); color: var(--text); }
.knopf.gruen, .knopf.haupt.gruen { background: var(--gruen); border-color: #18794e; color: #fff; box-shadow: 0 3px 0 #18794e; }
.knopf.blau { background: var(--blau); color: #fff; }
.knopf.rot { border-color: var(--rot); color: var(--rot); box-shadow: 0 3px 0 var(--rot); }
.knopf.klein { min-height: 44px; font-size: 16px; padding: 0 14px; }
.knopf.breit { width: 100%; text-align: left; }
.knopf.tipp { background: var(--gelb); color: var(--text); flex: 0 0 auto; }
.knopf.eltern { border-color: var(--hell); color: var(--tinte); box-shadow: none; font-size: 15px; font-weight: 400; position: relative; overflow: hidden; }
.knopf.eltern.haelt::after { content: ''; position: absolute; left: 0; bottom: 0; height: 4px; background: var(--tinte); animation: halten 1.5s linear forwards; }
@keyframes halten { from { width: 0; } to { width: 100%; } }
.knopf-reihe { display: flex; gap: 10px; }
.knopf-reihe .haupt { flex: 1; }
.knopf-vorlesen { border: 0; background: transparent; font-size: 24px; min-width: 44px; min-height: 44px; vertical-align: middle; }

.leiste { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.leiste-titel { font-family: var(--hand); font-size: 20px; font-weight: 700; color: var(--tinte); text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zaehler { font-weight: 700; background: #fff; padding: 4px 8px; white-space: nowrap; }

/* Profilauswahl */
.auswahl { gap: 24px; }
.kopf-titel { display: flex; flex-direction: column; gap: 8px; padding-top: 20px; }
.karten { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.karte { display: flex; align-items: center; gap: 18px; padding: 18px 20px; min-height: 180px; border: 2px solid var(--tinte); border-radius: 18px; box-shadow: 0 4px 0 var(--tinte); text-align: left; }
.karte:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--tinte); }
.karten-name { font-family: var(--hand); font-size: 34px; font-weight: 700; }
.fuss { display: flex; justify-content: center; }

/* Wochenziel */
.woche { background: #fff; border: 2px solid var(--tinte); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.woche-text { display: flex; flex-direction: column; font-size: 15px; }
.woche-tage { display: grid; grid-template-columns: repeat(7, 30px); gap: 4px; text-align: center; font-size: 13px; }
.tag { width: 30px; height: 30px; border: 2px solid var(--tinte); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; }
.tag.voll { background: var(--gruen); border-color: #18794e; }
.tag.heute:not(.voll) { background: var(--gelb); }
.tag-name.heute { font-weight: 700; }
.start-inhalt { display: flex; flex-direction: column; gap: 14px; }
.koennen { background: #fff; border: 2px dashed var(--tuerkis); border-radius: 12px; padding: 10px 12px; }
.abzeichen { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.abzeichen-item { background: #e3f8fa; border-radius: 20px; padding: 4px 10px; font-size: 15px; }

/* Merkkarten */
.merkkarte { background: #fffbe6; border: 2px solid var(--orange); border-radius: 14px; padding: 16px; font-size: 20px; line-height: 1.45; box-shadow: 0 4px 0 var(--orange); }
.merkkarte h2 { margin: 0 0 8px; font-family: var(--hand); color: var(--tinte); font-size: 24px; }
.merkkarte .beispiel { background: #fff; border-left: 5px solid var(--gelb); padding: 8px 10px; font-family: var(--hand); }

/* Aufgabe */
.aufgabe-seite { gap: 12px; }
.fortschritt { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; }
.fortschritt span { height: 12px; border: 2px solid var(--tinte); background: #fff; }
.fortschritt .fertig { background: var(--tinte); }
.fortschritt .jetzt { background: var(--gelb); }
.aufgabe-bereich { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.aufgabe-zahl, .aufgabe-wahl, .aufgabe-kacheln, .aufgabe-trennen, .aufgabe-schriftlich, .aufgabe-sach { display: flex; flex-direction: column; gap: 14px; }
.aufgabe-zeile { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; font-family: var(--hand); color: var(--tinte); padding: 8px 0; }
.term { font-size: 44px; font-weight: 700; white-space: nowrap; }
.antwort { min-width: 100px; height: 80px; padding: 0 10px; background: #fff; border: 3px solid var(--tinte); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: var(--hand); font-size: 44px; font-weight: 700; color: var(--tinte); }
.antwort.leer { color: var(--hell); }
.antwort.falsch, .falsch.antwort { border-color: var(--rot); animation: wackeln 0.3s; }
.einheit { font-size: 32px; font-weight: 700; }
.frage { margin: 0; font-size: 22px; font-weight: 700; text-align: center; background: #fff; padding: 4px 6px; }
.frage.klein { font-size: 17px; font-weight: 400; }
.frage-block { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.grosszahl { font-family: var(--hand); font-size: 46px; font-weight: 700; color: var(--tinte); text-align: center; letter-spacing: 1px; }
.lesetext { margin: 0; font-size: 40px; font-weight: 700; text-align: center; background: #fff; padding: 6px 10px; letter-spacing: 1px; }
.bild { font-size: 56px; line-height: 1; }
.bild.gross { font-size: 96px; }
.bild.klein { font-size: 48px; }
.bild.mini { font-size: 34px; }
.sachtext { margin: 0; font-size: 20px; line-height: 1.45; background: #fff; padding: 6px 8px; }
.sach-kopf { display: flex; align-items: flex-start; gap: 8px; }

.tastatur { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.taste { height: 58px; background: #fff; border: 2px solid var(--tinte); border-radius: 12px; font-family: var(--hand); font-size: 30px; font-weight: 700; color: var(--tinte); }
.taste.klein { font-size: 17px; }
.taste:active { background: #e8efff; }

.wahl-gitter { display: grid; gap: 10px; }
.wahl-gitter.spalten-2 { grid-template-columns: repeat(2, 1fr); }
.wahl-gitter.spalten-3 { grid-template-columns: repeat(3, 1fr); }
.wahl-gitter.spalten-4 { grid-template-columns: repeat(4, 1fr); }
.wahl { min-height: 70px; background: #fff; border: 2px solid var(--tinte); border-radius: 12px; font-size: 24px; font-weight: 700; color: var(--tinte); padding: 8px; box-shadow: 0 3px 0 var(--tinte); }
.wahl.gewaehlt { background: #e8efff; border-width: 4px; }
.wahl.falsch { border-color: var(--rot); background: #ffecee; }
.wahl.richtig { border-color: #18794e; background: #dcf7e8; }
.buchstabe { font-family: var(--hand); font-size: 40px; }
.laut-kasten { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 16px; }
.laut-zug { display: flex; gap: 4px; }
.laut-zug span { width: 18px; height: 18px; border: 2px solid var(--tinte); border-radius: 4px; }
.laut-zug span.voll { background: var(--pink); }

.kachel-ablage { min-height: 70px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; background: #fff; border: 3px dashed var(--tinte); border-radius: 12px; padding: 8px; }
.kachel-ablage.falsch { border-color: var(--rot); }
.kachel-ablage .platzhalter { color: var(--hell); font-size: 16px; }
.kachel-vorrat { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.kachel { min-width: 48px; min-height: 52px; padding: 0 12px; background: var(--gelb); border: 2px solid var(--tinte); border-radius: 10px; font-size: 24px; font-weight: 700; color: var(--text); box-shadow: 0 3px 0 var(--tinte); }
.kachel.gelegt { background: #e3f8fa; }
.kachel:disabled { visibility: hidden; }

.trenn-wort { display: flex; justify-content: center; align-items: stretch; flex-wrap: nowrap; background: #fff; padding: 10px; border-radius: 10px; }
.trenn-wort.falsch { outline: 3px solid var(--rot); }
.trenn-b { font-family: var(--hand); font-size: inherit; font-weight: 700; color: var(--tinte); padding: 4px 0; }
.trenn-luecke { width: 14px; flex: 0 0 14px; padding: 0; border: 0; background: transparent; position: relative; }
.trenn-luecke::after { content: ''; position: absolute; left: 5px; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: #e6ecf7; }
.trenn-luecke.an::after { background: var(--pink); left: 3px; width: 8px; }

.zaehl-feld { display: flex; flex-direction: column; gap: 8px; align-items: center; background: #fff; padding: 10px; border-radius: 10px; }
.zehner-reihe { display: flex; gap: 16px; }
.fuenfer { display: flex; gap: 4px; }

/* Schriftlich im Karoraster: eine Ziffer je Kästchen (40px = 2 Karos) */
.schriftlich { align-self: center; background: transparent; font-family: var(--hand); font-weight: 700; color: var(--tinte); }
.sr-zeile { display: flex; }
.sr-zelle, .sr-zeichen { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 30px; }
.sr-merk .sr-zelle { height: 26px; font-size: 18px; color: var(--pink); }
.sr-zelle.merk { border: 1px dashed var(--hell); background: transparent; border-radius: 4px; width: 26px; margin: 0 7px; }
.sr-strich { height: 3px; background: var(--tinte); margin: 2px 0 4px 40px; }
.sr-zelle.eingabe { border: 2px solid var(--tinte); background: #fff; border-radius: 6px; margin: 0 1px; width: 38px; font-family: var(--hand); font-weight: 700; color: var(--tinte); font-size: 30px; }
.sr-zelle.eingabe.aktiv { background: #fff6cc; border-width: 3px; }
.sr-zelle.eingabe.falsch { border-color: var(--rot); }

.hinweis-zeile { min-height: 48px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; font-size: 18px; }
.hinweis-zeile p { margin: 0; align-self: flex-start; padding: 6px 10px; }
.tipp-text { background: var(--gelb); border-radius: 8px; }
.lob { color: #18794e; font-weight: 700; background: #fff; font-size: 22px; }
.mut { background: #fff; }
.loesung { background: #e3f8fa; border-radius: 8px; }

@keyframes wackeln { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Ende */
.sterne { font-size: 56px; margin: 0; }
.gesichter { display: flex; gap: 18px; }
.gesicht { font-size: 54px; width: 84px; height: 84px; border: 2px solid var(--tinte); border-radius: 50%; background: #fff; box-shadow: 0 3px 0 var(--tinte); }

/* Kopplung und PIN */
.kopplung { display: flex; justify-content: center; }
.kopplung .antwort { min-width: 220px; letter-spacing: 6px; }

/* Eltern */
.reiter-leiste { display: flex; gap: 6px; }
.reiter { flex: 1; min-height: 44px; border: 2px solid var(--tinte); border-radius: 10px; background: #fff; color: var(--tinte); font-weight: 700; }
.reiter.aktiv { background: var(--tinte); color: #fff; }
.eltern-inhalt { display: flex; flex-direction: column; gap: 10px; -webkit-user-select: text; user-select: text; }
.paket { background: #fff; border: 2px solid var(--tinte); border-radius: 12px; padding: 10px 12px; }
.paket.neu { border-color: var(--orange); }
.paket-kopf { display: flex; justify-content: space-between; gap: 8px; }
.marke { background: var(--gelb); border-radius: 12px; padding: 2px 8px; font-size: 13px; white-space: nowrap; }
.vorschau { margin-top: 6px; }
.stand-block { background: #fff; border-radius: 10px; padding: 8px; }
.stand-block h2 { font-size: 18px; margin: 4px 0; }
table.stand { width: 100%; border-collapse: collapse; font-size: 14px; }
table.stand th, table.stand td { text-align: left; padding: 4px; border-bottom: 1px solid var(--karo); }
tr.wackelt td:nth-child(2) { color: var(--rot); font-weight: 700; }
tr.sitzt td:nth-child(2) { color: #18794e; font-weight: 700; }

/* Konfetti */
.konfetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.konfetti i { position: absolute; top: -20px; border-radius: 2px; animation-name: fallen; animation-timing-function: cubic-bezier(.25,.6,.45,1); animation-fill-mode: forwards; }
@keyframes fallen { to { transform: translateY(110vh) rotate(720deg); opacity: 0.9; } }

@media (min-width: 700px) {
  .karten { flex-direction: row; }
  .karte { flex: 1; flex-direction: column; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
