/* OLIFI – Gestaltung
   Grundsätze: große Ziele (mind. ~64 px), ruhiger Hintergrund, keine Schrift im Kinderbereich,
   Bewegungen weich und kurz, reduziert bei entsprechender Systemeinstellung. */

:root {
  --grund: #fff6e5;
  --grund-dunkel: #f5e6c8;
  --braun: #5b4636;
  --tuerkis: #39c6b5;
  --ding: clamp(72px, 24vmin, 140px);
  --schatten: 0 6px 0 rgba(91, 70, 54, 0.15);
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--grund);
  color: var(--braun);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#app {
  height: 100dvh;
  width: 100vw;
  position: relative;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

button {
  font: inherit;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

.bildschirm {
  position: absolute;
  inset: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  background:
    radial-gradient(circle at 15% 10%, #fff 0, transparent 40%),
    radial-gradient(circle at 90% 95%, var(--grund-dunkel) 0, transparent 45%), var(--grund);
}

/* ---------- Start ---------- */
.start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5vmin;
}
.start { gap: 3vmin; padding-bottom: 8vh; }
.start .logo { width: min(78vw, 46dvh, 420px); position: relative; z-index: 1; }
.start .start-olifi { width: min(42vmin, 240px); height: min(42vmin, 240px); position: relative; z-index: 1; }
.start .knopf-los { position: relative; z-index: 1; }
@media (orientation: landscape) {
  .start { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-content: center; justify-content: center; column-gap: 6vw; row-gap: 3vh; }
  .start .logo { grid-column: 1 / 3; justify-self: center; width: min(46vw, 34dvh * 2.05, 420px); }
  .start .start-olifi { width: min(36dvh, 220px); height: min(36dvh, 220px); }
}

/* ---------- Landschaft (Start, Profilwahl, Übersicht, Themen) ---------- */
.landschaft { overflow: hidden; }
.landschaft > .huegel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: min(22dvh, 160px);
  pointer-events: none;
}
.landschaft > .wolken {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: min(18dvh, 140px);
  pointer-events: none;
}
.landschaft > .profil-gitter { position: relative; z-index: 1; }
/* Olifi winkt (nur dreimal, dann Ruhe) */
.olifi-arm { transform-box: view-box; transform-origin: 158px 120px; animation: winken 1.2s ease-in-out 0.4s 3; }
@keyframes winken {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-22deg); }
}
@media (prefers-reduced-motion: reduce) { .olifi-arm { animation: none; } }
/* Oben links: Pfeil zurück (Lernfeld, Profilwahl) bzw. „Kind wechseln“ in der Übersicht – seit 0.25.0 */
.knopf-oben-links {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  left: calc(env(safe-area-inset-left) + 12px);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  padding: 10px;
  box-shadow: var(--schatten);
  z-index: 5;
}
/* Begleiter-Olifi unten links in der Übersicht */
.begleit-olifi {
  position: absolute;
  left: calc(env(safe-area-inset-left) + 2vw);
  bottom: calc(env(safe-area-inset-bottom) + 1vh);
  width: min(26vmin, 140px);
  height: min(26vmin, 140px);
  z-index: 2;
  padding: 0;
  background: none;
}
.begleit-olifi:active, .start .start-olifi:active { transform: scale(0.95); }
.start .start-olifi { padding: 0; border: 0; background: none; }
/* Olifi lebt (seit 0.18.0) */
.olifi-augen { transform-box: fill-box; transform-origin: center; transition: transform 0.07s ease-in; }
.olifi-augen.blinzelt { transform: scaleY(0.1); }
.olifi-pupillen { transition: transform 0.25s ease-out; }
.hops { animation: olifi-hops 0.65s ease-out; }
@keyframes olifi-hops { 0%, 100% { translate: 0 0; } 40% { translate: 0 -14%; } }
@media (prefers-reduced-motion: reduce) { .olifi-augen, .olifi-pupillen { transition: none; } .hops { animation: none; } }
.knopf-los {
  width: min(34vmin, 200px);
  height: min(34vmin, 200px);
  border-radius: 50%;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.12));
  animation: atmen 2.4s ease-in-out infinite;
}
.knopf-los:active {
  transform: scale(0.94);
}

/* Menü-Knopf für Eltern: bewusst klein und unauffällig, oben rechts */
.knopf-eltern {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  right: calc(env(safe-area-inset-right) + 12px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  padding: 12px;
  opacity: 0.8;
}

/* ---------- Übersicht ---------- */
.uebersicht {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vmin;
}
/* Lernfelder (seit 0.24.0): 3 × 3 in der Mitte, „Malen und Musik“ frei unten rechts,
   als Gegenstück zum eigenen Olifi unten links (gleich groß, gleiche Grundlinie). */
.uebersicht { --k: min(28vw, calc((100dvh - 330px) / 3.3), 170px); padding-bottom: 0; }
.lernfelder {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3.5vmin;
  justify-content: center;
  grid-template-columns: repeat(3, var(--k));
  margin-bottom: calc(var(--k) * 0.9);
}
.lf { display: block; width: var(--k); }
.lf .kachel {
  width: var(--k);
  aspect-ratio: 1;
  border-radius: 22%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.2vmin 1vmin 0.6vmin;
}
.lf .kachel > svg { width: 100%; flex: 1; min-height: 0; }
.lf:active .kachel { transform: scale(0.96) translateY(3px); }
/* Wort unter dem Bild: Platz für zwei Zeilen in jeder Kachel, damit alle Bilder gleich groß sind */
.lf-name {
  font: 700 clamp(11.5px, calc(var(--k) * 0.105), 16px) / 1.08 system-ui, sans-serif;
  color: #4a3b30;
  text-align: center;
  height: 2.2em;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Kreativ-Bereich: Regenbogen-Rand, hebt sich ohne Lesen ab */
.lf.kreativ { position: absolute; z-index: 2; right: calc(env(safe-area-inset-right) + 4vw); bottom: calc(env(safe-area-inset-bottom) + 2.5vh); }
.lf.kreativ .kachel {
  border: 5px solid transparent;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%) padding-box,
    linear-gradient(#fff4fb, #fff4fb) padding-box,
    conic-gradient(from 200deg, #ef6b5e, #ffcf1f, #6cc24a, #39c6b5, #6c93ea, #b78be6, #ef6b5e) border-box;
}
.uebersicht .begleit-olifi {
  width: calc(var(--k) * 1.05);
  height: calc(var(--k) * 1.05);
  left: calc(env(safe-area-inset-left) + 3vw);
  bottom: calc(env(safe-area-inset-bottom) + 2.5vh);
}
@media (orientation: landscape) {
  .uebersicht { --k: min(20vw, calc((100dvh - 64px) / 3.2), 170px); }
  .lernfelder { margin-bottom: 0; }
  .lf.kreativ { right: calc(env(safe-area-inset-right) + 3vw); bottom: calc(env(safe-area-inset-bottom) + 3vh); }
  .uebersicht .begleit-olifi { left: calc(env(safe-area-inset-left) + 3vw); bottom: calc(env(safe-area-inset-bottom) + 3vh); }
}
/* Lernfeld ohne Spiel: Olifi gießt ein Pflänzchen */
.kommt-bald { width: min(80vw, 60dvh * 1.5, 480px); aspect-ratio: 3 / 2; position: relative; z-index: 1; }
/* Lernfeld-Seite (seit 0.26.0): oben das Lernfeld-Bild, darunter die Spiele als quadratische Kacheln */
.lf-kopf {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 66px;
  height: 66px;
  border-radius: 22%;
  padding: 5px;
  background: var(--thema);
  box-shadow: var(--schatten);
  z-index: 4;
}
.lf-kopf svg { width: 100%; height: 100%; }
.spiele {
  position: relative;
  z-index: 1;
  --k: min(40vw, calc((100dvh - 260px) / 2.3), 190px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4vmin;
  max-width: calc(var(--k) * 2 + 4vmin + 1px);
}
.spiele .lf .kachel { background-color: #fff; }
@media (orientation: landscape) {
  .spiele { --k: min(26vw, calc(100dvh - 130px), 220px); max-width: calc(var(--k) * 3 + 8vmin + 1px); }
}
/* Themen-Seite: Hintergrund im Farbton des Themas */
.thema {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--thema, #fff6e5) 50%, #ffffff);
}
.kachel {
  width: var(--kachel-breite);
  aspect-ratio: 200 / 130;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 55%), var(--kachel, #ffe3a3);
  border-radius: 24px;
  padding: 2.5vmin;
  box-shadow: var(--schatten);
  transition: transform 0.12s;
}
.kachel:active {
  transform: scale(0.96) translateY(3px);
}

/* ---------- Spiel-Rahmen ---------- */
.knopf-haus {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  left: calc(env(safe-area-inset-left) + 12px);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  padding: 10px;
  box-shadow: var(--schatten);
  z-index: 5;
}
.buehne {
  position: absolute;
  inset: 0;
  touch-action: none;
}

/* ---------- Farbkörbe ---------- */
.fk {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 88px 3vw 3vh;
  gap: 2vh;
}
.fk-koerbe {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-evenly;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1vh 2vw;
}
.fk-korb {
  position: relative;
  /* Hochformat: bei 4 Farben zwei Reihen, damit die Körbe groß genug bleiben */
  width: min(calc((94vw - 6vw * (var(--spalten) - 1)) / var(--spalten)), 22vh, 220px);
  aspect-ratio: 120 / 100;
  transform-origin: 50% 100%;
}
.fk-korb > svg {
  position: relative;
  z-index: 1;
}
/* Eingeräumte Dinge schauen oben aus dem Korb heraus */
.fk-inhalt {
  position: absolute;
  left: 12%;
  right: 12%;
  top: -14%;
  height: 46%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 0;
}
.mini {
  width: 34%;
  max-width: 54px;
  margin: 0 -6%;
  animation: reinplumpsen 0.35s ease-out;
}
.fk-feld {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 3vmin 4vmin;
  padding: 2vmin;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 32px;
}
.ding {
  width: var(--ding);
  height: var(--ding);
  position: relative;
  z-index: 2;
  touch-action: none;
  cursor: grab;
}
.ding > svg {
  transform: rotate(var(--dreh));
  animation: auftauchen 0.4s backwards cubic-bezier(0.3, 1.6, 0.5, 1);
  animation-delay: var(--verz);
  transition: transform 0.15s;
  filter: drop-shadow(0 5px 0 rgba(91, 70, 54, 0.18));
}
.ding.gefasst {
  z-index: 10;
}
.ding.gefasst > svg,
.ding.gewaehlt > svg {
  transform: rotate(0deg) scale(1.15);
}
.ding.gewaehlt > svg {
  filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 4px var(--tuerkis));
  animation: hupfen 0.9s ease-in-out infinite;
}
.ding.zieht {
  cursor: grabbing;
}
.ding.gleitet {
  transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.4, 1);
}
.ding.weg {
  pointer-events: none;
  z-index: 10;
}
.ding.wackelt > svg {
  animation: wackeln 0.4s ease-in-out 3;
}

.fk-korb.pulsiert {
  animation: pulsieren 0.9s ease-in-out infinite;
}
.fk-korb.pulsiert > svg {
  filter: drop-shadow(0 0 12px #fff) drop-shadow(0 0 6px #ffd84d);
}
.fk-korb.freut {
  animation: freuen 0.5s ease-out;
}

/* Farbkörbe ab 0.32.0 */
.ding.leuchtet > svg { filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 6px #ffd84d); animation: hupfen 0.9s ease-in-out infinite; }
.fk-hoeren .fk-korb { width: min(70vw, 30vh, 280px); }
.fk-hoeren .fk-inhalt { flex-wrap: wrap; height: 60%; top: -24%; align-content: flex-end; }
.fk-hoeren .mini { width: 22%; margin: 0 -3% -6%; }
@media (orientation: landscape) { .fk-hoeren .fk-korb { width: min(30vw, 60vh, 260px); } }
.klecks-neu { animation: reinplumpsen 0.5s ease-out; transform-origin: 60px 64px; }

/* Querformat: Körbe links, Dinge rechts */
@media (orientation: landscape) {
  .fk {
    flex-direction: row;
    padding: 3vh 3vw 3vh 96px;
  }
  .fk-koerbe {
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
  }
  .fk-korb {
    width: min(calc((88vh - 2vh * (var(--anzahl) - 1)) / var(--anzahl) * 1.2), 30vw, 200px);
  }
}

/* ---------- Wer macht das? ---------- */
.ti {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
  padding: 84px 3vw 3vh;
}
.ti-gitter {
  display: grid;
  grid-template-columns: repeat(var(--spalten, 2), var(--karte));
  gap: 3vmin;
  justify-content: center;
}
.ti-karte {
  width: var(--karte);
  height: var(--karte);
  background: #e4f3da;
  border-radius: 24px;
  padding: calc(var(--teil) * 0.08);
  box-shadow: var(--schatten);
  transition: transform 0.12s, box-shadow 0.2s;
}
.ti-karte:active { transform: scale(0.96); }
.ti-karte.huepft > svg { animation: hupfen-gross 0.5s ease-out; }
.ti-karte.wackelt > svg { animation: wackeln 0.35s ease-in-out 2; }
.ti-karte.leuchtet {
  box-shadow: 0 0 0 5px #ffd84d, var(--schatten);
  animation: pulsieren 0.9s ease-in-out infinite;
}
.ti-karte.richtig { background: #fff3c4; }
.ti-weiter {
  position: absolute;
  right: calc(env(safe-area-inset-right) + 18px);
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--tuerkis);
  padding: 16px;
  box-shadow: var(--schatten);
  animation: atmen 1.6s ease-in-out infinite;
  transition: opacity 0.3s;
}
.ti-weiter.versteckt { opacity: 0; pointer-events: none; }
.ti-kopf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ti-laut {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #e8a33d;
  padding: 20px;
  box-shadow: var(--schatten);
}
.ti-laut.klingt { animation: freuen 0.5s ease-out; }
.ti-pfoten { display: flex; gap: 10px; }
.ti-pfoten span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #c9b79c;
  transition: background 0.3s, border-color 0.3s;
}
.ti-pfoten span.voll { background: #6cc24a; border-color: #3d8a27; }
@media (orientation: landscape) {
  .ti-raten { flex-direction: row; padding: 3vh 3vw 3vh 96px; gap: 4vw; }
  .ti-erkunden { padding: 3vh 124px 3vh 96px; }
}
@keyframes hupfen-gross {
  30% { transform: translateY(-14%) scale(1.06); }
  60% { transform: translateY(0) scale(0.97); }
}

/* ---------- Profilwahl und Code (Kinderprofile) ---------- */
.profilwahl {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 5vw 5vh;
}
.profil-gitter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5vmin;
  --profil: min(40vw, 34dvh, 230px);
  max-width: calc(2 * var(--profil) + 5vmin);
}
@media (orientation: landscape) {
  .profil-gitter { max-width: none; flex-wrap: nowrap; }
  .profil-gitter.profile-3,
  .profil-gitter.profile-4 { --profil: min(21vw, 60dvh, 230px); }
  .profil-gitter.profile-2 { --profil: min(32vw, 60dvh, 260px); }
}
.profil-knopf {
  width: var(--profil);
  height: var(--profil);
  border-radius: 32px;
  background: #fff;
  padding: calc(var(--profil) * 0.08);
  box-shadow: 0 6px 0 rgba(91, 70, 54, 0.15);
  transition: transform 0.12s;
}
.profil-knopf:active { transform: scale(0.95) translateY(3px); }
.code {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vmin;
  padding: 80px 5vw 5vh;
}
@media (orientation: landscape) { .code { flex-direction: row; gap: 6vw; } }
.code .code-olifi { width: min(32vmin, 180px); height: min(32vmin, 180px); }
.code-bilder {
  display: grid;
  grid-template-columns: repeat(2, var(--bild));
  gap: 4vmin;
  --bild: min(36vw, 26dvh, 170px);
}
.code-bild {
  width: var(--bild);
  height: var(--bild);
  border-radius: 28px;
  background: #fff;
  padding: calc(var(--bild) * 0.16);
  box-shadow: 0 6px 0 rgba(91, 70, 54, 0.15);
}
.code-bild:active { transform: scale(0.95) translateY(3px); }
.knopf-zurueck-pfeil {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  left: calc(env(safe-area-inset-left) + 12px);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  padding: 10px;
  box-shadow: var(--schatten);
}
.uebersicht .profil-wechsel { border-radius: 50%; }
.uebersicht .profil-wechsel:active { transform: scale(0.95); }
.schluss { flex-direction: column; gap: 4vmin; }
.schluss-andere { display: flex; gap: 4vmin; }
.profil-klein {
  width: min(22vmin, 120px);
  height: min(22vmin, 120px);
  border-radius: 24px;
  background: #fff;
  padding: 8%;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
}

/* ---------- Schluss für heute ---------- */
.schluss {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #3b4a78 0, #1f2747 70%);
}
.schluss .maskottchen {
  width: min(60vmin, 340px);
  height: min(60vmin, 340px);
  animation: atmen 3.2s ease-in-out infinite;
}
.schluss .knopf-eltern { background: rgba(255, 255, 255, 0.5); }

/* ---------- Tier-Memory ---------- */
.me-wahl {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8vmin;
  flex-wrap: wrap;
  padding: 84px 4vw 4vh;
}
.me-modus {
  width: min(38vmin, 220px);
  height: min(38vmin, 220px);
  border-radius: 32px;
  background: #fff;
  padding: 4%;
  box-shadow: var(--schatten);
}
.me-modus:active { transform: scale(0.96); }
/* Wahlbilder für Spielarten (Schattenpuzzle, Memory) */
.me {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
  padding: 84px 3vw 3vh;
}
.me-reihe { display: flex; gap: 18px; }
.me-spieler {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  opacity: 0.45;
  transform: scale(0.85);
  transition: transform 0.3s, opacity 0.3s, box-shadow 0.3s;
}
.me-spieler.aktiv { opacity: 1; transform: scale(1.1); box-shadow: 0 0 0 4px #ffd84d; }
.me-gitter {
  display: grid;
  grid-template-columns: repeat(var(--spalten, 2), var(--karte, 120px));
  gap: var(--luecke, 12px);
  justify-content: center;
}
.me-karte {
  width: var(--karte, 120px);
  height: var(--karte, 120px);
  perspective: 800px;
}
.me-innen {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.3, 0.7, 0.4, 1);
  transform-style: preserve-3d;
}
.me-karte.offen .me-innen,
.me-karte.gefunden .me-innen { transform: rotateY(180deg); }
.me-hinten,
.me-vorne {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--schatten);
}
.me-hinten {
  background: #39c6b5;
  padding: 18%;
  border: 4px solid #2ba394;
}
.me-hinten svg { opacity: 0.55; filter: saturate(0.4) brightness(1.4); }
.me-vorne {
  background: #e4f3da;
  padding: 9%;
  transform: rotateY(180deg);
}
.me-laut { background: #e8a33d; padding: 22%; }
/* Memory 3b: Kopfhälfte an ihrer Stelle (seit 0.39.0) */
.me-vorne-halb { padding: 0; overflow: hidden; }
.me-halb { position: absolute; overflow: hidden; }
.me-halb svg { width: 100%; height: 100%; display: block; overflow: hidden; }
.me-aufloesung {
  position: absolute;
  inset: 0;
  padding: 9%;
  background: #e4f3da;
  border-radius: 18px;
  opacity: 0;
  transition: opacity 0.4s 0.2s;
}
.me-karte.gefunden .me-aufloesung { opacity: 1; }
.me-karte.gefunden .me-vorne { box-shadow: 0 0 0 4px #ffd84d, var(--schatten); }
.me-karte.gefunden .me-vorne > svg,
.me-karte.gefunden .me-aufloesung > svg { animation: hupfen-gross 0.5s ease-out; }
.me-karte.wackelt { animation: wackeln 0.4s ease-in-out 3; }
@media (orientation: landscape) {
  .me { flex-direction: row; padding: 3vh 3vw 3vh 96px; gap: 3vw; }
  .me-reihe { flex-direction: column; }
}

/* ---------- Futter zählen ---------- */
/* Futter zählen (neu seit 0.28.0): Tier mit Sprechblase, Napf, eine Futter-Quelle */
.zn {
  --futter: min(13vw, 7vh, 58px);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1.5vh;
  padding: 84px 3vw 2vh;
}
.zn-oben { display: flex; align-items: center; justify-content: center; gap: 4vw; }
.zn-tier {
  width: min(34vw, 20vh, 180px);
  height: min(34vw, 20vh, 180px);
  background: #e4f3da;
  border-radius: 24px;
  padding: 6%;
  box-shadow: var(--schatten);
}
.zn-tier:active { transform: scale(0.96); }
.zn-tier.frisst > svg { animation: hupfen-gross 0.5s ease-out 2; }
.zn-blase {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 22px;
  padding: 10px 14px;
  box-shadow: var(--schatten);
  min-height: min(20vw, 12vh, 100px);
}
.zn-blase::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  border: 10px solid transparent;
  border-right: 14px solid #fff;
  transform: translateY(-50%);
}
.zn-teilen .zn-blase::before { display: none; }
.zn-blase.leuchtet { box-shadow: 0 0 0 5px #ffd84d, var(--schatten); animation: pulsieren 0.9s ease-in-out infinite; }
.zn-menge { width: min(22vw, 13vh, 110px); height: min(22vw, 13vh, 110px); }
.zn-ziffer { font-size: min(15vw, 9vh, 80px); font-weight: 800; color: #2e2a26; line-height: 1; min-width: 0.7em; text-align: center; }
.zn-naepfe { display: flex; gap: 4vw; justify-content: center; width: 100%; }
.zn-napf { position: relative; width: min(88vw, 440px); aspect-ratio: 200 / 110; container-type: inline-size; }
.zn-naepfe:has(.zn-napf + .zn-napf) .zn-napf { width: min(45vw, 300px); }
.zn-napf-bild { position: absolute; inset: 0; width: 100%; height: 100%; }
.zn-innen { position: absolute; left: 9%; right: 9%; top: 2%; height: 50%; transition: opacity 0.5s, transform 0.5s; }
.zn-innen.gegessen { opacity: 0; transform: scale(0.6); transition-delay: 0.4s; }
.zn-stueck {
  position: absolute;
  width: 19cqw;
  height: 19cqw;
  margin: -9.5cqw 0 0 -9.5cqw;
  touch-action: none;
  cursor: grab;
  z-index: 2;
  transition: opacity 0.2s, transform 0.2s;
}
.zn-stueck.weg { opacity: 0; transform: scale(0.5); }
.zn-stueck.gefasst { z-index: 10; }
.zn-stueck.gefasst > svg { transform: scale(1.15); }
.zn-stueck.gleitet { transition: transform 0.3s cubic-bezier(0.3, 0.7, 0.4, 1); }
.zn-stueck.plopp > svg { animation: reinplumpsen 0.3s ease-out; }
/* Nachzählen: jedes Stück bekommt seine Zahl */
.zn-stueck.zn-nr::after {
  content: attr(data-nr);
  position: absolute;
  right: -6px;
  top: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 11px;
  background: #1c7f73;
  color: #fff;
  font: 800 13px/22px system-ui, sans-serif;
  text-align: center;
}
.zn-unten { display: flex; flex-direction: column; align-items: center; gap: 1.5vh; }
.zn-quelle {
  width: min(26vw, 13vh, 120px);
  height: min(26vw, 13vh, 120px);
  background: #fff;
  border-radius: 50%;
  padding: 12%;
  box-shadow: var(--schatten);
  touch-action: none;
  cursor: grab;
}
.zn-quelle.gleitet { transition: transform 0.3s cubic-bezier(0.3, 0.7, 0.4, 1); }
.zn-quelle.gewaehlt { box-shadow: 0 0 0 5px #ffd84d, var(--schatten); }
@media (orientation: landscape) {
  .zn { flex-direction: row; justify-content: center; padding: 2vh 3vw 2vh 96px; gap: 3vw; --futter: min(8vw, 11vh, 58px); }
  .zn-oben { flex-direction: column; gap: 2vh; }
  .zn-teilen .zn-oben { flex-direction: row; flex-wrap: wrap; width: min(30vw, 260px); }
  .zn-tier { width: min(20vw, 28vh, 160px); height: min(20vw, 28vh, 160px); }
  .zn-teilen .zn-tier { width: min(12vw, 22vh, 110px); height: min(12vw, 22vh, 110px); }
  .zn-menge { width: min(14vw, 20vh, 100px); height: min(14vw, 20vh, 100px); }
  .zn-blase::before { left: 50%; top: -22px; border: 10px solid transparent; border-bottom: 14px solid #fff; transform: translateX(-50%); }
  .zn-napf { width: min(46vw, 70vh, 460px); }
  .zn-quelle { width: min(14vw, 22vh, 110px); height: min(14vw, 22vh, 110px); }
  .zn-naepfe:has(.zn-napf + .zn-napf) .zn-napf { width: min(26vw, 280px); }
  .zn-naepfe { width: auto; }
}

/* ---------- Schattenpuzzle ---------- */
.sp {
  --teil: 110px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 80px 3vw 2vh;
}
.sp-schatten-reihe,
.sp-teile {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-width: 100%;
}
.sp-schatten {
  width: var(--teil);
  height: var(--teil);
  border-radius: 22px;
  background: rgba(91, 70, 54, 0.07);
  border: 3px dashed rgba(91, 70, 54, 0.22);
  padding: calc(var(--teil) * 0.08);
  transition: box-shadow 0.2s, background 0.3s;
}
.sp-umriss {
  width: 100%;
  height: 100%;
  transform: rotate(var(--dreh, 0deg));
  filter: brightness(0);
  opacity: 0.32;
}
.sp-schatten.gefuellt { background: rgba(255, 255, 255, 0.7); border-style: solid; border-color: #ffd84d; }
.sp-schatten.gefuellt .sp-umriss { filter: none; opacity: 1; animation: eindrehen 0.45s ease-out; }
.sp-schatten.leuchtet { box-shadow: 0 0 0 5px #ffd84d; animation: pulsieren 0.9s ease-in-out infinite; }
/* Formen im Alltag (2c, seit 0.36.0): Ding in Farbe, Form halb durchsichtig darüber */
.sp-alltag { position: relative; background: #fff; border-style: solid; border-color: rgba(91, 70, 54, 0.18); }
.sp-alltag .sp-ding { filter: none; opacity: 1; transform: none; }
.sp-alltag.gefuellt .sp-ding { animation: none; }
.sp-auflage { position: absolute; inset: calc(var(--teil) * 0.08); opacity: 0.55; animation: auflegen 0.45s ease-out; pointer-events: none; }
@keyframes auflegen { from { opacity: 0; } to { opacity: 0.55; } }
/* Formen-Schatten 3a/3b (seit 0.37.0): große Schatten aus mehreren Bereichen, Teile im gleichen Maßstab */
.sp-gross { position: relative; width: var(--gross); height: var(--gross); border-radius: 22px; background: rgba(91, 70, 54, 0.07); border: 3px dashed rgba(91, 70, 54, 0.22); box-sizing: content-box; }
.sp-gross > svg { width: 100%; height: 100%; display: block; overflow: visible; }
.sp-bereich { fill: #b9ab98; stroke: #b9ab98; stroke-width: 1.5; stroke-linejoin: round; transition: fill 0.3s; } /* gleiche Kontur: keine hellen Nähte zwischen den Bereichen */
.sp-bereich.belegt { stroke-width: 3; stroke-linejoin: round; animation: auflegen-voll 0.35s ease-out; }
@keyframes auflegen-voll { from { opacity: 0.4; } to { opacity: 1; } }
.sp-gross.fertig { border-style: solid; border-color: #ffd84d; background: rgba(255, 255, 255, 0.7); }
.sp-feld { position: absolute; border-radius: 10px; pointer-events: none; }
.sp-feld.leuchtet { box-shadow: 0 0 0 4px #ffd84d; animation: pulsieren 0.9s ease-in-out infinite; }
.sp-teil.sp-stueck { width: calc(var(--gross) * var(--w) / 100); height: calc(var(--gross) * var(--h) / 100); padding: 0; box-sizing: content-box; }
.sp-stueck > svg { width: 100%; height: 100%; display: block; }
.sp-teil.sp-blass { opacity: 0.3; transition: opacity 0.4s; }
/* Tier-Schatten 3a–3c (seit 0.38.0) */
.sp-busch { position: relative; overflow: hidden; }
.sp-buschbild { position: absolute; left: -4px; right: -4px; bottom: -3px; height: 52%; pointer-events: none; z-index: 1; }
.sp-buschbild svg { width: 100%; height: 100%; display: block; }
.sp-ring:not(.gefuellt) .sp-umriss { filter: url(#sp-ring); opacity: 1; }
.sp-kn-schatten { position: absolute; inset: 0; opacity: 0.32; filter: brightness(0); }
.sp-kn-farbe { position: absolute; inset: 0; }
.sp-kn { position: absolute; width: 54%; height: 54%; }
.sp-kn svg { width: 100%; height: 100%; }
.sp-kn-farbe .sp-kn { opacity: 0; }
.sp-kn-farbe .sp-kn.da { opacity: 1; animation: auflegen-voll 0.35s ease-out; }
.sp-teil.leuchtet > svg { filter: drop-shadow(0 0 6px #ffd84d) drop-shadow(0 0 3px #ffd84d); animation: pulsieren 0.9s ease-in-out infinite; }
.sp-mehrteilig .sp-teile { align-items: center; gap: 14px 18px; }
.sp-mehrteilig.sp-quer { padding-top: 64px; }
.sp-mehrteilig.sp-quer { flex-direction: row; justify-content: center; gap: 4vw; }
.sp-mehrteilig.sp-quer .sp-teile { max-width: 44%; }
.sp-mehrteilig.sp-quer .sp-schatten-reihe { flex-wrap: nowrap; }
.sp-mehrteilig.sp-quer .ti-pfoten { position: absolute; bottom: 2vh; left: 50%; transform: translateX(-50%); }
.sp-mehrteilig { position: relative; }
.sp-auflage svg { width: 100%; height: 100%; }
.sp-teil {
  width: var(--teil);
  height: var(--teil);
  padding: calc(var(--teil) * 0.08);
  position: relative;
  z-index: 2;
  touch-action: none;
  cursor: grab;
}
.sp-teil > svg { filter: drop-shadow(0 5px 0 rgba(91, 70, 54, 0.18)); transition: transform 0.15s; }
.sp-teil.gefasst { z-index: 10; }
.sp-teil.gefasst > svg,
.sp-teil.gewaehlt > svg { transform: scale(1.12); }
.sp-teil.gewaehlt > svg { filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 4px var(--tuerkis)); }
.sp-teil.gleitet { transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.4, 1); }
.sp-teil.weg { pointer-events: none; z-index: 10; }
.sp-teil.wackelt > svg { animation: wackeln 0.4s ease-in-out 3; }
@keyframes eindrehen {
  from { transform: rotate(0deg) scale(0.85); }
  to { transform: rotate(var(--dreh, 0deg)) scale(1); }
}

/* ---------- Groß und klein ---------- */
.gk {
  --teil: 100px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 80px 3vw 2vh;
}
.gk-teile,
.gk-ziele {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  max-width: 100%;
}
.gk-art-treppe .gk-ziele { flex-wrap: nowrap; gap: 6px; }
.gk-ding {
  width: calc(var(--teil) * var(--s) * 0.9);
  height: calc(var(--teil) * var(--s) * 0.9);
  flex: none;
}
.gk-teil {
  width: var(--vorrat, var(--teil));
  height: var(--vorrat, var(--teil));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  z-index: 2;
  touch-action: none;
  cursor: grab;
}
.gk-teil .gk-ding {
  width: calc(var(--vorrat, var(--teil)) * var(--s) * 0.9);
  height: calc(var(--vorrat, var(--teil)) * var(--s) * 0.9);
}
.gk-teil svg { filter: drop-shadow(0 4px 0 rgba(91, 70, 54, 0.18)); transition: transform 0.15s; }
.gk-teil.gefasst { z-index: 10; }
.gk-teil.gefasst svg,
.gk-teil.gewaehlt svg { transform: scale(1.1); }
.gk-teil.gewaehlt svg { filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 4px var(--tuerkis)); }
.gk-teil.gleitet { transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.4, 1); }
.gk-teil.weg { pointer-events: none; z-index: 10; }
.gk-teil.wackelt svg { animation: wackeln 0.4s ease-in-out 3; }
/* Treppe */
.gk-stufe { display: flex; flex-direction: column; align-items: center; }
.gk-platz {
  width: var(--teil);
  height: var(--teil);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 18px 18px 0 0;
  transition: box-shadow 0.2s;
}
.gk-block {
  width: var(--teil);
  height: calc(var(--teil) * 0.16 * var(--n));
  background: #e9c9a0;
  border: 3px solid #b8915e;
  border-radius: 8px 8px 4px 4px;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.07);
}
/* Steckbrett */
.gk-loch {
  width: var(--teil);
  height: var(--teil);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(var(--teil) * 0.05);
  border-radius: 22px;
  background: #e9c9a0;
  border: 3px solid #b8915e;
  transition: box-shadow 0.2s;
}
.gk-loch .gk-umriss { filter: brightness(0); opacity: 0.3; }
.gk-loch.gefuellt { border-color: #ffd84d; }
.gk-ziel.leuchtet { box-shadow: 0 0 0 5px #ffd84d; animation: pulsieren 0.9s ease-in-out infinite; }
.gk-ziel.gefuellt .gk-ding { animation: eindrehen 0.4s ease-out; }
/* Treppe 3b/3c (seit 0.35.0) */
.gk-luecke { outline: 3px dashed #b8915e; outline-offset: -4px; }
.gk-luecke.gefuellt { outline: none; }
.gk-teil.leuchtet svg,
.gk-teil.gk-gefunden svg { filter: drop-shadow(0 0 6px #ffd84d) drop-shadow(0 0 3px #ffd84d); animation: pulsieren 0.9s ease-in-out infinite; }
.gk-teil.gk-blass { opacity: 0.3; transition: opacity 0.4s; }
.gk-tipp { cursor: pointer; }
.gk-modus-mitte .gk-ziele { display: none; }

/* ---------- Perlenkette ---------- */
.pk {
  --perle: 60px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
  padding: 80px 3vw 2vh;
}
.pk-feld { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; gap: 9vw; }
.pk-quer .pk-feld { flex-direction: column; gap: 5vh; }
.pk-kette { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pk-quer .pk-kette { flex-direction: row; }
.pk-kette::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -18px;
  bottom: -18px;
  width: 3px;
  margin-left: -1.5px;
  background: #8a7a66;
  border-radius: 2px;
}
.pk-quer .pk-kette::before { left: -18px; right: -18px; top: 50%; bottom: auto; width: auto; height: 3px; margin: -1.5px 0 0; }
.pk-perle,
.pk-platz { width: var(--perle); height: var(--perle); position: relative; flex: none; }
.pk-platz { border-radius: 50%; border: 3px dashed #8a7a66; background: rgba(255, 255, 255, 0.75); transition: box-shadow 0.2s; }
.pk-platz.gefuellt { border-color: transparent; background: none; }
.pk-platz.gefuellt > svg { animation: eindrehen 0.35s ease-out; }
.pk-platz.leuchtet,
.pk-lose.leuchtet { border-radius: 50%; box-shadow: 0 0 0 5px #ffd84d; animation: pulsieren 0.9s ease-in-out infinite; }
.pk-platz.wackelt,
.pk-fest.wackelt,
.pk-kette.wackelt { animation: wackeln 0.4s ease-in-out 3; }
/* Perlen-Muster 2c–3c (seit 0.33.0) */
.pk-fest.leuchtet { border-radius: 50%; box-shadow: 0 0 0 5px #ffd84d; animation: pulsieren 0.9s ease-in-out infinite; }
.pk-art-fehler .pk-fest { cursor: pointer; }
.pk-fest.pk-faellt { transition: transform 0.45s ease-in, opacity 0.45s ease-in; transform: translateY(40px) rotate(40deg) scale(0.5); opacity: 0; }
.pk-abstand { margin-top: calc(var(--perle) * 0.4); }
.pk-quer .pk-abstand { margin-top: 0; margin-left: calc(var(--perle) * 0.4); }
.pk-vorlage { gap: 2px; isolation: isolate; }
.pk-vorlage::after { content: ''; position: absolute; inset: -12px -10px; border-radius: 24px; background: rgba(255, 255, 255, 0.55); border: 3px solid #e3d6c3; z-index: -1; }
.pk-vorlage .pk-perle { width: calc(var(--perle) * 0.86); height: calc(var(--perle) * 0.86); }
.pk-vorrat.pk-verdeckt { visibility: hidden; }
.pk-vorrat {
  display: grid;
  grid-template-columns: repeat(var(--spalten, 2), var(--perle));
  gap: calc(var(--perle) * 0.22);
}
.pk-lose { touch-action: none; cursor: grab; z-index: 2; }
.pk-lose svg { filter: drop-shadow(0 4px 0 rgba(91, 70, 54, 0.18)); transition: transform 0.15s; }
.pk-lose.gefasst { z-index: 10; }
.pk-lose.gefasst svg,
.pk-lose.gewaehlt svg { transform: scale(1.15); }
.pk-lose.gewaehlt svg { filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 4px var(--tuerkis)); }
.pk-lose.gleitet { transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.4, 1); }
.pk-lose.weg { pointer-events: none; z-index: 10; }
.pk-glaenzt .pk-perle > svg,
.pk-glaenzt .pk-platz > svg { animation: hupfen 0.5s ease-out; }
.pk-olifi { height: 100%; display: flex; align-items: center; justify-content: center; padding: 80px 4vw 4vh; }
.pk-olifi-figur { position: relative; width: min(86vmin, 480px); aspect-ratio: 1; animation: auftauchen 0.5s ease-out; }
.pk-halskette { position: absolute; inset: 0; }
.pk-hals-perle { position: absolute; width: 11%; aspect-ratio: 1; transform: translate(-50%, -50%); }

/* ---------- Ende ---------- */
.ende {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8vmin;
  background: linear-gradient(180deg, color-mix(in srgb, var(--thema, #fff6e5) 55%, #fff), var(--thema, #fff6e5));
  animation: einblenden 0.4s ease-out;
}
.ende > .huegel { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 22vh; z-index: 0; pointer-events: none; }
.ende > :not(.huegel) { position: relative; z-index: 1; }
.ende button {
  width: min(32vmin, 180px);
  height: min(32vmin, 180px);
  border-radius: 50%;
  padding: 5vmin;
  box-shadow: var(--schatten);
  animation: auftauchen 0.45s backwards cubic-bezier(0.3, 1.6, 0.5, 1);
}
.knopf-nochmal {
  background: var(--tuerkis);
}
.knopf-zurueck {
  background: #fff;
}
.ende .knopf-nochmal { animation-delay: 0.12s !important; }
.ende button:active {
  transform: scale(0.94);
}

/* Olifi am Rundenende (seit 0.19.0): im Hochformat über den Knöpfen, im Querformat links daneben */
.ende.mit-olifi { flex-wrap: wrap; align-content: center; row-gap: 3vh; }
.ende-olifi { flex-basis: 100%; height: min(34vmin, 200px); display: flex; justify-content: center; animation: auftauchen 0.45s backwards cubic-bezier(0.3, 1.6, 0.5, 1); }
.ende-olifi > svg { width: auto; height: 100%; aspect-ratio: 1; }
@media (orientation: landscape) {
  .ende.mit-olifi { flex-wrap: nowrap; }
  .ende-olifi { flex-basis: auto; width: min(44vh, 220px); height: min(44vh, 220px); }
}

/* Olifi schaut im Spiel kurz vom unteren Rand herein (seit 0.19.0) */
.olifi-gast {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) - 1vmin);
  left: calc(env(safe-area-inset-left) + 1vw);
  width: min(32vmin, 170px);
  aspect-ratio: 1;
  z-index: 15;
  pointer-events: none;
  transform: translateY(115%);
  transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.olifi-gast.rechts { left: auto; right: calc(env(safe-area-inset-right) + 1vw); }
.olifi-gast.rechts > svg { transform: scaleX(-1); }
.olifi-gast.da { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .olifi-gast { transition: none; } }

/* ---------- Wie geht's dir? (seit 0.21.0) ---------- */
.gf-karte { background: #FFF1E0; }
.gf-karte.gewaehlt { box-shadow: 0 0 0 4px #C9B79C, var(--schatten); }
.gf-einstieg .gf-olifi { width: min(40vmin, 220px); aspect-ratio: 1; flex-shrink: 0; transition: width 0.4s; }
.gf-einstieg.geantwortet .gf-olifi { width: min(70vmin, 340px); }
.gf-einstieg.geantwortet .ti-gitter { display: none; }
.gf-olifi-karte { background: #E9F6F3; }
.gf-einstieg .ti-gitter { transition: opacity 0.4s; }
.gf-einstieg .ti-gitter.gf-weg { opacity: 0; pointer-events: none; }
.gf-szene {
  width: min(86vw, 52vh, 420px);
  aspect-ratio: 1;
  background: #fff;
  border-radius: 28px;
  padding: 3%;
  box-shadow: var(--schatten);
}
.gf-reihe { grid-template-columns: repeat(var(--spalten), var(--karte)); }
@media (orientation: landscape) {
  .gf-geschichte { flex-direction: row; flex-wrap: wrap; justify-content: center; align-content: center; column-gap: 4vw; }
  .gf-geschichte .gf-szene { width: min(44vw, 62vh, 380px); }
  .gf-geschichte .gf-reihe { grid-template-columns: repeat(2, var(--karte)); }
  .gf-geschichte .ti-pfoten { flex-basis: 100%; justify-content: center; }
  .gf-einstieg { flex-direction: row; column-gap: 6vw; padding-right: 120px; }
}

/* ---------- Eltern-Bereich (für Erwachsene: hier ist Schrift erlaubt) ---------- */
.eltern-ebene {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(46, 42, 38, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  user-select: text;
  -webkit-user-select: text;
}
.eltern-karte {
  background: #fff;
  border-radius: 20px;
  padding: 20px 22px;
  width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  font-size: 16px;
  line-height: 1.45;
  color: #2e2a26;
}
.eltern-karte h2 { margin: 0 0 8px; font-size: 21px; }
.eltern-karte h3 { margin: 18px 0 4px; font-size: 16px; }
.eltern-karte p { margin: 6px 0; }
.eltern-karte ul { padding-left: 18px; margin: 8px 0; }
.eltern-karte li { margin: 6px 0; }
.eltern-karte summary { cursor: pointer; color: #1c7f73; margin-top: 6px; }
.eltern-klein { color: #7a6f66; font-size: 13px; }
.eltern-pruefung { font-size: 14px; list-style: none; padding-left: 0; }
.eltern-anzeige {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 6px;
  min-height: 40px;
  margin: 6px 0;
  border-bottom: 2px solid #eee3d2;
}
.eltern-zahlen {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.eltern-zahlen button {
  height: 48px;
  border-radius: 12px;
  background: #f4ede2;
  font-size: 20px;
  font-weight: 600;
  color: #2e2a26;
}
.eltern-zeile {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.eltern-knopf {
  background: #1c7f73;
  color: #fff;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 16px;
  font-weight: 600;
}
.eltern-knopf.leise { background: #f4ede2; color: #2e2a26; }
.eltern-knopf.gross { width: 100%; padding: 14px; margin: 6px 0; }

/* Auswahlknöpfe im Eltern-Menü (z. B. Tageslimit) */
.eltern-wahl { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.eltern-wahl button {
  padding: 9px 13px;
  border-radius: 10px;
  background: #f4ede2;
  font-size: 15px;
  color: #2e2a26;
}
.eltern-wahl button.aktiv { background: #1c7f73; color: #fff; font-weight: 600; }
.eltern-knopf[hidden] { display: none; }

/* ---------- Eltern-Bereich (ganzer Bildschirm) ---------- */
.eltern-ebene.eb {
  display: block;
  padding: 0;
  background: var(--grund);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: #2e2a26;
}
.eb-seite {
  min-height: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: max(20px, env(safe-area-inset-top)) 20px 28px;
  font-size: 16px;
  line-height: 1.45;
}
.eb-kopf { display: flex; align-items: center; gap: 12px; }
.eb-kopf h1 { margin: 0; font-size: 24px; line-height: 1.2; }
.eb-zurueck {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(91, 70, 54, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.eb-text { margin: 0; font-size: 15px; color: #4a4039; }
ul.eb-text { padding-left: 18px; }
.eb-klein { font-size: 13px; color: #6b6058; }
.eb-mitte { text-align: center; margin: 0; }
.eb-fett { font-weight: 700; }
.eb-luft { flex-grow: 1; }
.eb-kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.eb-kachel {
  background: #fff;
  border-radius: 22px;
  padding: 18px 16px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  color: #2e2a26;
  box-shadow: 0 4px 0 rgba(91, 70, 54, 0.12);
}
.eb-kachel:active { transform: scale(0.98); }
.eb-symbol { width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.eb-kachel-titel { font-size: 18px; font-weight: 700; }
.eb-karte {
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.eb-karte h2 { margin: 0; font-size: 17px; }
.eb-karte ul { margin: 0; }
.eb-karte summary { font-weight: 700; cursor: pointer; }
details.eb-karte { display: block; }
.eb-zeile { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.eb-ok { display: flex; align-items: center; gap: 8px; color: #1c7f73; font-weight: 600; }
.eb-balken { height: 10px; border-radius: 5px; background: #f1e8da; overflow: hidden; }
.eb-balken > div { height: 100%; border-radius: 5px; background: #1c7f73; }
.eb-wahl { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.eb-wahl button { padding: 10px 0; border-radius: 12px; background: #f4ede2; color: #2e2a26; font-size: 14px; }
.eb-wahl button.aktiv { background: #1c7f73; color: #fff; font-weight: 700; }
.eb-knopf {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: #1c7f73;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.eb-knopf.leise { background: #f4ede2; color: #2e2a26; font-weight: 500; }
.eb-knopf.warnung { background: transparent; color: #a12a2a; border: 2px solid #e8c4c0; font-weight: 500; }
.eb-knopf:disabled { opacity: 0.6; }
/* Kinderprofile im Eltern-Bereich */
.eb-kind {
  background: #fff;
  border-radius: 22px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  color: #2e2a26;
  box-shadow: 0 4px 0 rgba(91, 70, 54, 0.12);
}
.eb-kind-olifi { width: 72px; height: 72px; flex: none; }
.eb-kind-olifi.klein { width: 56px; height: 56px; }
.eb-kind-text { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; min-width: 0; }
.eb-kind-kopf { display: flex; align-items: center; gap: 12px; }
.eb-neu {
  border: 3px dashed #b8a895;
  border-radius: 22px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 17px;
  font-weight: 600;
  color: #4a4039;
  background: transparent;
}
.eb-neu-plus { width: 56px; height: 56px; border-radius: 28px; background: #fff; display: flex; align-items: center; justify-content: center; }
.eb-gross-olifi { width: 150px; height: 150px; align-self: center; }
.eb-farben { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; justify-items: center; }
.eb-farbe {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 0 0 2px #e6dccb;
}
.eb-farbe.aktiv { border-color: #2e2a26; box-shadow: 0 0 0 2px #fff; }
.eb-zubehoer { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.eb-zub, .eb-code {
  height: 72px;
  border-radius: 16px;
  background: #fbf7f0;
  border: 3px solid transparent;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.eb-zub > svg, .eb-code > svg { width: 52px; height: 52px; }
.eb-zub.aktiv, .eb-code.aktiv { background: #e3f5f2; border-color: #1c7f73; }
.eb-codes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.eb-eingabe {
  font: inherit;
  font-size: 17px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #d8ccbb;
  background: #fffbf3;
  color: #2e2a26;
  user-select: text;
  -webkit-user-select: text;
}
.eb-zeile h2 { margin: 0; }
.eb-schalter {
  width: 60px;
  height: 34px;
  flex: none;
  border-radius: 17px;
  padding: 3px;
  background: #cfc4b4;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.eb-schalter.an { background: #1c7f73; justify-content: flex-end; }
.eb-schalter > span { width: 28px; height: 28px; border-radius: 14px; background: #fff; display: block; }

/* ---------- Konfetti ---------- */
.konfetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 15;
}
.konfetti i {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border-radius: 4px;
  animation: fallen linear forwards;
}

/* ---------- Bewegungen ---------- */
.hupft {
  animation: hupfen 2.4s ease-in-out infinite;
}
@keyframes atmen {
  50% { transform: scale(1.06); }
}
@keyframes hupfen {
  50% { transform: translateY(-6px); }
}
@keyframes auftauchen {
  from { transform: scale(0); opacity: 0; }
}
@keyframes reinplumpsen {
  from { transform: translateY(-30px) scale(1.3); opacity: 0; }
}
@keyframes wackeln {
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}
@keyframes pulsieren {
  50% { transform: scale(1.1); }
}
@keyframes freuen {
  40% { transform: scaleY(0.9) scaleX(1.08); }
  70% { transform: scaleY(1.06) scaleX(0.97); }
}
@keyframes einblenden {
  from { opacity: 0; }
}
@keyframes fallen {
  to { transform: translate(var(--drift), 110vh) rotate(720deg); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.eb-kind > svg { width: 20px; height: 20px; flex: none; }
.eb-neu-plus > svg { width: 26px; height: 26px; }

/* Eltern-Bereich: Lernen (seit 0.23.0) */
.eb-start-wahl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.eb-start-wahl button { padding: 10px 6px; border-radius: 12px; background: #f4ede2; color: #2e2a26; font-size: 15px; line-height: 1.25; text-align: center; }
.eb-start-wahl button > svg { width: 30px; height: 30px; display: block; margin: 0 auto 2px; background: #fff; border-radius: 50%; padding: 3px; }
.eb-start-wahl button small { display: block; font-size: 12px; color: #6b6058; }
.eb-start-wahl button.aktiv { background: #1c7f73; color: #fff; font-weight: 700; }
.eb-start-wahl button.aktiv small { color: #d9f3ef; }
.eb-link { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 0 2px; font-size: 16px; color: #1c7f73; font-weight: 600; background: none; }
.eb-link > svg { width: 20px; height: 20px; flex: none; }
.eb-karte > p.eb-text { margin: 0; }
.eb-bereich-symbol { display: inline-flex; font-style: normal; }
.eb-bereich-symbol > svg { width: 18px; height: 18px; }
.eb-lf { display: grid; grid-template-columns: 42px 1fr; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid #efe6d8; }
.eb-lf:first-of-type { border-top: 0; }
.eb-lf-symbol { width: 42px; height: 42px; padding: 3px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; grid-row: span 2; }
.eb-lf-name { font-size: 16px; font-weight: 600; color: #2e2a26; display: flex; justify-content: space-between; gap: 8px; }
.eb-lf-name > span { display: inline-flex; align-items: center; gap: 3px; font-weight: 500; color: #6b6058; font-size: 14px; white-space: nowrap; }
.eb-lf.leer .eb-lf-name > span { font-style: italic; }
.eb-balken { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.eb-balken i { height: 8px; border-radius: 4px; background: #efe6d8; position: relative; overflow: hidden; }
.eb-balken i b { position: absolute; inset: 0 auto 0 0; background: var(--lf); border-radius: 4px; }
.eb-start-wahl.gesperrt button:not(.aktiv) { opacity: 0.45; }
.eb-start-wahl.gesperrt button { cursor: default; }
.eb-lf-symbol > svg { width: 100%; height: 100%; }

/* Knopf „Kind wechseln“ (seit 0.25.0): spielendes Kind groß vorn, Geschwister klein und blass dahinter */
.knopf-kinder { padding: 0; overflow: hidden; }
.kinder-bild { position: relative; display: block; width: 100%; height: 100%; }
.kinder-bild > span { position: absolute; display: block; }
.kinder-bild .kb-vorn { width: 86%; height: 86%; left: 7%; bottom: -14%; }
.kinder-bild .kb-hinten { width: 50%; height: 50%; top: 4%; opacity: 0.45; filter: saturate(0.5); }
.andere-1 .kb-1 { right: 0; }
.andere-1 .kb-vorn { left: -2%; }
.andere-2 .kb-1 { left: 0; }
.andere-2 .kb-2 { right: 0; }
.andere-3 .kb-hinten { width: 42%; height: 42%; }
.andere-3 .kb-1 { left: -2%; top: 10%; }
.andere-3 .kb-2 { left: 29%; top: 0; }
.andere-3 .kb-3 { right: -2%; top: 10%; }

/* Name in den Profil-Kacheln (seit 0.27.0) */
.profil-knopf.mit-name, .profil-klein.mit-name { display: flex; flex-direction: column; align-items: center; padding-bottom: 4px; }
.profil-knopf.mit-name > svg, .profil-klein.mit-name > svg { flex: 1; min-height: 0; width: 100%; }
.profil-name { font: 700 clamp(13px, calc(var(--profil, 120px) * 0.12), 22px) / 1.1 system-ui, sans-serif; color: #4a3b30; padding: 2px 0 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profil-klein .profil-name { font-size: 13px; }
/* Zwei Näpfe sind kleiner – das Futter darin entsprechend größer, damit es greifbar bleibt */
.zn-naepfe:has(.zn-napf + .zn-napf) .zn-stueck { width: 30cqw; height: 30cqw; margin: -15cqw 0 0 -15cqw; }
@media (orientation: portrait) { .zn-naepfe:has(.zn-napf + .zn-napf) { gap: 2vw; } .zn-naepfe:has(.zn-napf + .zn-napf) .zn-napf { width: 47vw; } }

/* Wer frisst was? (seit 0.29.0) */
.wf { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-around; padding: 84px 3vw 2vh; gap: 2vh; }
.wf-tiere { --karte: min(42vw, 26vh, 220px); display: flex; flex-wrap: wrap; justify-content: center; gap: 4vw; max-width: 94vw; }
.wf-tiere[data-n="3"] { --karte: min(40vw, 19vh, 180px); }
.wf-tiere[data-n="4"] { --karte: min(40vw, 19vh, 170px); }
.wf-tier { --teil: var(--karte); }
.wf-unten { display: flex; flex-direction: column; align-items: center; gap: 1.5vh; }
.wf-platz { width: min(30vw, 15vh, 130px); height: min(30vw, 15vh, 130px); border-radius: 50%; background: #fff8; box-shadow: inset 0 2px 6px #0001; }
.wf-futter { width: 100%; height: 100%; background: #fff; border-radius: 50%; padding: 14%; box-shadow: var(--schatten); touch-action: none; cursor: grab; }
.wf-futter.gleitet { transition: transform 0.3s cubic-bezier(0.3, 0.7, 0.4, 1); }
.wf-futter.weg { opacity: 0; transition: opacity 0.2s; }
.wf-futter.huepft > svg { animation: hupfen-gross 0.5s ease-out; }
.wf-futter.kommt { animation: auftauchen 0.35s ease-out; }
@media (orientation: landscape) {
  .wf { flex-direction: row; justify-content: center; padding: 2vh 3vw 2vh 96px; gap: 5vw; }
  .wf-tiere { --karte: min(24vw, 36vh, 180px); max-width: 66vw; gap: 2.5vw; }
  .wf-tiere[data-n="3"] { --karte: min(19vw, 36vh, 170px); }
  .wf-tiere[data-n="4"] { --karte: min(15vw, 34vh, 150px); flex-wrap: nowrap; }
  .wf-platz { width: min(16vw, 26vh, 120px); height: min(16vw, 26vh, 120px); }
}

/* ---------- Testwerkzeug (nur Entwicklungsmodus, seit 0.34.0) ---------- */
.tw-plakette { position: absolute; top: 18px; right: 14px; z-index: 60; background: #26215c; color: #fff; border: 0; border-radius: 10px; padding: 7px 11px; font: 500 13px/1.2 ui-monospace, monospace; cursor: pointer; }
.tw-wahl { position: absolute; top: 60px; right: 12px; z-index: 61; width: min(300px, 88vw); background: #fff; color: #26215c; border-radius: 14px; border: 1px solid #d8d4ea; padding: 12px; box-shadow: 0 6px 20px rgba(38, 33, 92, 0.18); font: 14px/1.4 system-ui, sans-serif; }
.tw-gitter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.tw-gitter button, .tw-pm button { border: 1px solid #cfcae6; background: #fff; color: #26215c; border-radius: 8px; padding: 8px 0; font: 500 15px system-ui, sans-serif; }
.tw-gitter button.aktiv { background: #26215c; color: #fff; }
.tw-pm { display: flex; gap: 6px; }
.tw-pm button { flex: 1; }
.tw-titel { font-weight: 600; margin-bottom: 4px; }
.tw-klein { font-size: 12px; color: #6a6494; margin-top: 6px; }
.ende > .tw-auswertung { order: -1; flex-basis: 100%; display: flex; justify-content: center; }
.tw-karte { width: min(340px, 90vw); max-height: 36vh; overflow: auto; background: rgba(255, 255, 255, 0.94); color: #26215c; border-radius: 14px; border: 1px solid #d8d4ea; padding: 10px 12px; font: 13px/1.5 ui-monospace, monospace; }
.ende.mit-test .ende-olifi { height: min(24vmin, 150px); }
@media (orientation: landscape) {
  .ende.mit-test.mit-olifi, .ende.mit-test { flex-wrap: nowrap; }
  .ende.mit-test .ende-olifi { flex-basis: auto; }
  .ende > .tw-auswertung { order: 5; flex-basis: auto; }
  .tw-karte { width: min(300px, 38vw); max-height: 78vh; }
}
.tw-z { display: flex; justify-content: space-between; gap: 10px; }
.tw-sicher { color: #3b6d11; } .tw-versuch { color: #854f0b; } .tw-fehltipp, .tw-hinweis, .tw-loesung { color: #a32d2d; }
.tw-summe { border-top: 1px solid #d8d4ea; margin-top: 6px; padding-top: 6px; }
.spiel:has(.ende) .tw-plakette, .spiel:has(.ende) .tw-wahl { display: none; }
