:root {
  --grund: #f4f6fb;
  --flaeche: #ffffff;
  --text: #1c2333;
  --leise: #667085;
  --rand: #dde2ec;
  --haupt: #2f6fdb;
  --haupt-text: #ffffff;
  --gruen: #1f9d55;
  --gruen-hell: #e3f6ea;
  --rot: #d64545;
  --rot-hell: #fde8e8;
  --orange: #e08a1e;
  --blau-hell: #e6efff;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --f1: #d64545; --f2: #e08a1e; --f3: #d4b106; --f4: #6bb34a; --f5: #1f9d55;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #11151d;
    --flaeche: #1a202b;
    --text: #e6e9ef;
    --leise: #98a2b3;
    --rand: #2c3544;
    --haupt: #5b8def;
    --gruen-hell: #173826;
    --rot-hell: #3d1d1d;
    --blau-hell: #1c2b47;
    --schatten: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--haupt); }
h1 { font-size: 1.6rem; margin: .2em 0 .4em; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .6em; }
h3 { font-size: 1rem; margin: 1.2em 0 .4em; }
[hidden] { display: none !important; }
.leise { color: var(--leise); }
.mitte { text-align: center; justify-content: center; }
kbd { font: 11px/1 ui-monospace, monospace; opacity: .6; border: 1px solid currentColor; border-radius: 3px; padding: 2px 4px; margin-left: .4em; }

/* Kopf */
.kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 16px; background: var(--flaeche); border-bottom: 1px solid var(--rand);
}
.marke { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--haupt); color: #fff; font-size: 14px; }
.kopf nav { display: flex; gap: 1rem; }
.kopf nav a { text-decoration: none; color: var(--text); }
.kopf { flex-wrap: wrap; row-gap: .3rem; }
.kopf nav { align-items: center; }
.installieren { color: var(--haupt) !important; font-weight: 600 !important; }
.netzstatus { font-size: .8rem; padding: .15rem .6rem; border-radius: 99px; background: var(--blau-hell); color: var(--haupt); white-space: nowrap; }
.netzstatus.offline { background: var(--rot-hell); color: var(--rot); }
@media (display-mode: standalone) { .kopf { padding-top: max(.7rem, env(safe-area-inset-top)); } }

.inhalt { max-width: 760px; margin: 0 auto; padding: 1.2rem 16px 4rem; }
.titelzeile { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.brotkrumen { margin: 0 0 .5rem; }
.brotkrumen a { text-decoration: none; }

/* Karten */
.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px;
  padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--schatten);
}
.karte.schmal { max-width: 440px; margin-left: auto; margin-right: auto; }
.karte.hinweis { border-color: var(--haupt); background: var(--blau-hell); }
details.karte > summary { cursor: pointer; font-weight: 600; }
details.karte[open] > summary { margin-bottom: .8rem; }
details summary { cursor: pointer; }
.gefahr summary { color: var(--rot); }

/* Meldungen */
.meldung { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--gruen-hell); border: 1px solid var(--gruen); }
.meldung.fehler { background: var(--rot-hell); border-color: var(--rot); }

/* Formulare */
.formular { display: flex; flex-direction: column; gap: .8rem; margin-bottom: .6rem; }
.formular.zeile { flex-direction: row; flex-wrap: wrap; }
.formular.zeile input { flex: 1 1 200px; }
.formular label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; }
.formular label.haken { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.formular small { color: var(--leise); font-weight: 400; }
input, select, textarea {
  font: inherit; color: inherit; background: var(--grund);
  border: 1px solid var(--rand); border-radius: 8px; padding: .6rem .7rem; width: 100%; min-width: 0;
}
input[type=checkbox], input[type=radio] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--haupt); outline-offset: -1px; border-color: var(--haupt); }
textarea { resize: vertical; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 520px) { .zwei { grid-template-columns: 1fr; } }

/* Knoepfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid var(--rand);
  background: var(--flaeche); color: var(--text); min-height: 42px;
}
.knopf:hover { border-color: var(--haupt); }
.knopf.haupt { background: var(--haupt); border-color: var(--haupt); color: var(--haupt-text); }
.knopf.haupt:hover { filter: brightness(1.08); }
.knopf.rot { color: var(--rot); border-color: var(--rot); }
.knopf.klein { padding: .35rem .8rem; min-height: 34px; font-size: .9rem; }
.knopf.gross { padding: .8rem 1.6rem; font-size: 1.1rem; }
.knoepfe { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.knoepfe form { margin: 0; }
button.link { background: none; border: 0; color: var(--leise); cursor: pointer; font: inherit; padding: 0 .2rem; }
button.link:hover { color: var(--rot); }

/* Lektionsliste */
.lektionsliste { list-style: none; margin: 0 0 1rem; padding: 0; }
.karte.lektion { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; }
.waehlen { display: flex; padding: .3rem; }
.lektion-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; color: var(--text); text-decoration: none; }
.lektion-info strong { font-size: 1.05rem; }
.lektion-info .leise { font-size: .9rem; }
.balken { display: block; height: 5px; background: var(--rand); border-radius: 3px; overflow: hidden; margin: .2rem 0; max-width: 260px; }
.balken span { display: block; height: 100%; background: var(--gruen); }
.marken { display: flex; gap: .3rem; flex-wrap: wrap; }
.marke-klein { font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; background: var(--grund); border: 1px solid var(--rand); color: var(--leise); white-space: nowrap; }
.marke-klein.blau { background: var(--blau-hell); color: var(--haupt); border-color: transparent; }
.marke-klein.rot { background: var(--rot-hell); color: var(--rot); border-color: transparent; }
.gemeinsam { position: sticky; bottom: 1rem; text-align: center; }

/* Lernstand */
.faecher { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; text-align: center; margin-bottom: .6rem; }
.saeule { height: 70px; background: var(--grund); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.saeule span { display: block; width: 100%; min-height: 2px; }
.fach small { display: block; color: var(--leise); font-size: .8rem; }
.f1 .saeule span, .fachmarke.f1 { background: var(--f1); }
.f2 .saeule span, .fachmarke.f2 { background: var(--f2); }
.f3 .saeule span, .fachmarke.f3 { background: var(--f3); }
.f4 .saeule span, .fachmarke.f4 { background: var(--f4); }
.f5 .saeule span, .fachmarke.f5 { background: var(--f5); }
.fachmarke { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: .75rem; font-weight: 700; margin-left: .4rem; vertical-align: middle; }

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kennzahlen div { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: .8rem; text-align: center; }
.kennzahlen strong { display: block; font-size: 1.5rem; }
.kennzahlen span { color: var(--leise); font-size: .85rem; }

/* Vokabeltabelle */
.filter { margin-bottom: .6rem; }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th { text-align: left; font-size: .8rem; color: var(--leise); font-weight: 600; border-bottom: 1px solid var(--rand); padding: .4rem; }
.tabelle td { padding: .5rem .4rem; border-bottom: 1px solid var(--rand); vertical-align: top; overflow-wrap: anywhere; }
.tabelle tr.problem td:first-child { box-shadow: inset 3px 0 var(--rot); }
.tabelle .zahl { white-space: nowrap; color: var(--leise); font-size: .9rem; }
.tabelle .fachmarke { margin: 0; }
.richtungsfach { display: inline-flex; align-items: center; gap: 2px; margin-right: .3rem; white-space: nowrap; }
.richtungsfach .fachmarke { width: 20px; height: 20px; }
.tabelle .aktionen { white-space: nowrap; text-align: right; }
.tabelle .aktionen a { text-decoration: none; padding: 0 .3rem; }
.tabelle .aktionen form { display: inline; }
.tabelle tr.bearbeiten td { background: var(--blau-hell); }
.notiz { display: block; color: var(--leise); font-size: .85rem; font-style: italic; }
@media (max-width: 520px) { .tabelle th:nth-child(3), .tabelle td:nth-child(3) { display: none; } }

.teilen-link { display: flex; gap: .5rem; flex-wrap: wrap; }
.teilen-link input { flex: 1 1 220px; font-size: .9rem; }
.mitglieder { padding-left: 1.2rem; }
.mitglieder form { display: inline; }
.wahl { display: flex; flex-direction: column; gap: .7rem; margin: 1.2rem 0; }
.wahl .knopf { flex-direction: column; padding: .9rem; }
.wahl small { font-weight: 400; opacity: .85; }

/* Lernauswahl */
.lernwahl h2 { margin-top: 1.4rem; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .7rem; }
.kacheln.klein { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kachel {
  position: relative; display: flex; flex-direction: column; gap: .3rem; cursor: pointer;
  background: var(--flaeche); border: 2px solid var(--rand); border-radius: 12px; padding: .9rem 1rem;
}
.kachel input { position: absolute; opacity: 0; pointer-events: none; }
.kachel:has(input:checked) { border-color: var(--haupt); background: var(--blau-hell); }
.kachel:has(input:focus-visible) { outline: 2px solid var(--haupt); outline-offset: 2px; }
.kachel.leer { opacity: .65; }
.kachel-kopf { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.kachel-text { color: var(--leise); font-size: .9rem; }
.lernwahl select { font-weight: 500; }
.lernwahl > .knopf { margin-top: 1.6rem; width: 100%; }

/* Lerneinheit */
.lernkopf { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .9rem; }
.lernkopf a, .lernkopf #zaehler { text-decoration: none; white-space: nowrap; }
.lernkopf > span:nth-child(2) { text-align: center; }
.fortschritt { height: 6px; background: var(--rand); border-radius: 3px; margin: .6rem 0 1.4rem; overflow: hidden; }
.fortschritt span { display: block; height: 100%; width: 0; background: var(--haupt); transition: width .3s; }
.lernflaeche { max-width: 560px; margin: 0 auto; }
.lernkarte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 16px; box-shadow: var(--schatten);
  padding: 1.6rem 1.2rem; text-align: center; margin-bottom: 1rem;
}
.sprache { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); }
.wort { font-size: 1.9rem; font-weight: 600; margin: .3rem 0; overflow-wrap: anywhere; line-height: 1.25; }
.wort.loesung { color: var(--gruen); font-size: 1.5rem; }
.rueckseite { border-top: 1px dashed var(--rand); margin-top: 1.2rem; padding-top: 1rem; }
.vorlesen { background: none; border: 0; cursor: pointer; font-size: 1.1rem; vertical-align: middle; opacity: .6; padding: .2rem .4rem; }
.vorlesen:hover { opacity: 1; }
.lernkarte .notiz { margin: .6rem 0 0; font-size: .95rem; }
.steuerung { text-align: center; }
.bewerten { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.bewerten .knopf { padding: .7rem .2rem; font-size: .95rem; }
.knopf.rot { color: var(--rot); }
.knopf.orange { color: var(--orange); border-color: var(--orange); }
.knopf.gruen { color: var(--gruen); border-color: var(--gruen); }
.knopf.blau { color: var(--haupt); border-color: var(--haupt); }
@media (max-width: 420px) { .bewerten kbd, .optionen kbd { display: none; } }
.tastenhilfe { font-size: .8rem; margin-top: 1rem; }
@media (pointer: coarse) { .tastenhilfe { display: none; } }

.antwortform { margin-top: 1.2rem; }
.eingabe { font-size: 1.3rem; text-align: center; padding: .8rem; }
.sonderzeichen { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; margin-top: .5rem; }
.sonderzeichen button { font: inherit; min-width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--rand); background: var(--grund); color: var(--text); cursor: pointer; }
.ergebnis { margin-top: 1.2rem; padding: 1rem; border-radius: 12px; }
.ergebnis.gut { background: var(--gruen-hell); }
.ergebnis.schlecht { background: var(--rot-hell); }
.urteil { font-weight: 700; font-size: 1.1rem; }
.ergebnis.gut .urteil { color: var(--gruen); }
.ergebnis.schlecht .urteil { color: var(--rot); }
.deine { color: var(--leise); margin-top: .3rem; }

.optionen { display: grid; gap: .5rem; margin-top: 1.2rem; }
.option {
  font: inherit; font-size: 1.1rem; text-align: left; cursor: pointer; display: flex; align-items: center; gap: .6rem;
  padding: .8rem 1rem; border-radius: 10px; border: 2px solid var(--rand); background: var(--grund); color: var(--text);
}
.option kbd { margin: 0; }
.option:hover:not(:disabled) { border-color: var(--haupt); }
.option.gut { border-color: var(--gruen); background: var(--gruen-hell); }
.option.schlecht { border-color: var(--rot); background: var(--rot-hell); }
.option:disabled { cursor: default; color: var(--text); }

.zuordnen { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .7rem; }
.zuordnen .sprache { text-align: center; }
.spalte { display: flex; flex-direction: column; gap: .5rem; }
.paar {
  font: inherit; cursor: pointer; padding: .8rem .5rem; min-height: 56px; border-radius: 10px;
  border: 2px solid var(--rand); background: var(--flaeche); color: var(--text); overflow-wrap: anywhere;
  transition: background .2s, border-color .2s, opacity .3s;
}
.paar.aktiv { border-color: var(--haupt); background: var(--blau-hell); }
.paar.gut { border-color: var(--gruen); background: var(--gruen-hell); opacity: .45; cursor: default; }
.paar.schlecht { border-color: var(--rot); background: var(--rot-hell); animation: wackeln .3s; }
@keyframes wackeln { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.ende .gross-zahl { font-size: 3rem; font-weight: 700; margin: .2rem 0; color: var(--haupt); }
.fehlerliste { text-align: left; display: inline-block; margin: 0 0 1rem; }
