/* Farbthemen (lernen/themen.py). Der erste Block gilt für alle Themen als Grundwert (hell/Sand), die folgenden überschreiben ihn. Gewählt wird per data-thema am <html>-Element; "system" folgt dem Gerät.
   Die Variablen stehen auf jedem Element mit data-thema, so funktionieren auch die Vorschauen auf der Farbenseite. */
:root, [data-thema="system"], [data-thema="standard"], [data-thema="ozean"], [data-thema="wald"], [data-thema="beere"], [data-thema="dunkel"],
[data-thema="mitternacht"], [data-thema="nachtwald"], [data-thema="daemmerung"], [data-thema="glut"], [data-thema="kohle"],
[data-thema="solarized"], [data-thema="solarized-dunkel"] {
  --farbe: var(--set-farbe, #7b4b00);   /* Hell/Sand: die Farbe des Lernsets (app.js) färbt die Seite */
  --auf-farbe: #fff;
  --hell: #f6eddd;
  --text: #1c1b1a;
  --grau: #6b6760;
  --rand: #d9d2c4;
  --gut: #2e7d32;
  --schlecht: #b3261e;
  --seite: #fbf9f4;
  --karte: #fff;
  --feld: #fff;
  --feldrand: #b8b1a3;
  --falsch-bg: #fde8e6;
  --hinweis-bg: #fff8e1;
  --hinweis-rand: #e0a800;
  --loesung-bg: #eef6ee;
  --tutor-bg: #eef1f8;
  --tiefe: #000;
  color-scheme: light;
}
[data-thema="ozean"] {
  --farbe: #1b5e8c; --hell: #e3eff7; --text: #17202a; --grau: #576573; --rand: #c9d7e2; --seite: #f4f8fb;
  --feldrand: #9fb3c3; --loesung-bg: #e8f3ec; --tutor-bg: #e8eef7;
  color-scheme: light;
}
[data-thema="wald"] {
  --farbe: #2d6a3e; --hell: #e4f1e6; --text: #1a211b; --grau: #5a6a5d; --rand: #cfdccf; --seite: #f5f9f4;
  --feldrand: #a6b8a8; --gut: #1b6e2a; --loesung-bg: #e1f1e3; --tutor-bg: #eaf0ea;
  color-scheme: light;
}
[data-thema="beere"] {
  --farbe: #7a2e6e; --hell: #f4e6f1; --text: #211a20; --grau: #6b5f69; --rand: #dccbd8; --seite: #fbf6fa;
  --feldrand: #bba6b7; --loesung-bg: #eef6ee; --tutor-bg: #f1ecf7;
  color-scheme: light;
}
[data-thema="dunkel"] {
  --farbe: #e0a24a; --auf-farbe: #1b1405; --hell: #2b2a26; --text: #e8e6e1; --grau: #a8a59e; --rand: #3b3e46;
  --gut: #6fcf7a; --schlecht: #ff8a80; --seite: #16171a; --karte: #212329; --feld: #1a1c21; --feldrand: #5b606c;
  --falsch-bg: #3d2222; --hinweis-bg: #3a3218; --hinweis-rand: #c99a1a; --loesung-bg: #1f3324; --tutor-bg: #262c3a;
  --tiefe: #fff; color-scheme: dark;
}
/* Weitere dunkle Themen: gemeinsame Grundwerte, darunter je Thema die Farben */
[data-thema="mitternacht"], [data-thema="nachtwald"], [data-thema="daemmerung"], [data-thema="glut"], [data-thema="kohle"], [data-thema="solarized-dunkel"] {
  --gut: #6fcf7a; --schlecht: #ff8a80; --falsch-bg: #3d2222; --hinweis-bg: #3a3218; --hinweis-rand: #c99a1a;
  --tiefe: #fff; color-scheme: dark;
}
[data-thema="mitternacht"] {
  --farbe: #6cb2eb; --auf-farbe: #07131f; --hell: #1d2735; --text: #e4e9f0; --grau: #9aa8b8; --rand: #2f3b4b;
  --seite: #0f1620; --karte: #182130; --feld: #121a26; --feldrand: #4d5c70; --loesung-bg: #1b3226; --tutor-bg: #1f2a40;
}
[data-thema="nachtwald"] {
  --farbe: #6fcf8a; --auf-farbe: #06150b; --hell: #1f2b22; --text: #e3eae4; --grau: #9cab9f; --rand: #2f3f33;
  --seite: #101713; --karte: #19231c; --feld: #131b15; --feldrand: #4e6153; --loesung-bg: #1d3a25; --tutor-bg: #202b29;
}
[data-thema="daemmerung"] {
  --farbe: #d28ddb; --auf-farbe: #1d0a1a; --hell: #2a2030; --text: #ece5ee; --grau: #aa9fae; --rand: #40344a;
  --seite: #17121b; --karte: #211a27; --feld: #1b151f; --feldrand: #5f5069; --loesung-bg: #1f3324; --tutor-bg: #2a2540;
}
[data-thema="glut"] {
  --farbe: #ff8a65; --auf-farbe: #240a02; --hell: #2e2220; --text: #f0e6e3; --grau: #b0a09b; --rand: #46322e;
  --seite: #1a1210; --karte: #251a17; --feld: #1d1411; --feldrand: #6a4f48; --loesung-bg: #1f3324; --tutor-bg: #2c2530;
}
/* Kohle: echtes Schwarz (spart Strom auf OLED-Bildschirmen) */
[data-thema="kohle"] {
  --farbe: #cfd3da; --auf-farbe: #101114; --hell: #1a1a1a; --text: #ededed; --grau: #a0a0a0; --rand: #2e2e2e;
  --seite: #000; --karte: #0f0f0f; --feld: #0a0a0a; --feldrand: #555; --falsch-bg: #331414; --hinweis-bg: #2e280f;
  --loesung-bg: #12261a; --tutor-bg: #151a24;
}
/* Solarized (Ethan Schoonover): hell und dunkel mit derselben Palette; Blau, Grün und Text sind für die Lesbarkeit leicht angepasst */
[data-thema="solarized"] {
  --farbe: #1d77b5; --auf-farbe: #fdf6e3; --hell: #eee8d5; --text: #586e75; --grau: #657b83; --rand: #ddd5ba;
  --gut: #6b8200; --schlecht: #c42a27; --seite: #fdf6e3; --karte: #fef9ea; --feld: #fffdf5; --feldrand: #b9b29b;
  --falsch-bg: #fbe3d9; --hinweis-bg: #f7edc3; --hinweis-rand: #b58900; --loesung-bg: #eaf0cf; --tutor-bg: #e3ecee;
}
[data-thema="solarized-dunkel"] {
  --farbe: #3a9ae0; --auf-farbe: #002b36; --hell: #06303b; --text: #a1afaf; --grau: #839496; --rand: #124854;
  --gut: #9aae1a; --schlecht: #f0605c; --seite: #002b36; --karte: #073642; --feld: #01303b; --feldrand: #3d6470;
  --falsch-bg: #3a2a2f; --hinweis-bg: #3a3516; --hinweis-rand: #b58900; --loesung-bg: #0f3d2e; --tutor-bg: #123a4d;
}
@media (prefers-color-scheme: dark) {
  [data-thema="system"] {
    --farbe: #e0a24a; --auf-farbe: #1b1405; --hell: #2b2a26; --text: #e8e6e1; --grau: #a8a59e; --rand: #3b3e46;
    --gut: #6fcf7a; --schlecht: #ff8a80; --seite: #16171a; --karte: #212329; --feld: #1a1c21; --feldrand: #5b606c;
    --falsch-bg: #3d2222; --hinweis-bg: #3a3218; --hinweis-rand: #c99a1a; --loesung-bg: #1f3324; --tutor-bg: #262c3a;
    --tiefe: #fff; color-scheme: dark;
  }
}

/* ================================================================ Design-System
   Alles Folgende baut nur auf den Themenfarben oben auf. Abgeleitete Töne entstehen mit color-mix(); davor steht jeweils ein
   Grundwert für ältere Browser. --tiefe ist in hellen Themen Schwarz, in dunklen Weiß: damit abgetönte Flächen den Kontrast erhöhen. */
:root {
  --radius: 16px;
  --radius-klein: 10px;
  --schatten: 0 1px 2px rgb(0 0 0 / .05), 0 4px 18px rgb(0 0 0 / .06);
  --schatten-hoch: 0 2px 6px rgb(0 0 0 / .08), 0 14px 34px rgb(0 0 0 / .12);
  --uebergang: .18s cubic-bezier(.2, .7, .3, 1);
  --breite: 880px;
  accent-color: var(--farbe);
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  :root { scroll-behavior: smooth; }
  @view-transition { navigation: auto; }
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; min-height: 100dvh;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text); background: var(--seite);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { text-wrap: balance; line-height: 1.25; }
p, li { text-wrap: pretty; }
a { color: var(--farbe); text-underline-offset: .18em; text-decoration-thickness: from-font; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--farbe); outline-offset: 2px; border-radius: 6px; }
[id] { scroll-margin-top: 72px; }
code { font: .9em ui-monospace, "SF Mono", Menlo, Consolas, monospace; padding: .1em .35em; border-radius: 6px; background: var(--hell); }

/* ---------------------------------------------------------------- Kopf und Navigation */
#kopf {
  display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center;
  padding: 22px max(16px, calc((100% - var(--breite)) / 2 + 16px)) 26px;
  color: var(--auf-farbe); background: var(--farbe);
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--farbe) 70%, var(--auf-farbe)) 0%, transparent 55%),
              linear-gradient(135deg, var(--farbe), color-mix(in oklab, var(--farbe) 78%, var(--tiefe)));
}
#kopf h1 { margin: 0; font-size: clamp(1.3rem, 1.05rem + 1.2vw, 1.75rem); font-weight: 750; letter-spacing: -.01em; }
#untertitel { margin-top: 2px; font-size: .92rem; opacity: .88; }
#stand { margin-left: auto; font-size: .95rem; text-align: right; font-variant-numeric: tabular-nums; }
#nav {
  position: sticky; top: 0; z-index: 3;
  display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; overflow-x: auto; scrollbar-width: none;
  padding: 8px max(4px, calc((100% - var(--breite)) / 2 + 4px));
  background: var(--hell);
  background: color-mix(in srgb, var(--seite) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--rand);
  border-bottom-color: color-mix(in srgb, var(--rand) 70%, transparent);
}
#nav::-webkit-scrollbar { display: none; }
#nav > a, #nav .nutzer a {
  flex: none; padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  color: var(--farbe); font-weight: 600; font-size: .93rem; text-decoration: none;
  transition: background var(--uebergang);
}
#nav > a:hover, #nav .nutzer a:hover { background: var(--hell); background: color-mix(in srgb, var(--farbe) 12%, transparent); }
#nav .nutzer { flex: none; white-space: nowrap; padding-left: 8px; }
.nutzer { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .9rem; color: var(--grau); }
.nutzer form, #kopf form { margin: 0; }
.nutzer.hell, .nutzer.hell a { color: var(--auf-farbe); }
.nutzer.hell a, .nutzer.hell button.link {
  padding: 6px 13px; border-radius: 999px; font-weight: 600; text-decoration: none;
  background: rgb(255 255 255 / .16);
  background: color-mix(in srgb, var(--auf-farbe) 16%, transparent);
  transition: background var(--uebergang);
}
.nutzer.hell a:hover, .nutzer.hell button.link:hover { background: color-mix(in srgb, var(--auf-farbe) 28%, transparent); }
.chip {
  display: inline-flex; align-items: center; gap: .35em; padding: 2px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 650; white-space: nowrap; vertical-align: middle;
  color: var(--farbe); background: var(--hell); background: color-mix(in srgb, var(--farbe) 13%, var(--karte));
}
#kopf .chip { color: var(--auf-farbe); background: color-mix(in srgb, var(--auf-farbe) 20%, transparent); }

/* ---------------------------------------------------------------- Seitenaufbau, Karten */
main { max-width: var(--breite); margin: 0 auto; padding: 18px 16px 72px; }
h2 { color: var(--farbe); margin: 32px 0 10px; font-size: 1.25rem; font-weight: 720; letter-spacing: -.005em; }
.karte {
  background: var(--karte); border: 1px solid var(--rand); border-color: color-mix(in srgb, var(--rand) 75%, transparent);
  border-radius: var(--radius); padding: 16px 18px; margin: 12px 0; box-shadow: var(--schatten);
}
.karte h3 { margin: 0 0 8px; font-size: 1.06rem; color: var(--farbe); }
.karte ul { margin: 6px 0 6px 1.15em; padding: 0; }
.karte li { margin: 4px 0; }
.bonus, .zusatz { border-style: dashed; border-color: var(--rand); box-shadow: none; }
.kopfzeile { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.punkte { font-size: .84rem; color: var(--grau); white-space: nowrap; font-variant-numeric: tabular-nums; }
.grau { color: var(--grau); font-size: .9rem; text-align: center; }
.grau-links { color: var(--grau); font-size: .9rem; margin: 4px 0; }
details > summary { cursor: pointer; color: var(--farbe); font-weight: 650; border-radius: 6px; }
details.erklaerung { margin-top: 12px; border-top: 1px solid var(--rand); padding-top: 10px; overflow-wrap: anywhere; }
details.erklaerung p { margin: 8px 0; }
details.tutor { margin-top: 12px; border-top: 1px dashed var(--rand); padding-top: 10px; }

/* Hinweis-, Warn-, Quellen- und Lösungskästen */
.quelle, .hinweis, .warn, .loesung, .speicher { border-radius: var(--radius-klein); }
.quelle { background: var(--hell); border-left: 4px solid var(--farbe); padding: 10px 14px; margin: 10px 0; font-size: .95rem; }
.quelle > div { white-space: pre-line; }
.quelle small { color: var(--grau); display: block; margin-top: 6px; }
.hinweis { background: var(--hinweis-bg); border-left: 4px solid var(--hinweis-rand); padding: 8px 12px; margin: 8px 0; font-size: .95rem; }
.warn { background: var(--falsch-bg); border-left: 4px solid var(--schlecht); padding: 8px 12px; margin: 8px 0; font-size: .92rem; }
.loesung { background: var(--loesung-bg); border-left: 4px solid var(--gut); padding: 10px 14px; margin: 10px 0; font-size: .95rem; }
.loesung ul { margin: 4px 0 4px 1.1em; padding: 0; }
.speicher { margin: 10px 0; padding: 8px 10px; border: 1px dashed var(--farbe); font-size: .92rem; }
.speicher span { display: inline-block; margin: 2px 6px 2px 0; padding: 1px 10px; background: var(--hell); border-radius: 999px; }

/* ---------------------------------------------------------------- Formulare und Knöpfe */
.frage { margin: 6px 0 12px; }
.zeile { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 6px 8px; border-radius: var(--radius-klein); }
.zeile:nth-child(even) { background: color-mix(in srgb, var(--hell) 55%, transparent); }
.zeile.falsch { background: var(--falsch-bg); outline: 1px solid var(--schlecht); }
.zeile label.t { flex: 1 1 220px; }
select, input[type=text], input[type=password], textarea {
  font: inherit; color: var(--text); padding: 8px 11px; max-width: 100%;
  border: 1px solid var(--feldrand); border-radius: var(--radius-klein); background: var(--feld);
  transition: border-color var(--uebergang), box-shadow var(--uebergang);
}
select:focus-visible, input[type=text]:focus-visible, input[type=password]:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--farbe); box-shadow: 0 0 0 3px color-mix(in srgb, var(--farbe) 30%, transparent);
}
textarea { width: 100%; min-height: 7.5em; resize: vertical; field-sizing: content; max-height: 70vh; }
input.luecke { width: 11ch; margin: 2px; padding: 3px 8px; }
input.luecke.falsch { border-color: var(--schlecht); background: var(--falsch-bg); }
.rf label { margin-right: 14px; white-space: nowrap; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
button, a.knopf {
  font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--farbe); border-color: color-mix(in srgb, var(--farbe) 55%, transparent);
  background: var(--karte); color: var(--farbe);
  transition: background var(--uebergang), transform var(--uebergang), box-shadow var(--uebergang);
}
button:hover:not(:disabled), a.knopf:hover { background: var(--hell); background: color-mix(in srgb, var(--farbe) 10%, var(--karte)); }
button:active:not(:disabled) { transform: translateY(1px) scale(.99); }
button.primaer, a.knopf.primaer {
  background: var(--farbe); color: var(--auf-farbe); border-color: transparent;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--farbe) 35%, transparent);
}
button.primaer:hover:not(:disabled), a.knopf.primaer:hover { background: color-mix(in oklab, var(--farbe) 86%, var(--tiefe)); }
a.knopf { display: block; text-align: center; text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.link, button.link:hover { border: 0; background: none; padding: 0; color: var(--farbe); text-decoration: underline; box-shadow: none; font-weight: inherit; }
button.link.hell { color: var(--auf-farbe); }
.rueck { margin-top: 10px; min-height: 1.2em; }
.rueck.gut { color: var(--gut); font-weight: 650; }
.rueck.mittel { color: var(--text); font-weight: 650; }
.gespeichert { margin-top: 6px; font-size: .85rem; color: var(--grau); min-height: 1.1em; }
.absaetze { white-space: pre-line; }

/* Fortschrittsbalken einheitlich: abgerundet, in der Themenfarbe */
progress {
  -webkit-appearance: none; appearance: none; height: 10px; border: 0; border-radius: 999px; overflow: hidden;
  vertical-align: middle; background: var(--hell); color: var(--farbe);
}
progress::-webkit-progress-bar { background: var(--hell); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--farbe); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--farbe); border-radius: 999px; }

/* ---------------------------------------------------------------- Formeln */
.formel-inline { display: inline-block; max-width: 100%; vertical-align: middle; overflow-x: auto; }
.formel-block { display: block; max-width: 100%; overflow-x: auto; margin: 8px 0; }
.formel math { color: inherit; }
.formel-hilfe math, .formel-vorschau math { font-size: 1.1em; math-style: normal; }
.formel-fehler { display: block; color: var(--schlecht); font-size: .9rem; white-space: normal; overflow-wrap: anywhere; }
.formel-hilfe { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--rand); border-radius: var(--radius-klein); background: var(--hell); }
.formel-hilfe table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.formel-hilfe th, .formel-hilfe td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--rand); }
.formel-hilfe code { overflow-wrap: anywhere; background: var(--karte); }
.formel-vorschau { padding: 10px 12px; border: 1px dashed var(--rand); border-radius: var(--radius-klein); margin-top: 6px; }
.formel-vorschau > div { white-space: pre-wrap; }
.formel-optionen { list-style: none; }

/* ---------------------------------------------------------------- Tutor-Chat */
.chatliste { max-height: 340px; overflow: auto; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.blase { padding: 8px 12px; border-radius: 16px; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; }
.blase.ich { align-self: flex-end; background: var(--hell); border-bottom-right-radius: 4px; }
.blase.tutor { align-self: flex-start; background: var(--tutor-bg); border-bottom-left-radius: 4px; }
.chatzeile { display: flex; gap: 8px; }
.chatzeile input { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- Merkblatt: Zeittafel, Abbildungen, Hörtexte */
table.zeit { border-collapse: collapse; width: 100%; font-size: .93rem; }
table.zeit td { padding: 5px 8px; border-bottom: 1px solid var(--rand); vertical-align: top; }
table.zeit tr:last-child td { border-bottom: 0; }
table.zeit td:first-child { font-weight: 650; white-space: nowrap; color: var(--farbe); }
figure.abbildung { margin: 12px 0 4px; text-align: center; }
figure.abbildung img { max-width: 100%; height: auto; border-radius: var(--radius-klein); border: 1px solid var(--rand); background: #fff; }
figure.abbildung figcaption { font-size: .85rem; color: var(--grau); margin-top: 6px; }
.hoertext .steuerung { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.hoertext .saetze { margin: 8px 0; line-height: 1.7; }
.hoertext .saetze[hidden] { display: none; }
button.satz { display: block; width: 100%; text-align: left; border: 0; border-radius: 8px; background: none; color: inherit; padding: 4px 10px; font-weight: inherit; }
button.satz:hover:not(:disabled), button.satz.aktiv { background: var(--hinweis-bg); }
button.satz.aktiv { box-shadow: inset 4px 0 0 var(--hinweis-rand); }
.hoertext .modus button.gewaehlt { background: var(--hinweis-bg); border-width: 2px; font-weight: 750; }
/* Hörtext samt seinen Aufgaben: ein Block, damit man sieht, was zusammengehört */
.gruppe { border-left: 4px solid var(--farbe); border-left-color: color-mix(in srgb, var(--farbe) 45%, transparent); padding-left: 12px; margin: 18px 0; }
.gruppe > .karte:first-child { margin-top: 0; }
.zusatz textarea.lang { min-height: 16em; }
.zusatz .zaehler { font-size: .85rem; color: var(--grau); text-align: right; }
.zusatz .teile { margin: 4px 0 4px 1.4em; padding: 0; }
.zusatz details.anregung { margin: 8px 0; }
#fuss { max-width: var(--breite); margin: 0 auto; padding: 0 16px 32px; color: var(--grau); font-size: .8rem; }

/* ---------------------------------------------------------------- Startseite und Anmeldung */
body.seite main { max-width: var(--breite); }
.anmeldung { max-width: 440px; margin: 24px auto; padding: 24px; }
.anmeldung h2 { margin-top: 0; }
.anmeldung input[type=text], .anmeldung input[type=password] { width: 100%; margin-top: 4px; }
.klasse h2 { margin: 30px 0 12px; font-size: 1.3rem; }
.set-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.set-raster > .karte { margin: 0; }
a.thema {
  --akzent: var(--farbe);
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px;
  padding-top: 20px; text-decoration: none; color: inherit;
  transition: transform var(--uebergang), box-shadow var(--uebergang), border-color var(--uebergang);
}
a.thema::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--akzent); }
a.thema:hover { transform: translateY(-3px); box-shadow: var(--schatten-hoch); border-color: color-mix(in srgb, var(--akzent) 45%, var(--rand)); }
a.thema strong { display: block; font-size: 1.08rem; line-height: 1.3; color: var(--farbe); }
a.thema .fach { align-self: flex-start; font-size: .72rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--grau); }
a.thema .fach::before { content: ""; display: inline-block; width: .6em; height: .6em; margin-right: .45em; border-radius: 50%; background: var(--akzent); }
a.thema progress { width: 100%; height: 8px; margin-top: auto; }
a.thema .punkte { white-space: normal; }
a.thema .grau { text-align: left; }
.leer { text-align: center; padding: 32px 18px; color: var(--grau); }
.leer strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 4px; }
.verwaltung { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.verwaltung a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rand); text-decoration: none; font-size: .9rem; font-weight: 600; }
.verwaltung a:hover { background: var(--hell); }

/* ---------------------------------------------------------------- Auswertung für die Eltern */
body.eltern main { max-width: 1040px; }
body.eltern #kopf { padding-inline: max(16px, calc((100% - 1040px) / 2 + 16px)); }
.filter {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 12px 0 4px; padding: 14px 16px;
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten);
}
.filter label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--grau); }
.inhaltsstand { text-align: left; }
section.kind { margin-top: 30px; }
.kind-kopf { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rand); padding-bottom: 8px; }
.kind-kopf h2 { margin: 0; }
.klassenwahl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; font-size: .9rem; color: var(--grau); }
.klassenwahl select { padding: 5px 9px; }
.klassenwahl button { padding: 5px 14px; }
.stand { white-space: nowrap; font-size: .85rem; }
.stand::before { content: ""; display: inline-block; width: .6em; height: .6em; margin-right: .4em; border-radius: 50%; background: var(--grau); }
.stand-arbeit::before { background: var(--hinweis-rand); }
.stand-fertig::before { background: var(--gut); }
.klassentitel { margin: 18px 0 0; font-size: 1.02rem; color: var(--text); }
table.auswertung {
  border-collapse: separate; border-spacing: 0; width: 100%; margin: 8px 0 16px; font-size: .92rem;
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius-klein); overflow: hidden; box-shadow: var(--schatten);
}
table.auswertung caption { text-align: left; font-weight: 650; color: var(--grau); padding: 6px 2px 4px; }
table.auswertung th, table.auswertung td { padding: 8px 10px; border-bottom: 1px solid var(--rand); text-align: left; vertical-align: top; }
table.auswertung tr:last-child td { border-bottom: 0; }
table.auswertung th { background: var(--hell); font-size: .8rem; font-weight: 700; color: var(--grau); }
table.auswertung tbody tr:hover td { background: color-mix(in srgb, var(--hell) 45%, transparent); }
table.auswertung progress { width: 90px; height: 8px; }
table.auswertung td:has(> progress) { white-space: nowrap; }
/* Elternübersicht: gleiche Spalten in allen Tabellen, damit sie untereinander fluchten */
section.kind table.auswertung { table-layout: fixed; }
section.kind table.auswertung th:nth-child(1) { width: 30%; } section.kind table.auswertung th:nth-child(2) { width: 15%; }
section.kind table.auswertung th:nth-child(3) { width: 18%; } section.kind table.auswertung th:nth-child(4) { width: 6%; }
section.kind table.auswertung th:nth-child(5) { width: 11%; } section.kind table.auswertung th:nth-child(6) { width: 8%; }
section.kind table.auswertung th:nth-child(7) { width: 6%; } section.kind table.auswertung th:nth-child(8) { width: 11%; }
table.auswertung details { margin-top: 4px; }
tr.status-geloest td:nth-child(2) { color: var(--gut); font-weight: 650; }
tr.status-aufgedeckt td:nth-child(2) { color: var(--schlecht); font-weight: 650; }
.zusammen progress { width: 160px; height: 12px; }
button.thema-knopf .grau, table.auswertung .grau, .zusammen .grau { text-align: left; }
.pdfs { margin: 12px 0 0; }
@media (max-width: 700px) { table.auswertung { display: block; overflow-x: auto; } }

/* ---------------------------------------------------------------- Farbenseite */
.themenwahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; margin-top: 12px; }
button.thema-knopf { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; text-align: left; border-radius: var(--radius); border-color: var(--rand); }
button.thema-knopf.gewaehlt { outline: 3px solid var(--farbe); outline-offset: 2px; }
.vorschau { display: block; width: 100%; height: 68px; border-radius: var(--radius-klein); border: 1px solid var(--rand); background: var(--seite); position: relative; overflow: hidden; }
.vorschau i { position: absolute; display: block; }
.vorschau .v-kopf { left: 0; right: 0; top: 0; height: 17px; background: var(--farbe); }
.vorschau .v-karte { left: 8px; right: 8px; top: 25px; height: 18px; border-radius: 5px; background: var(--karte); border: 1px solid var(--rand); }
.vorschau .v-knopf { left: 8px; top: 49px; width: 38px; height: 11px; border-radius: 999px; background: var(--farbe); }
/* "Automatisch": links hell, rechts dunkel */
.vorschau[data-thema="system"] { background: linear-gradient(90deg, #fbf9f4 50%, #16171a 50%); }
.vorschau[data-thema="system"] .v-kopf { background: linear-gradient(90deg, #7b4b00 50%, #e0a24a 50%); }
.vorschau[data-thema="system"] .v-karte { background: linear-gradient(90deg, #fff 50%, #212329 50%); }
.vorschau[data-thema="system"] .v-knopf { background: linear-gradient(90deg, #7b4b00 50%, #e0a24a 50%); }

/* ---------------------------------------------------------------- Gamification */
body.spiel main { max-width: var(--breite); }
a.spielstand { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; transition: box-shadow var(--uebergang), transform var(--uebergang);
  background: var(--karte); background: linear-gradient(135deg, color-mix(in srgb, var(--farbe) 11%, var(--karte)), var(--karte) 70%); }
a.spielstand:hover { transform: translateY(-2px); box-shadow: var(--schatten-hoch); }
a.spielstand strong { color: var(--farbe); font-size: 1.1rem; }
a.spielstand progress, .level progress { width: 100%; height: 12px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.kachel { display: flex; flex-direction: column; padding: 12px 14px; background: var(--hell); border-radius: var(--radius-klein); text-decoration: none; color: inherit; transition: transform var(--uebergang); }
a.kachel:hover { transform: translateY(-2px); }
.kachel strong { font-size: 1.6rem; color: var(--farbe); font-variant-numeric: tabular-nums; }
.kachel span { font-size: .85rem; color: var(--grau); }
.abzeichen { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.abzeichen-karte { display: flex; flex-direction: column; gap: 3px; padding: 12px; background: var(--karte); border: 1px dashed var(--rand); border-radius: var(--radius); opacity: .65; }
.abzeichen-karte.erreicht { opacity: 1; border: 2px solid var(--farbe); background: var(--hell); box-shadow: var(--schatten); }
.abzeichen-karte .symbol { font-size: 1.9rem; filter: grayscale(1); }
.abzeichen-karte.erreicht .symbol { filter: none; }
.abzeichen-karte progress { width: 100%; height: 8px; }
.xp-liste { list-style: none; padding: 0; }
.xp-liste li { padding: 6px 0; border-bottom: 1px solid var(--rand); }
.xp-plus { display: inline-block; min-width: 3.2em; font-weight: 750; color: var(--gut); }
table.rangliste tr.ich td { background: var(--hinweis-bg); font-weight: 650; }
.xp-meldung { position: fixed; right: 16px; bottom: 16px; z-index: 5; padding: 10px 18px; border-radius: 999px; background: var(--farbe); color: var(--auf-farbe);
  font-weight: 750; box-shadow: var(--schatten-hoch); animation: xp-ein .3s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes xp-ein { from { transform: translateY(20px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- Vokabeln und Buchseitenscan */
.vokabelblock h2, .vokabelkarte h2 { margin: 8px 0; }
.vokabelblock form { margin-top: 10px; }
.vokabelkarte label, #scan-form label, .vokabel-eintrag label { display: block; margin: 8px 0 4px; font-weight: 600; }
.vokabelkarte input[type=text], #scan-form input[type=text], #scan-form select { width: 100%; margin-bottom: 8px; }
.scan-ansicht { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
#bildvorschau { display: grid; gap: 10px; }
.scan-bild { display: block; max-width: 100%; height: auto; border: 1px solid var(--rand); border-radius: var(--radius-klein); }
.vokabel-eintrag { margin: 10px 0; }
.vokabel-eintrag input[type=text] { width: 100%; }
.vokabel-eintrag.scan-unsicher { background: var(--hinweis-bg); border-color: var(--hinweis-rand); }
#speichern-form { margin-top: 14px; }
@media (max-width: 700px) { .scan-ansicht { grid-template-columns: 1fr; } }

@media (max-width: 520px) {
  body { font-size: 15px; }
  #stand { text-align: left; }
  .karte { padding: 14px; border-radius: 14px; }
  main { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- Eigene Lernsets: Unterlagen, Erstellen, Verwaltung */
.formular label, .formular .feldtitel { display: block; margin: 10px 0 4px; font-weight: 600; }
.formular input[type=text], .formular select, .formular input[type=file] { width: 100%; }
.formular .rf label, .formular label.auswahl { font-weight: inherit; }
.formular .rf { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.formular fieldset { margin: 14px 0; }
.formular legend { font-weight: 700; color: var(--farbe); padding: 0 4px; }
label.auswahl { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: var(--radius-klein); margin: 4px 0; cursor: pointer; }
label.auswahl:hover { background: var(--hell); }
label.auswahl input { margin-top: .3em; }
label.auswahl .grau { display: block; text-align: left; }
.ki-band { max-width: var(--breite); margin: 10px auto 0; padding: 8px 14px; border-left: 4px solid var(--hinweis-rand); background: var(--hinweis-bg);
  border-radius: var(--radius-klein); font-size: .92rem; }
td.aktionen { white-space: nowrap; }
td.aktionen form { display: inline; margin-left: 8px; }
.eigenes details { margin: 6px 0; }
.eigenes .knoepfe a.knopf { display: inline-block; }
form.loeschen { display: flex; gap: 6px; align-items: center; margin: 0; font-size: .9rem; }
.formular > h2:first-of-type { margin-top: 0; }
