/*
VOICE: freundlich und ruhig wie ein guter Lernbegleiter; klare Sprache, keine Hektik, Lob ohne Lärm.
IDEA: der Karteikasten. Jede Aufgabe ist eine Karteikarte mit roter Kopflinie und blauen Linien; sie wandert von Fach zu Fach.
PICTURE: auf der Startseite der eigene Karteikasten mit fünf Fächern, die Stapelhöhe zeigt den echten Lernstand.
COLOUR and TYPE: Heftblau als Fläche, weiße Karten, Textmarker-Gelb für den einen wichtigen Knopf; Systemschrift (keine Webfonts, nichts lädt von außen).
LAYOUT: eine Spalte bis 760 px, auf dem Tablet zweispaltige Startseite; Lernkarte füllt den Bildschirm, Knopf unten in Daumenreichweite.
*/
:root {
  color-scheme: light dark;
  --blau: #1d3f8f;
  --blau-tief: #132c66;
  --blau-hell: light-dark(#e7eefb, #1b2c55);
  --grund: light-dark(#f3f6fc, #0d1730);
  --karte: light-dark(#ffffff, #16244a);
  --tinte: light-dark(#14213d, #e9eefb);
  --leise: light-dark(#55617a, #a9b6d3);
  --linie: light-dark(#c9d8ee, #2b3d6b);
  --rot: #dd4234;
  --gelb: #ffcf33;
  --gelb-tinte: #2b2100;
  --gut: light-dark(#1f7a4a, #5fd394);
  --gut-flaeche: light-dark(#e3f5ea, #12392a);
  --halb: light-dark(#9a5b00, #f0b45a);
  --halb-flaeche: light-dark(#fdf1dc, #3d2c10);
  --falsch: light-dark(#c2410c, #ff8a5c);
  --falsch-flaeche: light-dark(#fde8de, #44200f);
  --schrift: 1;
  --rund: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }
* { box-sizing: border-box; min-width: 0; }
html { font-size: calc(17px * var(--schrift)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--tinte);
  font: 1rem/1.5 var(--text); overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gelb); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--rund); line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 6vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 750; }
p { margin: 0; }
.laden { padding: 40px 20px; text-align: center; color: var(--leise); }
.leise { color: var(--leise); }
.klein { font-size: .85rem; }
.zahl { font-variant-numeric: tabular-nums; }

/* Flächen */
.band { background: var(--blau); color: #fff; padding: calc(16px + env(safe-area-inset-top, 0px)) max(5vw, 16px) 28px; }
.band .leise { color: #c9d6f3; }
.inhalt { max-width: 760px; margin: 0 auto; padding: 20px max(4vw, 16px) 40px; display: grid; gap: 20px; }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 760px; margin: 0 auto 18px; }

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border-radius: 14px; border: 2px solid transparent;
  font-family: var(--rund); font-weight: 750; font-size: 1.05rem; text-decoration: none;
  background: var(--blau); color: #fff;
}
.knopf.haupt { background: var(--gelb); color: var(--gelb-tinte); box-shadow: 0 3px 0 #c99a00; }
.knopf.haupt:active { transform: translateY(2px); box-shadow: 0 1px 0 #c99a00; }
.knopf.rand { background: transparent; color: var(--blau); border-color: currentColor; }
.band .knopf.rand { color: #fff; }
.knopf.gut { background: var(--gut); color: #fff; }
.knopf.nochmal { background: var(--falsch); color: #fff; }
.knopf.breit { width: 100%; }
.knopf[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.textknopf { background: none; border: 0; padding: 8px 4px; color: var(--blau); text-decoration: underline; font-weight: 600; min-height: 44px; }
:root:not([data-theme=light]) .textknopf { color: light-dark(var(--blau), #9fbaf5); }
.symbolknopf {
  width: 48px; height: 48px; border-radius: 50%; border: 0; display: inline-grid; place-items: center;
  background: rgba(255,255,255,.14); color: inherit; flex: none;
}
.karte .symbolknopf { background: var(--blau-hell); color: light-dark(var(--blau), #cfe0ff); }
.symbolknopf svg { width: 24px; height: 24px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px 6px 6px;
  border-radius: 999px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-weight: 650;
}
.punkt { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--rund); font-weight: 800; color: #fff; flex: none; }

/* Profile */
.profile { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.profil {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; border: 0; text-align: left;
  background: var(--karte); color: var(--tinte); box-shadow: 0 1px 0 var(--linie), 0 6px 18px rgba(20,40,90,.08);
}
.profil .punkt { width: 52px; height: 52px; font-size: 1.4rem; }
.profil b { display: block; font-family: var(--rund); font-size: 1.2rem; }
.formular { display: grid; gap: 14px; background: var(--karte); padding: 20px; border-radius: 18px; }
.feld { display: grid; gap: 6px; font-weight: 650; }
.eingabe, select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--linie);
  background: var(--karte); font-size: max(16px, 1.05rem);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.eingabe:focus, textarea:focus, select:focus { border-color: var(--blau); outline: none; }

/* Startseite */
.gruss { display: grid; gap: 18px; max-width: 760px; margin: 0 auto; }
.ziel { display: grid; gap: 10px; }
.zielzeile { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.zielzahl { font-family: var(--rund); font-size: 1.6rem; font-weight: 800; }
.leiste { height: 14px; border-radius: 999px; background: rgba(255,255,255,.2); overflow: hidden; }
.leiste i { display: block; height: 100%; background: var(--gelb); border-radius: inherit; transition: width .4s ease; }
.serie { display: flex; align-items: center; gap: 10px; }
.serie svg { width: 30px; height: 30px; flex: none; }
.modus { display: inline-flex; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.14); }
.modus button { min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 0; background: transparent; color: #fff; font-weight: 700; }
.modus button[aria-pressed=true] { background: #fff; color: var(--blau); }
.aktionen { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Karteikasten */
.kasten { background: var(--karte); border-radius: 18px; padding: 18px; display: grid; gap: 14px; box-shadow: 0 1px 0 var(--linie); }
.faecher { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; }
.fach { display: grid; gap: 6px; text-align: center; }
.stapel { position: relative; height: 96px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 3px solid var(--linie); }
.stapel span { width: 86%; border-radius: 3px 3px 0 0; background: repeating-linear-gradient(to bottom, #fff 0 5px, var(--linie) 5px 6px); border: 1px solid var(--linie); border-bottom: 0; min-height: 4px; position: relative; }
.stapel span::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--rot); border-radius: 3px 3px 0 0; }
.fach.neu .stapel span { background: repeating-linear-gradient(to bottom, var(--blau-hell) 0 5px, var(--linie) 5px 6px); }
.fach.neu .stapel span::before { background: var(--blau); }
.stapel em { font-style: normal; font-weight: 800; font-family: var(--rund); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.fach small { display: block; color: var(--leise); font-size: .75rem; line-height: 1.2; white-space: nowrap; }
.fach b { display: block; font-size: .85rem; white-space: nowrap; }

/* Themen */
.themen { display: grid; gap: 10px; }
.thema {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; text-align: left; width: 100%;
  padding: 14px 16px; border-radius: 16px; border: 0; background: var(--karte); color: var(--tinte); box-shadow: 0 1px 0 var(--linie);
}
.thema b { font-family: var(--rund); font-size: 1.05rem; }
.thema .balken { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--blau-hell); overflow: hidden; }
.thema .balken i { display: block; height: 100%; background: var(--gut); }
.marke { font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--gelb); color: var(--gelb-tinte); white-space: nowrap; }
.marke.ruhig { background: var(--blau-hell); color: light-dark(var(--blau), #cfe0ff); }
.hinweis { background: var(--blau-hell); border-radius: 16px; padding: 16px; display: grid; gap: 8px; }
.fuss { display: flex; gap: 8px 18px; flex-wrap: wrap; justify-content: center; }

/* Sitzung */
.sitzung { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.sitzkopf { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(4vw, 12px) 10px; max-width: 800px; width: 100%; margin: 0 auto; }
.sitzkopf .leiste { flex: 1; background: var(--blau-hell); }
.sitzkopf .leiste i { background: var(--blau); }
.sitzkopf .symbolknopf { background: var(--blau-hell); color: light-dark(var(--blau), #cfe0ff); }
.buehne { padding: 6px max(4vw, 12px) 32px; max-width: 800px; width: 100%; margin: 0 auto; display: grid; align-content: start; gap: 16px; }
.karte {
  position: relative; background: var(--karte); border-radius: 18px; padding: 18px 18px 22px;
  box-shadow: 0 1px 0 var(--linie), 0 10px 30px rgba(20,40,90,.10);
  display: grid; gap: 16px;
}
.kartenkopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; margin: -6px -18px 0; padding: 0 18px 8px; border-bottom: 2px solid var(--rot); }
.kartenkopf span { font-size: .85rem; color: var(--leise); font-weight: 650; }
.frage { font-family: var(--rund); font-size: 1.35rem; font-weight: 700; line-height: 1.35; }
.hilfe { font-size: .9rem; color: var(--halb); font-weight: 650; }
.optionen { display: grid; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; min-height: 56px; padding: 14px 16px;
  border-radius: 14px; border: 2px solid var(--linie); background: var(--karte); font-size: 1.05rem;
}
.option .marker { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--leise); display: grid; place-items: center; font-weight: 800; font-size: .9rem; margin-top: 1px; }
.option.mehr .marker { border-radius: 7px; }
.option[aria-pressed=true] { border-color: var(--blau); background: var(--blau-hell); }
.option[aria-pressed=true] .marker { background: var(--blau); border-color: var(--blau); color: #fff; }
.option.ok { border-color: var(--gut); background: var(--gut-flaeche); }
.option.ok .marker { background: var(--gut); border-color: var(--gut); color: #fff; }
.option.no { border-color: var(--falsch); background: var(--falsch-flaeche); }
.option.no .marker { background: var(--falsch); border-color: var(--falsch); color: #fff; }
.option[disabled] { cursor: default; color: var(--tinte); }
.reihe { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reihe .eingabe { flex: 1 1 160px; max-width: 280px; }
.einheit { font-family: var(--rund); font-weight: 800; }
.luecke { display: grid; gap: 6px; }
.eingabe.ok { border-color: var(--gut); background: var(--gut-flaeche); }
.eingabe.no { border-color: var(--falsch); background: var(--falsch-flaeche); }
.paar { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--linie); }
.paar:first-child { border-top: 0; padding-top: 0; }
.paar > span { font-weight: 650; }
.wahl { display: flex; gap: 8px; flex-wrap: wrap; }
.wahl button { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--linie); background: var(--karte); font-weight: 650; }
.wahl button[aria-pressed=true] { background: var(--blau); border-color: var(--blau); color: #fff; }
.wahl button.ok { background: var(--gut); border-color: var(--gut); color: #fff; }
.wahl button.no { background: var(--falsch); border-color: var(--falsch); color: #fff; }
.wahl button.soll { border-color: var(--gut); border-style: dashed; }
.folge { display: grid; gap: 8px; min-height: 64px; padding: 10px; border-radius: 14px; border: 2px dashed var(--linie); background: var(--blau-hell); }
.folge .leer { color: var(--leise); align-self: center; padding: 4px 6px; }
.stueck { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--linie); background: var(--karte); text-align: left; font-weight: 650; }
.stueck b { color: var(--blau); font-family: var(--rund); min-width: 1.4em; }
.stueck.ok { border-color: var(--gut); }
.stueck.no { border-color: var(--falsch); }
.vorrat { display: flex; flex-wrap: wrap; gap: 8px; }

.rueckmeldung { border-radius: 16px; padding: 16px; display: grid; gap: 10px; border-left: 6px solid; }
.rueckmeldung.gut { background: var(--gut-flaeche); border-color: var(--gut); }
.rueckmeldung.halb { background: var(--halb-flaeche); border-color: var(--halb); }
.rueckmeldung.falsch { background: var(--falsch-flaeche); border-color: var(--falsch); }
.rueckmeldung h3 { font-size: 1.2rem; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rueckmeldung h3 > :last-child { flex: none; white-space: nowrap; }
.rueckmeldung h3.frage-klein { font-size: 1.02rem; line-height: 1.35; }
.rueckmeldung ul { margin: 0; padding-left: 1.2em; }
.loesung { font-weight: 700; }
.quelle { font-size: .8rem; color: var(--leise); }
.rueckseite { display: grid; gap: 10px; padding-top: 4px; }
.rueckseite .loesung { font-family: var(--rund); font-size: 1.2rem; }

.sitzfuss {
  position: sticky; bottom: 0; padding: 12px max(4vw, 12px) calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--grund) 75%, transparent); display: flex; gap: 12px; justify-content: center;
}
.sitzfuss > * { flex: 1; max-width: 380px; }

/* Ende */
.ende { min-height: 100dvh; display: grid; place-items: center; padding: 24px max(5vw, 16px); background: var(--blau); color: #fff; text-align: center; }
.ende .box { max-width: 520px; display: grid; gap: 20px; justify-items: center; }
.ende .werte { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.ende .wert { background: rgba(255,255,255,.12); border-radius: 16px; padding: 14px 18px; min-width: 120px; }
.ende .wert b { display: block; font-family: var(--rund); font-size: 2rem; }
.stern { width: 96px; height: 96px; }

.notenfeld { font-family: var(--rund); font-weight: 800; font-size: 4rem; line-height: 1; border: 3px solid #fff; border-radius: 16px; padding: 10px 20px; min-width: 2.4em; text-align: center; }

.meldung { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(92vw, 460px); background: var(--tinte); color: var(--grund); padding: 14px 18px; border-radius: 14px; font-weight: 650; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 5; animation: weg 4s forwards; }
@keyframes weg { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* Blatt für Einstellungen und Rückfragen */
.blatt-hinter { position: fixed; inset: 0; background: rgba(8,16,40,.55); display: grid; align-items: end; justify-items: center; z-index: 10; }
.blatt { width: min(100%, 560px); max-height: 92dvh; overflow: auto; background: var(--grund); border-radius: 22px 22px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 16px; }
.stufer { display: flex; align-items: center; gap: 10px; }
.stufer button { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--linie); background: var(--karte); font-size: 1.4rem; font-weight: 800; }
.stufer output { min-width: 3ch; text-align: center; font-family: var(--rund); font-size: 1.3rem; font-weight: 800; }
.zeile { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.gefahr { color: var(--falsch); }
pre.export { max-height: 160px; overflow: auto; font-size: .75rem; background: var(--karte); padding: 10px; border-radius: 10px; white-space: pre-wrap; word-break: break-all; }

@media (min-width: 900px) {
  .start-raster { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; max-width: 1100px; }
  .start-raster > .spalte { display: grid; gap: 20px; }
  .band .gruss, .band .kopf { max-width: 1100px; }
}
@media (max-width: 420px) {
  .faecher { gap: 4px; }
  .stapel { height: 72px; }
  .fach b, .fach small { font-size: .72rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .karte.neu { animation: herein .28s ease-out; }
  @keyframes herein { from { opacity: 0; transform: translateY(10px) rotate(-.6deg); } to { opacity: 1; transform: none; } }
}
