:root {
  --grund: #ffffff;
  --flaeche: #f5f5f4;
  --linie: #d6d3d1;
  --text: #1c1917;
  --leise: #57534e;
  --akzent: #1f6f6b;
  --akzent-text: #ffffff;
  --weg-grund: #fde2e1;
  --weg-text: #9f1d1a;
  --neu-grund: #d9f2e3;
  --neu-text: #13603a;
  --warn: #9a5b00;
  --fehler: #b42318;
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #1f1f1f;
    --flaeche: #2a2a2a;
    --linie: #444;
    --text: #f2f2f2;
    --leise: #b5b5b5;
    --akzent: #4fb3ac;
    --akzent-text: #0e1f1e;
    --weg-grund: #4a1f1d;
    --weg-text: #ffb4ae;
    --neu-grund: #173a27;
    --neu-text: #9be4b8;
    --warn: #f0b45c;
    --fehler: #ff8a80;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --grund: #1f1f1f;
  --flaeche: #2a2a2a;
  --linie: #444;
  --text: #f2f2f2;
  --leise: #b5b5b5;
  --akzent: #4fb3ac;
  --akzent-text: #0e1f1e;
  --weg-grund: #4a1f1d;
  --weg-text: #ffb4ae;
  --neu-grund: #173a27;
  --neu-text: #9be4b8;
  --warn: #f0b45c;
  --fehler: #ff8a80;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 12px 24px;
  background: var(--grund);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

[hidden] { display: none !important; }

.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
}
.kopf h1 { margin: 0; font-size: 18px; font-weight: 600; }
.kopfknoepfe { display: flex; gap: 6px; }
a.knopf { text-decoration: none; border-radius: var(--radius); font-size: 14px; }

fieldset { border: 0; margin: 0 0 12px; padding: 0; }
legend { font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; padding: 0; }
label { display: block; margin-bottom: 4px; }
input[type="password"] {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--grund);
  color: var(--text);
  font: inherit;
  margin-bottom: 8px;
}

button {
  font: inherit;
  border-radius: var(--radius);
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
.haupt {
  background: var(--akzent);
  color: var(--akzent-text);
  border: 0;
  padding: 8px 16px;
  font-weight: 600;
}
.leise {
  background: transparent;
  color: var(--akzent);
  border: 1px solid var(--linie);
  padding: 6px 10px;
}
.hilfe {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--linie);
  background: var(--flaeche);
  color: var(--text);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
}
.hilfe[aria-expanded="true"] { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }

.umschalter { display: flex; border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.umschalter label { flex: 1; margin: 0; }
.umschalter input { position: absolute; opacity: 0; pointer-events: none; }
.umschalter span {
  display: block;
  text-align: center;
  padding: 6px 4px;
  cursor: pointer;
  border-left: 1px solid var(--linie);
  font-size: 13px;
}
.dreifach span { font-size: 12.5px; padding: 6px 2px; }
.umschalter label:first-child span { border-left: 0; }
.umschalter input:checked + span { background: var(--akzent); color: var(--akzent-text); font-weight: 600; }
.umschalter input:focus-visible + span { outline: 2px solid var(--akzent); outline-offset: -3px; }

.klein { font-size: 12px; color: var(--leise); margin: 6px 0 0; }
.fehler { color: var(--fehler); }

#modusbeispiele {
  margin-top: 8px;
  padding: 10px;
  background: var(--flaeche);
  border-radius: var(--radius);
  font-size: 13px;
}
#modusbeispiele h3 { font-size: 12px; margin: 8px 0 2px; color: var(--leise); text-transform: uppercase; letter-spacing: 0.03em; }
#modusbeispiele h3:first-child { margin-top: 0; }
#modusbeispiele p { margin: 0 0 6px; }

.knoepfe { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; }

.balken { height: 6px; background: var(--flaeche); border-radius: 3px; overflow: hidden; }
#balkenstand { height: 100%; width: 0; background: var(--akzent); transition: width 0.3s; }

#zeichen {
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--flaeche);
  margin-bottom: 12px;
  font-size: 13px;
}
#zeichen .ok { color: var(--neu-text); font-weight: 600; }
#zeichen .warn { color: var(--warn); font-weight: 600; }
#zeichen ul { margin: 6px 0 0; padding-left: 18px; }
#zeichen button { margin: 2px 0; padding: 2px 6px; font-size: 12px; }

.ergebniskopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
#zusammenfassung { margin: 0; font-size: 13px; }

#karten { list-style: none; margin: 0; padding: 0; }
.karte {
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.karte:hover { border-color: var(--akzent); }
.karte.erledigt { opacity: 0.55; cursor: default; }
.karte .art {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--leise);
  margin-bottom: 4px;
}
.karte .diff { margin: 0 0 6px; overflow-wrap: anywhere; }
.karte .grund { margin: 0 0 8px; font-size: 12px; color: var(--leise); }
.karte .aktionen { display: flex; gap: 6px; }
.karte .aktionen button { padding: 4px 10px; font-size: 13px; }
.karte .status { font-size: 12px; font-weight: 600; }

del, .weg { background: var(--weg-grund); color: var(--weg-text); text-decoration: line-through; border-radius: 2px; }
ins, .neu { background: var(--neu-grund); color: var(--neu-text); text-decoration: none; border-radius: 2px; }

/* Feedback */
.abschnitt { font-size: 15px; margin: 4px 0 8px; }
textarea {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--grund);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--linie); cursor: default; }
.feedback .daumen { background: transparent; border: 1px solid var(--linie); padding: 1px 7px; font-size: 14px; line-height: 1.4; }
.feedback .daumen.aktiv { border-color: var(--akzent); background: var(--flaeche); }
.feedback .kommentar { flex-basis: 100%; margin-top: 6px; }
.feedback .kommentar .klein { margin: 2px 0 6px; }
.feedback .kommentar button { padding: 3px 10px; font-size: 13px; }
.historie { margin: 14px 0; }
.historie details { border: 1px solid var(--linie); border-radius: var(--radius); padding: 6px 8px; margin-top: 6px; }
.historie summary { cursor: pointer; font-size: 13px; }
.historie .wahl { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 13px; }
.historie .wahl input { margin-top: 3px; }
.historie .wahl.vorschlag { border-top: 1px solid var(--linie); }
.historie .diff { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.historie .art { font-size: 11px; color: var(--leise); text-transform: uppercase; letter-spacing: 0.03em; }

/* Reiter und Diktat */
.reiter { margin: 0 0 14px; }
.reiter span { font-weight: 600; }
.diktatausgabe { border: 1px solid var(--linie); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 8px; }
.diktatausgabe p { margin: 0 0 8px; overflow-wrap: anywhere; }
.diktatausgabe p:last-child { margin-bottom: 0; }
mark { background: #fde68a; color: #1c1917; border-radius: 2px; padding: 0 1px; }
#diktatunsicher ul { margin: 0 0 8px; padding-left: 18px; font-size: 13px; }
#diktatunsicher li { margin-bottom: 4px; }
