/* Deutsch B1 – Gestaltung. Mobil zuerst, hell und dunkel, Persisch rechts-nach-links. */

@font-face { font-family: "Geist"; src: url("/assets/fonts/geist-latin-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/assets/fonts/geist-latin-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/assets/fonts/geist-latin-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/assets/fonts/geist-latin-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #faf7f2;
  --flaeche: #ffffff;
  --flaeche2: #f3eee6;
  --text: #24211d;
  --text2: #6b6359;
  --linie: #e6dfd3;
  --akzent: #0f766e;
  --akzent-text: #ffffff;
  --akzent-hell: #d7efeb;
  --safran: #b45309;
  --safran-hell: #fcefd9;
  --gut: #15803d;
  --gut-hell: #dcf3e3;
  --schlecht: #b91c1c;
  --schlecht-hell: #fbe1e1;
  --der: #1d4ed8;
  --die: #be123c;
  --das: #15803d;
  --pl: #7c3aed;
  --schatten: 0 1px 2px rgba(36, 33, 29, .06), 0 4px 16px rgba(36, 33, 29, .06);
  --radius: 14px;
  --latein: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --persisch: "Vazirmatn", "Noto Naskh Arabic", "Noto Sans Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --flaeche: #1f1d1a;
    --flaeche2: #292622;
    --text: #f1ece4;
    --text2: #a9a197;
    --linie: #38342e;
    --akzent: #2fb3a3;
    --akzent-text: #0b1f1d;
    --akzent-hell: #17322f;
    --safran: #f0a234;
    --safran-hell: #3a2a12;
    --gut: #4ade80;
    --gut-hell: #17301f;
    --schlecht: #f87171;
    --schlecht-hell: #3a1a1a;
    --der: #7aa2ff;
    --die: #fb7192;
    --das: #5fd38a;
    --pl: #b79cff;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--latein);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 680px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 24px; outline: none; }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 8px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 0 0 6px; }
p { margin: 0 0 8px; }
a { color: var(--akzent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.fa, [lang="fa"] { font-family: var(--persisch); line-height: 1.8; }
span.fa { unicode-bidi: isolate; }
.fa.block, p.fa, div.fa { display: block; direction: rtl; text-align: right; }
.klein { font-size: .875rem; color: var(--text2); }
.unter { color: var(--text2); font-size: .9rem; }
.unterzeile { display: block; color: var(--text2); font-size: .8rem; font-weight: 400; }

/* ---------- Navigation */
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--flaeche) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--linie);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  color: var(--text2); text-decoration: none; font-size: .72rem; font-weight: 500;
  padding: 4px 2px; border-radius: 10px; min-height: 52px;
}
.nav a .fa { font-size: .66rem; line-height: 1.3; }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 1px; }
.nav a.aktiv { color: var(--akzent); }
.nav a.aktiv svg { stroke-width: 2.3; }

/* ---------- Bausteine */
.box {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 16px; margin: 12px 0; box-shadow: var(--schatten);
}
.box.flach { box-shadow: none; }
.box.akzent { background: var(--akzent-hell); border-color: transparent; }
.box.safran { background: var(--safran-hell); border-color: transparent; }
.reihe { display: flex; align-items: center; gap: 12px; }
.reihe.zwischen { justify-content: space-between; }
.spalte { display: flex; flex-direction: column; gap: 8px; }
.raster2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.raster3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.gruen { color: var(--gut); }
.safranfarbe { color: var(--safran); }
.rechts { text-align: right; }
.mitte { text-align: center; }
.mt { margin-top: 12px; }
.plan { margin: 12px 0 4px; font-size: .95rem; }
.plan p { margin-bottom: 4px; }
.punkt.inline { display: inline-block; width: 8px; height: 8px; vertical-align: middle; }
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 500; font-size: .9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); animation: rein .2s ease;
}
@keyframes rein { from { opacity: 0; transform: translate(-50%, 8px); } }
.feld input[type="range"] { padding: 0; min-height: 32px; border: 0; background: none; accent-color: var(--akzent); }
.zahl { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--akzent); color: var(--akzent-text); border: 0; border-radius: 12px;
  padding: 12px 18px; min-height: 48px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, filter .15s ease;
}
.knopf:active { transform: scale(.98); }
.knopf:disabled { opacity: .45; cursor: default; }
.knopf.breit { width: 100%; }
.knopf.zweit { background: var(--flaeche2); color: var(--text); }
.knopf.rand { background: transparent; color: var(--akzent); border: 1.5px solid var(--akzent); }
.knopf .fa { font-weight: 500; font-size: .9em; }
.knopfzeile { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.knopfzeile > .knopf { flex: 1 1 0; }
.link { background: none; border: 0; padding: 6px 0; color: var(--text2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: .875rem; }
.zurueck { display: inline-flex; align-items: center; gap: 4px; color: var(--text2); text-decoration: none; font-size: .9rem; padding: 6px 0; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--linie); background: var(--flaeche); border-radius: 999px;
  padding: 8px 14px; min-height: 40px; font-weight: 500; cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--akzent); background: var(--akzent-hell); color: var(--akzent); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--flaeche2); color: var(--text2); }
.tag.neu { background: var(--safran-hell); color: var(--safran); }
.tag.gut { background: var(--gut-hell); color: var(--gut); }
.tag.schlecht { background: var(--schlecht-hell); color: var(--schlecht); }

progress { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--flaeche2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--flaeche2); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--akzent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--akzent); border-radius: 99px; }
progress.safran::-webkit-progress-value { background: var(--safran); }
progress.safran::-moz-progress-bar { background: var(--safran); }

.woche { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; text-align: center; font-size: .72rem; color: var(--text2); }
.woche i { display: block; height: 28px; border-radius: 8px; background: var(--flaeche2); margin-bottom: 3px; }
.woche i.ein { background: color-mix(in srgb, var(--akzent) 45%, var(--flaeche2)); }
.woche i.voll { background: var(--akzent); }
.woche .heute { color: var(--text); font-weight: 700; }

/* ---------- Karteikarten */
.sitzung-kopf { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.sitzung-kopf progress { flex: 1; }
.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 20px; box-shadow: var(--schatten);
  padding: 20px 18px; min-height: 300px; display: flex; flex-direction: column; gap: 14px;
}
.karte-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.karte-wort { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.karte-wort .wortzeile { font-size: 1.9rem; font-weight: 650; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.art { font-weight: 600; }
.art-der { color: var(--der); } .art-die { color: var(--die); } .art-das { color: var(--das); } .art-pl { color: var(--pl); }
.laut {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--linie);
  background: var(--flaeche); color: var(--akzent); display: inline-grid; place-items: center; cursor: pointer;
}
.laut svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.laut.klein { width: 34px; height: 34px; vertical-align: middle; margin-inline-start: 6px; }
.laut.klein svg { width: 16px; height: 16px; }
.aufdecken-flaeche { flex: 1; display: grid; place-items: center; color: var(--text2); font-size: .95rem; text-align: center; cursor: pointer; border: 1.5px dashed var(--linie); border-radius: 14px; padding: 24px; }
.bedeutung .fa { font-size: 1.45rem; font-weight: 600; display: block; direction: rtl; text-align: right; }
.bedeutung .en { color: var(--text2); font-size: .95rem; text-align: right; }
.bedeutung.en-zuerst .en { color: var(--text); font-size: 1.35rem; font-weight: 600; text-align: left; }
.grammatik { font-size: .92rem; color: var(--text2); border-top: 1px solid var(--linie); padding-top: 10px; }
.grammatik b { color: var(--text); font-weight: 600; }
.beispiel { background: var(--flaeche2); border-radius: 12px; padding: 12px 14px; }
.beispiel .de { font-size: 1.02rem; margin-bottom: 4px; }
.beispiel .fa { color: var(--text2); font-size: .95rem; }
.beispiel .en { color: var(--text2); font-size: .9rem; }
details.hinweis { border: 1px solid var(--linie); border-radius: 12px; padding: 8px 12px; }
details.hinweis summary { cursor: pointer; color: var(--akzent); font-weight: 600; font-size: .9rem; }
.bewertung { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.bewertung button { border: 0; border-radius: 12px; padding: 10px 4px; min-height: 60px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.bewertung button .fa { font-size: .78rem; font-weight: 500; line-height: 1.4; }
.bewertung button small { font-weight: 500; font-size: .72rem; opacity: .8; margin-top: 3px; }
.b-nochmal { background: var(--schlecht-hell); color: var(--schlecht); }
.b-schwer { background: var(--safran-hell); color: var(--safran); }
.b-gut { background: var(--akzent-hell); color: var(--akzent); }
.b-leicht { background: var(--gut-hell); color: var(--gut); }
.erstwahl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.erstwahl .knopf { flex-direction: column; gap: 0; min-height: 60px; }

/* ---------- Wortliste */
.suche { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--linie); background: var(--flaeche); min-height: 48px; }
.suche:focus, textarea:focus, select:focus, input:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
.liste { list-style: none; margin: 12px 0; padding: 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.liste li + li { border-top: 1px solid var(--linie); }
.liste a, .liste .zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; min-height: 56px; }
.liste .fa { color: var(--text2); text-align: right; font-size: .95rem; }
.punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--linie); }
.punkt.lernt { background: var(--safran); } .punkt.sicher { background: var(--gut); }

/* ---------- Lesen */
.uhr { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text2); }
.uhr.ueber { color: var(--schlecht); }
.lesetext { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.lesetext h3 { font-size: 1.02rem; }
.lesetext .text { white-space: pre-line; font-size: 1.02rem; line-height: 1.65; }
.lesetext.anzeige { padding: 12px 14px; }
.lesetext.anzeige .kenn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--akzent-hell); color: var(--akzent); font-weight: 700; margin-inline-end: 8px; }
mark { background: color-mix(in srgb, var(--safran) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
mark sup { font-weight: 700; color: var(--safran); margin-inline-start: 2px; }
.aufgabe { border-top: 1px solid var(--linie); padding: 14px 0; }
.aufgabe:first-child { border-top: 0; }
.aufgabe .frage { font-weight: 500; margin-bottom: 8px; }
.aufgabe .nr { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; background: var(--flaeche2); font-weight: 700; font-size: .85rem; margin-inline-end: 8px; }
.optionen { display: flex; flex-direction: column; gap: 8px; }
.optionen.zwei { flex-direction: row; }
.optionen.zwei label { flex: 1; justify-content: center; }
.optionen label { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--linie); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: var(--flaeche); min-height: 46px; }
.optionen input { accent-color: var(--akzent); margin-top: 4px; }
.optionen label:has(input:checked) { border-color: var(--akzent); background: var(--akzent-hell); }
.optionen label.richtig { border-color: var(--gut); background: var(--gut-hell); }
.optionen label.falsch { border-color: var(--schlecht); background: var(--schlecht-hell); }
select.zuordnen { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--linie); background: var(--flaeche); min-height: 48px; }
.ergebnis { margin-top: 10px; border-radius: 12px; padding: 10px 12px; font-size: .95rem; }
.ergebnis.richtig { background: var(--gut-hell); }
.ergebnis.falsch { background: var(--schlecht-hell); }
.ergebnis .beleg { font-style: italic; }
.glossar { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: .92rem; }
.glossar .fa { text-align: right; color: var(--text2); }

/* ---------- Schreiben */
textarea.schreibfeld {
  width: 100%; min-height: 260px; resize: vertical; padding: 14px; border-radius: 14px;
  border: 1.5px solid var(--linie); background: var(--flaeche); font-size: 1.05rem; line-height: 1.6;
}
.zaehler { display: flex; justify-content: space-between; align-items: center; font-size: .875rem; color: var(--text2); margin-top: 6px; }
.zaehler .ok { color: var(--gut); font-weight: 600; }
.punkte { margin: 8px 0 0; padding-inline-start: 20px; }
.punkte li { margin-bottom: 6px; }
.punkte .fa { color: var(--text2); font-size: .92rem; }
.redemittel { display: grid; gap: 6px; margin-top: 8px; }
.redemittel div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: .92rem; border-bottom: 1px dashed var(--linie); padding-bottom: 6px; }
.redemittel .fa { text-align: right; color: var(--text2); }
.urteil { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; font-weight: 700; padding: 8px 14px; border-radius: 14px; }
.urteil > * { white-space: nowrap; }
.urteil.gut { background: var(--gut-hell); color: var(--gut); }
.urteil.knapp { background: var(--safran-hell); color: var(--safran); }
.urteil.noch_nicht { background: var(--schlecht-hell); color: var(--schlecht); }
.kriterien { display: grid; gap: 8px; }
.kriterium { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.stufe { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-weight: 800; }
.stufe.A, .stufe.B { background: var(--gut-hell); color: var(--gut); }
.stufe.C { background: var(--safran-hell); color: var(--safran); }
.stufe.D, .stufe.E { background: var(--schlecht-hell); color: var(--schlecht); }
.korrektur { border-top: 1px solid var(--linie); padding: 10px 0; }
.korrektur del { color: var(--schlecht); text-decoration-thickness: 1.5px; }
.korrektur ins { color: var(--gut); text-decoration: none; font-weight: 600; }
.vorlage { white-space: pre-line; background: var(--flaeche2); border-radius: 12px; padding: 12px 14px; }

/* ---------- Formulare / Dialog */
.feld { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-weight: 500; }
.feld input, .feld select, .feld textarea { padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--linie); background: var(--flaeche); min-height: 46px; font-weight: 400; }
.schalter { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.schalter input { width: 22px; height: 22px; accent-color: var(--akzent); }
.dialog { border: 0; border-radius: 18px; padding: 18px; width: min(92vw, 440px); background: var(--flaeche); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog::backdrop { background: rgba(0, 0, 0, .4); }
.wahl { border: 0; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.wahl label { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--flaeche2); cursor: pointer; }
.wahl .fa { color: var(--text2); font-size: .85rem; }

/* ---------- Laden / Anmelden */
.laden { min-height: 60vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text2); }
.kreisel { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--linie); border-top-color: var(--akzent); animation: dreh 0.9s linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }
.anmelden { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.anmelden .logo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 12px; display: block; }
.anmelden input { text-align: center; font-size: 1.2rem; letter-spacing: .1em; }
.fehler { color: var(--schlecht); font-weight: 500; }
.leer { text-align: center; color: var(--text2); padding: 24px 8px; }

@media (min-width: 720px) {
  body { padding-bottom: 0; padding-top: 64px; }
  .nav { inset: 0 0 auto 0; border-top: 0; border-bottom: 1px solid var(--linie); grid-template-columns: repeat(5, minmax(0, 120px)); justify-content: center; padding: 6px; }
  .nav a { flex-direction: row; gap: 6px; min-height: 44px; font-size: .9rem; }
  .nav a .fa { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
