/* Lernfuchs – helles, kindgerechtes Design */
:root {
  --bg: #F4F7FB;
  --karte: #FFFFFF;
  --text: #17283D;
  --leise: #5A6C84;
  --linie: #DCE4EF;
  --blau: #2563EB;
  --gruen: #1a9e5c;
  --rot: #d64541;
  --gelb: #FFC53D;
  --radius: 18px;
  --schatten: 0 2px 10px rgba(23, 40, 61, .07), 0 12px 28px rgba(23, 40, 61, .05);
  --font: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--blau); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- Kopfzeile ---------- */
.kopf {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 14px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  padding-bottom: 12px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linie);
}
.kopf h1 {
  grid-column: 1 / -1; grid-row: 2;
  margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em;
}
.kopf .marke, .kopf .zurueck {
  grid-row: 1; justify-self: start;
  font-weight: 800; font-size: 1rem; color: var(--blau);
  text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer;
}
.kopf-rechts { grid-row: 1; grid-column: 2; justify-self: end; }

.schnitt {
  display: flex; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--note, #999) 12%, white);
  border: 2px solid var(--note, #ccc);
  border-radius: 999px; padding: 5px 12px 5px 14px; white-space: nowrap;
}
.schnitt span { font-size: .72rem; color: var(--leise); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.schnitt b { font-size: 1.25rem; font-weight: 900; color: var(--note); line-height: 1; }
.schnitt i { font-size: .8rem; font-style: normal; color: var(--leise); }
.schnitt-leer { border-color: var(--linie); background: #fff; }
.schnitt-leer b { color: var(--leise); }

/* ---------- Grundgerüst ---------- */
.wrap { max-width: 900px; margin: 0 auto; padding: 18px 16px 26px; }
.wrap.schmal { max-width: 640px; }
.unter { color: var(--leise); margin: 0 0 16px; }
.klein { font-size: .85rem; color: var(--leise); }
.hinweis { margin-top: 24px; color: var(--leise); font-size: .9rem; text-align: center; }
.abschnitt { font-size: 1.1rem; margin: 30px 0 10px; }

.karte {
  background: var(--karte); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 18px; margin-bottom: 16px;
}

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blau); color: #fff; border: 0; border-radius: 14px;
  padding: 14px 22px; font-weight: 800; font-size: 1rem;
  text-decoration: none; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .12);
  transition: transform .08s;
}
.knopf:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.knopf.gross { width: 100%; padding: 18px; font-size: 1.1rem; margin-top: 14px; }
.knopf.leise { background: #fff; color: var(--text); border: 2px solid var(--linie); box-shadow: none; }
.knopf.loeschen { color: var(--rot); border-color: #f3c9c8; width: 100%; margin-top: 6px; }
.aktionen { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.aktionen .knopf { flex: 1 1 160px; }

/* ---------- Profile ---------- */
.profil-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.profil-karte {
  position: relative; background: #fff; border: 0; border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 22px 14px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.profil-karte:active { transform: scale(.98); }
.profil-karte .avatar { font-size: 2.6rem; }
.profil-karte b { font-size: 1.1rem; }
.profil-karte .klasse { color: var(--leise); font-size: .85rem; }
.mini-note { margin-top: 6px; color: #fff; font-weight: 800; border-radius: 999px; padding: 2px 12px; font-size: .85rem; }
.mini-note.leer { background: var(--linie); color: var(--leise); }
.profil-karte.neu { border: 2px dashed var(--linie); box-shadow: none; background: transparent; }

.formular label { display: block; margin-bottom: 16px; font-weight: 700; }
.formular input, .formular select {
  display: block; width: 100%; margin-top: 6px; padding: 14px;
  border: 2px solid var(--linie); border-radius: 12px; background: #fff; font-weight: 600;
}
.formular input:focus, .formular select:focus, .eingabe-feld:focus { outline: 3px solid #bcd3ff; border-color: var(--blau); }
.avatar-wahl { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.avatar-opt {
  font-size: 1.6rem; background: #fff; border: 2px solid var(--linie);
  border-radius: 12px; width: 52px; height: 52px; cursor: pointer;
}
.avatar-opt.aktiv { border-color: var(--blau); background: #EAF1FF; }
.karte.info { background: #EAF1FF; box-shadow: none; }
.karte.info p { margin: 0 0 6px; }

/* ---------- Start ---------- */
.schuljahr-leiste { margin-bottom: 18px; }
.schuljahr-leiste .balken { height: 10px; background: #E3EAF4; border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.schuljahr-leiste .balken i { display: block; height: 100%; background: linear-gradient(90deg, #7CB518, #FFC53D); }

.karte.aufstieg { text-align: center; background: linear-gradient(160deg, #FFF6D8, #FFE9A8); }
.karte.aufstieg h2 { margin: 6px 0; }
.karte.aufstieg .konfetti { font-size: 2.6rem; }

.fach-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.fach-kachel {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  background: var(--fach); color: #fff; text-decoration: none;
  border-radius: var(--radius); padding: 18px 16px 16px; min-height: 130px;
  box-shadow: var(--schatten); overflow: hidden;
}
.fach-kachel:active { transform: scale(.985); }
.fach-kachel .fach-icon { font-size: 2.2rem; }
.fach-kachel b { font-size: 1.15rem; }
.fach-kachel .fach-note { font-size: .82rem; opacity: .92; }
.fach-punkt {
  position: absolute; top: 12px; right: 12px; background: #fff; color: #fff;
  border-radius: 999px; min-width: 38px; text-align: center; padding: 3px 9px;
  font-weight: 900; box-shadow: 0 0 0 3px rgba(255, 255, 255, .45);
}
.start-aktionen { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.start-aktionen .knopf { flex: 1 1 150px; }

/* ---------- Tests ---------- */
.test-liste { display: flex; flex-direction: column; gap: 12px; }
.test-karte {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text);
  background: #fff; border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 16px; border-left: 6px solid var(--fach);
}
.test-karte:active { transform: scale(.99); }
.test-icon { font-size: 1.9rem; }
.test-text { flex: 1; display: flex; flex-direction: column; }
.test-text i { font-style: normal; color: var(--leise); font-size: .85rem; }
.test-note { color: #fff; font-weight: 900; border-radius: 999px; padding: 4px 12px; min-width: 44px; text-align: center; }
.test-note.leer { background: #EAF1FF; color: var(--blau); font-size: .8rem; }

.ergebnis-liste { display: flex; flex-direction: column; gap: 8px; }
.ergebnis-zeile {
  display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px;
  padding: 12px 14px; text-decoration: none; color: var(--text); box-shadow: var(--schatten);
}
.e-note { color: #fff; font-weight: 900; border-radius: 10px; padding: 6px 10px; min-width: 42px; text-align: center; }
.e-text { flex: 1; display: flex; flex-direction: column; }
.e-text i { font-style: normal; font-size: .8rem; color: var(--leise); }
.pfeil { color: var(--leise); font-size: 1.4rem; }

/* ---------- Aufgaben ---------- */
.fortschritt { position: relative; height: 26px; background: #E3EAF4; }
.fortschritt i { display: block; height: 100%; background: var(--gruen); transition: width .25s; }
.fortschritt span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; color: var(--text);
}
.karte.aufgabe { border-top: 6px solid var(--fach); padding: 22px 18px; }
.frage { font-size: 1.4rem; font-weight: 800; margin: 6px 0 18px; }
.a-hinweis { color: var(--leise); margin: 0 0 12px; }
.gross-emoji { font-size: 3.4rem; text-align: center; }
.lesetext {
  background: #F7FAFF; border-left: 4px solid var(--blau); border-radius: 10px;
  padding: 14px; margin-bottom: 14px; white-space: pre-wrap;
}
.optionen { display: flex; flex-direction: column; gap: 10px; }
.option {
  background: #fff; border: 2px solid var(--linie); border-radius: 14px;
  padding: 16px; text-align: left; font-weight: 700; font-size: 1.05rem; cursor: pointer;
}
.option:hover { border-color: var(--blau); background: #F5F9FF; }
.option:active { transform: scale(.99); }
.eingabe-feld {
  width: 100%; padding: 16px; border: 2px solid var(--linie); border-radius: 14px;
  font-size: 1.3rem; font-weight: 800; text-align: center; background: #fff;
}
.eingabe-feld.gross { text-align: left; font-size: 1.05rem; font-weight: 600; line-height: 1.7; }
.abschreib-text {
  background: #FFFBEA; border: 2px dashed #F0D98B; border-radius: 14px;
  padding: 16px; font-size: 1.15rem; line-height: 1.8; margin-bottom: 14px; white-space: pre-wrap;
}
.abschreib-text.klein-text { font-size: 1rem; }

/* Rückmeldung */
.rueckmeldung {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 50;
  background: #fff; border-radius: 16px; padding: 14px 20px; min-width: 260px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .22); border: 3px solid var(--gruen);
  animation: hoch .18s ease-out;
}
.rueckmeldung.schlecht { border-color: var(--rot); }
.rueckmeldung.weg { opacity: 0; transition: opacity .18s; }
.rueckmeldung .rm-icon { font-size: 1.8rem; }
.rueckmeldung .rm-text { display: flex; flex-direction: column; }
.rueckmeldung .rm-text b { font-size: 1.1rem; }
.rueckmeldung .rm-text span { font-size: .85rem; color: var(--leise); }
@keyframes hoch { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- Ergebnis ---------- */
.karte.zeugnis { text-align: center; border-top: 8px solid var(--note); }
.zeugnis-kopf { color: var(--leise); font-weight: 700; }
.note-gross { font-size: 4.6rem; font-weight: 900; line-height: 1.1; color: var(--note); }
.zeugnis-zahlen { font-weight: 700; }
.lob { margin: 10px 0 6px; }

.review { display: flex; flex-direction: column; gap: 10px; }
.r-karte { background: #fff; border-radius: 14px; box-shadow: var(--schatten); overflow: hidden; border-left: 6px solid var(--gruen); }
.r-karte.schlecht { border-left-color: var(--rot); }
.r-kopf {
  display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0;
  padding: 14px; text-align: left; cursor: pointer;
}
.r-nr { background: #EAF1FF; color: var(--blau); font-weight: 900; border-radius: 999px; width: 30px; height: 30px; display: grid; place-items: center; flex: none; }
.r-frage { flex: 1; font-weight: 700; }
.r-status { font-size: .9rem; font-weight: 800; color: var(--leise); }
.r-pfeil { color: var(--leise); transition: transform .15s; }
.r-karte.offen .r-pfeil { transform: rotate(180deg); }
.r-koerper { padding: 0 16px 18px; }
.r-antworten { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.r-deine, .r-richtige { flex: 1 1 160px; border-radius: 12px; padding: 10px 14px; background: #F4F7FB; }
.r-deine span, .r-richtige span { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); font-weight: 800; }
.r-deine.gut { background: #E7F7EE; }
.r-deine.schlecht { background: #FDECEC; }
.r-richtige { background: #E7F7EE; }

/* Erklärungen */
.erklaerung { display: flex; flex-direction: column; gap: 10px; }
.ex-box { background: #F7FAFF; border-radius: 12px; padding: 12px 14px; }
.ex-h { font-weight: 800; margin: 12px 0 6px; }
.ex-steps { margin: 0; padding-left: 22px; }
.ex-steps li { margin-bottom: 6px; }
.ex-calc { font-weight: 800; background: #FFF3CF; border-radius: 8px; padding: 2px 8px; white-space: nowrap; }
.ex-tipp { margin-top: 12px; background: #FFF6D8; border-left: 5px solid var(--gelb); border-radius: 10px; padding: 12px 14px; }

.reihe { display: flex; flex-wrap: wrap; gap: 6px; }
.reihe-item { background: #EEF3FA; border-radius: 8px; padding: 4px 9px; font-size: .9rem; }
.reihe-item.ist-treffer { background: var(--gruen); color: #fff; }
.reihe-item.ist-treffer b { color: #fff; }

.punktebild { margin: 10px 0; }
.punkt-zeile { display: flex; gap: 5px; margin-bottom: 5px; }
.punkt-zeile i { width: 15px; height: 15px; border-radius: 50%; background: var(--blau); display: block; }
.punkt-legende { font-size: .85rem; color: var(--leise); }

.stellenrechnung { font-family: 'Courier New', monospace; font-size: 1.25rem; font-weight: 700; display: inline-block; margin: 8px 0; }
.st-zeile { display: flex; gap: 8px; justify-content: flex-end; }
.st-op { width: 1em; }
.st-strich { border-bottom: 3px solid var(--text); margin: 4px 0; }

.stellentafel { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.stellentafel div { background: #EEF3FA; border-radius: 10px; padding: 6px 10px; text-align: center; }
.stellentafel div span { display: block; font-size: .68rem; color: var(--leise); font-weight: 700; }
.stellentafel div b { font-size: 1.3rem; }
.stellentafel div.ist-treffer { background: var(--gruen); color: #fff; }
.stellentafel div.ist-treffer span { color: #fff; }

.wort-diff { display: flex; flex-wrap: wrap; gap: 6px 8px; line-height: 2.2; }
.wort-diff span { position: relative; }
.wort-diff .w-falsch { background: #FDECEC; color: var(--rot); border-radius: 6px; padding: 0 5px; font-weight: 700; }
.wort-diff .w-fehlt { background: #FFF3CF; border-radius: 6px; padding: 0 5px; text-decoration: underline dotted; }
.wort-diff .w-zuviel { background: #EEE; border-radius: 6px; padding: 0 5px; text-decoration: line-through; }
.wort-diff i { display: block; font-style: normal; font-size: .68rem; color: var(--leise); margin-top: -6px; }

/* ---------- Noten ---------- */
.zeugnis-kopf-karte { text-align: center; }
.z-name { font-size: 1.4rem; font-weight: 900; }
.z-klasse { color: var(--leise); }
.z-gesamt { display: inline-block; margin-top: 10px; color: #fff; font-weight: 800; border-radius: 999px; padding: 6px 16px; }
.z-gesamt.leer { background: var(--linie); color: var(--leise); }
.fach-block { border-left: 6px solid var(--fach); }
.fb-kopf { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.fb-kopf span:first-child { font-size: 1.5rem; }
.fb-kopf b { flex: 1; }
.fb-note { color: #fff; font-weight: 800; border-radius: 999px; padding: 4px 12px; font-size: .9rem; }
.fb-note.leer { background: var(--linie); color: var(--leise); }
.noten-reihe { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.noten-punkt {
  color: #fff; font-weight: 900; text-decoration: none; border-radius: 10px;
  min-width: 40px; text-align: center; padding: 8px 6px;
}

/* ---------- Vorlesen ---------- */
.vorlesen {
  display: inline-flex; align-items: center; gap: 8px;
  background: #EAF1FF; color: var(--blau); border: 2px solid #C8DBFF;
  border-radius: 999px; padding: 8px 16px; font-weight: 800; cursor: pointer; margin-bottom: 12px;
}
.vorlesen:active { transform: scale(.97); }
.vorlesen.laeuft { background: var(--blau); color: #fff; border-color: var(--blau); animation: pulsieren 1.1s infinite; }
.vorlesen.klein-knopf { margin: 14px 0 0; font-size: .85rem; padding: 6px 14px; }
@keyframes pulsieren { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

.schalter {
  display: flex; align-items: flex-start; gap: 12px; background: #F7FAFF;
  border: 2px solid var(--linie); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; cursor: pointer;
}
.schalter input { width: 24px; height: 24px; margin-top: 2px; flex: none; accent-color: var(--blau); }
.schalter span { display: flex; flex-direction: column; font-weight: 700; }
.schalter i { font-style: normal; font-weight: 500; font-size: .82rem; color: var(--leise); }

/* ---------- Elternbereich ---------- */
.kind-wahl { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.kind-knopf {
  background: #fff; border: 2px solid var(--linie); border-radius: 999px;
  padding: 8px 16px; text-decoration: none; color: var(--text); font-weight: 700;
}
.kind-knopf.aktiv { border-color: var(--blau); background: #EAF1FF; color: var(--blau); }

.bericht-kopf { display: flex; align-items: center; gap: 16px; }
.bk-links { flex: 1; }
.bk-name { font-size: 1.3rem; font-weight: 900; }
.bk-note {
  color: #fff; border-radius: 14px; padding: 10px 18px; text-align: center; flex: none;
}
.bk-note b { display: block; font-size: 2rem; line-height: 1; }
.bk-note span { font-size: .8rem; opacity: .9; }

.tabelle-karte { padding: 6px 4px; overflow-x: auto; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabelle th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--leise); padding: 10px 10px 6px; border-bottom: 2px solid var(--linie); white-space: nowrap;
}
.tabelle td { padding: 10px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle tr.ohne td { color: var(--leise); }

.auffaellig p { margin: 0 0 10px; }
.auffaellig p:last-child { margin-bottom: 0; }
.pille {
  display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .72rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin-right: 8px; color: #fff;
}
.pille.gut { background: var(--gruen); }
.pille.schwach { background: #ef7d00; }
.pille.neutral { background: var(--leise); }

.wochen { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.woche { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.w-balken { flex: 1; width: 100%; display: flex; align-items: flex-end; background: #EEF3FA; border-radius: 8px 8px 0 0; }
.w-balken i { display: block; width: 100%; background: var(--blau); border-radius: 8px 8px 0 0; min-height: 3px; }
.w-zahl { font-weight: 800; font-size: .85rem; }
.w-datum { font-size: .68rem; color: var(--leise); }

.nur-drucken { display: none; }

/* ---------- Fuß ---------- */
.fuss {
  background: transparent; color: var(--leise); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 6px 16px calc(22px + env(safe-area-inset-bottom, 0px));
}
.fuss img { height: 22px; opacity: .8; }
.fuss p { margin: 0; font-size: .75rem; }

@media (max-width: 480px) {
  body { font-size: 17px; }
  .frage { font-size: 1.25rem; }
  .note-gross { font-size: 3.8rem; }
  .fach-gitter, .profil-liste { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Druck (Elternbericht) ---------- */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff; font-size: 11pt; }
  .kopf, .fuss, .nicht-drucken, .start-aktionen, .kind-wahl { display: none !important; }
  .nur-drucken { display: block; text-align: center; color: #5A6C84; font-size: 9pt; }
  .wrap { max-width: none; padding: 0; }
  .karte { box-shadow: none; border: 1px solid #DCE4EF; break-inside: avoid; margin-bottom: 10pt; padding: 10pt; }
  .abschnitt { margin: 14pt 0 6pt; font-size: 13pt; }
  .tabelle { font-size: 9.5pt; }
  .tabelle-karte { overflow: visible; }
  .tabelle tr { break-inside: avoid; }
  .bk-note { border: 1px solid #DCE4EF; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .pille, .bk-note, .w-balken i { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .wochen { height: 70pt; }
}
