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

:root {
  --warm: #ffb454;
  --creme: #ffeed3;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --hand: "Snell Roundhand", "Bradley Hand", "Segoe Script", "Apple Chancery", cursive;
}

html, body { height: 100%; overflow: hidden; background: #0b0a12; overscroll-behavior: none; }
body {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", sans-serif;
  color: var(--creme);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 3px solid #ffd27a; outline-offset: 3px; }

/* ---------- Die Hütte ---------- */

#buehne { position: fixed; inset: 0; overflow: hidden; touch-action: none; background: #0b0a12; cursor: grab; }
#buehne:active { cursor: grabbing; }
#fahrt { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
#raum { position: absolute; left: 0; top: 0; will-change: transform, perspective-origin; }

.ebene {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  pointer-events: none;
}
.ebene > canvas.bild, .ebene > svg, .ebene > .voll { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ebene.rueckseite-weg { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.ebene.tippbar, .ebene .tippbar { pointer-events: auto; cursor: pointer; }

/* Teile in einer Ebene, die sich bewegen (immer innen animieren, nie die Ebene selbst) */
.teil { position: absolute; inset: 0; width: 100%; height: 100%; }
.teil > svg, .teil > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.schneefall { position: absolute; inset: 0; overflow: hidden; }
.schneefall i {
  position: absolute; left: 0; top: -100%; width: 100%; height: 200%;
  background-size: calc(var(--s) * var(--kachel, 300px)) calc(var(--s) * var(--kachel, 300px));
  animation: schneien var(--dauer, 14s) linear infinite;
}
@keyframes schneien { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(calc(var(--s) * 40px), 50%, 0); } }

.pendel { transform-origin: 50% 0; animation: pendeln 2.2s ease-in-out infinite alternate; }
@keyframes pendeln { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.laterne { transform-origin: 50% 0; animation: schaukeln 6.5s ease-in-out infinite alternate; }
@keyframes schaukeln { from { transform: rotate(-2.2deg); } to { transform: rotate(2.4deg); } }

.laternen-griff { position: absolute; left: 8%; right: 8%; top: 66%; bottom: 0; }
.laterne.schubs { animation: schubs 3.2s cubic-bezier(.3, 0, .3, 1); }
@keyframes schubs { 10% { transform: rotate(14deg); } 30% { transform: rotate(-10deg); } 50% { transform: rotate(6deg); } 70% { transform: rotate(-3deg); } 100% { transform: rotate(0); } }

.schnuppe { position: absolute; left: 10%; top: 10%; width: 22%; height: 1.2%; border-radius: 99px; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(220, 235, 255, .7) 70%, #fff); transform-origin: 100% 50%;
  animation: schnuppe 17s linear infinite 4s; }
@keyframes schnuppe { 0%, 93% { opacity: 0; transform: translate(0, 0) rotate(18deg) scaleX(.3); } 94% { opacity: 1; } 97.5% { opacity: .9; transform: translate(220%, 1200%) rotate(18deg) scaleX(1); } 98.5%, 100% { opacity: 0; transform: translate(260%, 1400%) rotate(18deg) scaleX(.6); } }

.flackern { animation: flackern 3.1s ease-in-out infinite; }
@keyframes flackern { 0% { opacity: .85; } 13% { opacity: 1; } 27% { opacity: .78; } 41% { opacity: .95; } 58% { opacity: .82; } 72% { opacity: 1; } 86% { opacity: .88; } 100% { opacity: .85; } }

.funkeln { animation: funkeln 2.8s ease-in-out infinite; }
.funkeln.b { animation-delay: -0.93s; }
.funkeln.c { animation-delay: -1.86s; }
@keyframes funkeln { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.kerzenflamme { transform-origin: 50% 90%; animation: kerze 1.7s ease-in-out infinite alternate; }
@keyframes kerze { 0% { transform: scale(1, 1) skewX(0); } 30% { transform: scale(.94, 1.08) skewX(-3deg); } 60% { transform: scale(1.04, .95) skewX(2deg); } 100% { transform: scale(.98, 1.05) skewX(-1deg); } }

/* Baum */
.stern { position: absolute; left: 40.9%; top: -1%; width: 18.2%; height: 12%; animation: sternpuls 3.4s ease-in-out infinite; }
.stern svg { width: 100%; height: 100%; display: block; }
@keyframes sternpuls { 50% { transform: scale(1.07); filter: brightness(1.15); } }

/* Feuer */
.feuer .flamme { position: absolute; bottom: 0; transform-origin: 50% 100%; animation: flamme 1.4s ease-in-out infinite alternate; mix-blend-mode: screen; }
.feuer .flamme svg { width: 100%; height: 100%; display: block; }
@keyframes flamme {
  0% { transform: scale(1, 1) skewX(0deg); opacity: .9; }
  25% { transform: scale(.92, 1.1) skewX(-4deg); opacity: 1; }
  50% { transform: scale(1.06, .9) skewX(3deg); opacity: .85; }
  75% { transform: scale(.96, 1.06) skewX(-2deg); opacity: 1; }
  100% { transform: scale(1.02, .96) skewX(2deg); opacity: .92; }
}
.feuer .glut { position: absolute; bottom: 30%; width: 3%; height: 2.6%; border-radius: 50%; background: #ffd27a; box-shadow: 0 0 6px 2px rgba(255, 150, 50, .8); animation: glut 2.2s linear infinite; opacity: 0; }
@keyframes glut { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(calc(var(--s) * 18px), calc(var(--s) * -190px)); opacity: 0; } }

.kerzenflamme svg { width: 100%; height: 100%; display: block; }
.dampf { animation: dampf 4.5s ease-in-out infinite; opacity: 0; }
.dampf.b { animation-delay: -2.2s; }
@keyframes dampf { 0% { transform: translateY(20%) scaleX(.8); opacity: 0; } 30% { opacity: .9; } 100% { transform: translateY(-25%) scaleX(1.2); opacity: 0; } }
.staub { position: absolute; width: calc(var(--s) * 3.2px); height: calc(var(--s) * 3.2px); border-radius: 50%; background: #dfeaff; opacity: 0; animation: staub 12s ease-in-out infinite; }
@keyframes staub { 0% { transform: translate(0, 0); opacity: 0; } 20% { opacity: .65; } 50% { transform: translate(calc(var(--s) * 30px), calc(var(--s) * -20px)); } 80% { opacity: .5; } 100% { transform: translate(calc(var(--s) * 10px), calc(var(--s) * 40px)); opacity: 0; } }

/* Dobby */
.dobby-atmen { transform-origin: 48% 83%; animation: atmen 3.8s ease-in-out infinite alternate; }
@keyframes atmen { to { transform: scale(1.012, 1.022); } }
.dobby .ohr-l { transform-origin: 29% 28.7%; animation: ohrL 7s ease-in-out infinite; }
.dobby .ohr-r { transform-origin: 67% 28.7%; animation: ohrR 9.3s ease-in-out infinite; }
@keyframes ohrL { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(-12deg); } 92% { transform: rotate(4deg); } 95% { transform: rotate(-5deg); } }
@keyframes ohrR { 0%, 70%, 100% { transform: rotate(0); } 73% { transform: rotate(11deg); } 76% { transform: rotate(-4deg); } 79% { transform: rotate(5deg); } }
.dobby .lider { transform-origin: 50% 31.3%; transform: scaleY(0); animation: blinzeln 5.3s infinite; }
@keyframes blinzeln { 0%, 93%, 100% { transform: scaleY(0); } 95.5% { transform: scaleY(1); } }
.dobby .arme.zeigen { visibility: hidden; }
.dobby.zeigt .arme.zeigen { visibility: visible; }
.dobby.zeigt .arme.waermen { visibility: hidden; }
.dobby.wink .ohr-l { animation: ohrWinkL .5s ease-in-out 4; }
.dobby.wink .ohr-r { animation: ohrWinkR .5s ease-in-out 4; }
@keyframes ohrWinkL { 50% { transform: rotate(-16deg); } }
@keyframes ohrWinkR { 50% { transform: rotate(16deg); } }
.dobby.weg { animation: plopp .25s ease-in forwards; }
.dobby.da { animation: plopp .3s ease-out reverse; }
@keyframes plopp { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.2, 1.4); } }

/* Kleine Dinge im Raum */
.schwingen { transform-origin: 50% 2%; animation: schwingen 4.6s ease-in-out infinite alternate; }
.schwingen.b { animation-duration: 5.3s; animation-delay: -2s; }
.schwingen.c { transform-origin: 50% 0; animation-duration: 6.1s; animation-delay: -1s; }
@keyframes schwingen { from { transform: rotate(-1.6deg); } to { transform: rotate(1.8deg); } }

.kuckuckstuer { transform-origin: 30% 50%; }
.vogel { transform-origin: 50% 60%; opacity: 0; }
.ruft .kuckuckstuer { animation: kuckucksTuer 2.4s ease-in-out; }
.ruft .vogel { animation: kuckucksVogel 2.4s ease-in-out; }
@keyframes kuckucksTuer { 0%, 100% { transform: scaleX(1); } 10%, 86% { transform: scaleX(.12); } }
@keyframes kuckucksVogel {
  0%, 8% { opacity: 0; transform: translate(0, 0) scale(.5); }
  18% { opacity: 1; transform: translate(4%, 8%) scale(1.2); }
  28% { transform: translate(4%, 8%) scale(1.2) rotate(-10deg); }
  40% { transform: translate(4%, 8%) scale(1.2); }
  56% { transform: translate(4%, 8%) scale(1.2) rotate(-10deg); }
  70% { opacity: 1; transform: translate(4%, 8%) scale(1.2); }
  86%, 100% { opacity: 0; transform: translate(0, 0) scale(.5); }
}

.schneekugel { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.schneekugel i { position: absolute; top: -10%; width: 7%; height: 7%; border-radius: 50%; background: #fff; opacity: .9; animation: kugelSchnee 3.4s linear infinite; }
@keyframes kugelSchnee { from { transform: translate(0, 0); } to { transform: translate(calc(var(--s) * 6px), calc(var(--s) * 48px)); } }

.baumglanz { position: absolute; width: 5%; aspect-ratio: 1; margin: -2.5% 0 0 -2.5%; background: radial-gradient(closest-side, #fff, #fff3c0 40%, rgba(255, 220, 140, 0)); clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%); opacity: 0; animation: baumglanz 8s ease-in-out infinite; }
@keyframes baumglanz { 0%, 86%, 100% { opacity: 0; transform: scale(.2) rotate(0); } 91% { opacity: 1; transform: scale(1) rotate(45deg); } 95% { opacity: 0; transform: scale(.4) rotate(90deg); } }

/* Uhrzeiger (echte Uhrzeit) */
.uhr .zeiger { position: absolute; left: 50%; bottom: calc(100% - var(--mitte)); background: #1a0f0a; border-radius: 99px; transform-origin: 50% 100%; }
.uhr .zeiger.std { width: 3%; height: 14%; margin-left: -1.5%; }
.uhr .zeiger.min { width: 2.2%; height: 19%; margin-left: -1.1%; }
.uhr.gross .zeiger.std { width: 5%; height: 23%; margin-left: -2.5%; }
.uhr.gross .zeiger.min { width: 3.5%; height: 33%; margin-left: -1.75%; }

/* Die Maus */
.ebene.maus { clip-path: inset(0 0 24% 0); }
.ebene.maus:not(.sichtbar) { pointer-events: none; }
.maus-guckt { transform: translateY(100%); }
.maus-nase { transform-origin: 50% 54%; animation: schnuppern .3s ease-in-out infinite alternate; }
@keyframes schnuppern { to { transform: translateY(-1%) scale(1.07); } }
.mausweg .keks { position: absolute; left: 24%; bottom: 0; width: 6.7%; height: 24%; }
.mausweg .keks svg { width: 100%; height: 100%; display: block; }
.mausweg .laeufer { position: absolute; left: 80%; bottom: 0; width: 19%; height: 80%; opacity: 0; pointer-events: none; }
.mausweg .laeufer.unterwegs { pointer-events: auto; }
.mausweg .laeufer.unterwegs .teil { animation: trippeln .14s steps(2) infinite; }
@keyframes trippeln { to { transform: translateY(-7%); } }

/* Das Rotkehlchen */
.rk { position: absolute; left: 50%; top: 28%; width: 24%; height: 42%; opacity: 0; transform-origin: 50% 95%; }
.rk-wende { position: absolute; inset: 0; }
.rk-fluegel { transform-origin: 55% 42%; }
.rk.fliegt .rk-fluegel { animation: flattern .08s linear infinite alternate; }
@keyframes flattern { to { transform: scaleY(-.7) translateY(-10%); } }

/* Die Motte */
.motte-bahn { position: absolute; inset: 0; animation: motteBahn 7.5s ease-in-out infinite; }
.motte { position: absolute; left: 0; top: 0; width: 20%; height: 15%; }
.motte::before { content: ""; position: absolute; inset: -70%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 228, 160, .35), rgba(255, 228, 160, 0)); }
.motte svg { position: relative; width: 100%; height: 100%; display: block; animation: motteFluegel .07s linear infinite alternate; }
@keyframes motteFluegel { to { transform: scaleX(.35); } }
@keyframes motteBahn {
  0% { transform: translate(42%, 40%); } 12% { transform: translate(80%, 28%); } 22% { transform: translate(88%, 50%); }
  30% { transform: translate(70%, 64%) rotate(20deg); } 42% { transform: translate(40%, 70%); } 52% { transform: translate(10%, 52%) rotate(-15deg); }
  62% { transform: translate(6%, 30%); } 72% { transform: translate(30%, 14%); } 80% { transform: translate(55%, 22%); }
  88% { transform: translate(50%, 36%); } 100% { transform: translate(42%, 40%); }
}

/* Dobby: Kopf neigen, Blick zu Liv, Socke zappeln, Hände reiben */
.dobby .dobby-kopf { transform-origin: 49% 49.3%; animation: dobbyKopf 11s ease-in-out infinite; }
@keyframes dobbyKopf { 0%, 62%, 100% { transform: rotate(0); } 68%, 80% { transform: rotate(-5deg); } 86% { transform: rotate(1deg); } 90% { transform: rotate(0); } }
.dobby .augen { animation: dobbyBlick 13s ease-in-out infinite; }
@keyframes dobbyBlick { 0%, 46%, 100% { transform: translate(0, 0); } 51%, 73% { transform: translate(-2.4%, .6%); } 78% { transform: translate(0, 0); } }
.dobby .socke { transform-origin: 50% 80%; animation: socke 2.6s ease-in-out infinite alternate; }
@keyframes socke { from { transform: rotate(-2.5deg); } to { transform: rotate(2.5deg) translateY(-.4%); } }
.dobby .reiben { transform-origin: 50% 57%; animation: reiben .9s ease-in-out infinite alternate; }
@keyframes reiben { from { transform: translate(0, 0); } to { transform: translate(.6%, -.9%) rotate(-.8deg); } }
.dobby .winken { transform-origin: 64% 55.3%; }
.dobby .dobby-sprung { transform-origin: 50% 98%; }

/* Talahoon: Schwanz, Kopf neigen, Ohren zucken */
.talahoon .schwanz { transform-origin: 84% 87%; animation: tigerSchwanz 3.4s ease-in-out infinite alternate; }
@keyframes tigerSchwanz { from { transform: rotate(-7deg); } to { transform: rotate(10deg); } }
.talahoon .kopf { transform-origin: 50% 56.5%; animation: tigerKopf 9s ease-in-out infinite; }
@keyframes tigerKopf { 0%, 40%, 100% { transform: rotate(0); } 50%, 66% { transform: rotate(-6deg); } 74% { transform: rotate(1.5deg); } 80% { transform: rotate(0); } }
.talahoon .ohr-l { transform-origin: 29.3% 21.2%; animation: tigerOhrL 6.2s ease-in-out infinite; }
.talahoon .ohr-r { transform-origin: 70.7% 21.2%; animation: tigerOhrR 7.7s ease-in-out infinite; }
@keyframes tigerOhrL { 0%, 88%, 100% { transform: rotate(0); } 91% { transform: rotate(-14deg); } 94% { transform: rotate(3deg); } }
@keyframes tigerOhrR { 0%, 60%, 100% { transform: rotate(0); } 63% { transform: rotate(14deg); } 66% { transform: rotate(-3deg); } }

/* Dino: Schwanz wedeln, blinzeln (der Hals wiegt sich, siehe unten) */
.dino .dino-schwanz { transform-origin: 22% 80%; animation: dinoSchwanz 2.3s ease-in-out infinite alternate; }
@keyframes dinoSchwanz { from { transform: rotate(-4deg); } to { transform: rotate(6deg); } }
.dino .dino-lid { transform-origin: 86.7% 15.6%; transform: scaleY(0); animation: blinzeln 4.7s infinite -2s; }

/* Dobbys Schriftrolle */
.dobby .rolle { position: absolute; left: 16%; top: 61%; width: 60%; height: 20%; cursor: pointer; animation: rolleSchweben 3.2s ease-in-out infinite alternate; }
.dobby .rolle svg { position: relative; width: 100%; height: 100%; display: block; }
.dobby .rolle.neu::before { content: ""; position: absolute; inset: -45% -18%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 224, 140, .85), rgba(255, 190, 90, .3) 55%, transparent); animation: atmenGlanz 2s ease-in-out infinite; pointer-events: none; }
@keyframes rolleSchweben { from { transform: translateY(-3%) rotate(-2deg); } to { transform: translateY(4%) rotate(2deg); } }

/* Figuren reagieren nur dort, wo sie wirklich gemalt sind */
.ebene.dobby, .ebene.pluesch, .ebene.dobby svg, .ebene.pluesch svg { pointer-events: none; }
.ebene.dobby svg *, .ebene.pluesch svg * { pointer-events: visiblePainted; cursor: pointer; }
.ebene.pluesch .geschenk, .ebene.pluesch .geschenk * { pointer-events: auto; }

/* Plüschtiere */
.knautsch { transform-origin: 50% 100%; }
.pluesch.drueck .knautsch { animation: knautsch .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes knautsch { 0% { transform: scale(1, 1); } 25% { transform: scale(1.12, .84); } 55% { transform: scale(.95, 1.07); } 100% { transform: scale(1, 1); } }
.dino-hals { transform-origin: 59.3% 66.1%; animation: halsWiegen 6s ease-in-out infinite alternate; }
@keyframes halsWiegen { from { transform: rotate(-1.6deg); } to { transform: rotate(2deg); } }

/* Geschenke im Raum */
.geschenk { pointer-events: auto; cursor: pointer; }
.geschenk.im-dino { position: absolute; }
.geschenk .paket { position: absolute; inset: 0; transform-origin: 50% 100%; }
.geschenk .paket::before { content: ""; position: absolute; inset: calc(var(--s) * var(--polster) * -1); }
.geschenk .paket.haengend { transform-origin: 50% 0; animation: haengen 4.2s ease-in-out infinite alternate; }
@keyframes haengen { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
.geschenk .pzu, .geschenk .pauf { position: absolute; inset: 0; }
.geschenk .pzu svg, .geschenk .pauf svg { width: 100%; height: 100%; display: block; }
.geschenk .pauf, .geschenk.offen .pzu { display: none; }
.geschenk.offen .pauf { display: block; }
.geschenk .paket.wackeln { animation: wackeln .6s ease-in-out; }
.geschenk .paket.haengend.wackeln { animation: wackelnH .6s ease-in-out; }
@keyframes wackeln { 15% { transform: rotate(-6deg); } 35% { transform: rotate(5deg); } 55% { transform: rotate(-3deg); } 75% { transform: rotate(2deg); } }
@keyframes wackelnH { 15% { transform: rotate(-12deg); } 35% { transform: rotate(10deg); } 55% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
.geschenk .glitzer { position: absolute; inset: -12%; pointer-events: none; display: none; }
.geschenk.heute .glitzer { display: block; }
.geschenk .glitzer::before { content: ""; position: absolute; inset: -10%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 215, 130, .55), rgba(255, 190, 90, 0)); animation: atmenGlanz 2.6s ease-in-out infinite; }
@keyframes atmenGlanz { 50% { opacity: .35; transform: scale(.9); } }
.geschenk .glitzer i { position: absolute; width: 14%; aspect-ratio: 1; background: radial-gradient(closest-side, #fff, #ffe08a 35%, rgba(255, 200, 100, 0)); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: funke 2.4s ease-in-out infinite; opacity: 0; }
.geschenk .glitzer i:nth-child(1) { left: 8%; top: 20%; animation-delay: -.2s; }
.geschenk .glitzer i:nth-child(2) { left: 78%; top: 10%; animation-delay: -1s; }
.geschenk .glitzer i:nth-child(3) { left: 46%; top: -4%; animation-delay: -1.7s; width: 18%; }
.geschenk .glitzer i:nth-child(4) { left: 86%; top: 58%; animation-delay: -.6s; }
.geschenk .glitzer i:nth-child(5) { left: 2%; top: 64%; animation-delay: -2.1s; width: 10%; }
.geschenk .glitzer i:nth-child(6) { left: 60%; top: 34%; animation-delay: -1.3s; width: 10%; }
@keyframes funke { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 40% { opacity: 1; transform: scale(1) rotate(45deg); } 70% { opacity: 0; transform: scale(.5) rotate(90deg); } }
.geschenk.heute .paket:not(.haengend):not(.wackeln) { animation: huepfen 3.2s ease-in-out infinite; }
@keyframes huepfen { 0%, 70%, 100% { transform: none; } 76% { transform: translateY(-5%) scale(1.03, .98); } 82% { transform: scale(.98, 1.03); } 88% { transform: translateY(-1.5%); } }

/* Lichtkarte: dunkelt alles ab, außer um die Lichtquellen */
#lichtkarte, #glanzkarte { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#lichtkarte { background: #3a3150; mix-blend-mode: multiply; isolation: isolate; }
#glanzkarte { mix-blend-mode: screen; }
#lichtkarte i, #glanzkarte i { position: absolute; left: 0; top: 0; display: block; border-radius: 50%; will-change: transform; }

/* Licht über allem */
#licht { position: fixed; inset: 0; pointer-events: none; }
#licht .vignette { position: absolute; inset: 0; background: radial-gradient(ellipse 85% 75% at 50% 48%, transparent 55%, rgba(6, 3, 8, .55) 100%); }
#licht .feuerschein {
  position: absolute; left: 0; top: 0; width: 120vmax; height: 120vmax; margin: -60vmax 0 0 -60vmax;
  background: radial-gradient(circle, rgba(255, 150, 60, .16), rgba(255, 120, 40, .06) 35%, transparent 62%);
  mix-blend-mode: screen; will-change: transform, opacity;
  animation: flackern 2.6s ease-in-out infinite;
}
#licht .korn {
  position: absolute; inset: -50%; opacity: .07; will-change: transform;
  background-size: 160px 160px; animation: korn 1s steps(6) infinite;
}
@keyframes korn { 0% { transform: translate(0, 0); } 20% { transform: translate(-7%, 4%); } 40% { transform: translate(5%, -6%); } 60% { transform: translate(-4%, -3%); } 80% { transform: translate(6%, 5%); } 100% { transform: translate(0, 0); } }

#funken { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

#kopf {
  position: fixed; left: 0; right: 0; top: 0; z-index: 5; pointer-events: none;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 0;
  display: flex; align-items: flex-start; justify-content: center;
}
#untertitel {
  max-width: calc(100% - 104px);
  font-family: var(--serif); font-size: 16px; line-height: 1.3; letter-spacing: .01em; text-align: center;
  padding: 7px 16px; border-radius: 99px; margin-top: 4px;
  background: rgba(14, 8, 12, .42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6); transition: opacity 1.2s;
}
#untertitel.leise { opacity: 0; }
#untertitel:empty { display: none; }
#tonknopf {
  position: absolute; right: 12px; top: calc(env(safe-area-inset-top) + 10px);
  width: 40px; height: 40px; border-radius: 50%; pointer-events: auto;
  background: rgba(14, 8, 12, .42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center;
}
#tonknopf svg { width: 20px; height: 20px; fill: currentColor; opacity: .85; }
#tonknopf .aus, #tonknopf[aria-pressed="true"] .wellen { display: none; }
#tonknopf[aria-pressed="true"] .aus { display: inline; }

#hinweis {
  position: fixed; left: 0; top: 0; z-index: 8; max-width: 70vw;
  background: rgba(30, 16, 22, .9); border: 1px solid rgba(255, 200, 120, .35); border-radius: 14px;
  padding: 9px 14px; font-size: 14px; text-align: center; line-height: 1.35;
  opacity: 0; pointer-events: none; transform: translate(-50%, -100%) translateY(4px); transition: opacity .25s, transform .25s;
}
#hinweis.da { opacity: 1; transform: translate(-50%, -100%) translateY(-6px); }

#vorschauband {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 12px); transform: translateX(-50%); z-index: 6;
  display: flex; gap: 10px; align-items: center; white-space: nowrap;
  padding: 6px 6px 6px 14px; border-radius: 99px; font-size: 13px;
  background: rgba(120, 30, 40, .85); border: 1px solid rgba(255, 200, 140, .4);
}
#vorschauband button { padding: 6px 12px; border-radius: 99px; background: rgba(255, 238, 211, .16); }
body:has(#bescherung:not([hidden])) #vorschauband, body:has(#bibliothek:not([hidden])) #vorschauband { display: none; }

/* ---------- Dobby-Sprechblase ---------- */
.sprechblase {
  position: fixed; z-index: 7; max-width: 200px; padding: 10px 14px; border-radius: 16px;
  background: #fff4dd; color: #3a1d14; font-family: var(--serif); font-size: 15px; line-height: 1.3;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35); transform: translate(-50%, -100%); pointer-events: none;
  animation: blase .35s cubic-bezier(.3, 1.5, .5, 1);
}
.sprechblase::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: #fff4dd; }
@keyframes blase { from { opacity: 0; transform: translate(-50%, -80%) scale(.7); } }

/* ---------- Bescherung: Auspacken und Hören ---------- */
#bescherung { position: fixed; inset: 0; z-index: 20; }
#bescherung .schleier { position: absolute; inset: 0; background: rgba(10, 6, 12, 0); transition: background .9s, -webkit-backdrop-filter .9s, backdrop-filter .9s; }
#bescherung.da .schleier { background: rgba(10, 6, 12, .58); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
#bescherung.nacht .schleier { background: rgba(3, 2, 5, .94); transition-duration: 4s; }
#bescherung .glanz { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s; background: radial-gradient(circle at 50% 50%, rgba(255, 190, 90, .42), rgba(255, 150, 60, .12) 35%, transparent 62%); }
#bescherung.leuchtet .glanz { opacity: 1; }
#bescherung.hoeren .glanz { opacity: .7; background: radial-gradient(ellipse 70% 40% at 50% 28%, rgba(255, 190, 90, .32), transparent 70%); }
#bescherung.nacht .glanz { opacity: .25; transition-duration: 4s; }

#buehne3d { position: absolute; inset: 0; perspective: 1000px; touch-action: none; }
#paket, #buch { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }

.box { position: absolute; left: 0; top: 0; transform-style: preserve-3d; will-change: transform; transition: opacity .4s; }
.box .koerper { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.box .f { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.box .wand { position: absolute; left: calc(var(--w) / -2); top: calc(var(--h) / -2); width: var(--w); height: var(--h); transform-style: preserve-3d; transform-origin: 50% 100%; transition: transform 1s cubic-bezier(.45, -.25, .35, 1.25); }
.box .wand.links, .box .wand.rechts { left: calc(var(--d) / -2); width: var(--d); }
.box .wand.vorn { transform: translateZ(calc(var(--d) / 2)) rotateX(var(--klapp, 0deg)); }
.box .wand.hinten { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)) rotateX(var(--klapp, 0deg)); }
.box .wand.links { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)) rotateX(var(--klapp, 0deg)); }
.box .wand.rechts { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)) rotateX(var(--klapp, 0deg)); }
.box.klappt .wand { --klapp: -102deg; }
.box.klappt .wand.links { transition-delay: .06s; }
.box.klappt .wand.rechts { transition-delay: .12s; }
.box.klappt .wand.hinten { transition-delay: .18s; }
.box .wand .f { inset: 0; }
.box .aussen, .box .deckel .f { background: var(--muster), var(--papier); background-size: var(--mg), auto; overflow: hidden; }
.box .aussen { transform: translateZ(.6px); }
.box .aussen::after, .box .deckel .f::after { content: ""; position: absolute; inset: 0; background: #140a08; opacity: var(--dunkel, .15); pointer-events: none; }
.box .innen { background: linear-gradient(#6a4630, #3a2418); transform: rotateY(180deg) translateZ(.6px); }
.box .boden, .box .innenboden { left: calc(var(--w) / -2); top: calc(var(--d) / -2); width: var(--w); height: var(--d); }
.box .boden { background: var(--schatten); transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); }
.box .innenboden { background: #3a2418; transform: rotateX(90deg) translateZ(calc(var(--h) / -2 + 1px)); transition: background .6s; }
.box.licht .innenboden { background: radial-gradient(circle, #fff3c8, #ffc860 30%, #c87a2a 60%, #4a2a18 90%); }

.box .deckel { position: absolute; left: 0; top: 0; transform-style: preserve-3d; transform: translateY(calc(var(--h) / -2)) translate3d(0, var(--hub, 0px), 0) rotateX(var(--kipp, 0deg)); transition: transform .5s cubic-bezier(.3, 1.5, .5, 1); }
.box.deckel-fliegt .deckel { transform: translateY(calc(var(--h) / -2)) translate3d(90px, -110vh, 60px) rotateX(-75deg) rotateZ(32deg); transition: transform 1.1s cubic-bezier(.55, 0, .85, .35); }
.box .d-oben { left: calc((var(--w) + 8px) / -2); top: calc((var(--d) + 8px) / -2); width: calc(var(--w) + 8px); height: calc(var(--d) + 8px); transform: rotateX(90deg) translateZ(3px); }
.box .d-vorn, .box .d-hinten { left: calc((var(--w) + 8px) / -2); top: -3px; width: calc(var(--w) + 8px); height: var(--lh); }
.box .d-links, .box .d-rechts { left: calc((var(--d) + 8px) / -2); top: -3px; width: calc(var(--d) + 8px); height: var(--lh); }
.box .d-vorn { transform: translateZ(calc((var(--d) + 8px) / 2)); }
.box .d-hinten { transform: rotateY(180deg) translateZ(calc((var(--d) + 8px) / 2)); }
.box .d-links { transform: rotateY(-90deg) translateZ(calc((var(--w) + 8px) / 2)); }
.box .d-rechts { transform: rotateY(90deg) translateZ(calc((var(--w) + 8px) / 2)); }

.box .band { position: absolute; top: 0; bottom: 0; left: 43%; width: 14%; background: var(--band); box-shadow: inset 2px 0 0 rgba(255, 255, 255, .28), inset -2px 0 0 rgba(0, 0, 0, .22); transition: transform .65s ease-in, opacity .5s; }
.box .d-oben .band.l { top: 43%; bottom: auto; height: 14%; left: 0; right: 0; width: auto; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .28), inset 0 -2px 0 rgba(0, 0, 0, .22); }
.box.geloest .wand .band { transform: translateY(106%); }
.box.geloest .wand.links .band { transition-delay: .08s; }
.box.geloest .wand.rechts .band { transition-delay: .12s; }
.box.geloest .deckel .band { opacity: 0; transform: scale(.2, 1); }
.box.geloest .d-oben .band.l { transform: scale(1, .2); }

.box .schleife { position: absolute; left: calc(var(--w) * -.45); top: calc(var(--w) * -.52 + 2px); width: calc(var(--w) * .9); height: calc(var(--w) * .54); transform-origin: 50% 70%; }
.box .schleife svg { width: 100%; height: 100%; overflow: visible; display: block; }
.schleife g { transform-box: fill-box; transition: transform .35s cubic-bezier(.3, 1.5, .5, 1), opacity .5s; }
.schleife .schlaufe.l { transform-origin: 100% 85%; transform: rotate(calc(var(--zug, 0) * -18deg)) scale(calc(1 + var(--zug, 0) * .3), calc(1 - var(--zug, 0) * .35)); }
.schleife .schlaufe.r { transform-origin: 0% 85%; transform: rotate(calc(var(--zug, 0) * 18deg)) scale(calc(1 + var(--zug, 0) * .3), calc(1 - var(--zug, 0) * .35)); }
.schleife .knoten { transform-origin: 50% 50%; transform: scale(calc(1 - var(--zug, 0) * .25)); }
.box.geloest .schlaufe.l { transform: translate(-80%, -120%) rotate(-80deg) scale(.5); opacity: 0; transition: transform .8s cubic-bezier(.4, -.4, .7, 1), opacity .8s; }
.box.geloest .schlaufe.r { transform: translate(80%, -120%) rotate(80deg) scale(.5); opacity: 0; transition: transform .8s cubic-bezier(.4, -.4, .7, 1), opacity .8s; }
.box.geloest .knoten { transform: scale(0); opacity: 0; }
.box.geloest .ende.l { transform: translate(-40%, 180%) rotate(-50deg); opacity: 0; transition: transform .8s ease-in, opacity .8s; }
.box.geloest .ende.r { transform: translate(40%, 180%) rotate(50deg); opacity: 0; transition: transform .8s ease-in, opacity .8s; }

.box .strahlen { position: absolute; left: calc(var(--w) * -1.2); top: calc(var(--w) * -1.2); width: calc(var(--w) * 2.4); height: calc(var(--w) * 2.4); opacity: 0; pointer-events: none; transition: opacity .7s; }
.box .strahlen::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255, 232, 170, 0) 0deg 7deg, rgba(255, 226, 150, .6) 9deg 12deg, rgba(255, 232, 170, 0) 14deg 21deg); -webkit-mask: radial-gradient(closest-side, #000 15%, transparent 100%); mask: radial-gradient(closest-side, #000 15%, transparent 100%); animation: drehen 14s linear infinite; }
.box .strahlen::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 246, 210, .95), rgba(255, 200, 100, .4) 45%, transparent); }
.box.licht .strahlen { opacity: 1; }
@keyframes drehen { to { transform: rotate(360deg); } }

/* Das Buch */
.buch { position: absolute; left: 0; top: 0; transform-style: preserve-3d; opacity: 0; will-change: transform; }
.buchkoerper { position: absolute; left: calc(var(--bw) / -2); top: calc(var(--bh) / -2); width: var(--bw); height: var(--bh); transform-style: preserve-3d; }
.buch .b-hinten, .buch .b-block, .buch .b-vorn, .buch .blatt { position: absolute; inset: 0; transform-style: preserve-3d; }
.buch .b-hinten { background: var(--leder); border-radius: 2px 8px 8px 2px; transform: translateZ(-7px); box-shadow: 0 24px 50px rgba(0, 0, 0, .55); }
.buch .b-ruecken { position: absolute; left: -7px; top: 0; width: 14px; height: 100%; background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .1), rgba(0, 0, 0, .35)), var(--leder); transform: rotateY(-90deg); }
.buch .b-block { inset: 5px 4px 5px 0; background: linear-gradient(90deg, rgba(80, 50, 20, .22), transparent 14%), #f6ecd6; border-radius: 0 4px 4px 0; transform: translateZ(5px); }
.buch .blatt { inset: 5px 4px 5px 0; transform-origin: 0 50%; transform: translateZ(calc(6px + var(--i) * .6px)) rotateY(var(--dreh, 0deg)); transition: transform .9s cubic-bezier(.4, .1, .3, 1); }
.buch .blatt .vs, .buch .blatt .rs { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: linear-gradient(90deg, rgba(80, 50, 20, .2), transparent 14%), #f8efdc; border-radius: 0 4px 4px 0; }
.buch .blatt .rs { transform: rotateY(180deg); background: linear-gradient(270deg, rgba(80, 50, 20, .2), transparent 14%), #f8efdc; border-radius: 4px 0 0 4px; }
.buch .b-vorn { transform-origin: 0 50%; transform: translateZ(9px) rotateY(var(--dreh, 0deg)); transition: transform 1.15s cubic-bezier(.45, .05, .3, 1); }
.buch .b-vorn .aussen, .buch .b-vorn .innen { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 2px 8px 8px 2px; }
.buch .b-vorn .aussen { background: radial-gradient(circle at 30% 18%, rgba(255, 255, 255, .16), transparent 55%), radial-gradient(circle at 70% 90%, rgba(0, 0, 0, .3), transparent 60%), var(--leder); box-shadow: inset 7px 0 10px rgba(0, 0, 0, .35), inset -2px 0 0 rgba(255, 255, 255, .08); }
.buch .b-vorn .innen { transform: rotateY(180deg); border-radius: 8px 2px 2px 8px; background: radial-gradient(circle, rgba(226, 180, 90, .4) 1.5px, transparent 2.2px) 0 0 / 14px 14px, #24483c; box-shadow: inset 0 0 0 6px var(--leder); }
.buch.auf .b-vorn { --dreh: -177deg; }
.buch.auf .blatt { --dreh: calc(-174deg + (2 - var(--i)) * 4deg); transition-delay: calc(.38s + (2 - var(--i)) * .22s); }
.buch .rahmen { position: absolute; inset: 9%; border: 2px solid #d9b45a; outline: 1px solid rgba(217, 180, 90, .55); outline-offset: 4px; border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%; color: #ebc76c; font-family: var(--serif); text-shadow: 0 1px 0 rgba(0, 0, 0, .45), 0 0 12px rgba(255, 200, 100, .25); }
.buch .rahmen .zahl { font-size: calc(var(--bw) * .34); font-weight: 700; line-height: 1; }
.buch .rahmen .titel { font-size: calc(var(--bw) * .075); letter-spacing: .12em; text-transform: uppercase; text-align: center; padding: 0 8%; }
.buch .rahmen .stern { font-size: calc(var(--bw) * .1); }
.buch .seite { position: absolute; inset: 0; padding: 13% 11% 10% 13%; color: #4a2a1a; display: flex; flex-direction: column; align-items: center; text-align: center; overflow: hidden; }
.buch .seite h3 { font-family: var(--serif); font-size: calc(var(--bw) * .105); font-weight: 600; color: #6a2a1a; margin-bottom: 6%; }
.buch .seite .buchname { font-family: var(--serif); font-size: calc(var(--bw) * .062); letter-spacing: .14em; text-transform: uppercase; color: #9a6a3a; margin-bottom: 4%; }
.buch .seite .zierde { color: #c08a3a; font-size: calc(var(--bw) * .08); margin-bottom: 6%; }
.buch .seite .gruss { font-family: var(--hand); font-size: calc(var(--bw) * .1); line-height: 1.28; color: #3a2414; white-space: pre-line; }
.buch .seite .gruss.leer { opacity: .75; }
.buch .seite.links { justify-content: center; padding: 10%; }
.buch .seite.links .tag { font-family: var(--serif); font-size: calc(var(--bw) * .3); font-weight: 700; color: #8a1f26; line-height: 1; }
.buch .seite.links .monat { font-family: var(--serif); font-size: calc(var(--bw) * .09); letter-spacing: .16em; text-transform: uppercase; color: #9a6a3a; margin: 4% 0 8%; }
#bescherung.nacht .buch { opacity: .28 !important; transition: opacity 4s; }

/* Das entrollte Pergament */
.pergament { position: absolute; left: 0; top: 0; }
.rollenblatt { position: absolute; left: 0; top: 0; width: min(76vw, 310px); transform: translate(-50%, -50%); filter: drop-shadow(0 22px 34px rgba(0, 0, 0, .55)); }
.pergament .stab { display: block; position: relative; z-index: 1; height: 22px; margin: 0 -12px; border-radius: 11px; background: linear-gradient(#f4e0b0, #d1ac6c 55%, #8f6c38); }
.pergament .stab::before, .pergament .stab::after { content: ""; position: absolute; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #a9744a, #4a2a18); }
.pergament .stab::before { left: -8px; }
.pergament .stab::after { right: -8px; }
.pergament .papier { display: grid; grid-template-rows: 0fr; margin: -8px 4px; background: radial-gradient(ellipse at 50% 40%, #fff4d8, #ecd6a2 85%); transition: grid-template-rows 1s cubic-bezier(.3, .8, .3, 1); }
.pergament.entrollt .papier { grid-template-rows: 1fr; }
.pergament .papier > div { overflow: hidden; min-height: 0; text-align: center; color: #4a2a1a; }
.pergament h3 { font-family: var(--serif); font-size: 25px; color: #6a2a1a; padding: 26px 18px 4px; }
.pergament .zierde { color: #b0803a; margin-bottom: 8px; }
.pergament .gruss { font-family: var(--hand); font-size: 20px; line-height: 1.35; padding: 0 22px; }
.pergament .gruss.von { text-align: right; padding: 12px 26px 24px; color: #8a1f26; }
#bescherung.nacht .pergament { opacity: .28; transition: opacity 4s; }
#buecher button.rollenbuch { --leder: #d9bd82; color: #4a2418; text-shadow: none; }

/* Gesten-Hinweis */
#geste { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 13vh); text-align: center; font-family: var(--serif); font-size: 19px; text-shadow: 0 2px 12px rgba(0, 0, 0, .8); pointer-events: none; animation: auftauchen .6s ease-out; }
#geste:empty { display: none; }
#geste { opacity: 0; animation: leiseHinweis .9s ease-out 5s forwards; }
@keyframes leiseHinweis { from { opacity: 0; transform: translateY(10px); } to { opacity: .8; transform: none; } }
@keyframes auftauchen { from { opacity: 0; transform: translateY(14px); } }
.unsichtbar { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.unsichtbar:focus-visible { position: fixed !important; width: auto; height: auto; clip: auto; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 99px; background: #ffb454; color: #3a1d14; z-index: 30; }

#schliessen { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 14px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 238, 211, .14); font-size: 18px; z-index: 3; transition: opacity 1.5s; }
#bescherung.nacht #schliessen { opacity: .15; }

/* Player */
#spieler { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 24px calc(env(safe-area-inset-bottom) + 22px); text-align: center; animation: aufsteigen .7s ease-out; transition: opacity 1.5s; max-width: 440px; margin: 0 auto; }
@keyframes aufsteigen { from { opacity: 0; transform: translateY(30px); } }
#bescherung.nacht #spieler { opacity: 0; }
#tagzahl { font-family: var(--serif); font-size: 16px; color: #ffcf8a; margin-bottom: 14px; }
#leiste { width: 100%; accent-color: var(--warm); height: 30px; }
.zeiten { display: flex; justify-content: space-between; font-size: 13px; opacity: .75; font-variant-numeric: tabular-nums; }
.knoepfe { display: flex; justify-content: center; align-items: center; gap: 28px; margin: 14px 0 22px; }
.knoepfe button { width: 58px; height: 58px; border-radius: 50%; background: rgba(255, 238, 211, .13); }
.knoepfe #start { position: relative; width: 84px; height: 84px; background: var(--warm); color: #3a1d14; box-shadow: 0 0 36px rgba(255, 170, 70, .55); display: grid; place-items: center; }
#start svg { width: 36px; height: 36px; fill: currentColor; }
#start .pause, #start.spielt .dreieck { display: none; }
#start.spielt .pause { display: inline; }
#fehlt { margin-top: 16px; color: #ffcf8a; font-size: 14px; line-height: 1.4; }

/* ---------- Bücherregal ---------- */
#bibliothek { position: fixed; inset: 0; z-index: 21; padding: calc(env(safe-area-inset-top) + 64px) 22px calc(env(safe-area-inset-bottom) + 24px); overflow-y: auto; background: radial-gradient(ellipse at 50% 0%, rgba(90, 50, 30, .95), rgba(16, 10, 14, .97) 70%); animation: auftauchen .4s ease-out; }
#bibliothek h2 { font-family: var(--serif); font-weight: 600; font-size: 28px; text-align: center; margin-bottom: 22px; }
#buecher { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 16px 12px; max-width: 460px; margin: 0 auto; }
#buecher button { aspect-ratio: .72; border-radius: 3px 7px 7px 3px; background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .16), transparent 60%), var(--leder); box-shadow: inset 5px 0 8px rgba(0, 0, 0, .35), 0 8px 18px rgba(0, 0, 0, .4); color: #ebc76c; font-family: var(--serif); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; padding: 8px; }
#buecher button b { font-size: 28px; line-height: 1; }
#buecher button span { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; text-align: center; }
#bibLeer { text-align: center; opacity: .75; font-family: var(--serif); }
#bibZu { position: fixed; top: calc(env(safe-area-inset-top) + 12px); right: 14px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 238, 211, .14); font-size: 18px; }

/* ---------- Offline-Speicher ---------- */
#speicher {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 41;
  bottom: calc(env(safe-area-inset-bottom) + 8px); width: max-content; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 18px;
  font-size: 13px; line-height: 1.35; text-align: center;
  background: rgba(20, 11, 18, .9); border: 1px solid rgba(255, 200, 120, .35);
}
#speicher button { flex: none; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 238, 211, .14); }
body:has(#bescherung:not([hidden])) #speicher, body:has(#bibliothek:not([hidden])) #speicher { display: none; }
body:has(#speicher:not([hidden])) #vorschauband { display: none; }
body:has(#speicher:not([hidden])) #hereinkommen { bottom: calc(env(safe-area-inset-bottom) + max(9vh, 112px)); }
#start.laedt { opacity: .6; }
#start.laedt svg { visibility: hidden; }
#start.laedt::after { content: ""; position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 4px solid rgba(58, 29, 20, .25); border-top-color: #3a1d14; animation: drehen .9s linear infinite; }

/* ---------- Ankommen ---------- */
#intro { position: fixed; inset: 0; z-index: 40; background: #070b1c; overflow: hidden; transition: opacity 1s; }
#intro.weg { opacity: 0; pointer-events: none; }
#aussen { position: absolute; inset: 0; will-change: transform; }
#aussen > svg { position: absolute; display: block; }
#aussen .tuerrahmen, #aussen .tuerschein, #aussen .lichtteppich, #aussen .intro-rauch { position: absolute; }
#aussen .tuerblatt { position: absolute; inset: 0; transform-origin: 0 50%; will-change: transform; box-shadow: 2px 0 4px rgba(0, 0, 0, .4); }
#aussen .tuerblatt svg { width: 100%; height: 100%; display: block; }
#aussen .tuerschatten { position: absolute; inset: 0; background: linear-gradient(90deg, #000, #1a0e08); opacity: 0; }
#aussen .tuerschein { border-radius: 50%; opacity: 0; pointer-events: none; mix-blend-mode: screen; background: radial-gradient(closest-side, rgba(255, 214, 140, .95), rgba(255, 160, 70, .45) 35%, rgba(255, 140, 50, 0)); }
#aussen .lichtteppich { opacity: 0; background: radial-gradient(ellipse 50% 100% at 50% 0%, rgba(255, 205, 130, .9), rgba(255, 175, 90, .35) 55%, rgba(255, 170, 80, 0) 100%); }
#aussen .intro-rauch i { position: absolute; left: 20%; bottom: 0; width: 60%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgba(220, 230, 245, .45), rgba(220, 230, 245, 0)); animation: rauch 5.4s linear infinite; opacity: 0; }
#aussen .intro-rauch i:nth-child(2) { animation-delay: -1.8s; }
#aussen .intro-rauch i:nth-child(3) { animation-delay: -3.6s; }
@keyframes rauch { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 15% { opacity: .9; } 100% { transform: translate(60%, -260%) scale(2.4); opacity: 0; } }
.introText { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 9vh); text-align: center; padding: 0 24px; }
#introTitel { font-family: var(--serif); font-weight: 600; font-size: 46px; text-shadow: 0 0 24px rgba(255, 190, 110, .55), 0 2px 10px rgba(0, 0, 0, .6); }
#introUnter { font-family: var(--serif); font-size: 17px; opacity: .85; margin-top: 6px; min-height: 1.4em; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
#hereinkommen { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 9vh); transform: translateX(-50%); padding: 16px 30px; border-radius: 99px; background: var(--warm); color: #3a1d14; font-weight: 700; font-size: 17px; box-shadow: 0 0 40px rgba(255, 170, 70, .55); transition: opacity .4s; }
#hereinkommen:disabled { opacity: .55; background: rgba(255, 238, 211, .2); color: var(--creme); box-shadow: none; }
#intro.tritt-ein .introText, #intro.tritt-ein #hereinkommen { opacity: 0; transition: opacity .5s; }
#intro::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, #fff1cf, #ffcf8a 55%, #f0a050); opacity: 0; pointer-events: none; transition: opacity .9s ease-in; }
#intro.hell::after { opacity: 1; }
.intro-schnee { --s: 1.6; }

body.ruht #raum *, body.ruht #licht * { animation-play-state: paused !important; }
body.test #bescherung.da .schleier { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(10, 6, 12, .72); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
