:root {
  --cream: #fdf3e1;
  --paper: #fffaf2;
  --ink: #3b2a1e;
  --muted: #7a6450;
  --red: #e2574c;
  --red-dark: #b8322b;
  --teal: #4f8a8b;
  --mustard: #f0b43c;
  --chrome: 190px; /* Platz für Titel und Leiste unter der Bühne */
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100svh;
  background:
    radial-gradient(circle at 15% 10%, #fff7e8 0, transparent 40%),
    radial-gradient(circle at 85% 90%, #fde3d0 0, transparent 45%),
    #f6e7cf;
  color: var(--ink);
  font-family: Nunito, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px 24px;
}

.site-header { text-align: center; margin-bottom: 10px; }
.site-header h1 {
  font-family: Pacifico, cursive;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.1;
  margin: 0;
  color: var(--red);
  text-shadow: 2px 3px 0 #fff, 4px 6px 0 rgba(184, 50, 43, .18);
}
.site-header p { margin: 4px 0 0; color: var(--muted); font-size: clamp(.9rem, 1.6vw, 1.05rem); }

main { width: 100%; display: flex; flex-direction: column; align-items: center; }

/* ---------- Bühne ---------- */
.stage {
  position: relative;
  width: min(100%, 1400px, calc((100svh - var(--chrome)) * 1.6));
  min-width: min(100%, 320px);
  aspect-ratio: 16 / 10;
  container-type: inline-size;
  border-radius: 22px;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 0 18px 40px rgba(90, 58, 26, .25), 0 0 0 6px #fff, 0 0 0 9px #e9cfa9;
  -webkit-tap-highlight-color: transparent;
}
#scene { display: block; width: 100%; height: 100%; user-select: none; }

/* Klickbare Dinge */
.hot { cursor: pointer; outline: none; transition: filter .2s; }
.hot:hover, .hot:focus-visible { filter: brightness(1.05) drop-shadow(0 0 7px rgba(255, 205, 80, .95)); }
.hot.hint { animation: hint 1.1s ease-in-out 3; }
@keyframes hint {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.15) drop-shadow(0 0 14px #ffd23f) drop-shadow(0 0 4px #fff); }
}

/* Elemente, die per CSS transformiert werden: Ursprung im SVG-Koordinatensystem */
#zita, #zitaBody, #armL, #panRig, #pancake, .swing, #souffle, #fridgeDoor, #fridgeDoorOpen,
#ovenDoor2, #ovenDoor2Open, #chickenOut, #cabADoor, #cabADoorOpen, #mouseArm, #foam, #drips,
#knobPot .ind, #pot, #radio, #timer, #salt, #glasses, #brows, .eyes, #clouds, #steam path, #menuText {
  transform-box: view-box;
}

/* ---------- Zita ---------- */
#zitaBody { transform-origin: 800px 640px; }
#armL { transform-origin: 714px 432px; animation: stir 2.4s ease-in-out infinite; }
@keyframes stir { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-5deg); } }

.eyes, .mouth { display: none; }
#eyesOpen { transform-origin: 800px 305px; animation: blink 5s infinite; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }

#zita.mood-happy #eyesOpen, #zita.mood-laugh #eyesLaugh, #zita.mood-shock #eyesShock, #zita.mood-wink #eyesWink { display: inline; }
#zita.mood-happy #mouthHappy, #zita.mood-laugh #mouthHappy, #zita.mood-wink #mouthSmile, #zita.mood-shock #mouthO { display: inline; }
#zita.talk:not(.mood-shock) #mouthHappy, #zita.talk.mood-wink #mouthSmile { display: none; }
#zita.talk:not(.mood-shock) #mouthO { display: inline; transform: scale(1, .7); transform-box: fill-box; transform-origin: center; }

#brows { transition: transform .2s; }
#zita.mood-shock #brows { transform: translateY(-9px); }
#zita.mood-laugh #brows { transform: translateY(-4px); }
#glasses { transition: transform .35s cubic-bezier(.4, 1.6, .6, 1); }
#zita.glasses-down #glasses { transform: translateY(14px) rotate(-4deg); transform-origin: 800px 300px; }

#zita.mood-laugh #zitaBody { animation: laugh .32s ease-in-out 4; }
@keyframes laugh { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px) rotate(.6deg); } }
#zita.mood-shock #zitaBody { animation: jolt .4s ease-out; }
@keyframes jolt { 0% { transform: translateY(0); } 30% { transform: translateY(-14px); } 100% { transform: translateY(0); } }
.music #zitaBody { animation: dance .7s ease-in-out infinite !important; }
@keyframes dance { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg) translateY(-4px); } }

/* ---------- Topf ---------- */
#pot { transform-origin: 622px 634px; }
#steam path { opacity: 0; animation: steam 3s ease-in-out infinite; transform-origin: 624px 480px; }
#steam path:nth-child(2) { animation-delay: 1s; }
#steam path:nth-child(3) { animation-delay: 2s; }
@keyframes steam {
  0% { opacity: 0; transform: translateY(10px) scaleY(.6); }
  30% { opacity: .55; }
  100% { opacity: 0; transform: translateY(-50px) scaleY(1.1); }
}
.boiling #steam path { animation-duration: 1s; stroke-width: 14; }
#soupBubbles circle { animation: pop 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
#soupBubbles circle:nth-child(2) { animation-delay: .4s; }
#soupBubbles circle:nth-child(3) { animation-delay: .9s; }
#soupBubbles circle:nth-child(4) { animation-delay: 1.2s; }
@keyframes pop { 0%, 100% { transform: scale(.2); opacity: 0; } 50% { transform: scale(1); opacity: 1; } }
.boiling #soupBubbles circle { animation-duration: .45s; }

#foam { transform-origin: 622px 530px; transform: scaleY(0); transition: transform .9s cubic-bezier(.3, 1.5, .5, 1); }
#drips { transform-origin: 622px 528px; transform: scaleY(0); transition: transform .9s ease-in; }
.boiling #foam { transform: scaleY(1); }
.boiling #drips { transform: scaleY(1); transition-delay: .5s; }
.boiling #pot { animation: jiggle .12s linear infinite; }
@keyframes jiggle { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-2px) rotate(-.6deg); } 75% { transform: translateX(2px) rotate(.6deg); } }

#potGlow { animation: glow 2s ease-in-out infinite; }
.boiling #potGlow { fill: #ff2d10; }
.cooling #potGlow { opacity: .25; animation: none; }
@keyframes glow { 0%, 100% { opacity: .6; } 50% { opacity: .95; } }

#knobPot .ind { transform-origin: 600px 697px; transform: rotate(60deg); transition: transform .5s cubic-bezier(.4, 1.6, .6, 1); }
#knobPot.low .ind { transform: rotate(-70deg); }

/* ---------- Pfanne ---------- */
#panRig { transform-origin: 890px 432px; }
#pancake { transform-box: fill-box; transform-origin: center; }

/* ---------- Kühlschrank ---------- */
#fridgeDoor { transform-origin: 58px 600px; transition: transform .45s cubic-bezier(.5, 0, .3, 1); }
#fridgeDoorOpen { transform-origin: 58px 600px; transform: scaleX(0); transition: transform .45s cubic-bezier(.5, 0, .3, 1); }
#fridge.open #fridgeDoor { transform: scaleX(0); }
#fridge.open #fridgeDoorOpen { transform: scaleX(1); }

/* ---------- Öfen ---------- */
.glow { animation: glow 2.6s ease-in-out infinite; }
#souffle { transform-origin: 1410px 408px; }
#ovenDoor2 { transform-origin: 1410px 716px; transition: transform .4s cubic-bezier(.6, 0, .4, 1); }
#ovenDoor2Open { transform-origin: 1410px 716px; transform: scaleY(0); transition: transform .4s cubic-bezier(.6, 0, .4, 1); }
#oven2.open #ovenDoor2 { transform: scaleY(0); }
#oven2.open #ovenDoor2Open { transform: scaleY(1); transition-delay: .2s; }
#chickenOut { visibility: hidden; transform-origin: 1410px 690px; pointer-events: none; }

/* ---------- Schrank / Maus ---------- */
#cabADoor { transform-origin: 342px 766px; transition: transform .4s cubic-bezier(.5, 0, .3, 1); }
#cabADoorOpen { transform-origin: 342px 766px; transform: scaleX(0); transition: transform .4s cubic-bezier(.5, 0, .3, 1); }
#cabA.open #cabADoor { transform: scaleX(0); }
#cabA.open #cabADoorOpen { transform: scaleX(1); }
#cabA.open #mouseTail { display: none; }
#mouseTail { animation: tail 2.5s ease-in-out infinite; transform-box: fill-box; transform-origin: 0 0; }
@keyframes tail { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(12deg); } }
#mouseArm { animation: wave .5s ease-in-out infinite alternate; }
@keyframes wave { from { transform: rotate(-20deg); } to { transform: rotate(25deg); } }

/* ---------- Radio, Wecker, Salz ---------- */
#radio { transform-origin: 433px 636px; }
.music #radio { animation: boom .35s ease-in-out infinite; }
@keyframes boom { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04, .96); } }
#timer { transform-origin: 1110px 634px; }
#timer.ringing { animation: ring .08s linear infinite; }
@keyframes ring { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-3px); } }
#salt { transform-origin: 1176px 634px; }
#salt.shaking { animation: shake .22s ease-in-out 5; }
@keyframes shake { 0%, 100% { transform: translateY(-30px) rotate(-38deg); } 50% { transform: translateY(-48px) rotate(-55deg); } }

/* ---------- Fenster / Nacht ---------- */
#clouds { animation: drift 30s linear infinite; }
@keyframes drift { from { transform: translateX(-60px); } to { transform: translateX(260px); } }
#skyNight, #nightSky { opacity: 0; transition: opacity 1.2s; }
#sun { transition: transform 1.2s, opacity 1.2s; transform-box: view-box; transform-origin: 880px 82px; }
#nightShade { opacity: 0; pointer-events: none; transition: opacity 1.2s; mix-blend-mode: multiply; }
#nightLights { opacity: 0; pointer-events: none; transition: opacity 1.2s; mix-blend-mode: screen; }
.night #skyNight, .night #nightSky { opacity: 1; }
.night #sun { opacity: 0; transform: translateY(80px); }
.night #nightShade { opacity: .5; }
.night #nightLights { opacity: 1; }
.stars circle { animation: twinkle 2s ease-in-out infinite alternate; }
.stars circle:nth-child(odd) { animation-delay: 1s; }
@keyframes twinkle { from { opacity: .3; } to { opacity: 1; } }

#fx { pointer-events: none; }

/* ---------- Sprechblase ---------- */
.bubble {
  position: absolute;
  left: 57.5%;
  bottom: 69%;
  width: max-content;
  max-width: 22%;
  padding: .55em .85em;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 1.1em;
  font: 800 clamp(12px, 1.75cqw, 24px)/1.25 Nunito, system-ui, sans-serif;
  color: var(--ink);
  box-shadow: 4px 5px 0 rgba(59, 42, 30, .18);
  transform-origin: 0 100%;
  transform: scale(0);
  opacity: 0;
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), opacity .2s;
  pointer-events: none;
  z-index: 3;
}
.bubble.show { transform: scale(1); opacity: 1; }
@container (max-width: 640px) {
  .bubble { top: 2%; bottom: auto; max-width: 40%; font-size: 11px; border-width: 2px; padding: .45em .7em; }
}
.bubble::before, .bubble::after {
  content: "";
  position: absolute;
  left: -.2em;
  bottom: -1.05em;
  border-style: solid;
  border-width: 1.1em 1.4em 0 0;
  border-color: var(--ink) transparent transparent transparent;
  transform: skewX(30deg);
}
.bubble::after { left: .05em; bottom: -.72em; border-width: .9em 1.1em 0 0; border-color: #fff transparent transparent transparent; }

/* ---------- Konfetti ---------- */
#confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
#confetti i {
  position: absolute;
  top: -5%;
  width: 1.1cqw;
  height: 1.6cqw;
  border-radius: 2px;
  animation: fall linear forwards;
}
#confetti i.heart { width: auto; height: auto; background: none !important; font-style: normal; font-size: 2.4cqw; }
@keyframes fall {
  to { transform: translate(var(--dx), 110cqh) rotate(var(--rot)); }
}

/* ---------- HUD ---------- */
.hud {
  width: min(100%, 1400px, calc((100svh - var(--chrome)) * 1.6));
  min-width: min(100%, 320px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}
.progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1 1 260px; }
.progress-label { font-weight: 800; white-space: nowrap; }
.progress-label strong { color: var(--red); }
.bar { flex: 1 1 120px; max-width: 280px; height: 12px; border-radius: 99px; background: #fff; box-shadow: inset 0 0 0 2px #e9cfa9; overflow: hidden; }
#barFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--mustard), var(--red)); border-radius: 99px; transition: width .6s cubic-bezier(.3, 1.4, .5, 1); }
.toast { font-weight: 700; color: var(--teal); opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.toast.show { opacity: 1; transform: none; }

.buttons { display: flex; gap: 8px; }
button {
  font: 800 .95rem Nunito, system-ui, sans-serif;
  color: #fff;
  background: var(--red);
  border: 0;
  border-radius: 99px;
  padding: .55em 1.1em;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--red-dark);
  transition: transform .1s, box-shadow .1s;
}
button:hover { filter: brightness(1.06); }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red-dark); }
button:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }
button.secondary { background: var(--teal); box-shadow: 0 3px 0 #3c6c6d; }

.rotate-hint { display: none; margin: 10px 0 0; color: var(--muted); font-size: .9rem; text-align: center; }
@media (orientation: portrait) and (max-width: 700px) { .rotate-hint { display: block; } }
@media (max-height: 560px) and (orientation: landscape) {
  :root { --chrome: 64px; }
  body { padding-top: 6px; }
  .site-header { margin-bottom: 6px; }
  .site-header h1 { font-size: 1.6rem; }
  .site-header p { display: none; }
}

/* ---------- Finale ---------- */
.finale {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(59, 42, 30, .45);
  z-index: 10;
  animation: fade .3s;
}
.finale[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.finale-card {
  background: var(--paper);
  border-radius: 24px;
  padding: 28px 28px 24px;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3), 0 0 0 6px #fff, 0 0 0 9px var(--mustard);
  animation: popin .45s cubic-bezier(.3, 1.6, .5, 1);
}
@keyframes popin { from { transform: scale(.6); opacity: 0; } }
.finale-emoji { font-size: 2.6rem; }
.finale-card h2 { font-family: Pacifico, cursive; font-weight: 400; color: var(--red); margin: 8px 0; font-size: 2rem; }
.finale-card p { margin: 6px 0; }
.finale-quote { font-family: Caveat, cursive; font-size: 1.7rem; font-weight: 700; color: var(--teal); }
.finale-quote span { font-size: 1.2rem; color: var(--muted); }
.finale-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

.site-footer { margin-top: 22px; text-align: center; color: var(--muted); font-size: .9rem; line-height: 1.5; max-width: 640px; }

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