/* ==========================================================================
   MoLern – Designsystem
   Mobil zuerst, große Tippflächen, heller und dunkler Modus.
   Farben pro Fach über .fach-<name> auf <body> (siehe unten).
   ========================================================================== */

:root {
  --bg: #f3f5fa;
  --card: #ffffff;
  --ink: #12162a;
  --muted: #5d6480;
  --line: #e2e6f0;

  --brand: #2b5bd7;
  --brand-dark: #1e44a8;
  --brand-tint: #e7edff;

  --gut: #12855a;
  --gut-tint: #e2f6ed;
  --schlecht: #c02b3f;
  --schlecht-tint: #fdeaed;
  --gold: #ff8a1a;
  --gold-2: #ffb020;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 22px;
  --sp-6: 30px;

  --schatten: 0 2px 10px rgba(20, 30, 60, .07);
  --schatten-lg: 0 10px 30px rgba(20, 30, 60, .14);
  --ring: 0 0 0 3px rgba(43, 91, 215, .35);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101322;
    --card: #191d31;
    --ink: #eef1f8;
    --muted: #a0a7c0;
    --line: #2a3049;

    --brand: #7c9cff;
    --brand-dark: #5f83f5;
    --brand-tint: #20294a;

    --gut: #4ad295;
    --gut-tint: #12301f;
    --schlecht: #ff7b8e;
    --schlecht-tint: #331520;

    --schatten: 0 2px 10px rgba(0, 0, 0, .3);
    --schatten-lg: 0 10px 30px rgba(0, 0, 0, .45);
  }
}

/* Fach-Akzente – setzen die Markenfarbe für die ganze Seite um */
body.fach-mathe    { --brand: #d9534f; --brand-dark: #b23c38; --brand-tint: #fdecec; }
body.fach-englisch { --brand: #2b5bd7; --brand-dark: #1e44a8; --brand-tint: #e7edff; }
body.fach-deutsch  { --brand: #7a4ddb; --brand-dark: #5f37b0; --brand-tint: #f0e9fd; }
body.fach-biologie { --brand: #12855a; --brand-dark: #0c6644; --brand-tint: #e2f6ed; }
body.fach-sonstige { --brand: #0f7b8a; --brand-dark: #0a5b66; --brand-tint: #e2f4f6; }

@media (prefers-color-scheme: dark) {
  body.fach-mathe    { --brand: #ff8b87; --brand-tint: #3a1f1f; }
  body.fach-englisch { --brand: #7c9cff; --brand-tint: #20294a; }
  body.fach-deutsch  { --brand: #b596ff; --brand-tint: #2a2140; }
  body.fach-biologie { --brand: #4ad295; --brand-tint: #12301f; }
  body.fach-sonstige { --brand: #4fc3d1; --brand-tint: #10333a; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  /* Unten KEIN safe-area-Polster: Das übernimmt die Navileiste selbst.
     Zwei Elemente, die sich dieselbe Zone teilen, verschieben sich auf
     iOS gegeneinander, sobald gescrollt wird. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  min-height: 100%;
}

/* --------------------------------------------------------------- Layout */
/* Unten so viel Platz, dass die feste Leiste nichts verdeckt:
   Leistenhöhe (~72px) + Rand + sichere Zone des Geräts. */
.wrap {
  max-width: 680px; margin: 0 auto;
  padding: 14px 14px calc(96px + env(safe-area-inset-bottom));
}
/* Seiten ohne Leiste brauchen den Platz nicht. */
body.ohne-leiste .wrap { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

.kopf { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.kopf h1 { font-size: 19px; margin: 0; flex: 1; font-weight: 700; letter-spacing: -.2px; }
.kopf .zurueck {
  flex: none; width: 38px; height: 38px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  text-decoration: none; font-size: 18px;
}

.stack > * + * { margin-top: var(--sp-3); }
.grid { display: grid; gap: var(--sp-3); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.reihe { display: flex; gap: var(--sp-2); }
.reihe > * { flex: 1; }

/* ---------------------------------------------------------------- Karten */
.karte {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--schatten);
}
a.karte { display: block; text-decoration: none; color: inherit; }
a.karte:active { transform: scale(.99); }
.karte h2 { font-size: 16px; margin: 0 0 10px; }
.karte + .karte { margin-top: var(--sp-3); }
.hinweis { color: var(--muted); font-size: 14px; margin: 6px 0; }

/* --------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 16px; font-weight: 600;
  border: none; border-radius: var(--r); padding: 13px 18px;
  background: var(--brand); color: #fff; cursor: pointer;
  text-decoration: none; min-height: 46px;
}
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-voll { width: 100%; }
.btn-hell { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #fff; }
.btn-klein { padding: 9px 13px; font-size: 14.5px; min-height: 44px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* --------------------------------------------------------------- Formular */
.feld { display: block; margin-bottom: var(--sp-3); }
.feld > label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 17px; padding: 12px 13px;
  border: 1.5px solid var(--line); border-radius: var(--r);
  background: var(--bg); color: var(--ink); -webkit-appearance: none;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.textarea { min-height: 90px; resize: vertical; }
.hilfe { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- Badges */
.pille {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--brand-tint); color: var(--brand);
  border-radius: var(--r-full); padding: 4px 11px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pille-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #fff; }
.pille-gut { background: var(--gut-tint); color: var(--gut); }
.pille-warn { background: var(--schlecht-tint); color: var(--schlecht); }
.pille-grau { background: var(--line); color: var(--muted); }

/* ------------------------------------------------------------ Fortschritt */
.balken { height: 9px; background: var(--line); border-radius: var(--r-full); overflow: hidden; }
.balken > i { display: block; height: 100%; background: var(--brand); border-radius: var(--r-full); transition: width .4s; }
.balken.gold > i { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }

.werte { display: flex; gap: var(--sp-2); text-align: center; }
.werte > div { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 4px; }
.werte b { display: block; font-size: 21px; }
.werte span { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------- Levelkarte */
.levelkarte {
  background: linear-gradient(135deg, var(--brand), #8b4ddb);
  color: #fff; border: none; border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--schatten);
}
.levelkarte .hinweis { color: rgba(255, 255, 255, .85); }
.levelkopf { display: flex; align-items: center; gap: 12px; }
.levelkopf .ring {
  width: 60px; height: 60px; border-radius: 50%; background: rgba(255, 255, 255, .2);
  display: flex; align-items: center; justify-content: center; font-size: 28px; flex: none;
}
.levelkopf .name { font-size: 19px; font-weight: 800; line-height: 1.2; }
.levelkopf .unter { font-size: 13.5px; opacity: .9; }
.levelkopf .punkte { text-align: end; line-height: 1.1; }
.levelkopf .punkte b { font-size: 26px; font-weight: 800; display: block; }
.levelkopf .punkte span { font-size: 12px; font-weight: 600; opacity: .85; }
.xp { height: 10px; background: rgba(255, 255, 255, .25); border-radius: var(--r-full); overflow: hidden; margin: 12px 0 5px; }
.xp > i { display: block; height: 100%; background: #ffd44d; border-radius: var(--r-full); transition: width .5s; }

/* ------------------------------------------------------------------ Listen */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.liste li:last-child { border-bottom: none; }
.liste .titel { flex: 1; font-weight: 600; }
.liste .neben { color: var(--muted); font-size: 14px; text-align: end; }
a.zeile { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 10px; width: 100%; }

/* ----------------------------------------------------------------- Bericht */
.zeitwahl { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.zeitwahl .pille { text-decoration: none; }

.kacheln {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0;
}
.kacheln > div {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 8px; text-align: center;
}
.kacheln b { display: block; font-size: 19px; }
.kacheln span { color: var(--muted); font-size: 11.5px; }

.diagramm { width: 100%; height: 130px; display: block; margin-top: 6px; }
.diagramm .balken { fill: var(--brand); }
.diagramm .balken.leer { fill: var(--line); }
.diagramm .achse { stroke: var(--line); stroke-width: 1; }
.achsentext {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 10.5px; margin-top: 2px;
}

.fachzeile { padding: 12px 0; border-bottom: 1px solid var(--line); }
.fachzeile:last-child { border-bottom: none; }
.fachzeile .kopf { display: flex; align-items: center; gap: 8px; }
.fachzeile .leiste {
  height: 7px; background: var(--bg); border-radius: 999px; margin: 7px 0; overflow: hidden;
}
.fachzeile .leiste i { display: block; height: 100%; background: var(--brand); }
.fachzeile .zahlen { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.pille-gut { background: var(--gut-tint); color: var(--gut); }

.kasten { display: flex; align-items: flex-end; gap: 6px; height: 130px; margin-top: 10px; }
.kasten .saeule { flex: 1; display: flex; flex-direction: column;
                  align-items: center; justify-content: flex-end; height: 100%; }
.kasten .wert { font-size: 12px; font-weight: 700; }
.kasten .stab { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 3px; }
.kasten .saeule:first-child .stab { background: var(--schlecht); }
.kasten .saeule:last-child .stab { background: var(--gut); }
.kasten .name { color: var(--muted); font-size: 10px; margin-top: 4px; text-align: center; }

/* ------------------------------------------------------------------- Chat */
.chat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.blase {
  max-width: 82%; padding: 10px 13px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--schatten); word-wrap: break-word; overflow-wrap: anywhere;
}
.blase.meine {
  align-self: flex-end; background: var(--brand); color: #fff; border-color: transparent;
  border-bottom-right-radius: 5px;
}
.blase.andere { align-self: flex-start; border-bottom-left-radius: 5px; }
/* Erinnerung der App – klar als solche erkennbar, nie wie eine Person */
.blase.app {
  align-self: center; max-width: 92%; text-align: center;
  background: var(--gold-tint, var(--brand-tint)); border-style: dashed;
}
.blase .text { font-size: 15.5px; line-height: 1.45; }
.blase .zeit { font-size: 11.5px; opacity: .7; margin-top: 4px; }
.chat-form { position: sticky; bottom: 84px; z-index: 20; }

/* Roter Zähler an der Navileiste */
.navleiste a { position: relative; }
.zaehler {
  position: absolute; top: 2px; left: 50%; margin-left: 4px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--schlecht); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
}

/* ------------------------------------------------------- Lernkarte (Lernmodus) */
.lernkarte { text-align: start; }
.lern-bild { font-size: 46px; text-align: center; margin-bottom: 6px; line-height: 1.1; }
.lern-kopf { display: flex; align-items: center; gap: 12px; }
.lern-wort { font-size: 28px; font-weight: 800; letter-spacing: -.4px; }
.lern-ipa { color: var(--muted); font-size: 13px; font-family: ui-monospace, monospace; }
.lern-de { color: var(--ink); font-size: 16px; margin-top: 2px; }

.sprechen {
  flex: none; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  background: var(--brand-tint); color: var(--brand);
  border: 1px solid var(--line); font-size: 20px; line-height: 1;
}
.sprechen:active { transform: scale(.92); }
.sprechen.klein { width: 34px; height: 34px; font-size: 15px; }
.sprechen.winzig {
  width: 26px; height: 26px; font-size: 12px; background: transparent; border: none;
}

.formen { width: 100%; border-collapse: collapse; margin-top: 14px; }
.formen td { padding: 9px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
.formen .lab { color: var(--muted); font-size: 12.5px; width: 40%; }
.formen .lab .lern-ipa { display: block; }
.formen .val { font-weight: 700; font-size: 16.5px; }

.beispiel { display: flex; gap: 10px; margin-top: 14px; }
.beispiel .pic { font-size: 22px; flex: none; }
.beispiel .tag { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.beispiel .en { font-size: 15.5px; margin: 2px 0; }
.beispiel .det { color: var(--muted); font-size: 14px; }

.sitzt { color: var(--gut); font-size: 13px; margin-top: 12px; }

/* Alpine: verstecken, bis das Skript da ist – sonst blitzen beide
   Zustände eines x-show-Paares beim Laden kurz auf. */
[x-cloak] { display: none !important; }

/* Kleine Wertetabelle (Punkteübersicht in der Hilfe) */
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle td { padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.tabelle tr:last-child td { border-bottom: none; }
.tabelle td:last-child { text-align: end; white-space: nowrap; color: var(--brand); }

/* ------------------------------------------------------------- Fach-Kacheln */
.fachgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.fachkachel {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 14px; box-shadow: var(--schatten); position: relative; overflow: hidden;
}
.fachkachel .sym { font-size: 34px; line-height: 1; }
.fachkachel .nm { font-weight: 800; font-size: 17px; margin-top: 8px; }
.fachkachel .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.fachkachel .streifen { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 5px; }

/* ------------------------------------------------------------------ Übung */
.frage { font-size: 21px; line-height: 1.6; margin: 4px 0 16px; }
.luecke {
  display: inline-block; min-width: 74px; border-bottom: 2.5px dashed var(--brand);
  text-align: center; font-weight: 700; color: var(--brand);
}
.optionen .btn {
  width: 100%; margin-bottom: 9px; background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line); font-size: 18px; justify-content: flex-start;
}
.optionen .btn.gut { border-color: var(--gut); background: var(--gut-tint); color: var(--gut); }
.optionen .btn.schlecht { border-color: var(--schlecht); background: var(--schlecht-tint); color: var(--schlecht); }
.rueck { border-radius: var(--r); padding: 13px; margin-top: 13px; font-size: 16px; }
/* Fast richtig: eigene Farbe – weder Grün noch Rot, denn es war beides
   nicht. Gold passt: Es war nah dran. */
.rueck.fast { background: #fff4e0; color: #92610b; border-color: var(--gold); }
.rueck.fast s { opacity: .7; }

.rueck.gut { background: var(--gut-tint); color: var(--gut); }
.rueck.schlecht { background: var(--schlecht-tint); color: var(--schlecht); }
.rueck .loesung { font-weight: 800; font-size: 19px; }

/* ------------------------------------------------------------- Untermenü */
.navleiste {
  /* left/right statt inset-inline: ältere iOS-Versionen kennen die logische
     Kurzform nicht und lassen die Leiste dann horizontal frei stehen. */
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--card); border-top: 1px solid var(--line); display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30;

  /* Eigene Ebene erzwingen. Ohne das zeichnet iOS feste Elemente beim
     Schwung-Scrollen erst am Ende neu – die Leiste „wandert" sichtbar mit
     und rutscht dann zurück. */
  transform: translateZ(0);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.navleiste a {
  flex: 1 1 0; min-width: 0;          /* 7 Einträge müssen auf 320px passen */
  text-align: center; text-decoration: none; color: var(--muted);
  font-size: 10px; font-weight: 600; padding: 7px 0; border-radius: var(--r-sm);
  min-height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Eltern haben nur fünf Einträge – da ist Platz für normale Schrift. */
.navleiste[aria-label="Parent navigation"] a { font-size: 11.5px; }
.navleiste a .ic { display: block; font-size: 19px; margin-bottom: 1px; }
.navleiste a.aktiv { color: var(--brand); }

/* ---------------------------------------------------------------- Meldung */
.meldungen { position: sticky; top: 8px; z-index: 40; }
.meldung { border-radius: var(--r); padding: 12px 14px; margin-bottom: var(--sp-2); font-weight: 600; }
.meldung.success { background: var(--gut-tint); color: var(--gut); }
.meldung.error { background: var(--schlecht-tint); color: var(--schlecht); }
.meldung.info { background: var(--brand-tint); color: var(--brand); }
.meldung.warning { background: #fff4e0; color: #92610b; }

/* -------------------------------------------------------------- Geschenk */
.geschenk {
  position: fixed; inset: 0; z-index: 80; background: rgba(10, 14, 30, .72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.geschenk .box {
  background: var(--card); border-radius: 22px; padding: 26px 20px 20px;
  max-width: 340px; width: 100%; text-align: center; box-shadow: var(--schatten-lg);
  animation: aufpoppen .45s cubic-bezier(.2, 1.5, .4, 1);
}
@keyframes aufpoppen { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.geschenk .sym { font-size: 82px; line-height: 1; animation: wackeln 1.4s ease-in-out infinite; }
@keyframes wackeln { 0%, 100% { transform: rotate(-7deg) scale(1); } 50% { transform: rotate(7deg) scale(1.08); } }
.geschenk .art { font-size: 13px; font-weight: 800; letter-spacing: 1.5px; color: var(--gold); text-transform: uppercase; margin-top: 10px; }
.geschenk .nm { font-size: 24px; font-weight: 900; margin: 4px 0; }
.geschenk .txt { color: var(--muted); font-size: 15px; margin-bottom: 16px; }

.konfetti { position: fixed; inset: 0; z-index: 79; pointer-events: none; overflow: hidden; }
.konfetti i { position: absolute; top: -8%; font-size: 24px; animation: fallen linear forwards; }
@keyframes fallen { to { transform: translateY(115vh) rotate(720deg); opacity: .2; } }

.punkteflug {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, 0); z-index: 60;
  pointer-events: none; font-size: 44px; font-weight: 900; opacity: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .25);
}
.punkteflug.los { animation: flug 1.1s ease-out forwards; }
.punkteflug.plus { color: var(--gut); }
.punkteflug.minus { color: var(--schlecht); }
@keyframes flug {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(.6); }
  25% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); }
  60% { opacity: 1; transform: translate(-50%, -18px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(.9); }
}

/* ------------------------------------------------------------- Abzeichen */
.abzeichen { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 9px; }
.abz { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 5px; text-align: center; }
.abz .sym { font-size: 29px; line-height: 1.2; filter: grayscale(1); opacity: .35; }
.abz.hat { background: var(--brand-tint); border-color: var(--brand); }
.abz.hat .sym { filter: none; opacity: 1; }
.abz .nm { font-size: 11.5px; font-weight: 700; margin-top: 3px; line-height: 1.25; }
.abz .txt { font-size: 10.5px; color: var(--muted); line-height: 1.25; margin-top: 1px; }

/* ----------------------------------------------------------------- Sonstiges */
.leer { text-align: center; color: var(--muted); padding: var(--sp-6) var(--sp-4); }
.leer .sym { font-size: 44px; display: block; margin-bottom: var(--sp-2); }
.versteckt { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
a { color: var(--brand); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------- Kalender */
.terminliste { display: flex; flex-direction: column; }
.termin {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
}
.termin-link {
  display: flex; gap: 10px; align-items: flex-start; flex: 1; min-width: 0;
  text-decoration: none; color: inherit;
}
.haken-form { flex: none; margin: 0; }
/* Großes Kästchen: muss sich mit dem Daumen treffen lassen */
.haken {
  width: 30px; height: 30px; margin-top: 1px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--gut);
  font-size: 17px; font-weight: 800; line-height: 1; padding: 0;
}
.haken:active { transform: scale(.92); }
.haken.an { background: var(--gut-tint); border-color: var(--gut); }
.termin:last-child { border-bottom: none; }
.termin .sym { font-size: 21px; flex: none; line-height: 1.2; }
.termin .mitte { flex: 1; min-width: 0; }
.termin .titel { display: block; font-weight: 600; }
.termin .unter { display: block; color: var(--muted); font-size: 13px; }
.termin .mitbringen {
  display: inline-block; margin-top: 4px; font-size: 12.5px;
  background: var(--brand-tint); color: var(--brand);
  border-radius: var(--r-sm); padding: 2px 7px;
}
.termin .wann {
  flex: none; font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-align: end; white-space: nowrap; padding-top: 2px;
}
/* Je näher, desto deutlicher – vorbei wird blass */
.termin.heute  .wann { color: var(--gold); }
.termin.morgen .wann { color: var(--schlecht); }
.termin.vorbei { opacity: .5; }
.termin.erledigt .titel { text-decoration: line-through; opacity: .6; }

/* --------------------------------------------------------- Anmeldung */
.rollenwahl { display: flex; gap: 8px; }
.rollenwahl label { flex: 1; }
.rollenwahl input { position: absolute; opacity: 0; }
.rollenwahl span {
  display: block; text-align: center; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--r);
  padding: 12px 8px; background: var(--card);
}
.rollenwahl b { display: block; font-size: 16px; }
.rollenwahl small { color: var(--muted); font-size: 12px; }
.rollenwahl input:checked + span {
  border-color: var(--brand); background: var(--brand-tint); color: var(--brand);
}

/* Abmelden in der Navileiste: ein Formular (POST), soll aber aussehen und
   sich anfühlen wie die anderen Einträge. Schmaler als die übrigen, damit
   die sieben Einträge des Kindes nicht enger werden. */
.navleiste .nav-abmelden { flex: 0 0 46px; margin: 0; display: flex; }
.navleiste .nav-abmelden button {
  flex: 1; font: inherit; font-size: 10px; font-weight: 600;
  color: var(--muted); background: none; border: none; cursor: pointer;
  padding: 7px 0; border-radius: var(--r-sm); min-height: 44px;
  display: block; text-align: center;
}
.navleiste[aria-label="Parent navigation"] .nav-abmelden button { font-size: 11.5px; }
.navleiste .nav-abmelden button:active { color: var(--schlecht); }

/* Ein Knopf, der wie ein Link aussieht – für „Abmelden" im Fließtext. */
.alslink {
  font: inherit; color: var(--brand); background: none; border: none;
  padding: 0; cursor: pointer; text-decoration: underline;
}

/* ----------------------------------------------------------------- Blitz */
.blitz-kopf { display: flex; gap: 8px; text-align: center; }
.blitz-kopf > div {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 4px;
}
.blitz-kopf b { display: block; font-size: 22px; line-height: 1.1; }
.blitz-kopf span { font-size: 11px; color: var(--muted); }
.blitz-kopf .uhr.knapp b { color: var(--schlecht); }   /* letzte 10 Sekunden */

.zeitbalken { height: 6px; background: var(--line); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.zeitbalken > i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
  transition: width 1s linear;
}

.blitz-optionen { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.blitz-option {
  font: inherit; font-size: 17px; font-weight: 700; cursor: pointer;
  min-height: 64px; padding: 12px 10px;
  border: 2px solid var(--line); border-radius: var(--r);
  background: var(--bg); color: var(--ink);
  word-break: break-word;
}
.blitz-option:active { transform: scale(.97); }
.blitz-option.gut { border-color: var(--gut); background: var(--gut-tint); color: var(--gut); }
.blitz-option.schlecht { border-color: var(--schlecht); background: var(--schlecht-tint); color: var(--schlecht); }
.blitz-option[disabled] { pointer-events: none; }

/* Nur eine Spalte, wenn die Antworten lang sind (Sachfächer) */
@media (max-width: 380px) { .blitz-optionen { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ Aktivitäten */
.punktliste { display: flex; flex-direction: column; }
.punkt {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
}
.punkt:last-child { border-bottom: none; }
.punkt .punkt-sym { font-size: 18px; width: 30px; text-align: center; flex: none; }
.punkt .punkt-text { flex: 1; min-width: 0; }
.punkt .was { display: block; }
.punkt .dazu { display: block; color: var(--muted); font-size: 12.5px; }
.punkt.erledigt .was { text-decoration: line-through; opacity: .55; }

/* Regeln sind keine Aufgaben – sie sehen bewusst anders aus. */
.punkt.regel { background: var(--schlecht-tint); border-radius: var(--r-sm); padding: 10px 8px; }
.punkt.regel .was { color: var(--schlecht); font-weight: 600; }
.punkt.info .was { color: var(--muted); }

/* ------------------------------------------------------------------
   Stundenplan als Wochengitter.

   Fünf Spalten auf einem Handy sind eng, deshalb die Kürzel von der Tafel
   statt ausgeschriebener Fächer – „NW" versteht das Kind ohnehin besser als
   „Naturwissenschaften". Der volle Name steht im title und in der Tagesliste
   darüber. Der heutige Tag ist eingefärbt, damit das Auge sofort landet.
   ------------------------------------------------------------------ */
.stundenplan { border-collapse: collapse; width: 100%; min-width: 300px; }
.stundenplan th,
.stundenplan td {
  border: 1px solid var(--line);
  padding: 6px 2px;
  text-align: center;
  vertical-align: middle;
}
.stundenplan thead th { font-size: 13px; color: var(--muted); font-weight: 700; }
.stundenplan tbody th {
  font-size: 12px; font-weight: 700; color: var(--muted);
  white-space: nowrap; padding: 6px 6px; width: 1%;
}
.stundenplan tbody th .zeit { font-weight: 400; font-size: 10px; }
.stundenplan .kuerzel { font-weight: 700; font-size: 14px; }
.stundenplan td.frei { background: repeating-linear-gradient(
    45deg, transparent, transparent 5px, var(--bg) 5px, var(--bg) 10px); }
.stundenplan .heute { background: var(--brand-tint); }
.stundenplan thead th.heute { color: var(--brand); }
.stundenplan .arbeit { font-size: 10px; display: block; line-height: 1; }

/* ------------------------------------------------------------------
   Kinderwahl der Eltern.

   Eine Zeile Knöpfe unter dem Kopf. Bewusst immer sichtbar und nicht in einem
   Menü versteckt: Wer einen Bericht liest, muss ohne Nachdenken wissen, über
   wen er ihn liest. Bei nur einem Kind wird sie gar nicht erst gezeigt.
   ------------------------------------------------------------------ */
.kinderwahl {
  display: flex; gap: 6px; margin: 0 0 var(--sp-3);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.kinderwahl button {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--card); color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
.kinderwahl button small { font-weight: 400; opacity: .7; }
.kinderwahl button.aktiv {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.kinderwahl button.aktiv small { opacity: .85; }

/* ------------------------------------------------------------------
   Symbolwahl auf der Kinder-Seite.

   Ein Gitter aus Emoji-Knöpfen statt eines <select> mit 92 Einträgen: Auf dem
   Handy ist eine so lange Auswahlliste unbenutzbar, ein Gitter tippt man in
   einer Sekunde. Technisch sind es Radio-Knöpfe – damit funktioniert die Wahl
   auch ohne JavaScript und mit der Tastatur.
   ------------------------------------------------------------------ */
.symbolwahl { display: flex; flex-wrap: wrap; gap: 6px; }
.symbolwahl input { position: absolute; opacity: 0; width: 0; height: 0; }
.symbolwahl label > span[aria-hidden] {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; font-size: 22px; line-height: 1;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--card); cursor: pointer;
}
.symbolwahl input:checked + span {
  border-color: var(--brand); background: var(--brand-tint);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.symbolwahl input:focus-visible + span { box-shadow: var(--ring); }

.symbolgross { font-size: 26px; }
.zweispaltig { display: flex; gap: 10px; margin-top: 14px; }
.zweispaltig .feld { flex: 1; }

/* ------------------------------------------------------------------
   „Foto schicken" – der Hauptweg in die App.

   Sieht bewusst anders aus als die übrigen Karten und liegt auf der
   Startseite ganz oben: Gebraucht wird der Knopf mit dem Blatt in der Hand,
   und dann soll man nicht suchen müssen.
   ------------------------------------------------------------------ */
.fotokarte {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border: none; color: #fff;
}
.fotokarte .sym { font-size: 32px; line-height: 1; }
.fotokarte small { color: rgba(255, 255, 255, .88); }

/* Während das Foto gelesen wird, soll das Formular nicht mehr anfassbar
   aussehen – sonst wird ein zweites Mal getippt und doppelt bezahlt. */
form.laeuft { opacity: .6; pointer-events: none; }

/* ------------------------------------------------------------------
   Hilfeseite: Schnellanleitung oben, alles Weitere zum Aufklappen.

   Vorher standen zwanzig Kästen untereinander. Wer etwas wissen wollte, hat
   gescrollt statt gelesen – und wer nur „wie fange ich an?" wissen wollte,
   fand die Antwort zwischen Joker-Regeln und Bildschirmzeit. Jetzt steht das
   Nötigste in einem Kasten, der Rest ist zugeklappt und trotzdem da.
   ------------------------------------------------------------------ */
.schritte { counter-reset: schritt; list-style: none; margin: 0; padding: 0; }
.schritte li {
  counter-increment: schritt;
  position: relative;
  padding: 0 0 12px 40px;
  line-height: 1.5;
}
.schritte li::before {
  content: counter(schritt);
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; justify-content: center;
  width: 27px; height: 27px;
  border-radius: var(--r-full);
  background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 700;
}
.schritte li:last-child { padding-bottom: 0; }

.hilfe-teil > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.hilfe-teil > summary::-webkit-details-marker { display: none; }
.hilfe-teil > summary h2 { margin: 0; flex: 1; }
.hilfe-teil > summary::after {
  content: "▸"; color: var(--muted); font-size: 18px;
  transition: transform .15s ease;
}
.hilfe-teil[open] > summary::after { transform: rotate(90deg); }
.hilfe-teil > summary:focus-visible { box-shadow: var(--ring); border-radius: var(--r-sm); }

/* ------------------------------------------------------------------
   „Neu"-Zeichen an der Fächerkachel.

   Wenn jemand Stoff hinzufügt – ein ausgelesenes Arbeitsblatt, eine
   fotografierte Vokabelliste –, merkt das Kind es sonst gar nicht: Die Kachel
   sieht aus wie gestern. Grün, weil es eine gute Nachricht ist, und es
   verschwindet, sobald das Fach einmal geöffnet wurde.
   ------------------------------------------------------------------ */
.fachkachel { position: relative; }
.neu-marke {
  position: absolute; top: 6px; right: 6px;
  background: var(--gut); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 4px 7px; border-radius: var(--r-full);
  white-space: nowrap;
}

/* Lösung mit mehreren Antworten als Liste statt als Klumpen. Sechs Wörter
   hintereinander in einer Zeile kann ein Kind nicht auf die Aufgaben
   beziehen. */
.loesungsliste { margin: 0; padding-left: 22px; }
.loesungsliste li { padding: 2px 0; font-weight: 600; }

/* ------------------------------------------------------------------
   Mathe-Olympiade.

   Aufgabentexte sind länger und dichter als Übungsfragen – etwas mehr
   Zeilenabstand und eine ruhige Schrift, damit man sie zweimal lesen mag.
   ------------------------------------------------------------------ */
.formeltext p { margin: 0 0 10px; line-height: 1.6; }
.formeltext p:last-child { margin-bottom: 0; }
.aufgabentext { font-size: 16px; }
.zeile-link {
  display: flex; gap: 12px; align-items: center;
  border-bottom: 1px solid var(--line); padding: 10px 0; color: inherit;
}
.zeile-link:last-child { border-bottom: none; }
.zeile-link .sym { font-size: 22px; width: 28px; text-align: center; flex: none; }
.zeile-link .text { flex: 1; min-width: 0; }
.tipp {
  background: var(--brand-tint); border-radius: var(--r-sm);
  padding: 10px 12px; margin-bottom: 8px; line-height: 1.5;
}
.loesung-block { margin-top: 10px; }
.loesung-block summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: 6px 0; }
.loesung-block[open] summary { margin-bottom: 8px; }

/* ------------------------------------------------------------------
   Tagesliste und der Wochenblick der Eltern.
   ------------------------------------------------------------------ */
.tagwechsel { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 12px; }
.tagesgitter { border-collapse: collapse; width: 100%; font-size: 13px; }
.tagesgitter th, .tagesgitter td {
  border: 1px solid var(--line); padding: 5px 4px; text-align: center;
}
.tagesgitter tbody th {
  text-align: left; font-weight: 500; white-space: nowrap;
  padding-right: 10px; max-width: 170px; overflow: hidden; text-overflow: ellipsis;
}
.tagesgitter thead th { font-size: 11px; color: var(--muted); }
.tagesgitter thead th .tag { font-weight: 400; font-size: 10px; }
.tagesgitter td.ja { background: var(--gut-tint); color: var(--gut); font-weight: 700; }
.tagesgitter .heute { background: var(--brand-tint); }
.tagesgitter td.ja.heute { background: var(--gut-tint); }
.tagesgitter tr.summe th, .tagesgitter tr.summe td {
  font-weight: 700; color: var(--muted); border-top: 2px solid var(--line);
}

/* Der Tipp des Tages als Überlagerung – einmal am Tag, dann ist Ruhe. */
.tippfenster {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 14, 30, .6);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.tippfenster > div {
  background: var(--card); border-radius: var(--r-lg);
  padding: var(--sp-4); width: 100%; max-width: 520px;
  max-height: 86vh; overflow-y: auto; box-shadow: var(--schatten-lg);
}
@media (min-width: 520px) { .tippfenster { align-items: center; } }
