:root {
  --rot: #8C1017;
  --rot-hell: #C1121F;
  --grund: #f4f4f5;
  --flaeche: #ffffff;
  --rand: #d9d9de;
  --text: #1b1b1f;
  --gedaempft: #5c5c66;
  --gruen: #1a7f45;
  --gelb: #b07d00;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #131316;
    --flaeche: #1c1c20;
    --rand: #34343c;
    --text: #ececf0;
    --gedaempft: #a1a1ab;
    --rot-hell: #ff5a5a;
    --gruen: #4ec380;
    --gelb: #e0ac33;
    --schatten: 0 1px 2px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--rot-hell); }

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

.kopf {
  background: var(--rot);
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
}

.marke { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.marke small { display: block; font-size: 12px; opacity: .85; }
.marke-zeichen {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 2px solid #fff;
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: .5px;
}

.kopf-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.kopf-nav a {
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 15px;
}
.kopf-nav a:hover, .kopf-nav a.aktiv { background: rgba(255, 255, 255, .18); }

.inhalt { flex: 1; width: min(920px, 100%); margin: 0 auto; padding: 20px 16px 40px; }

.fuss {
  border-top: 1px solid var(--rand);
  padding: 12px 18px;
  font-size: 12.5px;
  color: var(--gedaempft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

/* -------------------------------------------------------------------- Bausteine */

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 19px; margin: 26px 0 10px; }
.unterzeile { color: var(--gedaempft); margin: 0 0 18px; }

.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.kachel-gitter { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.kachel { display: flex; flex-direction: column; gap: 10px; }
.kachel h3 { margin: 0; font-size: 17px; }
.kachel .meta { color: var(--gedaempft); font-size: 13px; }
.kachel .knopfreihe { margin-top: auto; }

.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; }

button, .knopf {
  font: inherit;
  border: 1px solid var(--rand);
  background: var(--flaeche);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 15px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .knopf:hover { border-color: var(--rot-hell); }
button.haupt, .knopf.haupt { background: var(--rot); border-color: var(--rot); color: #fff; }
button.haupt:hover { background: var(--rot-hell); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.still { background: transparent; }

label { display: block; font-size: 14px; margin: 12px 0 4px; color: var(--gedaempft); }
input, select {
  font: inherit;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rand);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--rot-hell); outline-offset: 1px; }

.merker {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.merker.gut { color: var(--gruen); }
.merker.warn { color: var(--gelb); }
.merker.stopp { color: var(--rot-hell); }

.hinweis {
  border-left: 4px solid var(--gelb);
  background: color-mix(in srgb, var(--gelb) 10%, transparent);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
  font-size: 14.5px;
}
.hinweis.fehler { border-color: var(--rot-hell); background: color-mix(in srgb, var(--rot-hell) 10%, transparent); }

/* ----------------------------------------------------------------------- Fragen */

.fortschritt { display: flex; align-items: center; gap: 12px; color: var(--gedaempft); font-size: 14px; margin-bottom: 10px; }
.balken { flex: 1; height: 6px; background: var(--rand); border-radius: 999px; overflow: hidden; }
.balken > div { height: 100%; background: var(--rot); transition: width .25s; }

.frage-text { font-size: 18px; font-weight: 600; margin: 4px 0 14px; }

.antworten { display: grid; gap: 8px; }
.antwort {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--flaeche);
}
.antwort:hover { border-color: var(--rot-hell); }
.antwort input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--rot); }
.antwort .key { font-weight: 600; color: var(--gedaempft); flex: none; }
.antwort.richtig { border-color: var(--gruen); background: color-mix(in srgb, var(--gruen) 12%, var(--flaeche)); }
.antwort.falsch { border-color: var(--rot-hell); background: color-mix(in srgb, var(--rot-hell) 12%, var(--flaeche)); }
.antwort.gesperrt { cursor: default; }

.uhr { font-variant-numeric: tabular-nums; font-weight: 600; }
.uhr.knapp { color: var(--rot-hell); }

/* ------------------------------------------------------------------- Lernkarten */

.lernkarte { text-align: center; }
.lernkarte svg { width: min(240px, 60vw); height: auto; }
.lernkarte .loesung { margin-top: 14px; font-size: 17px; font-weight: 600; }
.lernkarte ul { text-align: left; margin: 10px 0 0; padding-left: 20px; }

/* ---------------------------------------------------------------------- Tabellen */

.tabellenhuelle { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rand); }
th { color: var(--gedaempft); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: none; }

.zahlen { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.zahl { flex: 1 1 120px; border: 1px solid var(--rand); border-radius: 8px; padding: 10px 12px; background: var(--flaeche); }
.zahl b { display: block; font-size: 26px; line-height: 1.1; }
.zahl span { font-size: 13px; color: var(--gedaempft); }

.code-anzeige {
  font: 700 32px/1.2 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: 5px;
  padding: 12px 0;
}

.rueckblick li { margin-bottom: 6px; }
.klein { font-size: 13px; color: var(--gedaempft); }

.versteckt { display: none; }
