/* Lernapp – ruhig, groß, kindgerecht. Schrift Andika (OFL): Druckschrift mit einstöckigem a wie in der Schule. */
@font-face { font-family: 'Andika'; font-weight: 400; font-display: swap; src: url('/fonts/andika-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Andika'; font-weight: 700; font-display: swap; src: url('/fonts/andika-latin-700-normal.woff2') format('woff2'); }

:root {
  --grund: #fff8ec;
  --karte: #ffffff;
  --tinte: #2b2a33;
  --grau: #8b8796;       /* zweite Silbe – wie auf dem Blatt */
  --linie: #e7dccb;
  --akzent: #f29e4c;     /* warmes Orange */
  --akzent-dunkel: #b9651c;
  --richtig: #2f9e63;
  --nochmal: #f2c14e;
  --aktiv: #fff0b8;
  --still: #b9b3c4;
  --schatten: 0 2px 10px rgba(60, 40, 10, .08);
  --rund: 18px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #1d1b24; --karte: #2a2733; --tinte: #f4f1ea; --grau: #a7a2b4; --linie: #3d3948;
    --aktiv: #5a4a12; --still: #6c6779; --schatten: 0 2px 10px rgba(0, 0, 0, .35); --akzent-dunkel: #f6b878;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--tinte);
  font-family: 'Andika', 'Segoe UI', system-ui, sans-serif; font-size: 18px; line-height: 1.4;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { max-width: 1000px; margin: 0 auto; padding: 16px 16px 140px; }
h1 { font-size: 1.7rem; margin: 8px 0 16px; }
h2 { font-size: 1.25rem; margin: 24px 0 10px; }
p { margin: 0 0 12px; }
.laden { text-align: center; color: var(--grau); margin-top: 30vh; }
.klein { font-size: .9rem; color: var(--grau); }

/* Knöpfe: mindestens 44 px Tippfläche */
button, .knopf {
  font: inherit; min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 2px solid var(--linie);
  background: var(--karte); color: var(--tinte); cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; touch-action: manipulation;
}
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
button.haupt { background: var(--akzent); border-color: var(--akzent); color: #2b1a05; font-weight: 700; }
button.dezent { border-color: transparent; background: transparent; color: var(--grau); }
button:disabled { opacity: .5; cursor: default; }

/* Formulare */
form.karte { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 700; }
input {
  font: inherit; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--linie);
  background: var(--karte); color: var(--tinte); width: 100%;
}
.fehler { color: var(--akzent-dunkel); font-weight: 700; min-height: 1.4em; }

.karte { background: var(--karte); border-radius: var(--rund); box-shadow: var(--schatten); padding: 18px; }
.zeile { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.liste { display: grid; gap: 12px; }
.schmal { max-width: 460px; margin: 0 auto; }

/* Startseite Kind: Module als große Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kachel {
  display: grid; justify-items: center; gap: 8px; padding: 26px 16px; min-height: 170px; text-align: center;
  background: var(--karte); border: 3px solid var(--linie); border-radius: 24px; box-shadow: var(--schatten);
  font-size: 1.35rem; font-weight: 700; color: var(--tinte);
}
.kachel .symbol { font-size: 3.4rem; line-height: 1; }
.kachel.aus { opacity: .45; cursor: default; filter: grayscale(1); }
.kachel .hinweis { font-size: .9rem; font-weight: 400; color: var(--grau); }

/* Würfel-Symbol wie auf dem Blatt */
.wuerfel {
  width: 44px; height: 44px; border: 3px solid currentColor; border-radius: 9px; display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 4px; flex: none;
}
.wuerfel i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; place-self: center; }

/* Teppich-Auswahl */
.teppiche { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.teppichwahl {
  display: grid; justify-items: center; gap: 8px; padding: 16px 10px; border-radius: 20px; min-height: 150px;
  background: var(--karte); border: 3px solid var(--linie); box-shadow: var(--schatten); font-weight: 700;
}
.teppichwahl.aktuell { border-color: var(--akzent); }
.teppichwahl .marke { font-size: .8rem; background: var(--akzent); color: #2b1a05; border-radius: 99px; padding: 2px 10px; }
.sterne { color: #e0a100; letter-spacing: 1px; font-size: 1rem; white-space: nowrap; }
.sterne .leer { color: var(--still); }

/* Silbendarstellung: Bogen unter jeder Silbe, Silben abwechselnd dunkel / grau */
.teppich { display: grid; gap: 6px; }
.tzeile { display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: flex-end; margin: 0 0 10px; }
.el {
  font-size: clamp(1.7rem, 5vw, 2.6rem); line-height: 1.15; padding: 4px 8px 12px; border-radius: 12px;
  border: 3px solid transparent; background: none; cursor: pointer; display: inline-flex; align-items: flex-end;
  min-height: 48px; color: var(--tinte); font-family: inherit; white-space: nowrap;
}
.el.fertig { opacity: .55; }
.el.aktiv { background: var(--aktiv); border-color: var(--nochmal); opacity: 1; transform: scale(1.06); }
.el.geuebt::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--nochmal); align-self: flex-start; margin-right: 2px; }
.s { position: relative; display: inline-block; padding-bottom: 2px; }
.s::after {
  content: ''; position: absolute; left: 8%; right: 8%; bottom: -8px; height: 9px;
  border: 2.5px solid currentColor; border-top: 0; border-radius: 0 0 60% 60% / 0 0 100% 100%; opacity: .9;
}
.s.zwei, .s.zwei::after { color: var(--grau); }
.wort { display: inline-flex; align-items: flex-end; }
.wort + .wort { margin-left: .45em; }
.satzboxen { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 8px; }
.satzbox { border: 3px solid var(--tinte); border-radius: 6px; padding: 8px; display: grid; gap: 4px; }
.satzbox .el { white-space: normal; flex-wrap: wrap; justify-content: flex-start; text-align: left; width: 100%; }
.bild { display: inline-flex; width: 1.6em; height: 1.4em; margin-left: .4em; align-items: center; justify-content: center; font-size: 1.1em; }
.bild svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.punkt { margin-left: .1em; }

/* Leiste unten beim Lesen */
.leseleiste {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--karte); box-shadow: 0 -4px 16px rgba(0, 0, 0, .12);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 5;
}
.leseleiste .innen { max-width: 1000px; margin: 0 auto; display: grid; gap: 8px; }
.fortschritt { height: 10px; border-radius: 99px; background: var(--linie); overflow: hidden; }
.fortschritt span { display: block; height: 100%; background: var(--richtig); width: 0; transition: width .2s; }
.leseknoepfe { display: grid; grid-template-columns: auto 1fr 1.4fr; gap: 10px; }
.leseknoepfe button { min-height: 60px; font-size: 1.25rem; font-weight: 700; }
button.nochmal { background: var(--nochmal); border-color: var(--nochmal); color: #2b2200; }
button.richtig { background: var(--richtig); border-color: var(--richtig); color: #fff; }
.zaehler { text-align: center; font-size: .9rem; color: var(--grau); }

/* Belohnung */
.belohnung { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20, 15, 5, .55); z-index: 10; padding: 16px; }
.belohnung .karte { text-align: center; max-width: 420px; width: 100%; }
.belohnung .grosserstern { font-size: 5rem; line-height: 1; animation: hupf .7s ease-out; }
@keyframes hupf { 0% { transform: scale(.2) rotate(-30deg); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .belohnung .grosserstern { animation: none; } .el.aktiv { transform: none; } }

/* Auswertung */
.balken { height: 12px; border-radius: 99px; background: var(--linie); overflow: hidden; min-width: 80px; flex: 1; }
.balken span { display: block; height: 100%; background: #e0a100; }
.auswertungzeile { display: flex; align-items: center; gap: 12px; }
.auswertungzeile .nr { width: 92px; flex: none; font-weight: 700; }
.uebt .el { cursor: default; font-size: 1.8rem; }

#meldung {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 20;
  background: var(--tinte); color: var(--grund); padding: 10px 18px; border-radius: 12px; max-width: calc(100% - 32px);
}
.elternlink { margin-top: 40px; text-align: center; }

/* Teppich-Karten: Sterne dürfen umbrechen, Karten nie breiter als der Bildschirm */
.teppichwahl { min-width: 0; text-align: center; }
.teppichwahl .sterne { font-size: .85rem; letter-spacing: 0; white-space: normal; }
.el { min-width: 48px; justify-content: center; }
.auswertungzeile { flex-wrap: wrap; row-gap: 4px; }
.auswertungzeile .sterne { font-size: .9rem; letter-spacing: 0; }
@media (max-width: 480px) { .auswertungzeile .balken { flex-basis: calc(100% - 104px); } }
/* Silben eines Wortes stehen zusammen (Knopf-Abstand hier aufheben) */
.el { gap: 0; }
@media (max-width: 420px) { .leseknoepfe button { font-size: 1.05rem; padding: 8px 10px; } }
/* Kacheln und Teppich-Karten sind Links – ohne Link-Blau und Unterstreichung */
a.kachel, a.teppichwahl, a.knopf { color: var(--tinte); text-decoration: none; }
a.kachel:hover, a.teppichwahl:hover { border-color: var(--akzent); }
.leseknoepfe { grid-template-columns: minmax(52px, auto) 1fr 1.4fr; }

/* Etappe 2: Mikrofon-Modus und Häkchen/X an den Silben */
.el { position: relative; }
.el.geuebt::before { display: none; }
.el.fertig { opacity: .7; }
.el[data-urteil="richtig"]::after, .el[data-urteil="falsch"]::after {
  position: absolute; top: -8px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px; font-weight: 700; line-height: 1; color: #fff; z-index: 1;
}
.el[data-urteil="richtig"]::after { content: '✓'; background: var(--richtig); }
.el[data-urteil="falsch"]::after { content: '✗'; background: #d9480f; }
.leseknoepfe.mikro { grid-template-columns: minmax(52px, auto) 1fr; }
button.hoeren { font-size: 1.3rem; }
button.hoeren.an { background: var(--karte); color: var(--tinte); border-color: var(--akzent); }
.statuszeile { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 44px; }
.status { font-weight: 700; }
.status[data-art="ok"] { color: var(--richtig); }
.status[data-art="falsch"], .status[data-art="fehler"] { color: #d9480f; }
.statuszeile button.dezent { font-size: .9rem; min-height: 44px; padding: 6px 10px; }
[hidden] { display: none !important; }
/* Häkchen/X innerhalb der Silbe (ragt nicht über den Rand) */
.el[data-urteil="richtig"]::after, .el[data-urteil="falsch"]::after { top: 1px; right: 1px; width: 18px; height: 18px; font-size: 12px; }

/* Etappe 3: Vorlesen */
.leseknoepfe { grid-template-columns: minmax(52px, auto) minmax(52px, auto) 1fr 1.4fr; }
.leseknoepfe.mikro { grid-template-columns: minmax(52px, auto) minmax(52px, auto) 1fr; }
button.vorlesen { font-size: 1.4rem; }
.status[data-art="hilfe"] { color: var(--akzent-dunkel); }
.el.spricht { outline: 3px dashed var(--akzent); outline-offset: 2px; }
