:root {
  --night: #16233f; --night2: #24375f; --cream: #fbf5ea; --ink: #2a2a3a; --muted: #7b7f93;
  --red: #b23a48; --green: #3f7d5a; --gold: #e0b04a; --line: #eadfcc;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: linear-gradient(#0f1a31, var(--night2)) fixed; overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

#snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#snow i { position: absolute; top: -10px; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: fall linear infinite; }
@keyframes fall { to { transform: translate(30px, 105vh); } }

#app { position: relative; max-width: 480px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; }
header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(12px + env(safe-area-inset-top)) 16px 10px; color: #fff; }
h1 { font-size: 1.15rem; margin: 0; }
.counters { display: flex; gap: 6px; }
.pill { background: rgba(255, 255, 255, .14); border-radius: 99px; padding: 5px 10px; font-size: .9rem; white-space: nowrap; }

main { flex: 1; overflow-y: auto; padding: 4px 16px 20px; }
.hint { color: #cfd6ea; text-align: center; margin: 8px 0 14px; font-size: .95rem; }
.dev { background: var(--gold); color: #3a2c05; border-radius: 8px; text-align: center; padding: 4px; margin: 0 0 8px; font-size: .8rem; }

.card { background: var(--cream); border-radius: 18px; padding: 16px; margin-top: 16px; }
.card h2 { margin: 0 0 10px; font-size: 1rem; }
.card h3 { margin: 14px 0 8px; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card h3:first-child { margin-top: 0; }

/* Kalender */
.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.door { aspect-ratio: 1; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--red); color: #fff; box-shadow: inset 0 -4px rgba(0, 0, 0, .18); }
.door:nth-child(3n) { background: var(--green); }
.door:nth-child(4n+1) { background: #c98b3a; }
.door b { font-size: 1.5rem; }
.door i { font-style: normal; font-size: .9rem; height: 1.1em; }
.door.locked { opacity: .5; }
.door.ready { outline: 3px solid var(--gold); outline-offset: 1px; }
.door.open { background: var(--cream); color: var(--green); box-shadow: none; }
.letters { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.letters span { aspect-ratio: 3/4; border-radius: 6px; background: var(--line); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.letters .got { background: var(--gold); }

/* Charakter */
.stage { height: 38vh; min-height: 220px; display: grid; place-items: center; border-radius: 18px;
  background: radial-gradient(circle at 50% 80%, #3c558c, transparent 70%); }
.stage svg { height: 100%; }
.swatches, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatches .sel { box-shadow: 0 0 0 3px var(--ink); }
.chips button { padding: 8px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: .9rem; }
.chips .sel { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Shop */
.shopgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shopitem { background: var(--cream); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.shopitem svg { height: 130px; }
.tag { font-size: .8rem; color: var(--muted); padding: 7px 0; }

/* Bonus */
.check { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--cream); border-radius: 18px; padding: 16px; margin-bottom: 10px; border: 3px solid transparent; }
.check .emoji { font-size: 1.8rem; }
.check span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.check small, .two small { color: var(--muted); font-size: .8rem; }
.check .mark { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; font-weight: 700; }
.check.on { border-color: var(--green); }
.check.on .mark { background: var(--green); border-color: var(--green); }
.check:disabled { opacity: .55; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: center; }
.big { display: block; font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }

/* Knöpfe, Dialog, Navigation */
.btn { display: block; width: 100%; background: var(--red); color: #fff; border-radius: 14px; padding: 13px; font-weight: 700; margin-top: 10px; }
.btn.small { width: auto; padding: 7px 16px; margin: 0; font-size: .9rem; }
.btn.ghost { background: none; color: var(--muted); }
.btn:disabled { background: var(--line); color: var(--muted); }
dialog { border: 0; border-radius: 22px; padding: 22px; width: min(90vw, 380px); background: var(--cream); color: var(--ink); text-align: center; }
dialog::backdrop { background: rgba(8, 14, 30, .7); }
dialog h2 { margin: 0 0 8px; }
dialog input { width: 100%; padding: 13px; border-radius: 14px; border: 2px solid var(--line); text-align: center; font-size: 1.1rem; text-transform: uppercase; letter-spacing: .1em; background: #fff; }
.game { background: #fff; border-radius: 14px; padding: 18px; }
.game small { color: var(--muted); }

nav { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--cream); border-radius: 22px 22px 0 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 1.3rem; padding: 6px; border-radius: 14px; }
nav span { font-size: .7rem; color: var(--muted); }
nav .active { background: #fff; }
nav .active span { color: var(--ink); font-weight: 700; }

/* Minispiele */
.gamehint { color: var(--muted); margin: 6px 0 12px; }
.win { font-size: 1.1rem; font-weight: 700; }
.dev button { margin-left: 8px; text-decoration: underline; }
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mcard { aspect-ratio: 1; border-radius: 12px; background: var(--night2); font-size: 1.7rem; display: grid; place-items: center; overflow: hidden;
  box-shadow: inset 0 -3px rgba(0, 0, 0, .25); transition: transform .2s, background .2s; }
.mcard::before { content: "❄️"; font-size: 1.1rem; opacity: .6; }
.mcard span { display: none; width: 100%; height: 100%; place-items: center; }
.mcard img { width: 100%; height: 100%; object-fit: cover; }
.mcard.up { background: #fff; box-shadow: 0 0 0 2px var(--line); transform: scale(1.04); }
.mcard.up::before { display: none; }
.mcard.up span { display: grid; }
.mcard.found { background: #e3f1e6; box-shadow: 0 0 0 2px var(--green); transform: none; }

/* Karte */
main.full { padding: 0; overflow: auto; overscroll-behavior: contain; }
main.full .dev { position: sticky; left: 16px; width: calc(100% - 32px); }
main.full .dev { margin: 0 16px 6px; }
.mapbar { position: sticky; top: 0; left: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px 8px;
  color: #fff; font-size: .9rem; background: #131f42; min-height: 46px; }
.mapbar button { background: rgba(255, 255, 255, .16); color: #fff; border-radius: 99px; padding: 6px 12px; font-size: .85rem; white-space: nowrap; }
.map { display: block; max-width: none; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.map .place { cursor: pointer; }
.map .closed .building { opacity: .42; }
.map .plate rect { fill: #fff; stroke: #d9cdb8; }
.map .plate text { font: 700 9.5px ui-rounded, system-ui, sans-serif; fill: #2a2a3a; }
.map .plate.locked rect { fill: #2a3558; stroke: none; }
.map .plate.locked text { fill: #dfe6f5; font-weight: 600; }
.map .bang circle { fill: #e0b04a; stroke: #fff; stroke-width: 2; }
.map .bang text { font: 800 11px system-ui, sans-serif; fill: #3a2c05; }
.map .bang { animation: bang 1s ease-in-out infinite alternate; }
@keyframes bang { from { translate: 0 0; } to { translate: 0 -4px; } }
.quests { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.quest { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; text-align: left; color: var(--muted); }
.quest span { flex: 1; }
.quest.ready { border-color: var(--gold); color: var(--ink); font-weight: 700; }
.quest.done { color: var(--green); }
.quest i { font-style: normal; }
.map .town { font: 600 8px ui-rounded, system-ui, sans-serif; fill: #8a9bb5; letter-spacing: .12em; text-transform: uppercase; }
.map .town.water { fill: #fff; opacity: .8; }

/* Reisen */
.mapbar .fuel { background: rgba(255, 255, 255, .16); border-radius: 99px; padding: 6px 10px; font-size: .8rem; white-space: nowrap; }
.mapbar span:first-child { flex: 1; }
.map .bahn rect { fill: #fff; stroke: #d9cdb8; }
.map .bahn text { font-size: 12px; }
.quest small { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.quest b { font-size: 1.2rem; }
.quest:disabled { opacity: .6; }
.tank { height: 18px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 6px 0 4px; }
.tank i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--green)); border-radius: 99px; }

/* Breites Layout am PC: Navigation links, Inhalt rechts, die Karte passt ganz auf den Bildschirm. */
@media (min-width: 900px) {
  #app { max-width: none; display: grid; grid-template-columns: 230px 1fr; grid-template-rows: auto 1fr; grid-template-areas: "head main" "nav main"; }
  header { grid-area: head; flex-direction: column; align-items: flex-start; gap: 14px; padding: 28px 20px 16px; }
  h1 { font-size: 1.35rem; }
  nav { grid-area: nav; grid-template-columns: 1fr; align-content: start; gap: 4px; background: none; border-radius: 0; padding: 8px 12px; }
  nav button { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; }
  nav span { font-size: 1rem; color: #cfd6ea; }
  nav .active { background: rgba(255, 255, 255, .14); }
  nav .active span { color: #fff; }

  main { grid-area: main; padding: 28px max(32px, calc(50% - 400px)); }
  .shopgrid { grid-template-columns: repeat(4, 1fr); }
  .doors { grid-template-columns: repeat(6, 1fr); }

  /* Charakter: Figur links, Auswahl rechts */
  main:has(.stage) { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; align-content: start; padding-inline: max(32px, calc(50% - 480px)); }
  main:has(.stage) .dev { grid-column: 1 / -1; }
  main:has(.stage) .card { margin-top: 0; }
  .stage { height: 70vh; position: sticky; top: 0; }

  /* Karte: ganze Karte sichtbar, kein Verschieben nötig */
  main.full { display: flex; flex-direction: column; padding: 0; overflow: hidden; background: #e4edf6; border-radius: 22px 0 0 0; }
  main.full .dev { position: static; width: auto; margin: 0; border-radius: 0; }
  .map { width: 100% !important; flex: 1; min-height: 0; }
  .mapbar { padding: 10px 20px; font-size: 1rem; }
}

/* Keine Scrollbalken: gescrollt wird per Finger, Mausrad oder Ziehen. */
main, dialog { scrollbar-width: none; }
main::-webkit-scrollbar, dialog::-webkit-scrollbar { display: none; }
main.full { cursor: grab; }
main.full.dragging { cursor: grabbing; }
main.full.dragging .place { cursor: grabbing; }

/* Offene Welt */
main.full { position: relative; padding: 0; overflow: hidden; cursor: default; display: block; }
.scroller { position: absolute; inset: 0; overflow: hidden; touch-action: none; background: #e4edf6; user-select: none; -webkit-user-select: none; }
.world { position: relative; }
.worldsvg { display: block; width: 100%; height: 100%; }
.worldsvg .closed .building { opacity: .42; }
.worldsvg .plate rect { fill: #fff; stroke: #d9cdb8; }
.worldsvg .plate text { font: 700 9.5px ui-rounded, system-ui, sans-serif; fill: #2a2a3a; }
.worldsvg .plate.locked rect { fill: #2a3558; stroke: none; }
.worldsvg .plate.locked text { fill: #dfe6f5; font-weight: 600; }
.worldsvg .bang circle { fill: #e0b04a; stroke: #fff; stroke-width: 2; }
.worldsvg .bang text { font: 800 11px system-ui, sans-serif; fill: #3a2c05; }
.worldsvg .town { font: 600 13px ui-rounded, system-ui, sans-serif; fill: #8a9bb5; letter-spacing: .14em; text-transform: uppercase; }
.worldsvg .town.water { fill: #fff; opacity: .8; font-size: 18px; }
.worldsvg .pickup text { font-size: 15px; }
.worldsvg .pickup circle { opacity: .9; filter: drop-shadow(0 0 4px #fff); }
.actor { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; pointer-events: none; }
.actor[hidden] { display: none; }
.actor svg { display: block; overflow: visible; }

.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .dev { margin: 0; border-radius: 0; }
.hud .mapbar { position: static; }
.mapbar button { padding: 6px 10px; }
.mini { position: absolute; right: 10px; margin-top: 10px; width: 118px; border-radius: 12px; overflow: hidden; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); pointer-events: none; opacity: .92; }
.mini svg { display: block; width: 100%; height: auto; }
.acts { position: absolute; left: 50%; translate: -50% 0; bottom: 22px; display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; pointer-events: none; }
.acts > * { pointer-events: auto; }
.act { background: var(--red); color: #fff; font-weight: 700; border-radius: 99px; padding: 14px 22px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3); white-space: nowrap; }
.act.quiet { background: #fff; color: var(--ink); padding: 10px 18px; font-size: .9rem; }
..stick[hidden], .tip[hidden] { display: none; }
.tip { position: absolute; left: 50%; translate: -50% 0; bottom: 150px; margin: 0; width: max-content; max-width: 86%; text-align: center; background: rgba(19, 31, 66, .85); color: #fff;
  border-radius: 14px; padding: 8px 14px; font-size: .85rem; pointer-events: none; }
.stick { position: absolute; width: 0; height: 0; pointer-events: none; }
.stick::before { content: ""; position: absolute; left: -46px; top: -46px; width: 92px; height: 92px; border-radius: 50%; background: rgba(255, 255, 255, .35); border: 2px solid rgba(255, 255, 255, .8); }
.stick i { position: absolute; left: -20px; top: -20px; width: 40px; height: 40px; border-radius: 50%; background: rgba(19, 31, 66, .55); }
@media (min-width: 900px) {
  main.full { border-radius: 22px 0 0 0; }
  .mini { width: 170px; right: 16px; }
}

/* Laufen: Beine heben sich abwechselnd, Arme schwingen gegengleich, der Oberkörper wippt mit. */
.walking .avatar .leg-l { animation: step .42s ease-in-out infinite; }
.walking .avatar .leg-r { animation: step .42s ease-in-out -.21s infinite; }
.walking .avatar .arm-l { transform-origin: 68px 146px; animation: swing .42s ease-in-out -.21s infinite; }
.walking .avatar .arm-r { transform-origin: 132px 146px; animation: swing .42s ease-in-out infinite reverse; }
.walking .avatar .upper { transform-origin: 100px 215px; animation: bob .21s ease-in-out infinite alternate; }
.walking .avatar .shadow { transform-origin: 100px 290px; animation: shadow .21s ease-in-out infinite alternate; }
@keyframes step { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes swing { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(13deg); } }
@keyframes bob { from { transform: translateY(0) rotate(-1.5deg); } to { transform: translateY(-5px) rotate(1.5deg); } }
@keyframes shadow { from { transform: scaleX(1); } to { transform: scaleX(.86); } }
@media (prefers-reduced-motion: reduce) { .walking .avatar * { animation: none !important; } }

/* Tiefschnee: Schneerand um die Figur, Stapfen, Wolken und Spuren */
.walking .avatar .leg-l { animation-duration: var(--pace, .42s); }
.walking .avatar .leg-r { animation-duration: var(--pace, .42s); animation-delay: calc(var(--pace, .42s) / -2); }
.walking .avatar .arm-l { animation-duration: var(--pace, .42s); animation-delay: calc(var(--pace, .42s) / -2); }
.walking .avatar .arm-r { animation-duration: var(--pace, .42s); }
.walking .avatar .upper { animation-duration: calc(var(--pace, .42s) / 2); }
.walking.wading .avatar .upper { animation-name: wade; animation-duration: var(--pace, .42s); }
.walking.wading .avatar .arm-l, .walking.wading .avatar .arm-r { animation-name: flail; }
@keyframes wade { from { transform: translateY(2px) rotate(-6deg); } to { transform: translateY(-7px) rotate(6deg); } }
@keyframes flail { 0%, 100% { transform: rotate(-22deg); } 50% { transform: rotate(26deg); } }
.rim { position: absolute; left: 0; top: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 #cfdcea, 0 0 0 2px #eef4fa; opacity: 0; transition: opacity .2s; }
.puff, .print { position: absolute; pointer-events: none; border-radius: 50%; }
.puff { width: 11px; height: 11px; background: #fff; box-shadow: 0 0 0 1px #d5e2ee; animation: puff .75s ease-out forwards; }
@keyframes puff { from { transform: translate(-50%, -50%) scale(.5); opacity: .95; } to { transform: translate(calc(-50% + var(--dx)), -320%) scale(1.5); opacity: 0; } }
.print { width: 9px; height: 6px; background: #c5d4e4; transform: translate(-50%, -50%); animation: print 7s linear forwards; }
.print.rut { width: 7px; height: 12px; border-radius: 3px; }
@keyframes print { 0%, 55% { opacity: .9; } 100% { opacity: 0; } }

/* Fahrt-Animation für Bahn und Flugzeug */
.ride { position: fixed; inset: 0; z-index: 60; overflow: hidden; background: linear-gradient(#131f42, #4b4a86 52%, #e4edf6 52%); animation: ridein .35s ease-out; }
.ride.out { opacity: 0; transition: opacity .35s; }
.ride.fly { background: linear-gradient(#131f42, #4b4a86 70%, #9d8fc0); }
@keyframes ridein { from { opacity: 0; } }
.ride-far { position: absolute; left: 0; right: 0; top: 30%; height: 22%; background:
  radial-gradient(60% 100% at 20% 100%, #c3d2e3 60%, transparent 61%), radial-gradient(50% 80% at 62% 100%, #b4c5d9 60%, transparent 61%), radial-gradient(40% 70% at 92% 100%, #c3d2e3 60%, transparent 61%); }
.ride.fly .ride-far { top: auto; bottom: 0; height: 18%; opacity: .7; }
.ride-trees { position: absolute; left: 0; top: calc(52% - 16vh); width: 300vh; height: 20vh; animation: scroll 1.1s linear infinite; }
.ride-track { position: absolute; left: 0; right: -80px; top: calc(52% + 9vh); height: 10px; border-top: 4px solid #59647a;
  background: repeating-linear-gradient(90deg, #8c6f5e 0 10px, transparent 10px 40px); animation: sleepers .12s linear infinite; }
.ride-clouds { position: absolute; left: 0; top: 18%; width: 200%; height: 60%; animation: scroll 2.4s linear infinite; background:
  radial-gradient(70px 26px at 8% 20%, #fff 98%, transparent), radial-gradient(90px 30px at 30% 70%, #fff 98%, transparent), radial-gradient(60px 22px at 44% 34%, #fff 98%, transparent),
  radial-gradient(70px 26px at 58% 20%, #fff 98%, transparent), radial-gradient(90px 30px at 80% 70%, #fff 98%, transparent), radial-gradient(60px 22px at 94% 34%, #fff 98%, transparent); opacity: .85; }
@keyframes scroll { to { transform: translateX(-50%); } }
@keyframes sleepers { to { transform: translateX(-40px); } }
.ride-vehicle { position: absolute; left: 50%; top: calc(52% + 9vh); width: min(78vw, 520px); translate: -50% -100%; overflow: visible; animation: rumble .16s linear infinite alternate, arrive .7s cubic-bezier(.2, .8, .3, 1); }
.ride.fly .ride-vehicle { top: 46%; width: min(50vw, 320px); translate: -50% -50%; animation: float 1.4s ease-in-out infinite alternate, arrive .7s cubic-bezier(.2, .8, .3, 1); }
@keyframes rumble { to { transform: translateY(-2px); } }
@keyframes float { from { transform: translateY(-10px) rotate(-3deg); } to { transform: translateY(10px) rotate(1deg); } }
@keyframes arrive { from { left: -40%; } }
.ride-text { position: absolute; left: 0; right: 0; bottom: 14%; margin: 0; text-align: center; color: var(--ink); font-weight: 700; font-size: 1.05rem; padding: 0 16px; }
.ride.fly .ride-text { color: #fff; }

/* Innenräume */
.roomwrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 96px 10px 150px; background: #16233f; touch-action: none; user-select: none; -webkit-user-select: none; }
.room { flex: none; display: block; margin: 0 auto; border-radius: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); background: #000; }
.room text { font-family: system-ui, "Apple Color Emoji", "Segoe UI Emoji", sans-serif; }
.room .plate rect { fill: #fff; stroke: #d9cdb8; }
.room .plate text { font: 700 10px ui-rounded, system-ui, sans-serif; fill: #2a2a3a; }
.room .plate.todo rect { fill: #e0b04a; stroke: #fff; stroke-width: 2; }
.room .plate.done rect { fill: #e3f1e6; stroke: #3f7d5a; }
.room .plate.done text { fill: #3f7d5a; }
.room .plate.locked rect { fill: #2a3558; stroke: none; }
.room .plate.locked text { fill: #dfe6f5; font-weight: 600; }
.mapbar small { opacity: .75; font-size: .8rem; }
@media (min-width: 900px) { .roomwrap { padding: 80px 40px 110px; } }
.scroller.house { display: flex; align-items: center; background: #16233f; padding-top: 40px; }
.room .roomname { font: 700 13px ui-rounded, system-ui, sans-serif; fill: #000; opacity: .28; letter-spacing: .14em; text-transform: uppercase; }
.room .plate text { font-size: 11px; }

/* Spielereien in den Zimmern */
.room { transition: filter .35s; }
.room.dim { filter: brightness(.5) saturate(.8); }
.room .decor { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.room .float, .room .drop { pointer-events: none; opacity: 0; transform-box: fill-box; }
.room .float { animation: floatup 1.4s ease-out forwards; }
.room .drop { animation: dropdown .7s ease-in forwards; }
@keyframes floatup { 0% { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-80px) scale(1.2); } }
@keyframes dropdown { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(46px); } }
.room .bubble rect, .room .bubble path { fill: #fff; }
.room .bubble rect { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.room .bubble text { font: 600 11px ui-rounded, system-ui, sans-serif; fill: #2a2a3a; }
.room .bubble { animation: pop .25s cubic-bezier(.3, 1.6, .5, 1); transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* Posen der Figur in den Zimmern */
.room .prop { pointer-events: none; }
#rhero .avatar .arm-l { transform-origin: 68px 146px; }
#rhero .avatar .arm-r { transform-origin: 132px 146px; }
#rhero .avatar .arm-l, #rhero .avatar .arm-r, #rhero .avatar .leg-l, #rhero .avatar .leg-r, #rhero .avatar .upper { transition: transform .25s; }
/* etwas in der Hand halten: rechter Arm angehoben */
.holding .avatar .arm-r { transform: rotate(-58deg); }
.holding.stirring .avatar .arm-r { animation: stir .5s ease-in-out infinite alternate; }
.holding.stirring .prop { animation: wiggle .5s ease-in-out infinite alternate; }
.holding.strumming .avatar .arm-r { animation: strum .22s ease-in-out infinite alternate; }
.holding.strumming .avatar .arm-l { transform: rotate(48deg); }
.holding.strumming .avatar .upper { transform-origin: 100px 215px; animation: bob .22s ease-in-out infinite alternate; }
@keyframes stir { from { transform: rotate(-70deg); } to { transform: rotate(-40deg); } }
@keyframes strum { from { transform: rotate(-30deg); } to { transform: rotate(-8deg); } }
@keyframes wiggle { from { transform: translate(-4px, 0); } to { transform: translate(4px, -3px); } }
/* essen: Hand am Mund, Kopf kaut */
.eating .avatar .arm-r { transform: rotate(-112deg); }
.eating .avatar .head { transform-origin: 100px 128px; animation: chew .28s ease-in-out infinite alternate; }
@keyframes chew { from { transform: translateY(0); } to { transform: translateY(3px); } }
/* Hände ausstrecken, nach etwas greifen */
.warming .avatar .arm-l { transform: rotate(62deg); }
.warming .avatar .arm-r { transform: rotate(-62deg); }
.reaching .avatar .arm-r { transform: rotate(-120deg); }
/* sich drehen */
.spinning .flipper { transform-box: fill-box; transform-origin: 50% 50%; animation: twirl 1s ease-in-out; }
@keyframes twirl { 0% { transform: scaleX(1); } 25% { transform: scaleX(-1); } 50% { transform: scaleX(1); } 75% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
/* sitzen: Beine kurz nach vorn, Arme locker */
.sitting .avatar .leg-l, .sitting .avatar .leg-r { transform: scaleY(.42); transform-origin: 100px 215px; }
.sitting .avatar .shadow, .lying .avatar .shadow { display: none; }
.sitting .avatar .arm-l { transform: rotate(14deg); }
.sitting .avatar .arm-r { transform: rotate(-14deg); }
.sitting .avatar .upper { transform-origin: 100px 215px; animation: breathe 2.4s ease-in-out infinite alternate; }
.lying .avatar .upper { transform-origin: 100px 215px; animation: breathe 2.4s ease-in-out infinite alternate; }
@keyframes breathe { from { transform: scaleY(1); } to { transform: scaleY(1.025); } }

/* Tutorial */
.bigicon { font-size: 3rem; margin: 0 0 4px; }
.gamearea h3 { margin: 0 0 8px; font-size: 1.1rem; }
.gamearea form input { margin-bottom: 4px; text-transform: none; letter-spacing: 0; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 14px 0 0; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--red); }
dialog .check { border: 3px solid var(--line); background: #fff; }
dialog .check.on { border-color: var(--green); }

/* Katze */
.cat .tail { transform-box: fill-box; transform-origin: 100% 100%; animation: tail 1.6s ease-in-out infinite alternate; }
.catwalk .cat .tail { animation-duration: .35s; }
.catwalk .cat .paw { transform-box: fill-box; transform-origin: 50% 0; animation: paw .22s ease-in-out infinite alternate; }
.catwalk .cat .paw.b { animation-direction: alternate-reverse; }
.catwalk .cat { animation: catbob .22s ease-in-out infinite alternate; }
@keyframes tail { from { transform: rotate(-14deg); } to { transform: rotate(16deg); } }
@keyframes paw { from { transform: rotate(-28deg); } to { transform: rotate(28deg); } }
@keyframes catbob { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }
.shopitem > svg { width: auto; }

/* Quest-Anzeige */
.mapbar.onquest { background: #2f4273; }
.mapbar.onquest span:first-child { line-height: 1.25; }
.questdone { background: var(--gold) !important; color: #3a2c05 !important; font-weight: 700; }
.carrying { position: absolute; left: 0; translate: -50% 0; font-style: normal; animation: carry 1s ease-in-out infinite alternate; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
@keyframes carry { to { transform: translateY(-5px); } }
.mm-target { animation: target 1s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes target { from { transform: scale(.7); opacity: 1; } to { transform: scale(1.5); opacity: .25; } }

/* Minispiele: gemeinsame Effekte */
.gamearea { position: relative; }
.gamestat { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .9rem; margin: 10px 2px 0; min-height: 1.3em; }
.gamestat span:last-child { color: var(--red); font-weight: 700; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -30px; font-style: normal; animation: confetti linear forwards; }
@keyframes confetti { to { transform: translateY(520px) rotate(540deg); opacity: .2; } }
.popup { position: absolute; left: 50%; top: 0; translate: -50% 0; font-style: normal; font-size: 1.3rem; pointer-events: none; animation: popup .9s ease-out forwards; z-index: 3; }
@keyframes popup { from { transform: translateY(0) scale(.5); opacity: 1; } to { transform: translateY(-46px) scale(1.4); opacity: 0; } }

/* Memory mit Karten, die sich umdrehen */
.mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; perspective: 800px; }
.mc { position: relative; aspect-ratio: 1; padding: 0; animation: deal .4s cubic-bezier(.3, 1.4, .5, 1) backwards; animation-delay: var(--d); }
@keyframes deal { from { transform: translateY(-30px) scale(.4) rotate(-20deg); opacity: 0; } }
.mc-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.4, 1.3, .5, 1); }
.mc.up .mc-in { transform: rotateY(180deg); }
.mc-back, .mc-face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.mc-back { background: linear-gradient(135deg, #2f4273, #16233f); color: #fff; font-size: 1.1rem; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18), inset 0 -4px rgba(0, 0, 0, .25); }
.mc-face { background: #fff; transform: rotateY(180deg); font-size: 1.9rem; box-shadow: inset 0 0 0 2px var(--line); }
.mc-face img { width: 100%; height: 100%; object-fit: cover; }
.mc.found .mc-face { background: #e3f1e6; box-shadow: inset 0 0 0 3px var(--green); }
.mc.found { animation: matched .5s ease-out; }
@keyframes matched { 40% { transform: scale(1.18) rotate(4deg); } }
.mc.wrong { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.mc.dance { animation: dance .6s ease-in-out; }
@keyframes dance { 50% { transform: translateY(-12px) rotate(-6deg); } }

/* Hund im Geschenk */
.shell { position: relative; height: 170px; margin-top: 8px; border-radius: 16px; background: linear-gradient(#1c2b55 0 46%, #e4edf6 46%); overflow: hidden; }
.box { position: absolute; bottom: 14px; width: 22%; aspect-ratio: 1; padding: 0; transition: left var(--ms, .5s) ease-in-out; }
.box .gift, .box .pup { position: absolute; left: 50%; translate: -50% 0; line-height: 1; }
.box .gift { bottom: 0; font-size: clamp(2.6rem, 15vw, 4rem); transition: transform .3s cubic-bezier(.3, 1.5, .5, 1); z-index: 2; }
.box .pup { bottom: 4px; font-size: clamp(1.8rem, 10vw, 2.6rem); opacity: 0; transition: transform .35s cubic-bezier(.3, 1.5, .5, 1), opacity .15s; z-index: 1; }
.box.peek .pup { opacity: 1; transform: translateY(-46px); animation: wag .3s ease-in-out infinite alternate .35s; }
.box.peek .gift { transform: rotate(-8deg) translateY(4px); }
.box.empty .gift { transform: translateY(-38px) rotate(10deg); opacity: .55; }
.box.hop { animation: hop var(--ms, .5s) ease-in-out; z-index: 3; }
.box.duck { animation: duck var(--ms, .5s) ease-in-out; }
@keyframes hop { 50% { transform: translateY(-34px) scale(1.08); } }
@keyframes duck { 50% { transform: translateY(8px) scale(.94); } }
@keyframes wag { from { rotate: -8deg; } to { rotate: 8deg; } }
.box:not(:disabled) .gift { animation: invite 1s ease-in-out infinite alternate; }
@keyframes invite { to { transform: translateY(-5px); } }
.wag { animation: wag .35s ease-in-out infinite alternate; display: inline-block; }
.bigicon { position: relative; }
.bigicon.jump { animation: jump .5s ease-in-out 3; }
@keyframes jump { 50% { transform: translateY(-18px) scale(1.15); } }
.collar { display: flex; justify-content: center; gap: 6px; margin: 12px 0; }
.collar span { width: 38px; height: 46px; border-radius: 10px; background: #fff; border: 2px dashed var(--line); display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; }
.collar span.in { border: 2px solid var(--red); background: #fdeeee; animation: matched .4s ease-out; }
.tiles { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.tile { width: 46px; height: 50px; border-radius: 12px; background: var(--gold); color: #3a2c05; font-weight: 800; font-size: 1.3rem; box-shadow: 0 4px #b98a2c; transition: transform .15s, opacity .2s; }
.tile:active { transform: translateY(3px); box-shadow: 0 1px #b98a2c; }
.tile:disabled { opacity: .2; box-shadow: none; }
.tile.wrong { animation: shake .4s; background: #e58a8a; }

/* Geschichte */
.story { background: #fff; border-radius: 14px; padding: 16px; font-style: italic; line-height: 1.45; border-left: 5px solid var(--gold); text-align: left; }
.link { color: var(--muted); text-decoration: underline; font-size: .85rem; }

/* Türchen 4: Quiz mit Schneemann */
.snowman { position: relative; height: 150px; border-radius: 16px; background: linear-gradient(#1c2b55 0 62%, #e4edf6 62%); display: grid; place-items: end center; overflow: hidden; }
.snowman svg { height: 142px; }
.snowman .part { transform-box: fill-box; transform-origin: 50% 100%; animation: plop .5s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes plop { from { transform: translateY(-60px) scale(.3); opacity: 0; } }
.snowman.wave .arm { transform-box: fill-box; transform-origin: 50% 100%; animation: wave .35s ease-in-out infinite alternate; }
.snowman.wave svg { animation: jump .5s ease-in-out 3; }
@keyframes wave { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.gamearea h3[data-q] { min-height: 2.6em; margin: 8px 0; }
.answers { display: grid; gap: 8px; }
.answer { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 13px; font-weight: 600; transition: transform .12s, background .2s; }
.answer:active { transform: scale(.97); }
.answer.yes { background: #e3f1e6; border-color: var(--green); animation: matched .45s ease-out; }
.answer.no { background: #fdeeee; border-color: #e58a8a; color: var(--muted); animation: shake .4s; }

/* Türchen 5: Schneeflocken fangen */
.meter { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #7fb0dd, #fff); box-shadow: inset 0 0 0 2px #7fb0dd; transition: width .25s; }
.sky { position: relative; height: 290px; margin-top: 8px; border-radius: 16px; overflow: hidden; background: linear-gradient(#131f42, #4b4a86 78%, #e4edf6 78%); touch-action: none; cursor: ew-resize; outline: none; }
.sky .drop { position: absolute; font-size: 1.7rem; line-height: 1; pointer-events: none; will-change: transform, top; }
.basket { position: absolute; bottom: 4%; font-size: 2.6rem; line-height: 1; translate: -50% 0; pointer-events: none; transition: left .06s linear; }
.basket.hit { animation: catch .25s ease-out; }
.basket.ouch { animation: shake .35s; filter: grayscale(1); }
@keyframes catch { 50% { transform: scale(1.25) translateY(-4px); } }

/* Türchen 6: Suchbild */
.wanted { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.5rem; margin-bottom: 8px; }
.wanted span { width: 40px; height: 40px; border-radius: 12px; background: #fff; border: 2px dashed var(--line); display: grid; place-items: center; filter: grayscale(1); opacity: .55; transition: all .3s; }
.wanted span.have { filter: none; opacity: 1; border: 2px solid var(--green); background: #e3f1e6; animation: matched .45s ease-out; }
.wanted b { font-size: 1.3rem; }
.clutter { position: relative; height: 330px; border-radius: 16px; overflow: hidden; background: repeating-linear-gradient(0deg, #c9a27e 0 46px, #c29a75 46px 48px), #c9a27e; box-shadow: inset 0 0 0 4px #8c5a3c; }
.thing { position: absolute; padding: 0; font-size: 1.75rem; line-height: 1; translate: -50% -50%; transform: rotate(var(--r)) scale(var(--s)); transition: transform .2s, opacity .3s; }
.thing.nope { animation: nope .35s; }
@keyframes nope { 30% { transform: rotate(calc(var(--r) + 14deg)) scale(var(--s)); } 70% { transform: rotate(calc(var(--r) - 14deg)) scale(var(--s)); } }
.thing.got { transform: scale(1.9) rotate(0); opacity: 0; }
.thing.hint { animation: nope .35s 3; }

/* Türchen 7: Schiebepuzzle */
.slider { position: relative; width: min(100%, 300px); aspect-ratio: 1; margin: 0 auto; border-radius: 14px; background: #2a3558; box-shadow: 0 0 0 4px #8c5a3c; overflow: hidden; }
.slider::after { content: ""; position: absolute; inset: 0; background: var(--img) center / cover; opacity: 0; transition: opacity .4s; pointer-events: none; }
.slider.peek::after, .slider.solved::after { opacity: 1; }
.piece { position: absolute; left: 0; top: 0; width: 33.334%; height: 33.334%; padding: 0; background-image: var(--img); background-size: 300% 300%; border-radius: 8px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); transition: transform .18s ease-out; }
.piece i { position: absolute; left: 5px; top: 4px; font: 700 .7rem system-ui; color: #fff; background: rgba(0, 0, 0, .45); border-radius: 99px; padding: 1px 6px; }
.piece.stuck { animation: stuck .25s; }
@keyframes stuck { 50% { filter: brightness(.7); } }
.slider.solved { animation: matched .6s ease-out; }
.slider.solved .piece { opacity: 0; transition: opacity .3s; }

/* Türchen 8: Melodien */
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pad { aspect-ratio: 1.6; border-radius: 18px; background: var(--c); opacity: .5; font-size: 1.8rem; box-shadow: inset 0 -6px rgba(0, 0, 0, .25); transition: opacity .1s, transform .1s, box-shadow .1s; }
.pad span { opacity: 0; transition: opacity .1s; }
.pad:not(:disabled) { opacity: .78; }
.pad.on, .pad:not(:disabled):active { opacity: 1; transform: scale(1.05); box-shadow: 0 0 0 4px #fff, 0 0 22px var(--c); }
.pad.on span { opacity: 1; }
.pads.oops { animation: shake .4s; filter: grayscale(.8); }
.notes { display: flex; justify-content: center; gap: 6px; margin-top: 12px; min-height: 12px; }
.notes i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); transition: background .15s, transform .15s; }
.notes i.ok { background: var(--green); transform: scale(1.25); }

/* Türchen 9: Umschlag */
.envelope { position: relative; display: block; width: 210px; height: 140px; margin: 96px auto 14px; border-radius: 10px; background: #f4e7c8; box-shadow: 0 6px 16px rgba(0, 0, 0, .2), inset 0 0 0 3px #e0cfa6; overflow: visible; }
.envelope b { position: absolute; left: 0; right: 0; bottom: 22px; font: italic 600 1.05rem Georgia, serif; color: #6b4a36; }
.envelope .flap { position: absolute; left: 0; right: 0; top: 0; height: 74px; background: #ead9b3; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 0; transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); box-shadow: inset 0 -3px #d8c498; z-index: 2; }
.envelope .letter { position: absolute; left: 50%; top: 26px; translate: -50% 0; font-size: 2.6rem; opacity: 0; transition: transform .6s cubic-bezier(.3, 1.4, .5, 1), opacity .2s; z-index: 1; }
.envelope.rip { animation: rip .3s; }
@keyframes rip { 30% { transform: rotate(-5deg) scale(1.04); } 70% { transform: rotate(5deg) scale(1.04); } }
.envelope[data-tear="1"] .flap { transform: rotateX(18deg); }
.envelope[data-tear="2"] .flap { transform: rotateX(40deg); }
.envelope[data-tear="3"] .flap { transform: rotateX(72deg); }
.envelope.open .flap { transform: rotateX(178deg); }
.envelope.open .letter { opacity: 1; transform: translateY(-64px) scale(1.25); }

/* Türchen 10: Wort mit fünf Buchstaben */
.words { display: grid; gap: 5px; justify-content: center; }
.word { display: grid; grid-template-columns: repeat(5, 40px); gap: 5px; }
.word span { height: 40px; border-radius: 8px; background: #fff; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; }
.word span.typed { border-color: var(--muted); animation: catch .15s; }
.word span.flip { animation: flipin .35s ease-in-out; color: #fff; border-color: transparent; }
@keyframes flipin { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.word span.yes, .key.yes { background: var(--green); color: #fff; }
.word span.near, .key.near { background: var(--gold); color: #3a2c05; }
.word span.no, .key.no { background: #9aa0b0; color: #fff; }
.word.shake { animation: shake .4s; }
.word.won span { animation: dance .6s ease-in-out; }
.keys { display: grid; gap: 5px; margin-top: 4px; }
.keys div { display: flex; justify-content: center; gap: 4px; }
.key { flex: 1; max-width: 32px; height: 40px; border-radius: 7px; background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: .9rem; padding: 0; }
.key.wide { max-width: 46px; flex: 1.5; background: var(--line); }
.dev button + button { margin-left: 10px; }
.mc-face img { pointer-events: none; }
.mc.found .mc-face { box-shadow: inset 0 0 0 4px var(--green); }
.mc.found .mc-face img { opacity: .92; }

/* Test-Knopf „Nächste Aufgabe“: steht links im gelben Balken, nur im Testmodus */
.dev { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; position: relative; }
.dev .task { margin: 0 auto 0 0; background: #2a2a3a; color: #fff; text-decoration: none; font-weight: 700; border-radius: 99px; padding: 5px 12px; white-space: nowrap; }
.dev button { margin-left: 0; }

/* Ohne gültigen Schlüssel: kein Menü, keine Zähler */
body.locked nav, body.locked .counters { display: none; }
body.locked main { display: grid; place-items: center; }
