:root {
  /* Neue Farbpalette (dieselbe Vorgabe wie Portal + Artikel-Fresser):
     Petrol = Struktur, Gold = Highlight, Koralle = CTA/wichtige Aktionen,
     Creme = Hintergrund. --rot (Koralle) ist bewusst ein EIGENES Rot,
     getrennt von --dativ weiter unten - Dativ-Rot bleibt rein die
     Grammatik-Farbe, Koralle ist die allgemeine UI-Aktionsfarbe
     (Haupt-Knopf, Löschen-Hinweis, "falsch"-Meldung). */
  --grund: #fffdf8;
  --karte: #ffffff;
  --hell: #003a4d;
  --gedaempft: #4c6b74;
  --rand: #cde9ef;
  --gold: #fdcb52;
  --gold-hell: #fedd82;
  --gold-dunkel: #8a6a18;
  --rot: #ff6b6b;
  --rot-hell: #ff8f8f;
  --rot-dunkel: #d94b4b;

  /* Verb-Rektionsfarben - das Kernstück der Optik hier - UNVERÄNDERT,
     pädagogisch festgelegt, keine Dekoration. */
  --dativ: #c0273a;
  --dativ-hell: #e3737d;
  --akkusativ: #2f6fd0;
  --akkusativ-hell: #79aaf0;
  --keins: #7d7565;
  --keins-hell: #a89c86;

  /* Blasse Varianten für Objekt-Bausteine - deutlich heller/blasser als
     die kräftigen Verb-Farben, damit die Verben optisch "lauter" bleiben. */
  --akkusativ-pastell: #cfe0f7;
  --akkusativ-pastell-text: #1a3a63;
  --dativ-pastell: #f6d7dc;
  --dativ-pastell-text: #6b1220;
  --subjekt-pastell: #cdebd0;
  --subjekt-pastell-text: #1f6b2c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--grund);
  color: var(--hell);
  -webkit-tap-highlight-color: transparent;
}

.schirm { display: none; padding: 20px 16px 28px; max-width: 1100px; margin: 0 auto; }
.schirm.sichtbar { display: block; }

/* Sprachauswahl: seitenweit oben rechts, über allen Bildschirmen fix
   sichtbar (nicht nur auf dem Startbildschirm). */
/* Eigene Zeile im normalen Textfluss (nicht mehr "fixed") - ein fixiertes
   Element hätte sich mit der HUD-Leiste (Ende-Knopf) im Spielbildschirm
   überlagert, weil beide oben rechts sitzen wollten. */
.oben-leiste {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: 10px 16px 0;
}
/* Einheitliche Größe in allen Spielen (vorher unterschiedlich groß je
   nach Spiel, auf Nutzer-Feedback hin jetzt überall gleich), ohne
   Umrandung - der Hintergrund + Schatten reicht als Abgrenzung. */
.home-knopf {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 16px; font-size: 30px;
  text-decoration: none; background: var(--karte); border: none;
  box-shadow: 0 2px 8px #00000022; flex-shrink: 0;
}
.home-knopf:hover { background: #fbf5e8; }
.sprach-auswahl { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sprach-knopf { padding: 5px 12px; font-size: 13px; }
.sprach-knopf.aktiv { background: var(--hell); border-color: var(--hell); color: #fff; font-weight: 700; }

/* ------------------------------------------------------------ Startseite */
.kopf { text-align: center; margin-bottom: 22px; }
.kopf h1 { margin: 8px 0 4px; font-size: clamp(28px, 6vw, 46px); letter-spacing: -0.5px; }
.kopf h1::before { content: "🧩 "; }
.untertitel { margin: 0; color: var(--gedaempft); font-size: 16px; }
.kopf::after {
  content: ""; display: block; height: 3px; width: 160px; margin: 14px auto 0;
  border-radius: 2px; opacity: .85;
  background: linear-gradient(90deg, var(--hell) 0 33.3%, var(--rot) 33.3% 66.6%, var(--gold) 66.6% 100%);
}

.wahl { margin-bottom: 22px; }
.wahl h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--gedaempft); margin: 0 0 10px;
}

/* Nummerierte Auswahl-Schritte (1. Niveau, 2. ..., 3. ...) - Nutzer-
   Feedback: mehrere Auswahlpunkte hintereinander wirken unübersichtlich,
   eine Nummerierung schafft eine klare Reihenfolge. Zählt automatisch nur
   ".wahl"-Blöcke mit einer ECHTEN Überschrift - Kippschalter ohne eigene
   Überschrift (z.B. "Nur aktuelle Stufe") werden dadurch NICHT mitgezählt.
   Reine CSS-Lösung (counter-reset/-increment + ::before) - der über
   data-i18n übersetzte Text selbst bleibt unangetastet. */
#start { counter-reset: schrittzahl; }
#start .wahl h2 { counter-increment: schrittzahl; }
#start .wahl h2::before { content: counter(schrittzahl) ". "; }

.knopfreihe { display: flex; gap: 10px; flex-wrap: wrap; }
.knopfreihe button { flex: 1 1 100px; padding: 14px 10px; font-size: 18px; font-weight: 700; }

.thema-hinweis { color: var(--gedaempft); font-size: 14px; margin: 0 0 10px; }

.themengitter {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.themengitter button {
  text-align: left; padding: 11px 13px; font-size: 14px; line-height: 1.3;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
}
.themengitter button.nicht-verfuegbar {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 8px;
  opacity: .4; cursor: not-allowed; background: transparent;
}
.themengitter button.nicht-verfuegbar:hover { background: transparent; transform: none; }
.themengitter .marke-bald {
  font-size: 10px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--gedaempft); border: 1px solid var(--rand); border-radius: 20px;
  padding: 2px 7px; flex-shrink: 0;
}
.thema-titel { font-weight: 600; }
/* Beispielsatz bleibt bewusst immer deutsch (siehe game.js) - er zeigt den
   echten Lerninhalt, nicht die Bedienoberfläche, wird also NICHT übersetzt. */
.thema-beispiel {
  font-size: 12px; font-style: italic; font-weight: 400; color: var(--gedaempft);
  line-height: 1.35;
}
.themengitter button.alles-zusammen {
  grid-column: 1 / -1; border-color: var(--gold-hell); font-weight: 700;
}

.knopfreihe-klein { display: flex; gap: 8px; flex-wrap: wrap; }
.knopfreihe-klein button { padding: 9px 16px; font-size: 14px; }

button {
  background: #fff; color: var(--hell);
  border: 2px solid var(--rand); border-radius: 12px;
  padding: 10px 16px; font-size: 15px; font-family: inherit;
  cursor: pointer; transition: background .12s, border-color .12s, transform .08s;
  box-shadow: 0 1px 2px #00000010;
}
button:hover:not(:disabled) { background: #fbf5e8; border-color: var(--gold); }
button:active:not(:disabled) { transform: translateY(1px); }
button.aktiv { background: var(--hell); border-color: var(--hell); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
/* Koralle statt Gold: der auslösende Haupt-Knopf ist die "wichtige
   Aktion", Gold bleibt für Highlights (aktive Auswahl etc.) reserviert. */
button.gross { padding: 15px 30px; font-size: 18px; font-weight: 700; background: var(--rot); border-color: var(--rot-dunkel); color: #fff; }
button.gross:hover:not(:disabled) { background: var(--rot-hell); }
button.flach { background: transparent; box-shadow: none; }
button.gefahr { border-color: var(--rot); color: var(--rot); }
button.gefahr:hover:not(:disabled) { background: #fdeef0; }

/* ---------------------------------------------------------- Farblegende */
.farblegende {
  border: 2px solid var(--rand); border-radius: 12px; padding: 14px 18px;
  margin-bottom: 22px; background: var(--karte);
}
.farblegende h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--gedaempft); margin: 0 0 10px;
}
.legende-zeile { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 15px; }
.muster { display: inline-block; width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }
.muster-akkusativ { background: var(--akkusativ); }
.muster-dativ { background: var(--dativ); }
.muster-beide { background: linear-gradient(135deg, var(--dativ) 0 49%, var(--akkusativ) 51% 100%); }
.muster-keins { background: var(--keins); }
.legende-hinweis { margin: 10px 0 0; font-size: 13px; color: var(--gedaempft); line-height: 1.5; }

.muster-linie {
  display: inline-block; width: 22px; height: 22px; border-radius: 6px;
  flex-shrink: 0;
}
.muster-linie-akkusativ { background: var(--akkusativ-pastell); }
.muster-linie-dativ { background: var(--dativ-pastell); }
.muster-linie-subjekt { background: var(--subjekt-pastell); }
.symbol-vorschau { display: inline-flex; vertical-align: middle; color: var(--hell); }

.coach-hinweis {
  border: 2px solid var(--rand); border-left: 5px solid #7cc9e0;
  background: var(--karte); border-radius: 10px; padding: 12px 15px;
  font-size: 15px; line-height: 1.5; margin-bottom: 18px;
}
.coach-hinweis b { color: var(--hell); }

/* Sagt klar, was noch fehlt, bevor "Spiel starten" anklickbar wird. */
.start-hinweis {
  margin: 4px 0 0; padding: 10px 14px; border-radius: 10px;
  background: #eaf6fa; border: 1px solid #7cc9e0; color: var(--hell);
  font-size: 14px; font-weight: 600;
}

.startzeile { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 22px; }

/* ------------------------------------------------------------- Spielfeld */
.hud {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 8px 4px 12px; font-size: 15px; color: var(--gedaempft);
}
.hud b { color: var(--hell); font-size: 19px; }
.hud-rechts { margin-left: auto; display: flex; gap: 8px; }
.hud-rechts button { padding: 7px 13px; font-size: 14px; }

.spielflaeche { display: flex; flex-direction: column; gap: 6px; }
.bereich {
  background: var(--karte); border: 2px solid var(--rand); border-radius: 16px;
  padding: 18px 22px 22px; min-height: 92px;
}
.bereich h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1.3px;
  color: var(--gedaempft); margin: 0 0 14px;
}

.bauplatz, .vorrat {
  display: flex; flex-wrap: wrap; gap: 22px 14px; align-items: center; min-height: 56px;
}
.bauplatz.wackeln { animation: wackeln .4s ease-in-out; }
@keyframes wackeln {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.leerplatz {
  width: 84px; height: 54px; border: 3px dashed var(--rand); border-radius: 12px;
  flex-shrink: 0;
}

/* Satzklammer-Vorschau (nur A1, nur wenn das Verb aus zwei Teilen besteht):
   zeigt schematisch VOR dem Bauen, dass die beiden Verbteile den Satz wie
   eine Klammer umschließen - zwei Hände, oben von einem Männchen
   zusammengehalten. Bewusst schematisch (Prozent-Positionen nach
   Wortposition), nicht pixelgenau auf die Puzzleteile abgestimmt - das
   wäre bei unterschiedlich breiten Bausteinen fragil. */
.satzklammer-vorschau {
  background: var(--karte); border: 2px dashed var(--rand);
  border-radius: 16px; padding: 10px 18px 8px; margin-bottom: 2px;
}
.sk-grafik { position: relative; height: 66px; }
.sk-person, .sk-hand {
  position: absolute; transform: translateX(-50%);
  color: var(--gold); transition: left .25s ease;
}
.sk-person { top: 0; width: 26px; height: 26px; }
.sk-person svg { width: 100%; height: 100%; }
.sk-hand { bottom: 0; width: 24px; height: 24px; color: var(--gold-hell); }
.sk-hand svg { width: 100%; height: 100%; }
.sk-hand-letzt svg { transform: scaleX(-1); } /* spiegeln, damit beide Hände "zueinander" zeigen */
.sk-bogen {
  position: absolute; top: 28px; height: 24px;
  border: 2px solid var(--gold); border-top: none; border-radius: 0 0 26px 26px;
  opacity: .6; transition: left .25s ease, width .25s ease;
}
.sk-hinweis { text-align: center; font-size: 12px; color: var(--gedaempft); margin: 4px 0 0; }

/* ----------------------------------------------------------- Puzzleteile */
.baustein {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 11px 20px; margin: 0 10px;
  background: var(--grund); color: var(--hell);
  border-radius: 10px;
  font-size: clamp(15px, 2vw, 19px); font-weight: 700; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  box-shadow: 0 3px 8px #00000025;
  border: 3px solid var(--rand);
  transition: transform .1s, box-shadow .1s, border-color .12s;
}
.baustein:hover { transform: translateY(-2px); }
.baustein:active { transform: translateY(0); }

/* Puzzle-Nase rechts und Kerbe links - stilisierte Puzzleteil-Optik,
   funktioniert unabhängig von der Textlänge des Bausteins. Bewusst groß,
   damit es deutlich nach Puzzle statt nach einfachem Textchip aussieht. */
/* Größe von Nase/Kerbe über --nase; der linke Innenabstand richtet sich
   danach, damit der Text nie unter der Kerbe liegt (19.11.2026). */
.baustein { --nase: 24px; padding-left: calc(var(--nase) / 2 + 8px); }
.baustein::before, .baustein::after {
  content: ""; position: absolute; top: 50%; width: var(--nase); height: var(--nase);
  border-radius: 50%; transform: translateY(-50%);
}
.baustein::after { right: calc(var(--nase) / -2); background: inherit; box-shadow: inset 0 0 0 2px #00000018; }
.baustein::before { left: calc(var(--nase) / -2); background: var(--karte); }

.baustein.platziert { border-color: var(--gold); }

/* Rektionsfarben der Verb-Bausteine */
/* Schrift reinweiß (vorher #eaf1ff 4,30 : 1) -> 4,9 : 1; Fläche unverändert. */
.baustein.verb-akkusativ { background: var(--akkusativ); color: #fff; }
.baustein.verb-akkusativ::after { box-shadow: inset 0 0 0 2px #ffffff33; }
.baustein.verb-dativ { background: var(--dativ); color: #ffeef0; }
.baustein.verb-dativ::after { box-shadow: inset 0 0 0 2px #ffffff33; }
.baustein.verb-beide {
  background: linear-gradient(135deg, var(--dativ) 0 49%, var(--akkusativ) 51% 100%);
  color: #fff;
}
/* Schrift reinweiß (vorher #fffdf8 4,49 : 1) -> 4,6 : 1; Fläche unverändert. */
.baustein.verb-keins { background: var(--keins); color: #fff; }

/* Objekte: blasse Flächenfarbe statt kräftigem Verb-Hintergrund - deutlich
   heller, damit die Verben optisch "lauter" bleiben, aber der Kasus auf
   den ersten Blick erkennbar ist. */
.baustein.objekt-akkusativ { background: var(--akkusativ-pastell); color: var(--akkusativ-pastell-text); }
.baustein.objekt-dativ { background: var(--dativ-pastell); color: var(--dativ-pastell-text); }

/* Subjekt: helles Grün, damit es auf den ersten Blick von Verb (kräftige
   Farbe) und Objekten (blaues/rotes Pastell) unterscheidbar ist - einzige
   Bausteinart mit dem Männchen-Symbol (siehe .symbol-person unten). */
.baustein.subjekt { background: var(--subjekt-pastell); color: var(--subjekt-pastell-text); }

/* Symbole (Uhr/Haus/Minimännchen) vor dem Text */
.baustein .symbol { display: inline-flex; margin-right: 7px; opacity: .75; flex-shrink: 0; }
/* Männchen beim Subjekt deutlich größer als Uhr/Haus - soll als "das ist
   der Handelnde" sofort ins Auge springen. Nur die Baustein-Ansicht, NICHT
   die kleinen Symbol-Vorschauen in Legende/Satzklammer (icons.js bleibt
   dort unverändert bei 15x15). */
.baustein .symbol-person svg { width: 24px; height: 24px; }
.baustein .symbol-person { opacity: 1; margin-right: 8px; }

/* Fragewort: golden abgesetzt, damit es als "besonderes" Element auffällt */
.baustein.fragewort { border-color: var(--gold-hell); }

/* Satzzeichen-Baustein (Punkt/Fragezeichen): klein und golden umrandet,
   damit er nicht übersehen wird - genau der Punkt, den Schüler oft
   vergessen. */
.baustein.satzzeichen {
  padding: 11px 18px; font-size: clamp(19px, 2.4vw, 23px);
  border-color: var(--gold); color: var(--gold-dunkel); background: var(--karte);
}

.baustein.falsch { border-color: var(--dativ-hell); animation: schuetteln .35s ease-in-out; }
@keyframes schuetteln {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.baustein.verschwindet { animation: verschwinden .3s ease-in forwards; pointer-events: none; }
@keyframes verschwinden { to { transform: scale(.5); opacity: 0; } }

.meldung {
  text-align: center; min-height: 32px; font-size: 19px; font-weight: 700;
  opacity: 0; transition: opacity .15s;
}
.meldung.zeigen { opacity: 1; }
.meldung.gut { color: #1f8a37; }
.meldung.schlecht { color: var(--rot); }
.meldung.info { color: #1f5f2e; }
/* Lösung nach 3 Fehlversuchen (Zuza 18.11.2026) */
.baustein.loesung { border-color: #1f8a37; }
.weiter-zeile { text-align: center; }
#weiterKnopf { margin: 4px 0 10px; }
#weiterKnopf[hidden] { display: none; }

.fusszeile { text-align: center; color: var(--gedaempft); font-size: 14px; margin: 16px 0 0; }

/* -------------------------------------------- Liste der gelösten Sätze --- */
/* Bleibt die ganze Runde über sichtbar, damit der Schüler den gerade
   gebauten Satz noch einmal in Ruhe lesen kann, statt dass er sofort
   verschwindet. Wächst mit jedem weiteren richtig gelösten Satz. */
.geloeste-saetze { display: flex; flex-direction: column; gap: 4px; }
.geloester-satz {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px;
  padding: 10px 4px; border-bottom: 1px solid var(--rand);
  animation: satzEinblenden .4s ease-out;
}
.geloester-satz:last-child { border-bottom: none; }
@keyframes satzEinblenden {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.geloester-satz-nummer {
  color: var(--gedaempft); font-size: 13px; font-weight: 700;
  margin-right: 2px; flex-shrink: 0; min-width: 20px;
}
/* Bausteine hier: gleiche Farben wie beim Bauen, aber kompakt, flach und
   nicht anklickbar - das ist jetzt eine reine Lese-Ansicht. */
.geloester-satz .baustein {
  padding: 5px 12px; margin: 0; font-size: 14px; cursor: default;
  box-shadow: none; border-width: 2px;
}
.geloester-satz .baustein:hover { transform: none; }
.geloester-satz .baustein::before, .geloester-satz .baustein::after { display: none; }

/* --------------------------------------------------------- Auswertung ---- */
.ergebnis { font-size: 17px; line-height: 1.7; }
.ergebnis .zahl { font-size: 40px; font-weight: 800; color: var(--gold); }
.satzliste { list-style: none; padding: 0; margin: 12px 0 0; }
.satzliste li {
  padding: 10px 13px; border: 1px solid var(--rand); border-radius: 9px; margin-bottom: 6px;
  background: var(--karte); font-size: 15px;
}

@media (max-width: 560px) {
  .bereich { padding: 14px 14px 18px; }
  .baustein { padding: 9px 16px; margin: 0 8px; font-size: 15px; }
}

/* Handy im Spiel (Prüfbericht Fund 14/15, 18.11.2026): Die Bausteine lagen
   unterhalb des sichtbaren Bereichs und der Feedback-Knopf über einem
   Baustein. Im Spiel deshalb: Sprachleiste ausblenden (Sprache wird auf dem
   Startbildschirm gewählt), Feedback klein oben neben dem Haus-Knopf,
   kleinere Leerplätze, Satzklammer-Bild und Abstände. */
@media (max-width: 560px), (max-height: 500px) {
  body[data-schirm="spiel"] #sprachAuswahl { display: none; }
  body[data-schirm="spiel"] .oben-leiste { padding-top: 6px; }
  body[data-schirm="spiel"] .home-knopf { width: 48px; height: 48px; font-size: 24px; border-radius: 13px; }
  body[data-schirm="spiel"] .feedback-knopf {
    position: absolute; top: 6px; bottom: auto; left: 76px; right: auto;
    width: 48px; height: 48px; padding: 0; font-size: 0; line-height: 1;
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
  }
  body[data-schirm="spiel"] .feedback-knopf::before { content: "💬"; font-size: 20px; }
  body[data-schirm="spiel"] .pwa-knopf { display: none; }
  body[data-schirm="spiel"] .feedback-panel { top: 60px; bottom: auto; }
  .hud { padding: 4px 2px 6px; gap: 6px 12px; }
  .bereich { padding: 10px 12px 12px; min-height: 0; }
  .bereich h2 { margin-bottom: 8px; }
  .bauplatz, .vorrat { gap: 12px 6px; min-height: 48px; }
  .leerplatz { width: 56px; height: 46px; border-width: 2px; }
  .satzklammer-vorschau { padding: 4px 12px 4px; }
  .sk-grafik { height: 48px; }
  .sk-person { width: 20px; height: 20px; }
  .sk-bogen { top: 20px; height: 18px; }
  .sk-hand { width: 20px; height: 20px; }
  .meldung { min-height: 24px; font-size: 16px; }
}
/* Kleine Handys hoch (z. B. 320 × 568): Satzklammer nur als Bild, ohne Text */
@media (max-width: 560px) and (max-height: 700px) {
  .sk-hinweis { display: none; }
  .sk-grafik { height: 40px; }
  .meldung { min-height: 20px; }
  .hud { font-size: 14px; }
}
/* Sehr schmale Handys (320 px): Themenname im Spiel weglassen (steht auf
   dem Startbildschirm), Puzzleteile etwas schmaler. */
@media (max-width: 360px) {
  #hudThema { display: none; }
  .baustein { padding: 8px 12px; margin: 0 6px; }
  .leerplatz { width: 48px; }
}
/* Querformat (niedrig): Platz reicht nicht für das Satzklammer-Bild –
   die Bausteine müssen ohne Scrollen sichtbar sein. */
@media (max-height: 500px) {
  body[data-schirm="spiel"] .satzklammer-vorschau { display: none; }
  body[data-schirm="spiel"] .home-knopf { width: 44px; height: 44px; }
  body[data-schirm="spiel"] .feedback-knopf { top: 6px; width: 44px; height: 44px; left: 70px; }
  .hud { padding: 2px 2px 4px; }
  .meldung { min-height: 20px; }
  /* Haus- und Feedback-Knopf neben die Punktezeile statt in eine eigene Zeile */
  body[data-schirm="spiel"] .oben-leiste { position: absolute; top: 0; left: 0; padding: 6px 16px 0; }
  body[data-schirm="spiel"] #spiel .hud { padding-left: 172px; min-height: 50px; } /* 116 + 56 für den Zurück-Knopf */
  /* lange Sätze (bis 11 Teile) passen so auch quer ohne Scrollen */
  .baustein { padding: 6px 12px; margin: 0 6px; }
  .bauplatz, .vorrat { gap: 8px 4px; }
  .leerplatz { height: 38px; width: 48px; }
}
/* Niedrige Bildschirme: Überschriften „Dein Satz“/„Bausteine“ weglassen –
   Leerplätze und Puzzleteile sind auch ohne sie klar zu unterscheiden. */
@media (max-height: 600px) {
  body[data-schirm="spiel"] .bereich h2 { display: none; }
  body[data-schirm="spiel"] .bereich { padding: 8px 10px; }
}

/* ------------------------------------------- Kein Scrollen im Spiel ---
   (19.11.2026) Auch beim längsten Satz (11 Teile) und bei der Lösung muss
   alles ohne Scrollen sichtbar sein: Der Spielbildschirm füllt genau die
   Fensterhöhe, nur die Liste „Deine fertigen Sätze“ gibt Platz ab und
   scrollt in sich. Bei der Lösung wird der leere Bereich „Bausteine“
   ausgeblendet (game.js), „Weiter“ steht direkt unter dem Satz. */
body[data-schirm="spiel"] { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
body[data-schirm="spiel"] .oben-leiste { flex: none; width: 100%; }
body[data-schirm="spiel"] #spiel.sichtbar {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
  width: 100%; padding-bottom: 8px;
}
#spiel .hud, #spiel .fusszeile { flex: none; }
#spiel .spielflaeche { flex: 0 1 auto; min-height: 0; }
/* Feedback-Knopf sitzt hier unten rechts (fixiert): Bedienhinweis nie darunter */
@media (min-width: 561px) and (min-height: 501px) {
  body[data-schirm="spiel"] #spiel.sichtbar { padding-bottom: 72px; }
}
#spiel .spielflaeche > * { flex-shrink: 0; }
/* Lösungsansicht: Überschrift „So ist der Satz richtig:“ über dem Satz */
.spielflaeche.loesung-modus #satzklammerVorschau { order: -2; }
.spielflaeche.loesung-modus #meldung { order: -1; }
#spiel #geloesteBereich { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
.hud-rechts button { min-height: 48px; min-width: 48px; font-size: 15px; }
.bereich h2, .sk-hinweis, .geloester-satz-nummer, .fusszeile { font-size: 15px; }
.bereich h2 { letter-spacing: 1px; }
.geloester-satz .baustein { font-size: 15px; }

/* Handy hoch und quer: Puzzleteile mit kleinerer Nase/Kerbe, enger gesetzt */
@media (max-width: 560px), (max-height: 500px) {
  .baustein {
    --nase: 16px; padding: 7px 10px 7px 14px; margin: 0 5px;
    border-width: 2px; font-size: 15px; line-height: 20px;
  }
  .baustein.satzzeichen { padding: 7px 12px 7px 14px; font-size: 19px; line-height: 20px; }
  .baustein .symbol { margin-right: 5px; }
  .baustein .symbol-person { margin-right: 5px; }
  .baustein .symbol-person svg { width: 20px; height: 20px; }
  .bauplatz, .vorrat { gap: 6px; min-height: 38px; }
  .leerplatz { width: 40px; height: 38px; border-width: 2px; }
  .hud, .hud b { font-size: 15px; }
  .hud b { font-size: 18px; }
  body[data-schirm="spiel"] .home-knopf { width: 48px; height: 48px; }
  body[data-schirm="spiel"] .feedback-knopf { width: 48px; height: 48px; }
}
/* Handy hoch: Haus- und Feedback-Knopf neben Punkte und „Ende“, Satzzähler
   darunter (spart eine ganze Zeile). */
@media (max-width: 560px) {
  body[data-schirm="spiel"] .oben-leiste { position: absolute; top: 0; left: 0; width: auto; padding: 6px 16px 0; }
  body[data-schirm="spiel"] #spiel.sichtbar { padding-top: 6px; }
  body[data-schirm="spiel"] #spiel .hud { padding: 0 0 4px 172px; min-height: 48px; row-gap: 0; } /* 116 + 56 für den Zurück-Knopf */
  body[data-schirm="spiel"] #spiel .hud::before { content: ""; order: 2; flex-basis: 100%; height: 0; }
  body[data-schirm="spiel"] #spiel .hud-rechts { order: 1; }
  body[data-schirm="spiel"] #hudFortschritt { order: 3; }
  body[data-schirm="spiel"] #hudThema { order: 4; }
  body[data-schirm="spiel"] .bereich { padding: 8px 8px; }
  body[data-schirm="spiel"] .bereich h2 { margin-bottom: 6px; }
}
/* Wenig Höhe: Bedienhinweis unten weglassen, der Platz geht an die
   Puzzleteile. */
@media (max-height: 500px), (max-width: 560px) and (max-height: 700px) {
  body[data-schirm="spiel"] .fusszeile { display: none; }
}
@media (max-height: 500px) {
  body[data-schirm="spiel"] .oben-leiste { width: auto; }
  body[data-schirm="spiel"] .feedback-knopf { left: 70px; }
  body[data-schirm="spiel"] #spiel .hud { padding-left: 172px; min-height: 52px; } /* 116 + 56 für den Zurück-Knopf */
  body[data-schirm="spiel"] #spiel.sichtbar { padding-top: 4px; }
  body[data-schirm="spiel"] .bereich { padding: 6px 8px; }
  .meldung { min-height: 20px; line-height: 20px; }
  #weiterKnopf { margin: 2px 0 4px; padding: 12px 30px; }
}

/* Eigener Dunkelmodus (Muster Tanzroboter): Browser färben die Seite dann
   nicht selbst um (Samsung Internet ignoriert „only light“). */
:root { color-scheme: light dark; }

/* -------------------------------------------------------------- Dunkelmodus ---
   Petrol-Farbwelt wie im Tanzroboter. Nur innerhalb dieses Blocks - der
   Hellmodus bleibt unverändert. Die Grammatikfarben bleiben gleich: Verben
   kräftig (Blau/Rot/Grau), Objekte und Subjekt hell ausgemalt (die Legende
   sagt „hellblau/hellrot/hellgrün“) - auf dem dunklen Grund heben sie sich
   so noch deutlicher ab. Angaben/sonstige Bausteine: dunkles Petrol mit
   heller Schrift. Hover-Regeln bewusst ohne (hover: hover): auf Handys
   bleibt :hover nach dem Tippen hängen. */
@media (prefers-color-scheme: dark) {
  :root { --grund: #0e1d23; --karte: #17303a; --hell: #e8f3f6; --gedaempft: #a7c3cb; --rand: #2f5664; }
  button { background: var(--karte); color: var(--hell); }
  button.aktiv, .sprach-knopf.aktiv { background: #0d6b80; border-color: #7cc9e0; color: #fff; }
  button.gefahr { border-color: var(--rot); color: #ff8f85; }
  .home-knopf { box-shadow: 0 2px 8px #00000080; }
  button:hover:not(:disabled), .home-knopf:hover { background: #22424e; border-color: var(--gold); }
  button.flach:hover:not(:disabled) { background: #22424e; }
  button.gross:hover:not(:disabled) { background: var(--rot-hell); }
  button.gefahr:hover:not(:disabled) { background: #4a1d23; }
  .themengitter button.nicht-verfuegbar:hover { background: transparent; }
  .start-hinweis { background: #143847; border-color: #3f8fa8; color: var(--hell); }
  .leerplatz { border-color: #4b7684; }
  /* Bausteine */
  .baustein { background: #234652; box-shadow: 0 3px 8px #00000066; border-color: #3d6878; }
  /* Schrift reinweiß: Blau 4,9 : 1 und Grau 4,6 : 1 (≥ 4,5); Flächenfarben unverändert. */
  .baustein.verb-akkusativ, .baustein.verb-keins { color: #fff; }
  .baustein.satzzeichen { color: var(--gold); background: var(--karte); border-color: var(--gold); }
  .baustein.falsch { border-color: #ff8f85; }
  .baustein.loesung { border-color: #6ee08f; }
  .meldung.gut { color: #6ee08f; }
  .meldung.schlecht { color: #ff8f85; }
  .meldung.info { color: #8fe0a5; }
  body .feedback-knopf, body .hell-knopf, body .memo-knopf { background: #143847; color: #d8eef4; border-color: #3f8fa8; }
  .feedback-panel, .pwa-fenster { color-scheme: light; }
  .feedback-panel textarea { background: #fff; color: #2a231c; }
  .feedback-panel button { background: #fff; color: #2a231c; }
  .feedback-panel .fb-senden { background: #0d2b52; color: #fff; }
  .pwa-fenster button { background: #fdcb52; color: #003a4d; }
  .feedback-panel button:hover:not(:disabled) { background: #f4efe6; border-color: #ddd4c2; }
  .feedback-panel .fb-senden:hover:not(:disabled) { background: #16407a; border-color: #16407a; }
  .pwa-fenster button:hover:not(:disabled) { background: #fedd82; border-color: #e0ac2b; }
}
