/* Aktien verstehen: Gestaltung. Ruhig, gut lesbar, Systemschrift, keine externen Dateien. */

:root {
  color-scheme: light dark;
  --hg: #f7f6f2;
  --karte: #ffffff;
  --text: #1d2321;
  --leise: #5b6461;
  --linie: #e2e0d8;
  --akzent: #2e6b57;
  --akzent-text: #ffffff;
  --akzent-hell: #e3efe9;
  --merke-hg: #e8f1ec;
  --merke-rand: #2e6b57;
  --beispiel-hg: #f1f0ea;
  --beispiel-rand: #b9b5a6;
  --warn-hg: #fcefe4;
  --warn-rand: #c0601a;
  --warn-text: #8a3f0b;
  --ok: #2e7d4f;
  --ok-hg: #e5f3ea;
  --falsch: #b3362f;
  --falsch-hg: #fbe9e7;
  --gefahr: #b3362f;
  --et-belegt-hg: #dcefe2;
  --et-belegt-text: #1f5d36;
  --et-sek-hg: #fbe8c8;
  --et-sek-text: #7a4a00;
  --et-int-hg: #e2e8f0;
  --et-int-text: #34465e;
  --schatten: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 8px rgba(0, 0, 0, 0.04);
  --radius: 14px;
  --seitenrand: 16px;
  --reiter-hoehe: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hg: #151a18;
    --karte: #1e2522;
    --text: #e7ebe9;
    --leise: #a3ada9;
    --linie: #2f3834;
    --akzent: #7cc4a8;
    --akzent-text: #0f1a16;
    --akzent-hell: #23362f;
    --merke-hg: #1f3129;
    --merke-rand: #7cc4a8;
    --beispiel-hg: #242a27;
    --beispiel-rand: #4a524e;
    --warn-hg: #3a2817;
    --warn-rand: #e08a4a;
    --warn-text: #f2b88a;
    --ok: #6fcf97;
    --ok-hg: #1c3326;
    --falsch: #f08a80;
    --falsch-hg: #3a1f1c;
    --gefahr: #f08a80;
    --et-belegt-hg: #1f3a29;
    --et-belegt-text: #9ee0b5;
    --et-sek-hg: #3d2f12;
    --et-sek-text: #f3cf86;
    --et-int-hg: #26303e;
    --et-int-text: #b9c8dc;
    --schatten: none;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--hg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding-top: calc(env(safe-area-inset-top) + 12px);
  padding-right: max(var(--seitenrand), env(safe-area-inset-right));
  padding-bottom: calc(var(--reiter-hoehe) + env(safe-area-inset-bottom) + 32px);
  padding-left: max(var(--seitenrand), env(safe-area-inset-left));
  outline: none;
}

h1, h2 { line-height: 1.25; margin: 0 0 0.4em; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 0.8em; }
a { color: var(--akzent); }
ul, ol { padding-left: 1.3em; margin: 0 0 0.8em; }
li { margin-bottom: 0.3em; }

.leise { color: var(--leise); }
.klein { font-size: 0.85rem; }
.akzent { color: var(--akzent); }
.hinweis { color: var(--leise); padding: 24px 0; }

/* ---------- Kopf ---------- */

.seitenkopf { margin: 4px 0 16px; }
.oberzeile {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--leise);
  margin: 0 0 4px;
}
.zurueck {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.meta { color: var(--leise); font-size: 0.9rem; margin-top: -8px; }
.ziel { color: var(--leise); }

/* ---------- Karten, Balken, Knöpfe ---------- */

.karte {
  display: block;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 16px;
  margin-bottom: 14px;
  color: inherit;
  text-decoration: none;
}
.modulkarte h2 { margin-bottom: 0.25em; }
.modulkarte p.leise { margin-bottom: 0.7em; }
.modulkarte:active { background: var(--akzent-hell); }
.gesamt-zahl { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.6em; }
.geschafft { margin: 12px 0 0; font-weight: 600; color: var(--akzent); }

.balken {
  height: 8px;
  border-radius: 99px;
  background: var(--linie);
  overflow: hidden;
  margin: 6px 0 8px;
}
.balken-fuellung {
  height: 100%;
  width: 0;
  background: var(--akzent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.knopf {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--linie);
  background: var(--karte);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.knopf.breit { display: flex; width: 100%; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.leicht { background: transparent; }
.knopf.gefahr { background: transparent; color: var(--gefahr); border-color: var(--gefahr); }
.knopf:active { opacity: 0.75; }
.gesamt .knopf { margin-top: 12px; }
.gesamt .klein { margin: 8px 0 0; }

.aktionen { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }

/* ---------- Modul: Lektionsliste ---------- */

.lektionsliste { list-style: none; padding: 0; margin: 16px 0; }
.lektionsliste li { margin: 0 0 8px; }
.lektionszeile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}
.lektionszeile:active { background: var(--akzent-hell); }
.status {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--linie);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}
.fertig .status { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.lektionstext { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lektionstitel { font-weight: 600; }
.pfeil { color: var(--leise); font-size: 1.4rem; }

/* ---------- Lektion ---------- */

.lektion { margin-top: 8px; }
.text > :last-child { margin-bottom: 0; }
.abschnitt { margin: 0 0 18px; }
.marke {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
}
.merke {
  background: var(--merke-hg);
  border-left: 4px solid var(--merke-rand);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 500;
}
.merke .marke { color: var(--merke-rand); }
.beispiel {
  background: var(--beispiel-hg);
  border: 1px dashed var(--beispiel-rand);
  border-radius: 10px;
  padding: 12px 14px;
  font-variant-numeric: tabular-nums;
}
.beispiel .marke { color: var(--leise); }
.warnung {
  background: var(--warn-hg);
  border-left: 4px solid var(--warn-rand);
  border-radius: 10px;
  padding: 12px 14px;
}
.warnung .marke { color: var(--warn-text); }
.zitat { margin: 0 0 18px; padding: 4px 0 4px 16px; border-left: 3px solid var(--linie); }
.zitat blockquote { margin: 0; font-style: italic; }
.zitat blockquote p:last-child { margin-bottom: 0.4em; }
.zitat figcaption { font-size: 0.9rem; color: var(--leise); }

.quellenbereich { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--linie); }
.quellen { list-style: none; padding: 0; font-size: 0.9rem; }
.quellen li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 10px; }
.quellen a { min-width: 0; }

.etikett {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
  font-style: normal;
}
.etikett-belegt { background: var(--et-belegt-hg); color: var(--et-belegt-text); }
.etikett-sekundaer { background: var(--et-sek-hg); color: var(--et-sek-text); }
.etikett-interpretation { background: var(--et-int-hg); color: var(--et-int-text); }

.vorzurueck { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.vorzurueck .knopf { font-weight: 500; font-size: 0.9rem; align-items: flex-start; text-align: left; }
.vorzurueck .knopf.rechts { align-items: flex-end; text-align: right; }

/* ---------- Quiz ---------- */

.fragetext { font-size: 1.15rem; margin-bottom: 14px; }
.antworten { display: flex; flex-direction: column; gap: 10px; }
.antwort {
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--linie);
  background: var(--karte);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.antwort:active:not(:disabled) { background: var(--akzent-hell); }
.antwort:disabled { cursor: default; color: var(--text); opacity: 1; }
.antwort.richtig { border-color: var(--ok); background: var(--ok-hg); }
.antwort.falsch { border-color: var(--falsch); background: var(--falsch-hg); }
.antwort.blass { opacity: 0.55; }

.rueckmeldung { margin: 16px 0; padding: 14px; border-radius: 12px; }
.rueckmeldung.ok { background: var(--ok-hg); }
.rueckmeldung.nicht-ok { background: var(--falsch-hg); }
.urteil { font-weight: 700; margin-bottom: 6px; }
.rueckmeldung.ok .urteil { color: var(--ok); }
.rueckmeldung.nicht-ok .urteil { color: var(--falsch); }
.rueckmeldung .klein { margin: 10px 0 0; }

.ergebnis-zahl { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.ergebnis.ok { border-color: var(--ok); }
.ergebnis.nicht-ok { border-color: var(--warn-rand); }

/* ---------- Wiederholen ---------- */

.faecher { list-style: none; padding: 0; margin: 0; }
.faecher li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--linie);
}
.faecher li:last-child { border-bottom: 0; }
.erklaertext { font-size: 0.9rem; }

/* ---------- Glossar ---------- */

.suchfeld {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--linie);
  background: var(--karte);
  color: var(--text);
  font: inherit;
  font-size: 17px; /* ab 16px zoomt iOS beim Antippen nicht */
  -webkit-appearance: none;
  appearance: none;
  margin-bottom: 8px;
}
.glossareintrag {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--linie);
}
.glossareintrag.antippbar { cursor: pointer; }
.glossareintrag .begriff { font-weight: 700; margin: 0 0 4px; }
.glossareintrag .text { margin-bottom: 4px; }
.zurlektion { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }

/* ---------- Info ---------- */

.etikettliste { margin: 0; }
.etikettliste dt { margin-top: 10px; }
.etikettliste dd { margin: 4px 0 0; color: var(--leise); font-size: 0.95rem; }
.warnzeile { color: var(--warn-text); font-weight: 600; }
.versteckt {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ---------- Leisten oben ---------- */

.leiste {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: calc(env(safe-area-inset-top) + 8px) max(var(--seitenrand), env(safe-area-inset-right)) 8px max(var(--seitenrand), env(safe-area-inset-left));
  font-size: 0.9rem;
  text-align: center;
}
.leiste[hidden] { display: none; }
.update { background: var(--akzent-hell); color: var(--text); }
.warnung-leiste { background: var(--warn-hg); color: var(--warn-text); }
.klein-knopf { min-height: 44px; padding: 6px 14px; font-size: 0.9rem; }

/* ---------- Reiterleiste ---------- */

.reiter {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  background: var(--karte);
  border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.reiter a {
  flex: 1;
  max-width: 170px;
  min-height: var(--reiter-hoehe);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.72rem;
  color: var(--leise);
  text-decoration: none;
}
.reiter a.aktiv { color: var(--akzent); font-weight: 600; }
.reiter svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.symbol-mit-zahl { position: relative; display: inline-flex; }
.zahl {
  position: absolute;
  top: -6px;
  right: -12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #c0392b;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.zahl[hidden] { display: none; }

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