:root {
  --grund: #f6f4ef;
  --flaeche: #ffffff;
  --text: #1f2328;
  --leise: #646b73;
  --linie: #ddd8cc;
  --haupt: #2457a6;
  --haupt-text: #ffffff;
  --rot: #b42318;
  --rot-grund: #fdecea;
  --gruen: #1a7f37;
  --gruen-grund: #e6f4ea;
  --orange: #b54708;
  --orange-grund: #fff1e0;
  --markierung: #ffe08a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #16181c; --flaeche: #202329; --text: #e8eaed; --leise: #9aa2ab; --linie: #3a3f47;
    --haupt: #6c9cf0; --haupt-text: #0b1020; --rot: #ff8a80; --rot-grund: #3a1f1f; --gruen: #6fd08c;
    --gruen-grund: #1d3324; --orange: #ffb35c; --orange-grund: #3a2a17; --markierung: #7a5d00;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 52rem; margin: 0 auto; padding: 1rem 1rem 3rem; }
main.schmal, .schmal { max-width: 26rem; margin: 3rem auto; padding: 0 1rem; }
h1 { font-size: 1.8rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
.leise { color: var(--leise); }

.kopf {
  display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem;
  background: var(--flaeche); border-bottom: 1px solid var(--linie); position: sticky; top: 0; z-index: 2;
}
.kopf .titel { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf .marke { flex: 1; font-weight: 700; }
.kopf .wer { color: var(--leise); font-size: .9rem; white-space: nowrap; }

.karte {
  display: block; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px;
  padding: 1rem 1.2rem; color: inherit; text-decoration: none; text-align: left; font: inherit;
}
.karte.link, .textwahl { cursor: pointer; display: flex; flex-direction: column; gap: .3rem; }
.karte.link:hover, .textwahl:hover { border-color: var(--haupt); }
.karte.zeile { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
form.karte label { display: block; margin-bottom: .9rem; }
form.karte input { display: block; width: 100%; margin-top: .25rem; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .8rem; }
.marker { align-self: flex-start; background: var(--orange-grund); color: var(--orange); border-radius: 99px; padding: 0 .6rem; font-size: .9rem; }

.knopf {
  font: inherit; border: 1px solid var(--linie); background: var(--flaeche); color: var(--text);
  border-radius: 10px; padding: .6rem 1.1rem; min-height: 44px; cursor: pointer;
}
.knopf:hover { border-color: var(--haupt); }
.knopf.haupt { background: var(--haupt); color: var(--haupt-text); border-color: var(--haupt); font-weight: 600; }
.knopf.klein { padding: .3rem .8rem; min-height: 36px; font-size: .95rem; }
.knopf.leise { background: transparent; }
.knopf:disabled { opacity: .5; cursor: default; }
.link-knopf { font: inherit; background: none; border: 0; padding: 0; color: var(--haupt); cursor: pointer; text-decoration: underline; }
.knoepfe { display: flex; gap: .7rem; flex-wrap: wrap; margin: 1rem 0; }
.knoepfe.gross .knopf { font-size: 1.1rem; padding: .8rem 1.4rem; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 8px; padding: .5rem .7rem; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--haupt); outline-offset: 1px; }

.einstellungen { margin: 1rem 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: .6rem 1rem; }
.einstellungen summary { cursor: pointer; color: var(--leise); }
.einstellungen .felder { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: end; margin-top: .8rem; }
.einstellungen label { display: flex; flex-direction: column; font-size: .9rem; color: var(--leise); }
.einstellungen select { max-width: 18rem; }
.einstellungen label.haken { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); }
.einstellungen input[type=checkbox] { min-height: 0; width: 1.2rem; height: 1.2rem; }

.hinweis { border-radius: 10px; padding: .7rem 1rem; margin: .8rem 0; }
.hinweis.fehler { background: var(--rot-grund); color: var(--rot); }
.hinweis.gut { background: var(--gruen-grund); color: var(--gruen); font-weight: 600; }
.hinweis p { margin: .2rem 0; }

/* Diktat */
.fortschritt { height: 8px; background: var(--linie); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.balken { height: 100%; width: 0; background: var(--haupt); transition: width .3s; }
.stand { font-weight: 600; margin: .8rem 0 .2rem; }
.anleitung { color: var(--leise); margin: 0 0 .8rem; }
.diktat textarea {
  display: block; width: 100%; font-size: 1.35rem; line-height: 1.7; padding: .8rem 1rem; resize: vertical;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Auswertung */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .6rem; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: .7rem .9rem; }
.kachel strong { display: block; font-size: 1.8rem; line-height: 1.1; }
.kachel span { color: var(--leise); font-size: .9rem; }
.kachel.rot strong { color: var(--rot); }
.kachel.gruen strong { color: var(--gruen); }
.verbessert { font-size: 1.25rem; line-height: 2.2; }
ins, del { text-decoration: none; }
.falsch del, del.zuviel { color: var(--rot); text-decoration: line-through; }
.falsch ins { color: var(--gruen); background: var(--gruen-grund); border-radius: 4px; padding: 0 .2rem; margin-left: .2rem; font-weight: 600; }
ins.fehlt { color: var(--orange); background: var(--orange-grund); border-radius: 4px; padding: 0 .2rem; font-weight: 600; border: 1px dashed var(--orange); }
.legende { color: var(--leise); font-size: .95rem; }
.wortliste { columns: 2 14rem; padding-left: 1.2rem; }

.liste { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; overflow: hidden; }
.liste th, .liste td { padding: .55rem .8rem; border-bottom: 1px solid var(--linie); text-align: left; }
.liste th { font-size: .9rem; color: var(--leise); font-weight: 600; }
.liste .zahl { text-align: right; white-space: nowrap; }
.liste tr.gelernt td { color: var(--leise); }
.punkte { color: var(--gruen); letter-spacing: .15em; }

/* Training */
.luecke { font-size: 1.4rem; line-height: 1.8; }
.lueckenfeld { display: inline-block; min-width: 4rem; border-bottom: 3px solid var(--haupt); text-align: center; color: var(--haupt); }
.eingabezeile { display: flex; gap: .6rem; margin: 1rem 0; }
.eingabezeile input { flex: 1; font-size: 1.4rem; min-width: 0; }
.vergleich { font-size: 1.4rem; font-weight: 600; letter-spacing: .05em; color: var(--text); }
.vergleich mark { background: var(--markierung); color: inherit; border-radius: 3px; }
.vergleich.richtig { color: var(--gruen); }
.wackeln { animation: wackeln .35s; border-color: var(--rot); }
@keyframes wackeln { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .kopf { gap: .5rem; padding: .5rem .75rem; }
  .kopf .titel { display: none; }
  .liste th:nth-child(2), .liste td:nth-child(2) { display: none; }
}


