/* Mathe-Zauber – Aussehen */
:root {
  --purple: #6c3fc5;
  --purple-d: #4b2a96;
  --purple-l: #ece6ff;
  --pink: #ff5fa8;
  --mint: #43c6a1;
  --sun: #ffc93c;
  --ink: #2b2350;
  --ink-soft: #6a6290;
  --card: #ffffff;
  --bg1: #fff0fa;
  --bg2: #e6e4ff;
  --shadow: 0 8px 24px rgba(76, 42, 150, .18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }
#screen-auth, #screen-home, #screen-game, #screen-settings, #screen-collection {
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 14px)
           calc(env(safe-area-inset-bottom) + 10px) calc(env(safe-area-inset-left) + 14px);
}

/* ---------- Buttons ---------- */
.btn {
  padding: 12px 20px; border-radius: 16px; font-weight: 800; font-size: 1rem;
  background: #fff; box-shadow: 0 4px 0 #d9d2f3; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9d2f3; }
.btn.primary { background: linear-gradient(180deg, #8a5cf0, var(--purple)); color: #fff; box-shadow: 0 4px 0 var(--purple-d); }
.btn.primary:active { box-shadow: 0 1px 0 var(--purple-d); }
.btn.ghost { background: rgba(255,255,255,.75); }
.btn.danger { background: #ffe3e3; color: #b3261e; box-shadow: 0 4px 0 #f1bcbc; }
.btn.small { padding: 8px 14px; font-size: .9rem; margin-top: 10px; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; font-size: 1.25rem; font-weight: 800;
  background: rgba(255,255,255,.85); box-shadow: 0 3px 0 #d9d2f3;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9d2f3; }
.hint { font-size: .85rem; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.4; }
.hint.center { text-align: center; }
.warn { font-size: .9rem; color: #b3261e; background: #ffe9e9; border-radius: 12px; padding: 8px 12px; margin: 10px 0 0; }

/* ---------- Startseite ---------- */
.home-inner { margin: auto; width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 14px; overflow: auto; max-height: 100%; padding: 4px; }
.title { margin: 0; text-align: center; font-size: clamp(2rem, 8vw, 3rem); line-height: 1.1; }
.title span {
  background: linear-gradient(90deg, #ff5fa8, #ffa24d 30%, #43c6a1 60%, #6c3fc5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { margin: 0; text-align: center; color: var(--ink-soft); font-weight: 700; }
.worlds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.world {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 108px; padding: 12px 8px; border-radius: 24px; color: #fff; font-weight: 800;
  box-shadow: 0 6px 0 rgba(0,0,0,.18), var(--shadow); transition: transform .1s, box-shadow .1s;
}
.world:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.w-emoji { font-size: 3rem; line-height: 1; filter: drop-shadow(0 3px 2px rgba(0,0,0,.25)); }
.w-name { font-size: 1.02rem; text-shadow: 0 2px 2px rgba(0,0,0,.25); text-align: center; }
.w-unicorn { background: linear-gradient(150deg, #b06bff, #6c3fc5); }
.w-flower  { background: linear-gradient(150deg, #ff8cc6, #ff5fa8); }
.w-zoo     { background: linear-gradient(150deg, #5fd0a0, #2f9e7c); }
.w-vehicle { background: linear-gradient(150deg, #ff7a6b, #e0432f); }
.w-random  { background: linear-gradient(150deg, #ffcf5a, #ff9f43); grid-column: 1 / -1; flex-direction: row; min-height: 72px; gap: 12px; }
.w-random .w-emoji { font-size: 2.2rem; }

.home-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Spiel ---------- */
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 0 0 auto; padding-bottom: 8px; }
.round-info { font-weight: 800; font-size: 1.1rem; background: rgba(255,255,255,.85); padding: 8px 18px; border-radius: 999px; box-shadow: 0 3px 0 #d9d2f3; }
.game-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }

.scene { position: relative; flex: 4 1 0; min-height: 120px; border-radius: 26px; overflow: hidden; background: #2a1b4d; box-shadow: var(--shadow); }
.play { flex: 6 1 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }

.timer { position: relative; flex: 0 0 20px; height: 20px; border-radius: 12px; background: rgba(108,63,197,.16); overflow: hidden; }
.timer-fill { height: 100%; width: 100%; border-radius: 12px; background: linear-gradient(90deg, #43c6a1, #8be26e); }
.timer.warn .timer-fill { background: linear-gradient(90deg, #ffb020, #ffd45e); }
.timer.danger .timer-fill { background: linear-gradient(90deg, #ff4d4d, #ff7a7a); animation: blink .45s ease-in-out infinite alternate; }
.timer-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 900; color: var(--ink); }

.task { flex: 0 0 auto; text-align: center; font-weight: 900; font-size: clamp(1.9rem, 8vw, 2.8rem); line-height: 1.15; letter-spacing: .02em; padding: 2px 4px; }
.task .eq { color: var(--purple); }
.answer {
  flex: 0 0 auto; align-self: center; min-width: 8ch; text-align: center; font-weight: 900;
  font-size: clamp(1.8rem, 7vw, 2.4rem); padding: 4px 22px; border-radius: 18px;
  background: #fff; box-shadow: inset 0 3px 0 rgba(108,63,197,.12), 0 3px 0 #d9d2f3; color: var(--purple-d);
}
.answer.empty { color: #b9b0de; }
.answer.shake { animation: shake .4s; background: #ffe3e3; }
.answer.good { background: #dcffe9; }
.feedback { flex: 0 0 26px; min-height: 26px; text-align: center; font-weight: 800; font-size: 1.05rem; }
.feedback.good { color: #1f9d6b; }
.feedback.bad { color: #d6336c; }

.keypad { flex: 1 1 auto; min-height: 150px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr); gap: 8px; }
.key {
  border-radius: 18px; background: #fff; font-weight: 900; font-size: clamp(1.4rem, 5.5vmin, 2.1rem);
  box-shadow: 0 4px 0 #cfc7f0; transition: transform .06s, box-shadow .06s; min-height: 0;
}
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #cfc7f0; background: var(--purple-l); }
.key-del { background: #fff1de; box-shadow: 0 4px 0 #f0d3a8; }
.key-ok { background: linear-gradient(180deg, #5fe0b8, var(--mint)); color: #fff; box-shadow: 0 4px 0 #2c9b7b; }
.key-ok:active { box-shadow: 0 1px 0 #2c9b7b; background: var(--mint); }

@media (orientation: landscape) and (min-width: 640px) {
  .game-body { flex-direction: row; gap: 14px; }
  .scene { flex: 1.15 1 0; min-height: 0; aspect-ratio: 4 / 3; max-height: 100%; align-self: center; }
  .play { flex: 1 1 0; }
  .task { font-size: clamp(1.6rem, 5vh, 2.6rem); }
}
@media (max-height: 560px) and (orientation: portrait) {
  .scene { flex: 3 1 0; min-height: 90px; }
  .task { font-size: 1.7rem; }
}

/* ---------- Einstellungen ---------- */
.set-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 8px; flex: 0 0 auto; }
.set-top h2 { margin: 0; font-size: 1.35rem; }
.set-top small { font-size: .8rem; color: var(--ink-soft); font-weight: 700; margin-left: 4px; }
.settings-scroll { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; max-width: 640px; width: 100%; margin: 0 auto; }
.card { background: var(--card); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 10px; font-size: 1.05rem; }
.card h4 { margin: 16px 0 8px; font-size: .95rem; color: var(--ink-soft); }
.spacer { height: 20px; flex: 0 0 auto; }

.seg { display: flex; gap: 6px; background: var(--purple-l); padding: 5px; border-radius: 16px; }
.seg button { flex: 1; min-height: 44px; border-radius: 12px; font-weight: 800; font-size: 1.05rem; color: var(--purple-d); }
.seg.wide button { font-size: .95rem; padding: 0 6px; }
.seg button.on { background: var(--purple); color: #fff; box-shadow: 0 2px 0 var(--purple-d); }

.chips { display: flex; gap: 8px; }
.chips button {
  flex: 1; min-height: 52px; border-radius: 16px; font-size: 1.6rem; font-weight: 900;
  background: var(--purple-l); color: var(--purple-d); border: 3px solid transparent;
}
.chips button.on { background: var(--purple); color: #fff; border-color: var(--purple-d); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; margin-top: 10px; font-weight: 700; line-height: 1.3; }
.switch:first-of-type { margin-top: 0; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 52px; height: 30px; border-radius: 999px;
  background: #cfc7f0; position: relative; transition: background .15s; cursor: pointer; margin: 0;
}
.switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--mint); }
.switch input:checked::after { transform: translateX(22px); }
#mix-wrap.off { opacity: .45; pointer-events: none; }

.example-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-weight: 800; font-size: 1.05rem; }
.example-list span { color: var(--ink); }

/* ---------- Ergebnis ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(43, 35, 80, .55); backdrop-filter: blur(3px); }
.result-card { background: #fff; border-radius: 28px; padding: 24px 22px; text-align: center; max-width: 420px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: pop .5s cubic-bezier(.3,1.5,.5,1); }
.result-emoji { font-size: 4.5rem; line-height: 1; animation: floaty 2s ease-in-out infinite; }
.result-card h2 { margin: 8px 0 4px; font-size: 1.7rem; }
.stars { font-size: 2.4rem; letter-spacing: .1em; margin: 4px 0; }
.stars .off { filter: grayscale(1); opacity: .3; }
.result-card p { color: var(--ink-soft); font-weight: 700; margin: 6px 0 16px; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 700; font-size: .95rem; line-height: 1.35; box-shadow: var(--shadow); width: max-content; max-width: min(90vw, 440px); text-align: center; }

#fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 70; }
.confetti { position: absolute; top: -40px; animation: confetti-fall linear forwards; }

/* ---------- Welt-Bühne ---------- */
.stage { position: absolute; left: 50%; top: 50%; width: 400px; height: 300px; transform-origin: center center; overflow: hidden; }
.stage .layer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.vignette { pointer-events: none; opacity: 0; box-shadow: inset 0 0 70px 18px rgba(255, 50, 50, .7); transition: opacity .3s; }
.stage.danger .vignette { opacity: 1; animation: pulse .7s ease-in-out infinite alternate; }

.spark { position: absolute; font-size: 22px; opacity: 0; animation: sparkle 1.7s ease-out forwards; z-index: 5; }

/* Einhorn */
.sky-night { background: linear-gradient(#24104d, #51248a 55%, #8c4fb0); }
.sky-day { background: linear-gradient(#ffb8d9, #ffd9a8 55%, #fff2b8); opacity: 0; transition: opacity 1s; }
.world-unicorn .dim { background: #120a2c; transition: opacity 1s; }
.twinkle { animation: twinkle 2.4s ease-in-out infinite; }
.starfield { transition: opacity 1s; }
.unicorn { position: absolute; left: 120px; top: 98px; width: 160px; height: 144px; transform-origin: 50% 92%; transition: filter 1s; filter: grayscale(1) brightness(.7); }
.unicorn svg { width: 100%; height: 100%; display: block; overflow: visible; }
.unicorn.hop { animation: hop .6s ease-out; }
.unicorn.leap { animation: leap 1.4s ease-in-out; }
.world-unicorn.danger .unicorn { animation: tremble .25s linear infinite; }
.cage { position: absolute; left: 92px; top: 58px; width: 216px; height: 196px; transition: opacity 1s .5s; }
.cage .frame { position: absolute; left: -6px; right: -6px; height: 12px; border-radius: 6px; background: linear-gradient(#f1effb, #8f8bb0); box-shadow: 0 2px 3px rgba(0,0,0,.3); }
.cage .frame.top { top: 0; }
.cage .frame.bot { bottom: 0; }
.cage .bar { position: absolute; top: 10px; bottom: 10px; width: 7px; border-radius: 4px; background: linear-gradient(90deg, #8f8bb0, #f1effb 45%, #8f8bb0); transform-origin: 50% 100%; transition: transform .8s cubic-bezier(.5, 0, .9, .5), opacity .8s; }
.cage .bar.gone { transform: translateY(130px) rotate(var(--rot)); opacity: 0; }
.stage.done .cage { opacity: 0; }
.lock { position: absolute; left: 186px; top: 36px; font-size: 28px; transition: transform 1s, opacity 1s; }
.stage.done .lock { transform: translateY(70px) rotate(30deg); opacity: 0; }

/* Blume */
.sky-gray { background: linear-gradient(#8f9bb8, #b9c3d8); }
.sky-blue { background: linear-gradient(#6ec9ff, #c9f0ff 70%, #eafff2); opacity: 0; transition: opacity 1s; }
.world-flower .dim { background: #1b2240; transition: opacity 1s; }
.world-flower .sun {
  position: absolute; width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff7b0, #ffd23c 70%); box-shadow: 0 0 28px 12px rgba(255, 214, 80, .65);
  transition: opacity 1s, transform 1s;
}
.world-flower .sun { left: 312px; top: 18px; opacity: .25; }
.world-flower .cloud { position: absolute; left: 250px; top: 4px; width: 150px; height: 75px; color: #5f6b85; transition: transform 1.2s ease-in-out, opacity 1.2s, color 1.2s; }
.cloud svg { width: 100%; height: 100%; display: block; }
.flower { position: absolute; left: 200px; top: 108px; width: 0; height: 0; }
/* Geschlossene Knospe: kleine grüne Blätter um die Mitte. Jede gelöste Aufgabe öffnet eines. */
.petal {
  --s: .34; --k: .52;
  position: absolute; left: 0; top: 0; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.18);
  transform: rotate(var(--a)) translateY(calc(var(--d) * var(--k) * -1)) scale(var(--s));
  transition: transform .8s cubic-bezier(.34, 1.56, .64, 1);
}
.petal::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(#7ad37f, #4aa564); transition: opacity .6s; }
.petal.on { --s: 1; --k: 1; }
.petal.on::after { opacity: 0; }
.fcenter {
  position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe98a, #f2a93b 75%); box-shadow: 0 2px 4px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.fcenter span { font-size: 26px; opacity: 0; transition: opacity .6s; }
.world-flower.done .fcenter span { opacity: 1; }
.fcenter.bounce { animation: bounce .5s ease-out; }
.leaf { transition: transform .8s cubic-bezier(.34, 1.56, .64, 1); }
.leaf-l { transform-origin: 200px 232px; }
.leaf-r { transform-origin: 200px 214px; }
.bee, .bfly { position: absolute; font-size: 28px; opacity: 0; z-index: 4; }
.world-flower.done .bee { opacity: 1; animation: bee 5s ease-in-out infinite; }
.world-flower.done .bfly { opacity: 1; animation: bfly 7s ease-in-out infinite; }

/* ---------- Animationen ---------- */
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes hop { 0% { transform: none; } 30% { transform: translateY(-22px) scale(.95, 1.06); } 60% { transform: translateY(0) scale(1.08, .92); } 100% { transform: none; } }
@keyframes leap { 0% { transform: none; } 25% { transform: translateY(-70px) rotate(-8deg); } 50% { transform: none; } 70% { transform: translateY(-35px) rotate(6deg); } 100% { transform: none; } }
@keyframes tremble { 0% { transform: translateX(-2px); } 50% { transform: translateX(2px); } 100% { transform: translateX(-2px); } }
@keyframes pulse { from { opacity: .3; } to { opacity: 1; } }
@keyframes sparkle { 0% { opacity: 0; transform: translate(0, 0) scale(.2); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.3) rotate(120deg); } }
@keyframes bounce { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes bee { 0% { left: 60px; top: 70px; } 25% { left: 150px; top: 30px; } 50% { left: 300px; top: 120px; } 75% { left: 120px; top: 190px; } 100% { left: 60px; top: 70px; } }
@keyframes bfly { 0% { left: 340px; top: 200px; } 30% { left: 280px; top: 60px; } 60% { left: 90px; top: 150px; } 100% { left: 340px; top: 200px; } }
@keyframes fall { to { transform: translateY(330px); } }
@keyframes blink { from { opacity: .65; } to { opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes glow { 0%, 100% { box-shadow: 0 3px 0 #f0d3a8, 0 0 0 0 rgba(255,159,67,0); } 50% { box-shadow: 0 3px 0 #f0d3a8, 0 0 14px 4px rgba(255,159,67,.55); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(540deg); } }

@media (prefers-reduced-motion: reduce) {
  .twinkle, .drop, .bee, .bfly, .result-emoji { animation: none !important; }
}

/* ======================================================================
   Konto, Startseite, Sammlungen (neu)
   ====================================================================== */
input, .text-input { -webkit-user-select: text; user-select: text; }
.text-input {
  width: 100%; padding: 14px 16px; border-radius: 16px; border: 3px solid #d9d2f3; background: #fff;
  font: inherit; font-weight: 800; font-size: 1.3rem; text-align: center; color: var(--ink);
}
.text-input:focus { outline: none; border-color: var(--purple); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%; font-size: 24px; line-height: 1;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.08);
}

/* ---------- Anmelden ---------- */
.auth-inner { margin: auto; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; overflow: auto; max-height: 100%; padding: 4px; }
.auth-view { display: flex; flex-direction: column; gap: 12px; }
.auth-view[hidden] { display: none; }
.auth-msg { min-height: 1.4em; margin: 0; text-align: center; font-weight: 800; color: #d6336c; line-height: 1.3; }
.auth-actions { display: flex; gap: 10px; justify-content: center; }
.auth-actions .btn { flex: 1; max-width: 200px; }
.recent { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.recent button { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; background: #fff; font-weight: 800; box-shadow: 0 3px 0 #d9d2f3; }
.recent .avatar { width: 32px; height: 32px; font-size: 19px; }

.pin-dots { display: flex; justify-content: center; gap: 14px; height: 26px; }
.pin-dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--purple); background: transparent; transition: background .1s, transform .1s; }
.pin-dots i.on { background: var(--purple); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
.pin-pad { flex: none; width: min(100%, 300px); height: min(34vh, 260px); min-height: 200px; margin: 0 auto; }
.pin-pad .gap { visibility: hidden; }

.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-grid button { padding: 0; border-radius: 50%; border: 4px solid transparent; aspect-ratio: 1; display: flex; }
.avatar-grid button .avatar { width: 100%; height: 100%; font-size: clamp(20px, 6vw, 30px); }
.avatar-grid button.on { border-color: var(--purple); transform: scale(1.12); box-shadow: 0 4px 10px rgba(76,42,150,.35); }
.reg-who { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 900; font-size: 1.3rem; }
.reg-who .avatar { width: 56px; height: 56px; font-size: 34px; }

/* ---------- Startseite ---------- */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 16px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.9); box-shadow: 0 3px 0 #d9d2f3; font-size: 1.05rem; min-width: 0; }
.user-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.streak-chip { padding: 8px 16px; border-radius: 999px; background: #fff3dc; color: #b4560a; font-weight: 900; font-size: 1.15rem; box-shadow: 0 3px 0 #f0d3a8; }
.streak-chip.cold { background: #eceaf5; color: var(--ink-soft); box-shadow: 0 3px 0 #d9d2f3; filter: grayscale(.8); }
.week { display: flex; justify-content: space-between; gap: 4px; background: rgba(255,255,255,.7); border-radius: 18px; padding: 8px 10px; }
.week div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .72rem; font-weight: 800; color: var(--ink-soft); }
.week i { width: 26px; height: 26px; border-radius: 50%; background: #e4def7; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: .9rem; color: #fff; }
.week .done i { background: linear-gradient(150deg, #ffb74d, #ff7a2f); }
.week .today i { outline: 3px solid var(--purple); outline-offset: 1px; }
.banner { padding: 10px 14px; border-radius: 16px; background: #fff3dc; color: #8a4208; font-weight: 800; text-align: center; line-height: 1.3; box-shadow: 0 3px 0 #f0d3a8; animation: glow 2.2s ease-in-out infinite; }
.coll-links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.coll-link { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 4px; border-radius: 20px; background: rgba(255,255,255,.9); box-shadow: 0 4px 0 #d9d2f3; }
.coll-link span { font-size: 1.8rem; line-height: 1.1; }
.coll-link b { font-size: .92rem; }
.coll-link i { font-style: normal; font-size: .85rem; font-weight: 800; color: var(--ink-soft); }
.coll-link:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9d2f3; }
.coll-stats { text-align: center; font-weight: 700; color: var(--ink-soft); }

/* ---------- Sammlung ---------- */
.coll-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; border-radius: 24px; padding: 10px 10px 16px; box-shadow: var(--shadow); }
#screen-collection[data-kind="unicorn"] .coll-scroll { background: linear-gradient(#bfe8c9, #7cc58d 45%, #4f9d63); }
#screen-collection[data-kind="flower"] .coll-scroll { background: linear-gradient(#cdeeff, #d8f7d0 40%, #8fd47f); }
#screen-collection[data-kind="vehicle"] .coll-scroll { background: linear-gradient(#cfe3ff, #d9dde8 45%, #9aa3b5); }
#screen-collection[data-kind="zoo"] .coll-scroll { background: linear-gradient(#ffe9b8, #cfe9a8 45%, #8fc27a); }
.coll-lead { margin: 2px 6px 10px; text-align: center; font-weight: 800; color: rgba(30, 50, 40, .8); line-height: 1.35; }
.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 20px; background: rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; padding: 8px; box-shadow: 0 3px 0 rgba(0,0,0,.12); overflow: hidden; }
.tile svg { width: 100%; height: 100%; display: block; }
.tile .zoo-emoji { font-size: 52px; line-height: 1; }
.tile.locked { background: rgba(255,255,255,.25); box-shadow: none; }
.tile.locked > .pic { filter: brightness(0); opacity: .22; }
.tile.locked::after { content: "?"; position: absolute; font-weight: 900; font-size: 1.6rem; color: rgba(255,255,255,.9); text-shadow: 0 2px 3px rgba(0,0,0,.35); }
.tile.soon > .pic { opacity: .6; }
.tile .pic { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.tile .left { position: absolute; right: 4px; top: 4px; padding: 1px 6px; border-radius: 999px; font-size: .72rem; font-weight: 900; background: #ff9f43; color: #fff; }
.tile.sel { outline: 4px solid var(--purple); }
.coll-detail { flex: 0 0 auto; margin-top: 10px; padding: 12px 16px; border-radius: 20px; background: #fff; box-shadow: var(--shadow); text-align: center; font-weight: 700; line-height: 1.4; }
.coll-detail b { font-size: 1.15rem; }

/* ---------- Konto in den Einstellungen ---------- */
.acc-row { display: flex; align-items: center; gap: 12px; }
.acc-row b { font-size: 1.2rem; }
.acc-row .avatar { width: 52px; height: 52px; font-size: 31px; }
.acc-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Ergebnis ---------- */
.result-art { height: 130px; display: flex; align-items: center; justify-content: center; animation: floaty 2s ease-in-out infinite; }
.result-art svg { height: 100%; width: auto; max-width: 100%; }
.result-art .zoo-emoji, .result-art .big-emoji { font-size: 5.5rem; line-height: 1; }
.result-badge { display: inline-block; margin-top: 4px; padding: 4px 14px; border-radius: 999px; background: linear-gradient(150deg, #ffb74d, #ff7a2f); color: #fff; font-weight: 900; letter-spacing: .03em; animation: pop .5s cubic-bezier(.3,1.5,.5,1); }
.result-badge.renew { background: linear-gradient(150deg, #62c6ff, #4d7cff); }
.result-card p.result-streak { margin: 0 0 14px; color: #b4560a; font-weight: 900; }

/* ---------- Zoo-Welt ---------- */
.world-zoo .sky-night { background: linear-gradient(#0e3b3a, #1f6b5a 55%, #4a9a6a); }
.world-zoo .sky-day { background: linear-gradient(#9be4ff, #d4f5c0 55%, #fff2b8); }
.world-zoo .unicorn, .world-vehicle .unicorn { display: flex; align-items: center; justify-content: center; font-size: 112px; line-height: 1; }
.world-zoo .unicorn .zoo-emoji, .world-vehicle .unicorn .zoo-emoji { display: block; transform: translateY(6px); }
.world-vehicle .sky-night { background: linear-gradient(#1c2340, #3a3f6b 55%, #6c6a86); }
.world-vehicle .sky-day { background: linear-gradient(#8fd3ff, #d6efff 55%, #fff1c2); }
.world-vehicle .unicorn { font-size: 104px; }

@media (orientation: landscape) and (max-height: 520px) {
  .pin-pad { height: 180px; min-height: 160px; }
}

.coll-lead::before { display: block; font-size: 1.7rem; letter-spacing: .15em; margin-bottom: 4px; }
#screen-collection[data-kind="unicorn"] .coll-lead::before { content: "🌲🌳🌲🌲🌳🌲"; }
#screen-collection[data-kind="flower"] .coll-lead::before { content: "🌷🌼🌸🌻🌺🌷"; }
#screen-collection[data-kind="zoo"] .coll-lead::before { content: "🌴🌳🐾🌳🌴"; }
#screen-collection[data-kind="vehicle"] .coll-lead::before { content: "🚧🏢🚦🏗️🚧"; }

/* ---------- Ziel, Abzeichen, Übersicht ---------- */
.text-input.small { font-size: 1.05rem; padding: 10px 12px; text-align: left; }
.wide-btn { width: 100%; margin-bottom: 4px; }
.banner.level { background: #e6f7ee; color: #17694a; box-shadow: 0 3px 0 #b9e3cf; animation: none; }
.reward-chip { padding: 10px 14px; border-radius: 16px; background: #fff; box-shadow: 0 3px 0 #d9d2f3; font-weight: 800; line-height: 1.3; }
.reward-chip .bar { height: 10px; border-radius: 6px; background: #ece6ff; margin-top: 6px; overflow: hidden; }
.reward-chip .bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ffb74d, #ff7a2f); }
.reward-chip.won { background: linear-gradient(150deg, #fff3b0, #ffd45e); color: #6b4300; text-align: center; box-shadow: 0 3px 0 #e0b232; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.badge { background: #fff; border-radius: 20px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.badge .em { font-size: 2.4rem; line-height: 1; }
.badge b { font-size: .95rem; }
.badge span.d { font-size: .78rem; color: var(--ink-soft); font-weight: 700; line-height: 1.25; }
.badge.locked { background: rgba(255,255,255,.55); box-shadow: none; }
.badge.locked .em { filter: grayscale(1) brightness(.5); opacity: .3; }
.badge.locked b { color: var(--ink-soft); }
.result-card p.new-badge { color: #17694a; }

.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: var(--purple-l); border-radius: 14px; padding: 8px 10px; text-align: center; }
.stat b { display: block; font-size: 1.4rem; }
.stat span { font-size: .78rem; color: var(--ink-soft); font-weight: 700; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding-top: 6px; }
.chart > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; font-size: .62rem; font-weight: 800; color: var(--ink-soft); }
.chart i { display: block; width: 100%; min-height: 3px; border-radius: 5px 5px 2px 2px; background: linear-gradient(#8a5cf0, var(--purple)); }
.chart i.zero { background: #e4def7; }
.chart em { font-style: normal; color: var(--ink); }

#screen-settings.locked .parent-only { display: none; }
#screen-settings:not(.locked) #lock-card { display: none; }
#code-input { margin: 6px 0 2px; }
