/* Layout: eine ruhige App-Spalte (max. 560px), oben Kopf mit Kind + Lerntagen, darunter immer genau eine Aufgabe als Karte.
   Farbwelt wie die Lernblätter (Navy, Gelb, Teal, Orange), Schriften Fredoka + Nunito. */
:root {
  --bg: #eef2f7;
  --flaeche: #ffffff;
  --flaeche-2: #f5f7fb;
  --linie: #d9e0ea;
  --text: #1c2738;
  --text-leise: #5b6779;
  --navy: #1d3557;
  --navy-text: #ffffff;
  --gelb: #ffd166;
  --teal: #2a9d8f;
  --teal-leise: #e3f4f1;
  --orange: #e76f51;
  --orange-leise: #fdece7;
  --rot: #c8323c;
  --rot-leise: #fbe6e7;
  --gruen: #23845a;
  --gruen-leise: #e2f4ea;
  --fokus: #3a86ff;
  --schatten: 0 1px 2px rgba(29,53,87,.06), 0 6px 20px rgba(29,53,87,.08);
  --f-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --f-text: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1726; --flaeche: #172338; --flaeche-2: #1d2b43; --linie: #2b3b57;
    --text: #e8eef7; --text-leise: #a3b0c4; --navy: #2b4c7e; --navy-text: #ffffff;
    --gelb: #ffd166; --teal: #4cc2b2; --teal-leise: #163a3a; --orange: #f08a6f; --orange-leise: #3d2421;
    --rot: #f0707a; --rot-leise: #3c1f25; --gruen: #5fd09a; --gruen-leise: #173628; --fokus: #7aa9ff;
    --schatten: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1726; --flaeche: #172338; --flaeche-2: #1d2b43; --linie: #2b3b57;
  --text: #e8eef7; --text-leise: #a3b0c4; --navy: #2b4c7e; --navy-text: #ffffff;
  --gelb: #ffd166; --teal: #4cc2b2; --teal-leise: #163a3a; --orange: #f08a6f; --orange-leise: #3d2421;
  --rot: #f0707a; --rot-leise: #3c1f25; --gruen: #5fd09a; --gruen-leise: #173628; --fokus: #7aa9ff;
  --schatten: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--f-text); font-size: 16px; line-height: 1.5; }
#app { max-width: 560px; margin: 0 auto; padding-inline: 16px; padding-block: 16px 40px; display: flex; flex-direction: column; gap: 14px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; margin: 0; text-wrap: balance; line-height: 1.15; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
.ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Kopf */
.kopf { background: var(--navy); color: var(--navy-text); border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.kopf .wer { flex: 1; min-width: 0; }
.kopf h1 { font-size: 24px; }
.kopf .unter { color: var(--gelb); font-weight: 700; font-size: 14px; }
.flamme { display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,.12); border-radius: 12px; padding: 6px 10px; min-width: 64px; }
.flamme b { font-family: var(--f-display); font-size: 22px; line-height: 1; color: var(--gelb); font-variant-numeric: tabular-nums; }
.flamme span { font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.kopf-knopf { background: rgba(255,255,255,.12); border: 0; border-radius: 10px; padding: 8px; color: var(--navy-text); display: flex; }

/* Karten & Knöpfe */
.karte { background: var(--flaeche); border-radius: 16px; padding: 18px; box-shadow: var(--schatten); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.knopf { border: 0; border-radius: 12px; padding: 14px 18px; font-weight: 800; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.knopf.haupt { background: var(--teal); color: #fff; }
.knopf.zweit { background: var(--flaeche-2); color: var(--text); border: 1.5px solid var(--linie); }
.knopf.breit { width: 100%; }
.knopf:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--text-leise); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 4px; font-size: 14px; }
.leise { color: var(--text-leise); font-size: 14px; }
.zeile { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.zeile > .knopf { flex: 1 1 140px; }

/* Startauswahl */
.kinder { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kind-knopf { border: 0; background: var(--flaeche); border-radius: 16px; padding: 22px 12px; box-shadow: var(--schatten); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kind-knopf .kreis { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--f-display); font-size: 30px; color: #fff; }
.kind-knopf b { font-family: var(--f-display); font-size: 22px; font-weight: 600; }

/* Tagesübersicht */
.heute { background: var(--navy); color: var(--navy-text); }
.heute .zahlen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.heute .zahl { background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px 12px; }
.heute .zahl b { font-family: var(--f-display); font-size: 28px; color: var(--gelb); display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.heute .zahl span { font-size: 13px; font-weight: 700; }
.heute .knopf.haupt { background: var(--gelb); color: #1d3557; }
.liste-kopf { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.liste-kopf h2 { font-size: 19px; }
.balken { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--flaeche-2); border: 1px solid var(--linie); }
.balken i { display: block; height: 100%; }
.b-sitzt { background: var(--teal); } .b-lernt { background: var(--gelb); } .b-neu { background: transparent; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-leise); font-variant-numeric: tabular-nums; }
.legende span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); border: 1px solid var(--linie); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--linie); background: var(--flaeche-2); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--navy); color: var(--navy-text); border-color: var(--navy); }
.schwer { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.schwer li { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.schwer li span:last-child { color: var(--text-leise); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Übung */
.fortschritt { display: flex; align-items: center; gap: 10px; }
.fortschritt .balken { flex: 1; height: 10px; }
.fortschritt .balken i { background: var(--teal); transition: width .3s; }
.aufgabe { text-align: center; align-items: center; padding-block: 26px; }
.etikett { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-leise); }
.wort { font-family: var(--f-display); font-weight: 600; font-size: clamp(28px, 8vw, 40px); line-height: 1.15; overflow-wrap: anywhere; }
.wort-de { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.ton { border: 0; background: var(--teal-leise); color: var(--teal); border-radius: 50%; width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.wahl { display: grid; grid-template-columns: 1fr; gap: 10px; width: 100%; }
.wahl button { border: 1.5px solid var(--linie); background: var(--flaeche-2); border-radius: 12px; padding: 14px 14px; font-size: 17px; font-weight: 700; text-align: left; display: flex; gap: 12px; align-items: center; }
.wahl button kbd { font-family: var(--f-text); font-size: 12px; color: var(--text-leise); border: 1px solid var(--linie); border-radius: 6px; padding: 1px 7px; background: var(--flaeche); }
.wahl button.ok { background: var(--gruen-leise); border-color: var(--gruen); }
.wahl button.nein { background: var(--rot-leise); border-color: var(--rot); }
form.tippen { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.eingabe { width: 100%; font: inherit; font-size: 22px; font-weight: 700; text-align: center; padding: 14px; border-radius: 12px; border: 2px solid var(--linie); background: var(--flaeche-2); color: var(--text); }
.eingabe.ok { border-color: var(--gruen); background: var(--gruen-leise); }
.eingabe.nein { border-color: var(--rot); background: var(--rot-leise); }
.meldung { border-radius: 12px; padding: 12px 14px; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.meldung.ok { background: var(--gruen-leise); color: var(--text); border-left: 0; }
.meldung.fast { background: var(--orange-leise); }
.meldung.nein { background: var(--rot-leise); }
.meldung b { font-family: var(--f-display); font-weight: 600; font-size: 18px; }
.meldung .loesung { font-family: var(--f-display); font-size: 24px; font-weight: 600; }
.hinweis-text { font-family: ui-monospace, 'Consolas', monospace; font-size: 20px; letter-spacing: .15em; }
.bruecke { background: var(--flaeche-2); border: 1.5px dashed var(--linie); border-radius: 12px; padding: 12px; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.bruecke label { font-weight: 800; font-size: 14px; }
.bruecke textarea { font: inherit; font-size: 15px; width: 100%; min-height: 64px; border-radius: 10px; border: 1.5px solid var(--linie); background: var(--flaeche); color: var(--text); padding: 8px 10px; resize: vertical; }
.bruecke .zeile .knopf { padding: 8px 14px; font-size: 15px; flex: 0 0 auto; }

/* Ergebnis & Wörterliste */
.gross { font-family: var(--f-display); font-size: 44px; color: var(--teal); line-height: 1; font-variant-numeric: tabular-nums; }
.woerter { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.woerter li { display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linie); }
.woerter li:last-child { border-bottom: 0; }
.woerter .en { font-weight: 800; overflow-wrap: anywhere; }
.woerter .de { color: var(--text-leise); overflow-wrap: anywhere; }
.woerter .mn { grid-column: 2 / -1; font-size: 13px; color: var(--text-leise); font-style: italic; }
.woerter .ton { width: 34px; height: 34px; }
.woerter .ton .ic { width: 18px; height: 18px; }
.punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
h3.abschnitt { font-size: 16px; color: var(--teal); margin-top: 8px; }
.fuss { text-align: center; font-size: 12px; color: var(--text-leise); }
.leer { text-align: center; padding-block: 28px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@keyframes hoch { from { transform: translateY(6px); opacity: .4; } to { transform: none; opacity: 1; } }
.aufgabe > * { animation: hoch .2s ease-out; }

/* Ergänzungen Web-Version */
.kopf-knopf.hell { background: var(--flaeche); color: var(--text); }
.eltern-kopf { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); }
.eltern-kopf .unter { color: var(--text-leise); }
.eltern-kopf .kopf-knopf { background: var(--flaeche-2); color: var(--text); }
.hinweis-karte { background: var(--orange-leise); box-shadow: none; gap: 4px; }
.meldung-karte { box-shadow: none; padding: 12px 16px; font-weight: 700; }
.meldung-karte.ok { background: var(--gruen-leise); }
.meldung-karte.fehler { background: var(--rot-leise); }
.tabs { display: flex; gap: 6px; background: var(--flaeche); border-radius: 14px; padding: 5px; box-shadow: var(--schatten); }
.tabs button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 10px; font-weight: 800; color: var(--text-leise); }
.tabs button[aria-selected="true"] { background: var(--navy); color: var(--navy-text); }
.kennzahlen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kennzahlen div { background: var(--flaeche-2); border-radius: 12px; padding: 10px 12px; }
.kennzahlen b { font-family: var(--f-display); font-size: 26px; color: var(--teal); display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kennzahlen span { font-size: 13px; font-weight: 700; color: var(--text-leise); }
.eltern-liste { display: flex; flex-direction: column; gap: 6px; }
.listen-zeile { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding-block: 10px; border-top: 1px solid var(--linie); }
.listen-info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.listen-knoepfe { flex: 0 0 auto; }
.knopf.klein { padding: 8px 14px; font-size: 15px; }
.zeile > .knopf.klein { flex: 0 0 auto; }
.knopf.gefahr { background: var(--rot); color: #fff; }
.formular { display: flex; flex-direction: column; gap: 8px; }
.formular label { font-weight: 800; font-size: 14px; margin-top: 4px; }
.formular input, .formular select, .formular textarea { font: inherit; font-size: 16px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--linie); background: var(--flaeche-2); color: var(--text); min-width: 0; }
.felder { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.felder > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
@media (max-width: 460px) { .felder { grid-template-columns: 1fr; } }
.vokabel-text { min-height: 220px; font-family: ui-monospace, 'Consolas', monospace !important; font-size: 14px !important; line-height: 1.5; resize: vertical; }
.hilfe { background: var(--flaeche-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.hilfe summary { font-weight: 800; cursor: pointer; }
.hilfe p { margin-top: 8px; }
.hilfe pre { background: var(--flaeche); border-radius: 8px; padding: 8px 10px; overflow-x: auto; font-size: 13px; margin: 8px 0 0; }
code { font-family: ui-monospace, 'Consolas', monospace; font-size: .92em; background: var(--flaeche-2); border-radius: 4px; padding: 0 4px; }
.datei { position: relative; overflow: hidden; }
.datei input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.vorschau-zahl { font-size: 15px; }
.tabelle-rahmen { overflow: auto; max-height: 320px; border: 1px solid var(--linie); border-radius: 10px; }
table.vorschau { border-collapse: collapse; width: 100%; font-size: 14px; }
table.vorschau th, table.vorschau td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--linie); vertical-align: top; }
table.vorschau th { position: sticky; top: 0; background: var(--flaeche-2); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-leise); }
table.vorschau td:first-child { color: var(--text-leise); white-space: nowrap; }
.fehlerliste { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
#vorschau { display: flex; flex-direction: column; gap: 8px; }

.formular .eingabe { font-size: 24px; text-align: center; letter-spacing: .3em; max-width: 260px; align-self: center; }
.haken { display: flex; gap: 10px; align-items: flex-start; font-weight: 600 !important; font-size: 14px !important; }
.haken input { width: auto !important; margin-top: 3px; }
.pin-zeile { border-top: 1px solid var(--linie); padding-top: 8px; }
.pin-zeile .zeile input { flex: 1 1 140px; width: auto; }

/* Protokoll im Elternbereich */
.prot-ueberblick { display: grid; gap: 10px; }
.prot-ueberblick div { background: var(--flaeche-2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.prot-ueberblick b { font-family: var(--f-display); font-size: 18px; }
.rot { color: var(--rot); font-weight: 800; }
.schwer li.rot span { color: var(--rot); }
details.block { border: 1.5px solid var(--linie); border-radius: 12px; padding: 10px 12px; }
details.block + details.block { margin-top: 8px; }
details.block.warn { border-color: var(--rot); background: var(--rot-leise); }
details.block summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 4px; }
details.block summary::-webkit-details-marker { display: none; }
details.block[open] summary { margin-bottom: 10px; }
.block-kopf { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.block-kopf b { font-variant-numeric: tabular-nums; }
.block-kopf span:nth-child(2) { font-weight: 700; }
.block-kopf .leise { margin-left: auto; }
.flags { margin: 2px 0 0; padding-left: 18px; color: var(--rot); font-weight: 700; font-size: 14px; }
details.block .tabelle-rahmen { max-height: 420px; background: var(--flaeche); }
table.protokoll { border-collapse: collapse; width: 100%; font-size: 13px; }
table.protokoll th, table.protokoll td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--linie); vertical-align: top; }
table.protokoll th { position: sticky; top: 0; background: var(--flaeche-2); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-leise); }
table.protokoll td:first-child { color: var(--text-leise); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.protokoll tr.falsch td { background: var(--orange-leise); }
table.protokoll tr.auffaellig td { background: var(--rot-leise); color: var(--rot); font-weight: 700; }
#app.breit { max-width: 980px; }
table.protokoll { min-width: 720px; }
table.protokoll td:nth-child(3) { min-width: 180px; }
