/* Lernstapel – Layout „Kartenstapel“ (Philipp, 19.10.2026: „das, was nicht so ablenkt“).
   Keine style-Attribute (CSP) – alles über Klassen. Lehren aus Walter: Felder ≥ 16 px, festes Gerüst,
   nichts läuft seitlich aus dem Bild. Schrift: die des Geräts (kein Download, keine Fremdquelle). */

:root {
  --grund: #F5F6FA;
  --flaeche: #FFFFFF;
  --tinte: #161B2E;
  --text: #3A415A;
  --grau: #6A7189;
  --linie: #ECEEF4;
  --akzent: #3B5BDB;
  --akzent-hell: #E4E9FB;
  --akzent-zart: #F0F3FF;
  --gut: #2B8A3E;
  --gut-hell: #EBFBEE;
  --wackelt: #B35C00;
  --wackelt-hell: #FFF4E0;
  --falsch: #C92A2A;
  --falsch-hell: #FFE3E3;
  color-scheme: light;
}
.f-beere { --akzent: #C2255C; --akzent-hell: #FBE3EC; --akzent-zart: #FDF1F5; }
.f-gruen { --akzent: #2B8A3E; --akzent-hell: #DDF3E2; --akzent-zart: #F0FAF2; }
.f-orange { --akzent: #C2410C; --akzent-hell: #FDE7D9; --akzent-zart: #FEF4EC; }
.f-grau { --akzent: #495057; --akzent-hell: #E9ECEF; --akzent-zart: #F4F5F7; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  color: var(--tinte);
  background: var(--grund);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: max(16px, 1em); }
button { cursor: pointer; }
[hidden] { display: none !important; }
.unsichtbar { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Knöpfe --- */
.knopf { min-height: 56px; border-radius: 18px; border: 0; padding: 0 18px; font-size: 17px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; text-align: center; }
.knopf-dunkel { background: var(--tinte); color: #fff; }
.knopf-akzent { background: var(--akzent); color: #fff; }
.knopf-hell { background: var(--flaeche); color: var(--tinte); }
.knopf-leise { background: transparent; color: var(--grau); min-height: 46px; font-size: 15px; font-weight: 500; }
.knopf:disabled { opacity: .45; }
.knopf-reihe { display: flex; gap: 10px; }
.knopf-reihe > .knopf { flex: 1; }
.knopf-nochmal { background: var(--falsch-hell); color: var(--falsch); }
.knopf-wusste { background: var(--gut-hell); color: var(--gut); }
.rund { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--flaeche);
  display: flex; align-items: center; justify-content: center; color: var(--tinte); }
.rund svg { width: 18px; height: 18px; stroke-width: 2.4; }
.rund-platz { width: 44px; height: 44px; flex: none; }
.kapsel { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--akzent-zart);
  color: var(--akzent); font-size: 14px; font-weight: 600; }

/* --- Tor (Anmeldung) --- */
.tor { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px 20px; text-align: center; overflow-y: auto; }
.tor-stapel { position: relative; width: 120px; height: 90px; margin-bottom: 8px; }
.tor-stapel span { position: absolute; inset: 0; border-radius: 18px; }
.tor-stapel span:nth-child(1) { background: #C9D4FB; transform: rotate(6deg); }
.tor-stapel span:nth-child(2) { background: #A9BBF7; transform: rotate(-4deg); }
.tor-stapel span:nth-child(3) { background: #3B5BDB; }
.tor-wort { font-size: 32px; font-weight: 700; letter-spacing: -.5px; }
.tor-text { max-width: 320px; line-height: 1.45; color: var(--text); }
.tor .knopf { max-width: 320px; }
.fehler { color: var(--falsch); font-weight: 600; min-height: 1.2em; max-width: 320px; }
.tor-code { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 8px; padding-top: 14px;
  border-top: 1px solid var(--linie); }
.tor-code-name { font-weight: 600; font-size: 14px; color: var(--text); }
.tor-code input { border: 0; border-radius: 14px; padding: 14px; background: var(--flaeche); text-align: center; letter-spacing: .08em; }

/* --- Gerüst: #app füllt den Bildschirm, nur <main> scrollt --- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.inhalt { flex: 1; min-height: 0; width: 100%; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; outline: none; }
.seite { max-width: 560px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 18px; min-height: 100%; }
.oben { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.oben-mitte { font-size: 15px; color: var(--grau); text-align: center; flex: 1; min-width: 0; }
.leiser { font-size: 15px; color: var(--grau); }
.titel { font-size: 32px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; margin: 0; overflow-wrap: anywhere; }
.satz { font-size: 17px; color: var(--text); line-height: 1.45; margin: 0; }
.platz { flex: 1; }
.abschnitt { font-size: 13px; font-weight: 600; color: var(--grau); letter-spacing: .4px; text-transform: uppercase; margin: 6px 4px -8px; }

/* --- Stapel (nächste Arbeit) --- */
.stapel { position: relative; height: 222px; border: 0; padding: 0; background: none; text-align: left; width: 100%; }
.stapel-lage { position: absolute; border-radius: 26px; }
.stapel-lage.l3 { left: 22px; right: 22px; top: 24px; height: 190px; background: var(--akzent-hell); transform: rotate(4deg); }
.stapel-lage.l2 { left: 12px; right: 12px; top: 12px; height: 196px; background: var(--akzent); opacity: .45; transform: rotate(-3deg); }
.stapel-vorn { position: absolute; inset: 0 0 auto 0; height: 206px; border-radius: 26px; background: var(--akzent); color: #fff;
  padding: 22px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 16px 30px rgba(30, 40, 70, .22); }
.stapel-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stapel-klein { font-size: 13px; font-weight: 600; opacity: .9; text-transform: uppercase; letter-spacing: .4px; }
.stapel-tage { font-size: 14px; font-weight: 600; background: rgba(255, 255, 255, .2); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.stapel-titel { font-size: 28px; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.stapel-unter { font-size: 15px; opacity: .92; }

/* --- Gruppenliste --- */
.liste { background: var(--flaeche); border-radius: 22px; padding: 4px 16px; display: flex; flex-direction: column; }
.zeile { display: flex; align-items: center; gap: 12px; min-height: 56px; border: 0; border-bottom: 1px solid var(--linie);
  background: none; width: 100%; text-align: left; padding: 6px 0; }
.zeile:last-child { border-bottom: 0; }
.zeile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.zeile-name { font-size: 16px; overflow-wrap: anywhere; }
.zeile-unter { font-size: 13px; color: var(--grau); }
.zeile-rechts { font-size: 15px; color: var(--grau); flex: none; text-align: right; }
.zeile-rechts.gut { color: var(--gut); font-weight: 600; }
.zeile-rechts.wackelt { color: var(--wackelt); font-weight: 600; }
.pfeil { color: #B8C0D6; flex: none; }
.punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--akzent); }
.punkt.sitzt { background: var(--gut); }
.punkt.wackelt { background: #F08C00; }
.punkt.neu { background: #B8C0D6; }
.marke { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 8px; background: var(--akzent-zart); color: var(--akzent); flex: none; }

/* --- Filter (Eltern) --- */
.filter { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-knopf { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--flaeche); font-size: 15px; font-weight: 500; }
.filter-knopf.an { background: var(--tinte); color: #fff; }

/* --- Arbeit: Themenblatt und Seiten --- */
.karte { background: var(--flaeche); border-radius: 22px; padding: 14px; display: flex; gap: 12px; align-items: center; border: 0;
  width: 100%; text-align: left; }
.karte-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.karte-name { font-size: 16px; font-weight: 600; }
.karte-unter { font-size: 14px; color: var(--grau); line-height: 1.35; }
.mini { width: 56px; height: 74px; border-radius: 8px; object-fit: cover; flex: none; background: var(--akzent-hell); }
.mini-leer { width: 56px; height: 74px; border-radius: 8px; flex: none; border: 2px dashed var(--akzent); display: flex;
  align-items: center; justify-content: center; color: var(--akzent); }
.raster { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kachel { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; border: 0; padding: 0; background: var(--flaeche);
  box-shadow: 0 2px 6px rgba(30, 40, 70, .08); }
.kachel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kachel-marke { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 11px; font-weight: 600; border-radius: 6px;
  padding: 3px 4px; text-align: center; background: rgba(22, 27, 46, .72); color: #fff; }
.kachel-marke.warn { background: #F08C00; }
.kachel-neu { aspect-ratio: 3 / 4; border-radius: 10px; border: 2px dashed #B8C0D6; display: flex; align-items: center;
  justify-content: center; color: var(--grau); font-size: 26px; background: none; }
.hinweis-zeile { font-size: 14px; color: var(--text); line-height: 1.45; background: var(--wackelt-hell); border-radius: 16px; padding: 12px 14px; }
.hinweis-zeile.ruhig { background: var(--flaeche); }

/* --- Üben --- */
.lernkarte { background: var(--flaeche); border-radius: 30px; box-shadow: 0 18px 36px rgba(30, 40, 70, .12); padding: 24px;
  display: flex; flex-direction: column; gap: 16px; }
.lk-art { font-size: 13px; font-weight: 600; color: var(--akzent); letter-spacing: .5px; text-transform: uppercase; }
.lk-frage { font-size: 24px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.lk-trenner { height: 1px; background: var(--linie); }
.lk-antwort { font-size: 19px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.lk-beleg { font-size: 13px; color: var(--grau); }
.luecke { display: inline-block; min-width: 72px; border-bottom: 2px solid var(--akzent); margin: 0 4px; }
.optionen { display: flex; flex-direction: column; gap: 10px; }
.option { min-height: 56px; border-radius: 16px; border: 2px solid var(--linie); background: var(--flaeche); font-size: 17px;
  text-align: left; padding: 10px 16px; overflow-wrap: anywhere; }
.option.richtig { border-color: var(--gut); background: var(--gut-hell); }
.option.falsch { border-color: var(--falsch); background: var(--falsch-hell); }
.eingabe { width: 100%; border: 2px solid var(--akzent); border-radius: 16px; padding: 14px 16px; background: var(--flaeche); font-size: 20px; }
.rueck { border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.rueck.gut { background: var(--gut-hell); }
.rueck.nein { background: var(--wackelt-hell); }
.rueck-titel { font-size: 16px; font-weight: 600; }
.rueck.gut .rueck-titel { color: var(--gut); }
.rueck.nein .rueck-titel { color: var(--wackelt); }
.rueck-text { font-size: 15px; color: var(--text); line-height: 1.4; }
.fortschritt { height: 6px; border-radius: 3px; background: var(--linie); overflow: hidden; }
.fortschritt-balken { height: 100%; background: var(--akzent); width: 0; }
.ende { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding-top: 40px; }
.ende-zahl { font-size: 56px; font-weight: 700; color: var(--akzent); }

/* --- Blatt (von unten) --- */
.blatt-grund { position: fixed; inset: 0; background: rgba(22, 27, 46, .35); z-index: 20; }
.blatt { position: fixed; left: 0; right: 0; bottom: 0; max-height: 90dvh; z-index: 21; background: var(--grund);
  border-radius: 24px 24px 0 0; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.blatt-kopf { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; gap: 10px; }
.blatt-titel { font-size: 20px; font-weight: 700; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.blatt-inhalt { overflow-y: auto; padding: 4px 18px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.feld { display: flex; flex-direction: column; gap: 6px; }
.feld-name { font-size: 14px; font-weight: 600; color: var(--text); }
.feld input, .feld select { border: 0; border-radius: 14px; padding: 14px; background: var(--flaeche); width: 100%; min-height: 50px; }
.wahl { display: flex; flex-wrap: wrap; gap: 8px; }
.wahl-knopf { min-height: 42px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--flaeche); font-size: 15px; }
.wahl-knopf.an { background: var(--tinte); color: #fff; }
.grossbild { width: 100%; border-radius: 12px; display: block; background: var(--flaeche); }

/* --- Hinweis oben: unten verdeckte er den Hauptknopf (Lehre aus Casa Uschi) --- */
.hinweis { position: fixed; left: 16px; right: 16px; top: calc(12px + env(safe-area-inset-top)); z-index: 30;
  background: var(--tinte); color: #fff; border-radius: 16px; padding: 12px 14px; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; max-width: 528px; margin: 0 auto; font-size: 15px; }
.hinweis button { border: 0; background: rgba(255, 255, 255, .16); color: #fff; border-radius: 10px; min-height: 40px; padding: 0 12px; font-weight: 600; flex: none; }
