:root {
  --bg: #f4f1ea;
  --karte: #ffffff;
  --text: #23201c;
  --grau: #6d675e;
  --linie: #e0dbd1;
  --akzent: #7a5c3e;
  --akzent-hell: #f0e7dc;
  --gut: #2f7a45;
  --gut-bg: #e7f4ea;
  --schlecht: #a83232;
  --schlecht-bg: #fbeaea;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--akzent);
  color: #fff;
}
header .marke { font-size: 19px; font-weight: 600; }
header a { color: #fff; text-decoration: none; }
header nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 18px; }
header nav a { opacity: .9; }
header nav a:hover { opacity: 1; text-decoration: underline; }
header nav form { margin: 0; }
header .benutzer {
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, .35);
  font-weight: 600;
}
header .abmelden {
  background: none;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 6px;
  color: #fff;
  font: inherit;
  font-size: 14px;
  padding: 3px 10px;
  cursor: pointer;
}
header .abmelden:hover { background: rgba(255, 255, 255, .14); }

main { max-width: 860px; margin: 0 auto; padding: 22px 16px 60px; }

footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 40px;
  color: var(--grau);
  font-size: 13px;
}

.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.karte.schmal { max-width: 460px; margin-left: auto; margin-right: auto; }

/* Anmelde-/Registrierformular */
.formular { display: flex; flex-direction: column; gap: 14px; margin: 18px 0 12px; }
.formular label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; }
.formular label.zeile {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  font-weight: 400;
  font-size: 14px;
  color: var(--grau);
}
.formular input[type="text"],
.formular input[type="password"] {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--karte);
  color: var(--text);
}
.formular input[type="text"]:focus,
.formular input[type="password"]:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
.formular p { margin: -6px 0 0; }

h1 { font-size: 22px; margin: 0 0 14px; line-height: 1.35; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; line-height: 1.4; }
p { margin: 10px 0; }

.nr { display: block; font-size: 12px; font-weight: 500; color: var(--grau); margin-bottom: 4px; }
.klein { font-size: 13px; }
.grau { color: var(--grau); }

/* Buttons */
.knopf {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--akzent);
  border-radius: 8px;
  background: var(--akzent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.knopf:hover { filter: brightness(1.08); }
.knopf.gross { padding: 12px 22px; font-size: 17px; }
.knopf.klein { padding: 5px 11px; font-size: 14px; }
.knopf.sekundaer { background: #fff; color: var(--akzent); }
.knopf.gefahr { background: var(--schlecht); border-color: var(--schlecht); }
.knopf[disabled] { opacity: .45; cursor: not-allowed; }

.blaettern {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}
.blaettern form { margin: 0; }

/* Fortschritt */
.fortschritt { margin-bottom: 16px; }
.balken {
  height: 8px;
  background: var(--akzent-hell);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.balken span { display: block; height: 100%; background: var(--akzent); }

/* Antwortoptionen */
.optionen { list-style: none; margin: 16px 0 0; padding: 0; }
.optionen li {
  border: 1px solid var(--linie);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}
.optionen li label {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px 13px;
  cursor: pointer;
}
.optionen.kompakt li { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 9px 12px; }
.optionen li input { margin-top: 4px; }
.buchstabe { font-weight: 700; color: var(--akzent); }
.optext { grid-column: span 1; }
.optionen li .marke { grid-column: 1 / -1; font-size: 13px; font-weight: 600; }
.optionen li.richtig { border-color: var(--gut); background: var(--gut-bg); }
.optionen li.richtig .marke { color: var(--gut); }
.optionen li.falsch { border-color: var(--schlecht); background: var(--schlecht-bg); }
.optionen li.falsch .marke { color: var(--schlecht); }

.auswertung {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 600;
}
.auswertung.gut { background: var(--gut-bg); color: var(--gut); }
.auswertung.schlecht { background: var(--schlecht-bg); color: var(--schlecht); }

.fragebild {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 300px;
  background: #fff;
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: 8px;
  margin: 10px auto 4px;
}
.klein-bild { max-height: 170px; margin: 8px 0; }

.hinweis {
  background: var(--akzent-hell);
  border-left: 4px solid var(--akzent);
  padding: 10px 14px;
  border-radius: 6px;
  margin: 12px 0;
}

.kacheln { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 12px; }
.kachel {
  flex: 1 1 150px;
  background: var(--akzent-hell);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--grau);
}
.kachel .zahl { display: block; font-size: 26px; font-weight: 700; color: var(--text); }

.ergebnis-gross {
  font-size: 26px;
  font-weight: 700;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--akzent-hell);
}
.ergebnis-gross.gut { background: var(--gut-bg); color: var(--gut); }
.ergebnis-gross.schlecht { background: var(--schlecht-bg); color: var(--schlecht); }

.ergebniszeile {
  border-top: 1px solid var(--linie);
  padding: 16px 0 8px;
}
.ergebniszeile.gut h3 { color: var(--gut); }
.ergebniszeile.schlecht h3 { color: var(--schlecht); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { color: var(--grau); font-weight: 600; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge.gut { background: var(--gut-bg); color: var(--gut); }
.badge.schlecht { background: var(--schlecht-bg); color: var(--schlecht); }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916;
    --karte: #24211d;
    --text: #ece7df;
    --grau: #a49c90;
    --linie: #3a352e;
    --akzent: #b08a63;
    --akzent-hell: #332c24;
    --gut: #7bc98f;
    --gut-bg: #22301f;
    --schlecht: #e58a8a;
    --schlecht-bg: #331f1f;
  }
  header { background: #2e2820; }
  .optionen li { background: var(--karte); }
  .knopf { color: #1b1916; }
  .knopf.sekundaer { background: var(--karte); color: var(--akzent); }
  .knopf.gefahr { color: #1b1916; }
}

.balken.breit { height: 10px; margin: 6px 0 12px; }

/* Startseite: Übung vs. Prüfung */
.modi { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }
.modi form {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
}

/* Prüfungsmodus: Sprungleiste über alle Fragen */
.fragenleiste {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 16px;
}
.fragenleiste a {
  min-width: 30px;
  padding: 4px 0;
  border: 1px solid var(--linie);
  border-radius: 6px;
  background: var(--karte);
  color: var(--grau);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
}
.fragenleiste a.fertig { background: var(--akzent-hell); color: var(--text); font-weight: 600; }
.fragenleiste a.hier { border-color: var(--akzent); background: var(--akzent); color: #fff; font-weight: 700; }

/* Karteikarten */
.karteikarte .optionen.kompakt li { background: var(--karte); }
.kartenaktionen { border-top: 1px solid var(--linie); margin-top: 18px; padding-top: 14px; }
.kartenaktionen form { margin: 0; }

/* Statistik */
.balkenzelle { width: 34%; min-width: 120px; }
td .balken { margin: 4px 0 0; }
.balken span.gutbalken { background: var(--gut); }
.balken span.warnung { background: #c98a2e; }
.balken span.schlechtbalken { background: var(--schlecht); }

.urteil { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 18px; }
.urteilbox { flex: 1 1 240px; border-radius: 8px; padding: 12px 14px; }
.urteilbox h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.urteilbox.stark { background: var(--gut-bg); }
.urteilbox.stark h3 { color: var(--gut); }
.urteilbox.schwach { background: var(--schlecht-bg); }
.urteilbox.schwach h3 { color: var(--schlecht); }

.fehlt, .zuviel { display: inline-block; margin-right: 8px; font-weight: 600; }
.fehlt { color: var(--schlecht); }
.zuviel { color: #b4761f; }

.problemfrage { border-top: 1px solid var(--linie); padding: 14px 0 6px; }
.problemfrage h3 { margin-bottom: 4px; }
.antwortverlauf { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.antwortverlauf li {
  padding: 5px 10px;
  border-left: 3px solid var(--linie);
  margin-bottom: 4px;
  background: var(--akzent-hell);
  border-radius: 0 6px 6px 0;
}
.antwortverlauf li.gut { border-left-color: var(--gut); background: var(--gut-bg); }
.antwortverlauf li.schlecht { border-left-color: var(--schlecht); background: var(--schlecht-bg); }

.ergebnisverlauf {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  padding: 8px 0 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--linie);
}
.ergebnisverlauf::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: var(--grenze);
  border-top: 2px dashed var(--akzent);
  opacity: .65;
}
.ergebnisverlauf .saeule {
  flex: 1 1 14px;
  max-width: 34px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
}
.ergebnisverlauf .fuellung { width: 100%; border-radius: 4px 4px 0 0; background: var(--akzent); }
.ergebnisverlauf .fuellung.gut { background: var(--gut); }
.ergebnisverlauf .fuellung.schlecht { background: var(--schlecht); }
