@font-face { font-family: "Dancing"; src: url("fonts/dancing-script-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Quicksand"; src: url("fonts/quicksand-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Quicksand"; src: url("fonts/quicksand-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --nacht: #041a24;
  --tief: #06343d;
  --tuerkis: #2ec4c4;
  --tuerkis-hell: #8ff0e8;
  --tuerkis-dunkel: #0d6e74;
  --rose: #ffd84d;
  --rose-dunkel: #f2a900;
  --schnee: #f4fdff;
  --creme: #fffaf0;
  --tinte: #14444a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { background: var(--nacht); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "Quicksand", system-ui, sans-serif;
  font-weight: 500;
  color: var(--schnee);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body.gesperrt { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Himmel ---------- */
.himmel {
  position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none;
  background: linear-gradient(180deg, #031219 0%, #052a37 40%, #0b4f58 75%, #137a7c 100%);
}
.polarlicht { position: absolute; width: 120vw; height: 60vh; left: -10vw; border-radius: 50%; will-change: transform, opacity; }
.p1 { top: -12vh; background: radial-gradient(closest-side, rgba(46,196,196,.38), rgba(46,196,196,0)); animation: polar 17s ease-in-out infinite alternate; }
.p2 { top: 18vh; background: radial-gradient(closest-side, rgba(123,160,255,.22), rgba(123,160,255,0)); animation: polar 23s ease-in-out infinite alternate-reverse; }
@keyframes polar {
  from { transform: translateX(-14vw) rotate(-6deg) scaleY(.8); opacity: .65; }
  to   { transform: translateX(14vw) rotate(7deg) scaleY(1.15); opacity: 1; }
}
.stern { position: absolute; border-radius: 50%; background: #fff; animation: funkeln var(--d, 3s) ease-in-out infinite; animation-delay: var(--v, 0s); }
@keyframes funkeln { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }
.mond {
  position: absolute; top: 76px; right: 7vw; width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffef2, #ffeeb0 70%, #f5d77e);
  box-shadow: 0 0 30px 10px rgba(255,236,170,.35), 0 0 90px 40px rgba(255,236,170,.14);
  animation: schweben 9s ease-in-out infinite;
}
@keyframes schweben { 50% { transform: translateY(10px); } }
.sternschnuppe {
  position: absolute; top: 12%; left: 70%; width: 110px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #fff, rgba(255,255,255,0));
  opacity: 0; transform: rotate(-28deg); animation: schnuppe 11s ease-in infinite 3s;
}
@keyframes schnuppe {
  0% { opacity: 0; translate: 0 0; }
  2% { opacity: 1; }
  10% { opacity: 0; translate: -340px 180px; }
  100% { opacity: 0; translate: -340px 180px; }
}
.schlitten { position: absolute; top: 14%; left: 0; width: 230px; opacity: .85; transform: translateX(-260px); animation: flug 38s linear infinite 6s; }
.schlitten svg { width: 100%; display: block; animation: huepfen 2.4s ease-in-out infinite; }
@keyframes flug {
  0% { transform: translate(-260px, 20px) rotate(-3deg); }
  40% { transform: translate(calc(100vw + 40px), -40px) rotate(-6deg); }
  100% { transform: translate(calc(100vw + 40px), -40px) rotate(-6deg); }
}
@keyframes huepfen { 50% { transform: translateY(-7px); } }

#schnee, #feuerwerk { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#schnee { z-index: 5; }
#feuerwerk { z-index: 60; }

/* ---------- Lichterkette ---------- */
.lichterkette { position: relative; z-index: 6; height: 54px; width: 100%; overflow: hidden; margin-top: env(safe-area-inset-top, 0); }
.lichterkette svg.draht { position: absolute; inset: 0; width: 100%; height: 100%; }
.lampe {
  position: absolute; width: 12px; height: 18px; margin-left: -6px;
  border-radius: 50% 50% 50% 50% / 35% 35% 65% 65%;
  background: var(--f); transform-origin: 50% -4px;
  animation: baumeln 4s ease-in-out infinite; animation-delay: var(--v);
}
.lampe::before { content: ""; position: absolute; left: 3px; top: -4px; width: 6px; height: 5px; background: #123b40; border-radius: 2px; }
.lampe::after {
  content: ""; position: absolute; inset: -14px -17px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--f), transparent);
  animation: leuchten 2.2s ease-in-out infinite; animation-delay: var(--v);
}
@keyframes baumeln { 25% { transform: rotate(6deg); } 75% { transform: rotate(-6deg); } }
@keyframes leuchten { 0%, 100% { opacity: .15; } 50% { opacity: .75; } }

/* ---------- Kopf ---------- */
main { width: min(980px, 100%); margin: 0 auto; padding: 0 16px; position: relative; z-index: 1; flex: 1 0 auto; }
.kopf { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: -6px; }
.titelblock { text-align: center; min-width: 0; }
h1 {
  text-wrap: balance;
  font-family: "Dancing", cursive; font-size: clamp(2.1rem, 6vw, 3.4rem); line-height: 1.12; padding: 0 4px;
  background: linear-gradient(100deg, #fff 20%, var(--tuerkis-hell) 38%, var(--rose) 50%, var(--tuerkis-hell) 62%, #fff 80%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: schimmer 9s linear infinite;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,.45));
}
@keyframes schimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.untertitel { margin-top: 4px; color: #cdf7f3; font-size: clamp(.9rem, 2.6vw, 1.08rem); }
.strauss { flex: 0 0 clamp(64px, 15vw, 150px); }
.strauss svg { width: 100%; display: block; overflow: visible; }
.strauss.rechts svg { transform: scaleX(-1); }
.wiegen { transform-box: fill-box; transform-origin: 50% 100%; animation: wiegen 6s ease-in-out infinite; }
.wiegen.b { animation-duration: 7.5s; animation-delay: -2s; }
.wiegen.c { animation-duration: 5.2s; animation-delay: -4s; }
@keyframes wiegen { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3.5deg); } }

.status { text-align: center; margin: 12px 0 14px; display: grid; gap: 9px; justify-items: center; }
.countdown {
  background: rgba(255,255,255,.1); border: 1px solid rgba(143,240,232,.35);
  border-radius: 999px; padding: 7px 18px; font-size: .95rem; font-variant-numeric: tabular-nums; max-width: 100%;
}
.fortschritt { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: #bdeeea; }
.balken { width: min(210px, 42vw); height: 8px; border-radius: 9px; background: rgba(255,255,255,.14); overflow: hidden; }
.balken i { display: block; height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, var(--tuerkis), var(--rose)); transition: width .8s cubic-bezier(.2,.8,.2,1); }

/* ---------- Kalender ---------- */
.rahmen {
  position: relative; padding: clamp(14px, 3vw, 30px); border-radius: 28px;
  background: linear-gradient(160deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 25px 60px rgba(0,0,0,.35), inset 0 0 40px rgba(143,240,232,.08);
}
.ecke { position: absolute; width: clamp(70px, 13vw, 128px); z-index: 7; pointer-events: none; }
.ecke svg, .karte-ecke svg { width: 100%; display: block; overflow: visible; }
.ecke.ol { top: -22px; left: -14px; }
.ecke.ur { bottom: -22px; right: -14px; transform: rotate(180deg); }

.kalender { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(9px, 1.8vw, 18px); }
@media (min-width: 700px) { .kalender { grid-template-columns: repeat(6, 1fr); } }

.tuer {
  position: relative; aspect-ratio: 1 / 1.12; border: 0; background: none; perspective: 600px;
  border-radius: 16px; z-index: 1;
  transition: translate .2s ease, scale .2s ease;
}
.kalender.neu .tuer { animation: auftauchen .6s cubic-bezier(.2,.9,.3,1.2) backwards; animation-delay: calc(var(--i) * 35ms); }
@keyframes auftauchen { from { opacity: 0; transform: translateY(18px) scale(.85); } }
.tuer:hover { translate: 0 -4px; }
.tuer:active { scale: .96; }
.tuer:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; }

.innen {
  position: absolute; inset: 0; border-radius: 16px; display: grid; place-content: center; justify-items: center;
  background: radial-gradient(circle at 50% 40%, #fffbe6, #ffe9a6 55%, #f4c95d);
  color: var(--tinte); box-shadow: inset 0 4px 16px rgba(120,70,0,.35);
}
.innen .sym { font-size: clamp(1.7rem, 5.5vw, 2.7rem); animation: pochen 3.2s ease-in-out infinite; animation-delay: calc(var(--i) * -170ms); }
.innen .nr { font-family: "Dancing", cursive; font-size: 1.15rem; opacity: .75; }
@keyframes pochen { 50% { transform: scale(1.13); } }

.fluegel { position: absolute; inset: 0; transform-style: preserve-3d; transform-origin: left center; transition: transform .9s cubic-bezier(.5,.05,.2,1.1); }
.vorne, .hinten { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.vorne {
  display: grid; place-items: center; overflow: hidden;
  background: var(--bg); color: var(--zahl);
  box-shadow: 0 6px 14px rgba(0,0,0,.35), inset 0 0 0 2px rgba(255,255,255,.28), inset 0 0 0 6px rgba(255,255,255,.07);
}
.vorne::after { /* Glanz */
  content: ""; position: absolute; top: -40%; bottom: -40%; width: 38%; left: -80%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); transform: rotate(18deg);
}
.hinten { transform: rotateY(180deg); background: linear-gradient(135deg, #0f7c80, #0a545a); box-shadow: inset 0 0 0 3px rgba(255,255,255,.16); }
.zahl { font-family: "Dancing", cursive; font-weight: 700; font-size: clamp(1.9rem, 6.5vw, 3rem); text-shadow: 0 2px 6px rgba(0,0,0,.28); position: relative; z-index: 1; }
.zier { position: absolute; width: 34%; top: 7%; right: 7%; opacity: .95; }
.knauf { position: absolute; right: 9%; top: 56%; width: 7px; height: 7px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4c2, #d59b1c); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.schneehaube { position: absolute; top: 0; left: 0; width: 100%; height: 17%; z-index: 0; opacity: .92; }

.stil-0 { --bg: linear-gradient(150deg, #2fd0cc, #0f8c93 60%, #0b6770); --zahl: #fff; }
.stil-1 { --bg: linear-gradient(150deg, #c5fbf4, #77e0d9 60%, #45c2c4); --zahl: #0a5258; }
.stil-2 { --bg: linear-gradient(150deg, #fffdf4, #fff0c2 60%, #ffdf85); --zahl: #0d6e74; }
.stil-3 { --bg: linear-gradient(150deg, #1b5f86, #123e66 60%, #0c2a49); --zahl: #ffe38a; }
.tuer.gross .vorne { box-shadow: 0 0 0 3px var(--rose), 0 6px 18px rgba(0,0,0,.4); }

/* Zustände */
.tuer.zu-frueh .vorne { filter: saturate(.78) brightness(.84); }
.tuer.zu-frueh { cursor: default; }
.tuer.bereit::before {
  content: ""; position: absolute; inset: -7px; border-radius: 22px; z-index: -1;
  background: radial-gradient(closest-side, rgba(255,224,102,.95) 55%, rgba(255,224,102,0));
  animation: gluehen 1.9s ease-in-out infinite;
}
@keyframes gluehen { 0%, 100% { opacity: .35; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.07); } }
.tuer.bereit .vorne::after { animation: glanz 3.4s ease-in-out infinite; animation-delay: calc(var(--i) * 130ms); }
@keyframes glanz { 0% { left: -80%; } 40%, 100% { left: 150%; } }
.tuer.heute { animation: wackeln 3.6s ease-in-out infinite; }
@keyframes wackeln { 0%, 74%, 100% { rotate: 0deg; } 78% { rotate: -5deg; } 82% { rotate: 5deg; } 86% { rotate: -3deg; } 90% { rotate: 2deg; } }
.tuer .marke {
  position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); z-index: 3; white-space: nowrap;
  background: var(--rose); color: #4a3200; font-weight: 700; font-size: .68rem; padding: 2px 9px; border-radius: 99px; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.tuer.offen .fluegel { transform: rotateY(-104deg); }
.tuer.offen { z-index: 0; }
.kalender .tuer.nein { animation: nein .5s ease; }
@keyframes nein { 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 3px 0; } }

/* ---------- Fuß ---------- */
footer { position: relative; z-index: 1; margin-top: 18px; flex-shrink: 0; }
.landschaft { line-height: 0; }
.landschaft svg { display: block; width: 100%; height: clamp(170px, 24vw, 280px); }
.baumlicht { animation: leuchten2 1.8s ease-in-out infinite; }
@keyframes leuchten2 { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.rauch { transform-box: fill-box; transform-origin: center; animation: rauch 4.5s ease-out infinite; opacity: 0; }
@keyframes rauch { 0% { opacity: 0; transform: translate(0, 0) scale(.4); } 20% { opacity: .6; } 100% { opacity: 0; transform: translate(22px, -52px) scale(1.9); } }
.fenster { animation: flackern 3.7s ease-in-out infinite; }
@keyframes flackern { 0%, 100% { opacity: 1; } 45% { opacity: .78; } 55% { opacity: .95; } 70% { opacity: .85; } }
.arm { transform-box: fill-box; transform-origin: 0% 100%; animation: winken 2.8s ease-in-out infinite; }
@keyframes winken { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-22deg); } }
.boden { background: #e9f8fb; color: var(--tinte); text-align: center; padding: 2px 16px calc(16px + env(safe-area-inset-bottom, 0px)); font-size: .85rem; margin-top: -1px; }
.links-unten { margin-top: 6px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.boden a, .boden button { color: var(--tuerkis-dunkel); background: none; border: 0; text-decoration: underline; font-weight: 700; font-size: .83rem; }
body.in-app #appLink { display: none; }

.ton {
  position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); background: rgba(4,40,50,.75); font-size: 1.15rem;
}
.hinweis {
  position: fixed; left: 50%; bottom: 70px; transform: translate(-50%, 20px); z-index: 30; width: max-content; max-width: calc(100vw - 32px);
  background: var(--creme); color: var(--tinte); border: 2px solid var(--tuerkis); border-radius: 18px; padding: 10px 18px; text-align: center; font-weight: 700; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.hinweis.an { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Karten ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: flex; padding: 34px 20px; overflow-y: auto;
  background: rgba(2,20,28,.78); animation: einblenden .35s ease;
}
@keyframes einblenden { from { opacity: 0; } }
.karte {
  position: relative; margin: auto; width: min(440px, 100%); border-radius: 26px; color: var(--tinte);
  background: linear-gradient(170deg, #fffdf6, #eafcf9);
  box-shadow: 0 0 0 3px var(--tuerkis), 0 0 0 8px rgba(255,255,255,.75), 0 30px 70px rgba(0,0,0,.5);
  animation: karte .65s cubic-bezier(.2,.9,.3,1.25);
}
@keyframes karte { from { opacity: 0; transform: translateY(40px) scale(.7) rotate(-4deg); } }
.karte-inhalt { padding: 46px 30px 42px; text-align: center; }
.karte-inhalt > * { animation: hoch .6s ease backwards; }
.karte-inhalt > :nth-child(2) { animation-delay: .15s; }
.karte-inhalt > :nth-child(3) { animation-delay: .3s; }
.karte-inhalt > :nth-child(4) { animation-delay: .5s; }
.karte-inhalt > :nth-child(5) { animation-delay: .65s; }
@keyframes hoch { from { opacity: 0; transform: translateY(14px); } }
.karte-symbol { font-size: 3.4rem; line-height: 1.2; }
.karte h2 { font-family: "Dancing", cursive; font-size: 2.1rem; color: var(--tuerkis-dunkel); margin: 6px 0 12px; line-height: 1.15; }
.karte-text { font-size: 1.14rem; line-height: 1.65; }
.karte-gruss { font-family: "Dancing", cursive; font-size: 1.35rem; margin: 18px 0 20px; color: #a86f00; }
.knopf {
  border: 0; border-radius: 999px; padding: 12px 30px; font-weight: 700; color: #4a3200;
  background: linear-gradient(135deg, #ffe680, var(--rose) 55%, #ffc21f); box-shadow: 0 6px 18px rgba(242,169,0,.45); transition: scale .2s;
}
.knopf:hover { scale: 1.05; }
.knopf:focus-visible, .zu:focus-visible { outline: 3px solid var(--tuerkis-dunkel); outline-offset: 3px; }
.zu { position: absolute; top: 10px; right: 12px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(13,110,116,.1); color: var(--tinte); font-size: 1.5rem; line-height: 1; }
.karte-ecke { position: absolute; width: 96px; pointer-events: none; }
.karte-ecke.ol { top: -30px; left: -24px; }
.karte-ecke.ur { bottom: -30px; right: -24px; transform: rotate(180deg); }
.karte.finale { box-shadow: 0 0 0 4px var(--rose), 0 0 0 10px rgba(143,240,232,.85), 0 0 80px rgba(255,216,77,.55); }

@media (max-width: 440px) {
  .mond { width: 38px; height: 38px; top: 48px; right: 5px; }
  .strauss { flex-basis: 58px; }
  .kopf { gap: 2px; }
  main { padding: 0 14px; }
  .karte-inhalt { padding: 42px 22px 38px; }
  .karte-text { font-size: 1.06rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .schlitten, .sternschnuppe, .rauch { display: none; }
  .tuer.bereit::before { opacity: 1; }
}
