:root {
  --akzent: #4f46e5;
  --akzent-dunkel: #4338ca;
  --gruen: #15803d;
  --gruen-bg: #f0fdf4;
  --rot: #b91c1c;
  --rot-bg: #fef2f2;
  --gelb-bg: #fefce8;
  --text: #1f2937;
  --text-schwach: #6b7280;
  --bg: #f4f4f8;
  --karte-bg: #ffffff;
  --rand: #e5e7eb;
  --schatten: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 14px rgba(0, 0, 0, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --akzent: #818cf8;
    --akzent-dunkel: #6366f1;
    --gruen: #4ade80;
    --gruen-bg: rgba(74, 222, 128, .10);
    --rot: #f87171;
    --rot-bg: rgba(248, 113, 113, .10);
    --gelb-bg: rgba(250, 204, 21, .08);
    --text: #e5e7eb;
    --text-schwach: #9ca3af;
    --bg: #111318;
    --karte-bg: #1c1f26;
    --rand: #33363f;
    --schatten: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

.kopf {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rand);
  background: var(--karte-bg);
}

.marke {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.untertitel { color: var(--text-schwach); margin-top: .25rem; }

/* Themenwahl */
.themen-grid { display: grid; gap: 1rem; margin-top: 1.25rem; }

.thema-card {
  background: var(--karte-bg);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--schatten);
}

.thema-card .fach {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--akzent);
  background: color-mix(in srgb, var(--akzent) 12%, transparent);
  border-radius: 999px;
  padding: .1rem .6rem;
  margin-bottom: .35rem;
}

.thema-card h2 { margin: .1rem 0 .2rem; font-size: 1.15rem; }
.thema-card .kurs { color: var(--text-schwach); font-size: .9rem; margin: 0 0 .35rem; }
.thema-card .anzahl { color: var(--text-schwach); font-size: .9rem; margin: 0 0 .8rem; }

.hinweis {
  margin-top: 2rem;
  font-size: .85rem;
  color: var(--text-schwach);
  border-top: 1px solid var(--rand);
  padding-top: 1rem;
}

code {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  padding: .1em .35em;
  border-radius: 5px;
  font-size: .9em;
}

/* Buttons */
button {
  font: inherit;
  border: none;
  border-radius: 10px;
  padding: .55rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
}

button.primaer { background: var(--akzent); color: #fff; }
button.primaer:hover { background: var(--akzent-dunkel); }

button.sekundaer {
  background: transparent;
  color: var(--text-schwach);
  border: 1px solid var(--rand);
}
button.sekundaer:hover { color: var(--text); border-color: var(--text-schwach); }

.knopfzeile { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.25rem; }
.knopfzeile.mittig { justify-content: center; }

/* Quiz */
.quiz-status { margin-bottom: 1rem; }

.fortschritt {
  height: 6px;
  border-radius: 999px;
  background: var(--rand);
  overflow: hidden;
}

#fortschritt-balken {
  height: 100%;
  width: 0;
  background: var(--akzent);
  border-radius: 999px;
  transition: width .3s ease;
}

.statuszeile {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
  color: var(--text-schwach);
  margin-top: .45rem;
}

.frage-karte, .ergebnis-karte {
  background: var(--karte-bg);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  box-shadow: var(--schatten);
}

.frage-meta {
  font-size: .82rem;
  color: var(--text-schwach);
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

#frage-text, #karte-frage {
  font-size: 1.06rem;
  font-weight: 600;
  margin: .6rem 0 .4rem;
  white-space: pre-line;
}

.anleitung { font-size: .85rem; color: var(--text-schwach); margin: 0 0 1rem; }

.antwort {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: .7rem .85rem;
  margin-bottom: .55rem;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.antwort:hover { border-color: var(--akzent); }

.antwort input {
  margin-top: .3rem;
  accent-color: var(--akzent);
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.antwort.ausgewaehlt { border-color: var(--akzent); background: color-mix(in srgb, var(--akzent) 6%, transparent); }

/* Feedback-Zustände nach dem Prüfen */
.antwort.geprueft { cursor: default; }
.antwort.geprueft:hover { border-color: var(--rand); }
.antwort.richtig { border-color: var(--gruen); background: var(--gruen-bg); }
.antwort.falsch { border-color: var(--rot); background: var(--rot-bg); }
.antwort.verpasst { border-color: var(--gruen); border-style: dashed; background: var(--gruen-bg); }

.antwort .inhalt { flex: 1; }

.urteil { font-size: .8rem; font-weight: 700; display: block; margin-bottom: .1rem; }
.antwort.richtig .urteil { color: var(--gruen); }
.antwort.falsch .urteil { color: var(--rot); }
.antwort.verpasst .urteil { color: var(--gruen); }

.beleg {
  font-size: .82rem;
  color: var(--text-schwach);
  border-left: 3px solid var(--gruen);
  padding-left: .6rem;
  margin-top: .45rem;
  white-space: pre-line;
}

.feedback-punkte { font-weight: 700; margin: .9rem 0 .4rem; }
.feedback-punkte.gut { color: var(--gruen); }
.feedback-punkte.schlecht { color: var(--rot); }

.erklaerung {
  background: var(--gelb-bg);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 10px;
  padding: .75rem .9rem;
  font-size: .9rem;
  white-space: pre-line;
}

.erklaerung strong { display: block; margin-bottom: .2rem; }

/* Ergebnis */
.ergebnis-karte { text-align: center; }

.ergebnis-prozent {
  font-size: 3rem;
  font-weight: 800;
  color: var(--akzent);
  margin: .5rem 0 .2rem;
}

/* Lernkarten */
.lernkarte { min-height: 14rem; }

.fehler { color: var(--rot); font-weight: 600; }
