/* Flauschis — mobile-first, fingergroße Buttons, Pastell-Look */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg1: #ffe3f0;
  --bg2: #d6ecff;
  --card: #fffaf5;
  --accent: #ff8fb8;
  --accent2: #8fd0ff;
  --text: #5a4a5e;
  --shadow: 0 6px 16px rgba(120, 80, 120, 0.18);
  --radius: 24px;
}

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: "Comic Sans MS", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
}

body {
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  transition: background 2s;
}
body.night {
  --bg1: #3b3560;
  --bg2: #1f2547;
  --card: #4a4472;
  --text: #f0e8ff;
  --shadow: 0 6px 16px rgba(0, 0, 20, 0.4);
}

#app { height: 100%; display: flex; flex-direction: column; }

/* ---------- Screens ---------- */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  flex: 1;
  padding: max(16px, env(safe-area-inset-top)) 16px 24px;
  overflow-y: auto;
  position: relative;
}
.screen.active { display: flex; }

h1 { font-size: 1.7rem; text-align: center; margin: 10px 0; }
h2 { font-size: 1.4rem; text-align: center; margin: 8px 0; }
.hint { font-size: 1.1rem; margin: 4px 0; }

.loading-heart { font-size: 5rem; animation: pulse 1s infinite alternate; margin-top: 30vh; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.25); } }

/* ---------- Buttons ---------- */
.btn {
  min-height: 64px; min-width: 64px;
  border: none; border-radius: var(--radius);
  background: var(--accent);
  color: #fff; font-size: 1.3rem; font-family: inherit; font-weight: bold;
  padding: 14px 26px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
}
.btn:active { transform: scale(0.93); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.big { width: min(92vw, 360px); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: none; border: 3px dashed var(--accent); }

.icon-btn {
  min-width: 64px; min-height: 64px;
  border: none; border-radius: 50%;
  background: var(--card);
  font-size: 1.8rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn.back { position: absolute; top: 12px; left: 12px; z-index: 5; }
/* Screens mit Zurück-Button: Platz lassen, damit nichts überlappt */
#screen-login, #screen-register, #screen-name { padding-top: 88px; }
/* Tierauswahl: kompakter oben, damit alle 5 Tiere ohne Scrollen passen */
#screen-species { padding-top: 66px; }
#screen-species h1 { margin: 4px 0 8px; font-size: 1.5rem; }
.icon-btn.logout-corner { position: absolute; top: 12px; right: 12px; z-index: 5; }
.icon-btn.close { position: absolute; top: 10px; right: 10px; z-index: 5; }

/* ---------- Nutzer-Schnellauswahl ---------- */
.user-list { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; max-width: 420px; }
.user-chip {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 96px; min-height: 96px;
  background: var(--card); border: none; border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; font-family: inherit;
  font-size: 1.05rem; color: var(--text); padding: 10px;
}
.user-chip .avatar { font-size: 2.6rem; }
.user-chip:active { transform: scale(0.93); }

/* ---------- PIN-Pad (Zahlenschloss) ---------- */
.name-input {
  font-family: inherit; font-size: 1.5rem; text-align: center;
  border: 4px solid var(--accent2); border-radius: var(--radius);
  padding: 12px; width: min(88vw, 320px);
  background: var(--card); color: var(--text); outline: none;
}
.pin-dots { display: flex; gap: 14px; height: 30px; }
.pin-dots span {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--accent);
  background: transparent; transition: background 0.15s;
}
.pin-dots span.filled { background: var(--accent); }
.pin-pad {
  display: grid; grid-template-columns: repeat(3, 76px); gap: 12px;
  justify-content: center;
}
.pin-pad button {
  width: 76px; height: 76px; border-radius: 50%;
  border: none; background: var(--card); color: var(--text);
  font-size: 1.9rem; font-family: inherit; font-weight: bold;
  box-shadow: var(--shadow); cursor: pointer;
}
.pin-pad button:active { transform: scale(0.9); background: var(--accent2); }
.error-msg { color: #d9534f; font-size: 1.1rem; min-height: 1.4em; text-align: center; }
body.night .error-msg { color: #ffb3b0; }

/* ---------- Tierauswahl ---------- */
.species-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: min(94vw, 420px); }
.species-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--card); border: none; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 8px; cursor: pointer;
  font-family: inherit; font-size: 1.05rem; color: var(--text); font-weight: bold;
}
.species-card .big-emoji { font-size: 3.4rem; }
.species-card:active { transform: scale(0.93); }
/* Sprite-Wrap + Bild kompakt halten, damit alle 5 Tiere ohne Scrollen passen */
.species-card > div { width: min(22vw, 92px); height: min(22vw, 92px); }
.species-card svg, .species-card img { width: 100%; height: 100%; }

.name-preview svg, .name-preview img { width: 130px; height: 130px; }
.name-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 400px; }
.name-chip {
  border: none; border-radius: 999px; background: var(--accent2); color: #fff;
  font-family: inherit; font-size: 1.15rem; font-weight: bold;
  padding: 14px 20px; min-height: 64px; box-shadow: var(--shadow); cursor: pointer;
}
.name-chip:active { transform: scale(0.93); }

/* ---------- Hauptscreen ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 520px;
}
.pet-title { font-size: 1.3rem; font-weight: bold; text-align: center; }
.pet-title small { display: block; font-size: 0.85rem; opacity: 0.75; }

/* Pet-Umschalter (max. 2 Pets pro Nutzer) */
.pet-switcher { display: flex; gap: 8px; justify-content: center; align-items: center; width: 100%; max-width: 520px; flex-wrap: wrap; }
.pet-switcher:empty { display: none; }
.pet-tab {
  display: flex; align-items: center; gap: 6px; min-height: 52px;
  border: none; border-radius: 999px; background: var(--card); color: var(--text);
  font-family: inherit; font-weight: bold; font-size: 1rem; padding: 6px 16px;
  box-shadow: var(--shadow); cursor: pointer; opacity: 0.55; transition: opacity 0.2s;
}
.pet-tab.active { opacity: 1; outline: 3px solid var(--accent); }
.pet-tab:active { transform: scale(0.94); }
.pet-tab .em { font-size: 1.5rem; }
.pet-add {
  min-width: 52px; min-height: 52px; border-radius: 50%;
  border: 3px dashed var(--accent); background: transparent; color: var(--accent);
  font-size: 1.6rem; font-weight: bold; cursor: pointer;
}
.pet-add:active { transform: scale(0.9); }

.stats { display: flex; gap: 8px; width: 100%; max-width: 520px; }
.stat { flex: 1; text-align: center; }
.stat .stat-emoji { font-size: 1.5rem; }
.stat .bar {
  height: 16px; border-radius: 8px; background: rgba(255,255,255,0.55);
  overflow: hidden; margin-top: 2px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
body.night .stat .bar { background: rgba(0,0,0,0.25); }
.stat .fill { height: 100%; border-radius: 8px; transition: width 0.6s; }
.stat .face { font-size: 1.05rem; height: 1.3em; }

.heart-progress {
  width: 100%; max-width: 520px; height: 14px; border-radius: 7px;
  background: rgba(255,255,255,0.55); overflow: hidden; position: relative;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
body.night .heart-progress { background: rgba(0,0,0,0.25); }
.heart-progress .fill {
  height: 100%; background: linear-gradient(90deg, #ff8fb8, #ff5c9d);
  border-radius: 7px; transition: width 0.6s;
}

.pet-area {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative;
  width: 100%;
}
.pet-sprite { width: min(64vw, 300px); height: min(64vw, 300px); cursor: pointer; position: relative; }
.pet-sprite svg, .pet-sprite img { width: 100%; height: 100%; }
/* Kein natives Bild-Ziehen (sonst würde man beim Streicheln/Baden das PNG
 * verschieben statt die Geste auszulösen). pointer-events: none leitet die
 * Zeiger-Ereignisse an den Container-Handler (Streicheln/Baden) weiter. */
.pet-sprite img, .pet-sprite svg, .name-preview img, .name-preview svg {
  -webkit-user-drag: none; user-select: none; pointer-events: none;
}
.pet-sprite img { -webkit-touch-callout: none; }
.pet-sprite.small { width: 160px; height: 160px; }
/* Alle Animationen setzen transform-origin unten-mitte (50% 100%): so wirkt
 * jede Bewegung wie ein Wesen, das auf dem Boden hüpft/wippt — nicht wie ein
 * Bild, das gedehnt wird. Squash/Stretch immer an den Bodenkontakt gekoppelt
 * (unten breit/flach, oben schmal/hoch) = lebendige Physik statt Verzerrung.
 * Der Bodenschatten wippt synchron mit. */
.pet-sprite.breathe, .pet-sprite.hop, .pet-sprite.cheer, .pet-sprite.wiggle,
.pet-sprite.tilt, .pet-sprite.walking, .pet-sprite.sleeping, .pet-sprite.petting {
  transform-origin: 50% 100%;
}

/* Grundzustand: ruhiges, organisches Atmen/Wippen (der mitlaufende Schatten
 * gibt die Lebendigkeit dazu; die großen Sprünge machen die Extra-Moves) */
.pet-sprite.breathe { animation: idleHop 2.1s ease-in-out infinite; }
@keyframes idleHop {
  0%, 100% { transform: translateY(0) scale(1.02, 0.985); }    /* Boden: leicht flach */
  50%      { transform: translateY(-13px) scale(0.99, 1.01); }  /* oben: leicht schmal */
}

/* Großer, federnder Hüpfer mit Anlauf, Landungs-Squash und Nachhüpfer */
.pet-sprite.hop { animation: bigHop 0.8s cubic-bezier(0.3, 0.7, 0.35, 1); }
@keyframes bigHop {
  0%   { transform: translateY(0) scale(1.08, 0.92); }
  22%  { transform: translateY(-54px) scale(0.93, 1.09); }
  50%  { transform: translateY(0) scale(1.12, 0.88); }
  70%  { transform: translateY(-16px) scale(0.98, 1.02); }
  100% { transform: translateY(0) scale(1); }
}

/* Freudensprung — hoch mit fröhlichem Schlenker nach links/rechts */
.pet-sprite.cheer { animation: cheer 1s ease-in-out; }
@keyframes cheer {
  0%   { transform: translateY(0) rotate(0) scale(1.06, 0.94); }
  22%  { transform: translateY(-44px) rotate(-9deg) scale(0.95, 1.06); }
  46%  { transform: translateY(-50px) rotate(9deg) scale(0.96, 1.05); }
  66%  { transform: translateY(0) rotate(-4deg) scale(1.1, 0.9); }
  82%  { transform: translateY(-12px) rotate(2deg) scale(0.99, 1.01); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}

/* Wackelpudding — sich setzender Flausch (Jelly-Wobble) */
.pet-sprite.wiggle { animation: jelly 0.75s ease-in-out; }
@keyframes jelly {
  0%, 100% { transform: translateY(0) scale(1); }
  18%  { transform: translateY(0) scale(1.12, 0.88); }
  40%  { transform: translateY(-8px) scale(0.9, 1.1); }
  60%  { transform: translateY(0) scale(1.06, 0.94); }
  80%  { transform: translateY(-3px) scale(0.98, 1.02); }
}

/* Neugieriges Kopf-Neigen mit kleinem Hüpfer */
.pet-sprite.tilt { animation: headTilt 1.1s ease-in-out; }
@keyframes headTilt {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-6px) rotate(-8deg); }
  65% { transform: translateY(-4px) rotate(7deg); }
}

/* Watscheln beim Spazieren — deutliches Wiegen mit Auf und Ab */
.pet-sprite.walking { animation: waddleSoft 0.44s ease-in-out infinite; }
@keyframes waddleSoft {
  0%, 100% { transform: rotate(-5deg) translateY(0) scale(1.03, 0.97); }
  50%      { transform: rotate(5deg) translateY(-8px) scale(0.98, 1.02); }
}
/* Blickrichtung: Kind läuft nach links → Tier schaut nach links */
.pet-sprite.face-left > div:first-child { transform: scaleX(-1); }

/* Schlafen — ruhiges, tiefes Bauch-Heben */
.pet-sprite.sleeping { animation: sleepBreathe 3.8s ease-in-out infinite; }
@keyframes sleepBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.03, 1.04); }
}

/* Ei-Wackeln — weich, wie ein wippendes Püppchen */
.pet-sprite.wobble { animation: wobble 1.7s ease-in-out infinite; transform-origin: 50% 94%; }
@keyframes wobble { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* Streicheln — fröhliches, lebhaftes Wippen von Seite zu Seite */
.pet-sprite.petting { animation: pettingHappy 0.5s ease-in-out infinite; cursor: grab; }
@keyframes pettingHappy {
  0%, 100% { transform: rotate(-5deg) translateY(0) scale(1.03, 0.97); }
  50%      { transform: rotate(5deg) translateY(-9px) scale(0.98, 1.02); }
}

/* Bodenschatten — Position/Größe/Deckkraft werden per JS jeden Frame an die
 * tatsächliche Position und Sprunghöhe des Tiers gekoppelt (driveShadow),
 * damit er exakt unter den Füßen sitzt und beim Springen/Laufen mitgeht. */
.pet-shadow {
  position: absolute; height: 24px; z-index: 0; pointer-events: none;
  transform-origin: center center; will-change: transform, opacity;
  background: radial-gradient(ellipse at center, rgba(120,90,120,0.30), rgba(120,90,120,0) 70%);
}
body.night .pet-shadow { background: radial-gradient(ellipse at center, rgba(10,5,30,0.40), rgba(10,5,30,0) 70%); }

.egg-hint { font-size: 1.15rem; text-align: center; animation: pulse 1.2s infinite alternate; }

.float-heart {
  position: absolute; font-size: 1.9rem; pointer-events: none;
  animation: floatUp 1.2s ease-out forwards;
}
@keyframes floatUp {
  from { opacity: 1; transform: translateY(0) scale(0.7); }
  to { opacity: 0; transform: translateY(-90px) scale(1.4); }
}

/* Wunsch-Blase: das Tier bittet um Futter/Schlaf/Bad/Spiel */
.wish-bubble {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  min-width: 76px; min-height: 76px;
  border: none; border-radius: 50% 50% 50% 12px;
  background: var(--card); box-shadow: var(--shadow);
  font-size: 2.2rem; cursor: pointer;
  animation: wishBounce 1.4s ease-in-out infinite;
}
.wish-bubble small { display: block; font-size: 0.7rem; font-weight: bold; color: var(--text); }
@keyframes wishBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.wish-bubble:active { transform: scale(0.9); }

/* Himmels-Deko: Sonne/Wolken am Tag, Mond/Sterne in der Nacht */
.sky-layer { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.pet-sprite, .wish-bubble, .gift-btn, .album-btn { z-index: 1; }
.sky-sun { position: absolute; top: 4%; left: 6%; font-size: 3rem; animation: sunSpin 24s linear infinite; }
@keyframes sunSpin { to { transform: rotate(360deg); } }
.sky-cloud { position: absolute; font-size: 2.4rem; opacity: 0.85; animation: cloudDrift linear infinite; }
@keyframes cloudDrift { from { transform: translateX(-120px); } to { transform: translateX(calc(100vw + 120px)); } }
.sky-moon { position: absolute; top: 4%; left: 6%; font-size: 2.8rem; animation: moonBob 5s ease-in-out infinite; }
@keyframes moonBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.sky-star { position: absolute; font-size: 1.3rem; animation: starTwinkle ease-in-out infinite; }
@keyframes starTwinkle { 0%,100% { opacity: 0.25; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.15); } }

/* Futter fliegt zum Tier, das Tier mampft */
.flying-food {
  position: fixed; z-index: 60; font-size: 3rem; pointer-events: none;
  transition: left 0.8s cubic-bezier(0.3, -0.2, 0.6, 1), top 0.8s cubic-bezier(0.3, -0.2, 0.6, 1), transform 0.8s;
}
.pet-sprite.eating { animation: chomp 0.35s ease-in-out 3; transform-origin: 50% 80%; }
@keyframes chomp { 0%,100% { transform: scale(1,1); } 50% { transform: scale(1.06, 0.93); } }

/* Tagesgeschenk & Album-Knopf */
.gift-btn {
  position: absolute; bottom: 8px; right: 8px; z-index: 4;
  min-width: 76px; min-height: 76px;
  border: none; border-radius: 50%; background: var(--card);
  font-size: 2.4rem; box-shadow: var(--shadow); cursor: pointer;
  animation: wishBounce 1.1s ease-in-out infinite;
}
.gift-btn:active { transform: scale(0.9); }
.album-btn {
  position: absolute; bottom: 8px; left: 8px; z-index: 4;
  min-width: 64px; min-height: 64px;
  border: none; border-radius: 50%; background: var(--card);
  font-size: 1.8rem; box-shadow: var(--shadow); cursor: pointer;
}
.album-btn:active { transform: scale(0.9); }

/* Sticker-Album */
.album-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
.album-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(255, 220, 235, 0.5); border-radius: 18px; padding: 10px;
  font-size: 0.95rem; font-weight: bold; text-align: center;
}
body.night .album-card { background: rgba(255,255,255,0.1); }
.album-card svg { width: 84px; height: 84px; }
.album-card.locked { opacity: 0.6; }
.album-card.locked .album-silhouette {
  width: 84px; height: 84px; display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; filter: grayscale(1); opacity: 0.5;
}
.album-card.current { outline: 4px solid var(--accent); }

/* Seifenblasen-Minispiel */
.mg-bubble {
  position: absolute; cursor: pointer;
  min-width: 64px; min-height: 64px; text-align: center;
  border: none; background: transparent; padding: 0;
}
.mg-bubble.popped { animation: bubblePop 0.18s ease-out forwards; }
@keyframes bubblePop { to { transform: scale(1.9); opacity: 0; } }

/* Schmetterlings-Besucher */
.butterfly {
  position: absolute; z-index: 3;
  min-width: 64px; min-height: 64px;
  border: none; background: transparent; padding: 0;
  font-size: 2.6rem; cursor: pointer;
  transition: left 3.2s ease-in-out, top 3.2s ease-in-out;
  animation: flutter 0.5s ease-in-out infinite;
}
@keyframes flutter { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-4px); } }

.speech-bubble {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 10px 18px; font-size: 1.15rem; z-index: 4; max-width: 82vw; text-align: center;
}
.speech-bubble::after {
  content: ""; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  border: 10px solid transparent; border-top-color: var(--card); border-bottom: none;
}

.actionbar {
  display: flex; gap: 10px; width: 100%; max-width: 520px;
  justify-content: space-around; padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.action-btn {
  flex: 1; min-height: 84px; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: none; border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); cursor: pointer; font-family: inherit; color: var(--text);
}
.action-btn span, .action-btn .ui-emoji { font-size: 2rem; }
.action-btn small { font-size: 0.9rem; font-weight: bold; }
.action-btn:active { transform: scale(0.92); }
.action-btn:disabled { opacity: 0.4; }

/* KI-Icons (Aktionen, Futter, Spiele) mit Emoji-Fallback */
.ui-icon { object-fit: contain; display: inline-block; }
.action-btn .ui-icon { width: 2.7rem; height: 2.7rem; }
.food-btn .ui-icon { width: 3rem; height: 3rem; }
.game-btn .ui-icon { width: 2rem; height: 2rem; vertical-align: middle; margin-right: 4px; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(90, 60, 100, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.overlay[hidden] { display: none; }
.overlay-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 20px; width: min(94vw, 420px); max-height: 88vh; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: 14px; position: relative;
}
.overlay.fullscreen { background: linear-gradient(180deg, var(--bg1), var(--bg2)); padding: 0; }
.overlay.fullscreen.night { background: linear-gradient(180deg, #2c2a52, #14183a); color: #f0e8ff; }

.food-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; }
.food-btn {
  min-height: 88px; border: none; border-radius: var(--radius);
  background: rgba(255, 220, 235, 0.6); box-shadow: var(--shadow); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-family: inherit; color: var(--text); font-weight: bold;
}
body.night .food-btn { background: rgba(255,255,255,0.12); color: var(--text); }
.food-btn span, .food-btn .ui-emoji { font-size: 2.2rem; }
.food-btn:active { transform: scale(0.9); }

.game-list { display: flex; flex-direction: column; gap: 12px; width: 100%; align-items: center; }
.game-btn.locked { opacity: 0.5; background: var(--card); color: var(--text); box-shadow: none; }
.game-btn.locked small { font-weight: bold; opacity: 0.8; }

/* Nachmachen (Simon): 4 farbige Felder aufleuchten lassen */
.simon-wrap {
  position: absolute; inset: 0; margin: auto;
  width: min(82vw, 340px); height: min(82vw, 340px);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 16px;
}
.simon-pad {
  border: none; border-radius: 26px; opacity: 0.5; cursor: pointer;
  box-shadow: var(--shadow); transition: opacity 0.12s, transform 0.12s;
}
.simon-pad.lit { opacity: 1; transform: scale(1.06); box-shadow: 0 0 34px rgba(255,255,255,0.8); }
.simon-pad:active { transform: scale(0.95); }

.confirm-row { display: flex; flex-direction: column; gap: 12px; width: 100%; align-items: center; }

.reward-hearts { font-size: 2.4rem; letter-spacing: 6px; min-height: 1.4em; text-align: center; }

/* ---------- Schlafen ---------- */
.sleep-scene { display: flex; flex-direction: column; align-items: center; gap: 18px; font-size: 1.3rem; }
.zzz { font-size: 3rem; animation: zfloat 2s ease-in-out infinite; }
@keyframes zfloat { 0%,100% { transform: translateY(0); opacity: 0.6; } 50% { transform: translateY(-18px); opacity: 1; } }

/* ---------- Baden ---------- */
.bath-scene {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; position: relative;
  touch-action: none;
}
.bath-progress {
  width: min(80vw, 340px); height: 22px; border-radius: 11px;
  background: rgba(255,255,255,0.6); overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}
#bath-fill { height: 100%; width: 0; background: linear-gradient(90deg, #8fd0ff, #5cb8ff); transition: width 0.2s; border-radius: 11px; }
.bubble {
  position: absolute; pointer-events: none; font-size: 1.6rem;
  animation: bubbleUp 1.4s ease-out forwards;
}
@keyframes bubbleUp {
  from { opacity: 1; transform: translateY(0) scale(0.6); }
  to { opacity: 0; transform: translateY(-70px) scale(1.3); }
}

/* ---------- Minispiele ---------- */
.minigame-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 12px 6px;
  font-size: 1.5rem; font-weight: bold;
}
#minigame-area { position: absolute; inset: 0; overflow: hidden; }
/* Schrumpfende Zeitleiste, damit auch Nichtleser sehen, wie lange es noch geht */
.time-bar {
  position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 62px);
  left: 5%; right: 5%; height: 18px; z-index: 6;
  background: rgba(255,255,255,0.55); border-radius: 9px; overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
.time-bar-fill {
  height: 100%; width: 100%; border-radius: 9px;
  background: linear-gradient(90deg, #8fe08f, #ffd97a);
  transition: width 1s linear, background 0.4s;
}
.time-bar-fill.hurry { background: linear-gradient(90deg, #ff9a76, #ff6b8f); animation: hurryPulse 0.5s ease-in-out infinite; }
@keyframes hurryPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.mg-ball {
  position: absolute; font-size: 3.4rem; cursor: pointer;
  animation: pulse 0.7s infinite alternate;
  min-width: 64px; min-height: 64px; text-align: center; line-height: 64px;
  border: none; background: transparent; padding: 0;
}
.mg-pet { position: absolute; width: 110px; height: 110px; transition: left 0.45s ease, top 0.45s ease; pointer-events: none; }
.mg-pet svg, .mg-pet img { width: 100%; height: 100%; }
.mg-star {
  position: absolute; font-size: 3rem; cursor: pointer;
  min-width: 64px; min-height: 64px; text-align: center; line-height: 64px;
  border: none; background: transparent; padding: 0;
}
.memory-grid {
  position: absolute; inset: 0; margin: auto;
  display: grid; grid-template-columns: repeat(3, minmax(84px, 110px));
  grid-auto-rows: minmax(84px, 110px);
  gap: 14px; place-content: center;
}
.memory-card {
  border: none; border-radius: 18px; background: var(--accent2);
  font-size: 2.6rem; box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.25s; transform-style: preserve-3d;
}
.memory-card.flipped { background: var(--card); transform: rotateY(180deg); }
.memory-card.matched { background: #b6f0c8; animation: pulse 0.5s 2 alternate; }
.mg-praise {
  position: absolute; font-size: 2rem; font-weight: bold; pointer-events: none;
  color: #ff5c9d; animation: floatUp 1s ease-out forwards; text-shadow: 0 2px 6px rgba(255,255,255,0.7);
}

/* Kuckuck-Spiel: 3 Büsche, das Tier lugt hervor */
.kuckuck-wrap {
  position: absolute; bottom: 12%; left: 0; right: 0;
  display: flex; justify-content: space-around; align-items: flex-end;
  padding: 0 6%;
}
.kuckuck-slot { position: relative; display: flex; flex-direction: column; align-items: center; }
.kuckuck-peek {
  width: min(30vw, 130px); height: min(30vw, 130px); margin-bottom: -18px;
  opacity: 0; transform: translateY(46px) scale(0.5); pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.3,0.8,0.4,1.2), opacity 0.25s;
}
.kuckuck-peek.show { opacity: 1; transform: translateY(0) scale(1); }
.kuckuck-peek.found { animation: jelly 0.55s; }
.kuckuck-bush {
  font-size: min(16vw, 5rem); line-height: 1; background: none; border: none;
  cursor: pointer; min-width: 88px; min-height: 88px; padding: 0;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.15));
}
.kuckuck-bush:active { transform: scale(0.9); }

/* ---------- Lernspiele ---------- */
.playmode-cards { display: flex; gap: 14px; width: 100%; justify-content: center; }
.playmode-card {
  flex: 1; max-width: 180px; min-height: 140px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--radius); background: rgba(255, 220, 235, 0.6);
  box-shadow: var(--shadow); cursor: pointer; font-family: inherit;
  font-size: 1.1rem; font-weight: bold; color: var(--text); padding: 12px;
}
body.night .playmode-card { background: rgba(255,255,255,0.12); }
.playmode-card .pm-emoji { font-size: 3rem; }
.playmode-card:active { transform: scale(0.93); }

.lern-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 6px;
}
.lern-title { font-size: 1.25rem; font-weight: bold; text-align: center; flex: 1; }
.lern-round { font-size: 1.2rem; font-weight: bold; min-width: 64px; text-align: right; }
.age-chip {
  min-height: 64px; min-width: 64px; border: none; border-radius: 999px;
  background: var(--card); color: var(--text); font-family: inherit;
  font-size: 1.1rem; font-weight: bold; box-shadow: var(--shadow); cursor: pointer; padding: 6px 14px;
}
.age-chip:active { transform: scale(0.93); }

.lern-scroll {
  position: absolute; top: 84px; bottom: 0; left: 0; right: 0;
  overflow-y: auto; padding: 4px 14px max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin: 0 auto;
}
.lern-section h3 { margin: 10px 0 6px; font-size: 1.15rem; }
.lern-card {
  width: 100%; display: flex; align-items: center; gap: 12px;
  min-height: 72px; border: none; border-radius: 18px; background: var(--card);
  box-shadow: var(--shadow); cursor: pointer; font-family: inherit; color: var(--text);
  padding: 10px 14px; margin-bottom: 8px; text-align: left;
}
.lern-card:active { transform: scale(0.97); }
.lern-card.locked { opacity: 0.55; }
.lern-card .lc-emoji { font-size: 1.9rem; }
.lern-card .lc-mid { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lern-card .lc-title { font-weight: bold; font-size: 1.05rem; }
.lern-card .lc-diff { color: var(--accent); letter-spacing: 2px; margin-left: 4px; }
.lern-card .lc-sub { opacity: 0.7; font-size: 0.85rem; }
.lern-card .lc-stars { font-size: 1.1rem; white-space: nowrap; }
.star-empty { opacity: 0.35; }

/* 4 Spalten statt 5: so bleiben die Zahl-Knöpfe auch auf schmalen Handys >=64px breit */
.age-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.lern-empty { text-align: center; font-size: 1.15rem; padding: 40px 16px; line-height: 1.7; }
.age-btn {
  min-height: 64px; border: none; border-radius: 16px; background: rgba(255, 220, 235, 0.6);
  font-family: inherit; font-size: 1.5rem; font-weight: bold; color: var(--text);
  box-shadow: var(--shadow); cursor: pointer;
}
body.night .age-btn { background: rgba(255,255,255,0.12); }
.age-btn.active { outline: 3px solid var(--accent); }
.age-btn:active { transform: scale(0.9); }

#learn-area {
  position: absolute; top: 84px; bottom: 0; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 12px; padding: 8px 14px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.learn-q { font-size: 1.35rem; font-weight: bold; text-align: center; }
.learn-q.big-q { font-size: 2.2rem; }
.count-field { position: relative; width: min(92vw, 420px); height: 220px; }
.count-item { position: absolute; font-size: 2.4rem; animation: pulse 1.6s infinite alternate; }
.answer-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.answer-btn {
  min-width: 76px; min-height: 76px; border: none; border-radius: 20px;
  background: var(--card); color: var(--text); font-family: inherit;
  font-size: 1.9rem; font-weight: bold; box-shadow: var(--shadow); cursor: pointer;
}
.answer-btn:active { transform: scale(0.9); }
.answer-btn.emoji-answer { font-size: 2.6rem; min-width: 88px; min-height: 88px; }
.shake { animation: shakeNo 0.4s; }
@keyframes shakeNo { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

.mengen-row { display: flex; gap: 14px; width: min(94vw, 460px); }
.mengen-box {
  flex: 1; min-height: 190px; border: none; border-radius: 20px;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer;
  font-size: 1.9rem; line-height: 1.5; padding: 12px; word-break: break-all;
}
.mengen-box:active { transform: scale(0.95); }

.rechnen-vis { font-size: 2rem; text-align: center; max-width: 92vw; line-height: 1.5; }
.minus-out { opacity: 0.45; text-decoration: line-through; }

.letter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: min(92vw, 380px); }
.letter-grid.small { grid-template-columns: repeat(4, 1fr); }
.letter-tile {
  min-height: 72px; border: none; border-radius: 16px; background: var(--card);
  color: var(--text); font-family: inherit; font-size: 2rem; font-weight: bold;
  box-shadow: var(--shadow); cursor: pointer;
}
.letter-tile:active { transform: scale(0.9); }
.letter-tile.hit { background: #b6f0c8; transform: scale(1.05); }
.letter-tile.used { opacity: 0.25; }
.target-letter { font-size: 1.8rem; color: var(--accent); }

.trace-head { display: flex; align-items: center; gap: 10px; width: min(92vw, 360px); }
.trace-label { font-size: 1.5rem; font-weight: bold; min-width: 84px; }
.trace-bar { flex: 1; height: 18px; border-radius: 9px; background: rgba(255,255,255,0.55); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.12); }
body.night .trace-bar { background: rgba(0,0,0,0.25); }
#tr-fill { height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, #8fe08f, #ffd97a); transition: width 0.15s; }
.trace-hint { font-size: 1rem; opacity: 0.75; }
#tr-canvas {
  width: min(88vw, 320px); height: auto; aspect-ratio: 320/380;
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  touch-action: none; cursor: crosshair;
}
.trace-clear { min-width: 64px !important; min-height: 64px !important; font-size: 1.4rem !important; }

.read-word { font-size: 3rem; font-weight: bold; letter-spacing: 6px; color: var(--accent); }
/* Neue Lese-Spiele */
.answer-btn.stack { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 96px; min-height: 96px; }
.answer-btn.stack span { font-size: 2.4rem; }
.answer-btn.stack small { font-size: 0.95rem; font-weight: bold; letter-spacing: 1px; }
.answer-btn.word-answer { font-size: 1.5rem; letter-spacing: 2px; min-width: 120px; padding: 0 16px; }
.answer-btn.szene { font-size: 2.4rem; min-width: 96px; min-height: 96px; }
.reim-quelle { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 3rem; }
.reim-quelle span { font-size: 1.6rem; font-weight: bold; letter-spacing: 3px; color: var(--accent); }
.anlaut-wort { font-size: 2.6rem; font-weight: bold; letter-spacing: 6px; color: var(--text); }
.satz-text {
  font-size: 1.8rem; font-weight: bold; letter-spacing: 2px; line-height: 1.5;
  color: var(--accent); text-align: center; max-width: 92vw; padding: 0 10px;
}
/* Groß-/Kleinbuchstaben */
.gross-letter { font-size: 5rem; font-weight: bold; color: var(--accent); line-height: 1; }
.answer-btn.klein-letter { font-size: 2.4rem; text-transform: none; }
/* Silben */
.silben-wort { font-size: 2.6rem; font-weight: bold; letter-spacing: 4px; color: var(--text); }
/* Satz legen */
.satz-slots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 94vw; }
.satz-slot {
  min-width: 60px; height: 46px; border-radius: 10px; padding: 0 10px;
  background: rgba(255,255,255,0.6); border: 3px dashed var(--accent2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: bold; letter-spacing: 1px; color: var(--text);
}
body.night .satz-slot { background: rgba(0,0,0,0.25); }
.satz-slot.filled { border-style: solid; background: var(--card); animation: pulse 0.3s; }
.satz-tiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 94vw; }
.satz-word {
  min-height: 56px; border: none; border-radius: 14px; background: var(--card);
  color: var(--text); font-family: inherit; font-size: 1.2rem; font-weight: bold;
  letter-spacing: 1px; box-shadow: var(--shadow); cursor: pointer; padding: 0 16px;
}
.satz-word:active { transform: scale(0.92); }
.satz-word.used { opacity: 0.25; }
.write-emoji { font-size: 3.4rem; }
.write-slots { display: flex; gap: 8px; }
.write-slot {
  width: 52px; height: 62px; border-radius: 12px; background: rgba(255,255,255,0.6);
  border: 3px dashed var(--accent2); font-size: 2rem; font-weight: bold;
  display: flex; align-items: center; justify-content: center; color: var(--text);
}
body.night .write-slot { background: rgba(0,0,0,0.25); }
.write-slot.filled { border-style: solid; background: var(--card); animation: pulse 0.3s; }

.lr-stars { font-size: 3rem; letter-spacing: 8px; min-height: 1.3em; }

/* ---------- Konfetti & Toast ---------- */
.confetti {
  position: fixed; top: -20px; font-size: 1.4rem; z-index: 200; pointer-events: none;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); }
}
.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--text); border-radius: 999px;
  padding: 14px 26px; font-size: 1.2rem; font-weight: bold;
  box-shadow: var(--shadow); z-index: 300; white-space: nowrap;
  animation: pulse 0.3s;
}

/* Sterne am Nachthimmel */
body.night .screen.active::before {
  content: "✦ ✧ ✦ ✧ ✦";
  position: absolute; top: 8px; left: 0; right: 0; text-align: center;
  color: rgba(255,255,240,0.5); letter-spacing: 30px; pointer-events: none;
}
