:root {
  --bg: #f5f7fb;
  --karte: #ffffff;
  --text: #1f2937;
  --leise: #6b7280;
  --linie: #e5e7eb;
  --primaer: #2563eb;
  --gruen: #16a34a;
  --gelb: #d97706;
  --rot: #dc2626;
  --sicher: #22c55e;
  --wackelt: #f59e0b;
  --neu: #d1d5db;
  --radius: 14px;
  --schatten: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a; --karte: #1e293b; --text: #e5e7eb; --leise: #94a3b8; --linie: #334155;
    --primaer: #60a5fa; --neu: #475569; --schatten: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primaer); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.leise { color: var(--leise); font-size: .9em; }
.mitte { text-align: center; justify-content: center; }
kbd { font: .75em monospace; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: .6; margin-left: 4px; }

/* Kopf */
.kopf { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.5rem; background: var(--karte); border-bottom: 1px solid var(--linie); flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.kopf nav { display: flex; gap: 1rem; flex: 1; }
.kopf nav a { color: var(--leise); padding: .3rem .1rem; border-bottom: 2px solid transparent; }
.kopf nav a.aktiv { color: var(--text); border-color: var(--primaer); }
.wer { display: flex; align-items: center; gap: .8rem; color: var(--leise); font-size: .9rem; }
.wer form { margin: 0; }
button.link { background: none; border: 0; color: var(--primaer); cursor: pointer; font: inherit; padding: 0; }
.kindwahl select { font: inherit; padding: .2rem; border-radius: 6px; }

main { max-width: 1150px; margin: 0 auto; padding: 1.5rem; }
main.mitte { display: grid; place-items: center; min-height: 90vh; }

.karte { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten); padding: 1.2rem 1.4rem; margin-bottom: 1.2rem; border: 1px solid var(--linie); }
.raster { display: grid; grid-template-columns: 2fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 800px) { .raster { grid-template-columns: 1fr; } }

/* Login */
.login { width: min(380px, 100%); }
.login label { display: block; margin: .8rem 0; font-size: .9rem; }
.login input { display: block; width: 100%; margin-top: .3rem; }
input { font: inherit; padding: .6rem .8rem; border: 1px solid var(--linie); border-radius: 10px; background: var(--bg); color: var(--text); }
input:focus { outline: 2px solid var(--primaer); outline-offset: 1px; }
.fehlermeldung { color: var(--rot); }

/* Knöpfe */
.knopf { display: inline-block; background: var(--primaer); color: #fff; border: 0; border-radius: 10px; padding: .55rem 1rem; font: inherit; cursor: pointer; text-decoration: none !important; }
.knopf:hover { filter: brightness(1.08); }
.knopf.gross { padding: .8rem 1.4rem; font-size: 1.05rem; }
.knopf.leicht { background: var(--bg); color: var(--text); border: 1px solid var(--linie); }
.knopf.gruen { background: var(--gruen); }
.knopf.rot { background: var(--rot); }
.knopfreihe { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; }

/* Dashboard */
.gruss { margin-bottom: 1rem; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.2rem; margin-bottom: .2rem; }
.countdown { display: block; color: var(--text); border-top: 5px solid var(--fach); text-decoration: none !important; transition: transform .1s; }
.countdown:hover { transform: translateY(-2px); }
.fachzeile { display: flex; justify-content: space-between; font-size: .85rem; }
.fach { font-weight: 600; color: var(--fach, var(--primaer)); }
.art { color: var(--leise); }
.countdown .tage { font-size: 1.9rem; font-weight: 800; line-height: 1.2; margin-top: .3rem; }
.countdown .titel { font-weight: 600; }
.countdown .datum { color: var(--leise); font-size: .9rem; margin-bottom: .6rem; }
.kopfkarte { border-top: 5px solid var(--fach); }

.balken { display: flex; height: 10px; border-radius: 99px; background: var(--neu); overflow: hidden; margin-top: .5rem; }
.balken .sicher { background: var(--sicher); }
.balken .wackelt { background: var(--wackelt); }
.legende { display: flex; gap: .8rem; font-size: .8rem; color: var(--leise); margin-top: .3rem; flex-wrap: wrap; }
.punkt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; background: var(--neu); }
.punkt.sicher { background: var(--sicher); }
.punkt.wackelt { background: var(--wackelt); }

.block { border-left: 4px solid var(--fach); padding: .6rem .9rem; margin-bottom: 1rem; background: var(--bg); border-radius: 0 10px 10px 0; }
.block.fertig { opacity: .65; }
.blockkopf { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.hinweis { font-size: .9rem; color: var(--leise); margin: .3rem 0; }
.warnung { color: var(--gelb); }
.schritte { list-style: none; padding: 0; margin: .5rem 0 0; }
.schritte li { display: flex; gap: .6rem; align-items: baseline; padding: .3rem 0; border-top: 1px solid var(--linie); }
.schritte li:first-child { border-top: 0; }
.schritte li a, .schritte li > span:nth-child(2) { flex: 1; }
.schritte li.erledigt a { color: var(--leise); text-decoration: line-through; }
.haken { width: 1.2rem; color: var(--gruen); }

.liste { list-style: none; padding: 0; margin: 0; }
.liste li { padding: .35rem 0; border-top: 1px solid var(--linie); }
.liste li:first-child { border-top: 0; }
.liste.klein { font-size: .9rem; }
.datumchip { display: inline-block; min-width: 4.8rem; font-size: .8rem; font-weight: 600; color: var(--fach, var(--leise)); }
.mehr { display: inline-block; margin-top: .6rem; font-size: .9rem; }
.zahlen { display: flex; justify-content: space-around; text-align: center; }
.zahlen b { display: block; font-size: 1.8rem; }
.zahlen span { font-size: .8rem; color: var(--leise); }
.zahl { background: var(--rot); color: #fff; border-radius: 99px; padding: 0 .5rem; font-size: .8rem; vertical-align: middle; }

.tabelle { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabelle td, .tabelle th { padding: .35rem .4rem; border-top: 1px solid var(--linie); text-align: left; vertical-align: top; }
.tabelle tr.ok td:last-child { color: var(--gruen); }
.tabelle tr.falsch td:nth-child(2) { color: var(--rot); text-decoration: line-through; }
.tabelle tr.fast td:nth-child(2) { color: var(--gelb); }
details summary { cursor: pointer; }
.inline { display: inline; }

/* Kalender */
.kalenderkopf { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.kalenderkopf h1 { margin: 0; min-width: 12rem; text-align: center; }
.kalender { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wt { text-align: center; font-weight: 600; color: var(--leise); font-size: .85rem; }
.tag { background: var(--karte); border: 1px solid var(--linie); border-radius: 8px; min-height: 95px; padding: 4px; font-size: .78rem; overflow: hidden; }
.tag.fremd { opacity: .45; }
.tag.heute { outline: 2px solid var(--primaer); }
.tag .nr { font-weight: 700; display: block; margin-bottom: 2px; }
.ereignis { display: block; padding: 2px 4px; margin-bottom: 2px; border-radius: 4px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ereignis.pruefung { background: color-mix(in srgb, var(--fach) 30%, transparent); font-weight: 600; }
.ereignis.lernen { border-left: 3px solid var(--fach); background: var(--bg); }
.ereignis.fertig { opacity: .55; }

/* Übung */
.uebungskopf { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.uebungskopf > div:nth-child(2) { flex: 1; }
.uebungskopf h1 { margin: 0; }
.zurueck { white-space: nowrap; padding-top: .3rem; }
.uhr { font-variant-numeric: tabular-nums; color: var(--leise); padding-top: .3rem; }
.uebung { max-width: 760px; margin: 0 auto; min-height: 320px; }
.fortschritt { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; }
.fortschritt .leiste { flex: 1; height: 8px; background: var(--neu); border-radius: 99px; overflow: hidden; }
.fortschritt .leiste span { display: block; height: 100%; background: var(--sicher); transition: width .3s; }
.aufgabe { text-align: center; margin: 1.5rem 0; }
.wort { font-size: 2rem; font-weight: 700; }
.wort.de { color: var(--primaer); }
.satz { font-size: 1.3rem; }
.luecke { display: inline-block; border-bottom: 2px solid var(--primaer); min-width: 5rem; color: transparent; }
.eingabe { display: flex; gap: .6rem; max-width: 520px; margin: 0 auto; }
.eingabe input { flex: 1; font-size: 1.2rem; }
.nachschreiben { flex-direction: column; margin-top: .8rem; }
.nachschreiben label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.rueck { margin: 1rem auto 0; max-width: 520px; padding: .7rem 1rem; border-radius: 10px; }
.rueck.ok { background: color-mix(in srgb, var(--gruen) 15%, transparent); color: var(--gruen); }
.rueck.fast { background: color-mix(in srgb, var(--gelb) 15%, transparent); }
.rueck.falsch { background: color-mix(in srgb, var(--rot) 12%, transparent); }
.markiert { font-size: 1.3rem; font-weight: 700; letter-spacing: .02em; }
mark { background: var(--wackelt); color: #000; border-radius: 3px; padding: 0 1px; }
.wackeln { animation: wackeln .35s; border-color: var(--rot); }
@keyframes wackeln { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.laut { background: none; border: 0; cursor: pointer; font-size: 1.1rem; vertical-align: middle; }

.karteikarte { margin: 1.5rem auto; max-width: 480px; min-height: 180px; border: 2px solid var(--linie); border-radius: var(--radius); display: grid; place-items: center; text-align: center; padding: 1.5rem; background: var(--bg); }
.karteikarte .hinten { margin-top: 1rem; border-top: 1px dashed var(--linie); padding-top: 1rem; }

.optionen { display: grid; gap: .6rem; max-width: 520px; margin: 1rem auto; }
.option { font: inherit; text-align: left; padding: .8rem 1rem; border-radius: 10px; border: 1px solid var(--linie); background: var(--bg); color: var(--text); cursor: pointer; }
.option.ok { background: color-mix(in srgb, var(--gruen) 20%, transparent); border-color: var(--gruen); }
.option.falsch { background: color-mix(in srgb, var(--rot) 15%, transparent); border-color: var(--rot); }
.frage { text-align: center; }
.info { max-width: 520px; margin: .5rem auto; }

.abschluss { text-align: center; }
.gross-emoji { font-size: 3rem; }
.statistik .ok { color: var(--gruen); } .statistik .fast { color: var(--gelb); } .statistik .falsch { color: var(--rot); }
.abschluss .tabelle { text-align: left; margin: 1rem 0; }
.note { font-size: 1.4rem; }
.note b { font-size: 2.4rem; }

.esel { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin: 1rem 0; }
.eselkarte { background: var(--bg); border-radius: 10px; padding: .9rem; border: 1px solid var(--linie); }
.eselkarte .wort { font-size: 1.3rem; }
.eselkarte .de { color: var(--primaer); font-weight: 600; }
.eselkarte .satz { font-size: .95rem; font-style: italic; margin: .4rem 0; }
.merkhilfe { font-size: .9rem; margin: .4rem 0; }
.eselkarte label { display: flex; flex-direction: column; font-size: .85rem; gap: .2rem; margin-top: .4rem; }
