/* ============ Adventskalender – Styles ============ */
:root {
  --nacht-1: #070d24;
  --nacht-2: #0f1d4a;
  --nacht-3: #1c2f6e;
  --rot: #c8102e;
  --rot-dunkel: #8e0b20;
  --gruen: #0f6b3f;
  --gruen-dunkel: #0a4a2b;
  --gold: #f5c451;
  --gold-dunkel: #c9952a;
  --schnee: #ffffff;
  --text: #eef3ff;
  --text-leise: #b8c4e6;
  --karte: #fffaf0;
  --tinte: #1a2238;
  --radius: 16px;
  --serif: "Georgia", "Times New Roman", "Palatino Linotype", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, canvas { max-width: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: var(--nacht-2);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(245, 196, 81, .18), transparent 60%),
    radial-gradient(900px 600px at 85% 20%, rgba(80, 120, 255, .18), transparent 60%),
    linear-gradient(180deg, var(--nacht-1) 0%, var(--nacht-2) 55%, var(--nacht-3) 100%);
}

a { color: var(--gold); }

/* ---------- Schnee ---------- */
#schnee {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* ---------- Lichterkette ---------- */
.lichterkette {
  position: relative;
  z-index: 6;
  height: 26px;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  border-top: 2px solid rgba(255, 255, 255, .25);
  padding: 0 6px;
}
.lichterkette i {
  width: 10px;
  height: 14px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  margin-top: 2px;
  background: var(--c);
  box-shadow: 0 0 10px 3px var(--c);
  animation: blinken 1.8s ease-in-out infinite;
  animation-delay: var(--d);
}
@keyframes blinken {
  0%, 100% { opacity: 1; filter: brightness(1.2); }
  50% { opacity: .35; filter: brightness(.7); }
}

/* ---------- Badges / Buttons oben ---------- */
.testbadge {
  position: relative;
  z-index: 6;
  display: table;
  margin: 10px auto 0;
  background: #ff3b3b;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .04em;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
  white-space: nowrap;
}
.testbadge[hidden] { display: none; }
.ton-btn {
  position: absolute;
  top: 34px;
  right: 12px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(10, 18, 50, .6);
  backdrop-filter: blur(6px);
  font-size: 20px;
  cursor: pointer;
}
.ton-btn.aus { opacity: .5; filter: grayscale(1); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 18px 0;
  display: grid;
  grid-template-columns: 1fr;
  text-align: center;
}
.hero-kicker {
  margin: 8px 0 4px;
  font-size: 13px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--gold);
}
.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(2.3rem, 9vw, 4.4rem);
  line-height: 1.02;
  color: #fff;
  text-shadow: 0 2px 0 var(--rot-dunkel), 0 0 28px rgba(245, 196, 81, .45);
}
.hero-sub {
  margin: 12px auto 0;
  max-width: 34rem;
  color: var(--text-leise);
  font-size: 1rem;
  line-height: 1.5;
}
.countdown {
  display: inline-block;
  margin: 14px auto 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(245, 196, 81, .5);
  color: var(--gold);
  font-size: .9rem;
  font-weight: 600;
}
.countdown:empty { display: none; }

.szene3d {
  width: 100%;
  height: clamp(210px, 54vw, 400px);
  margin-top: 0;
  cursor: grab;
  touch-action: pan-y;
}
.szene3d canvas {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-mask-image: radial-gradient(ellipse 62% 70% at 50% 48%, #000 72%, transparent 100%);
  mask-image: radial-gradient(ellipse 62% 70% at 50% 48%, #000 72%, transparent 100%);
}
.szene3d.ersatz {
  display: grid;
  place-items: center;
  font-size: 5rem;
  cursor: default;
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1fr 1.1fr;
    align-items: center;
    text-align: left;
    gap: 20px;
    padding-top: 30px;
  }
  .hero-sub { margin-left: 0; }
  .szene3d { height: 430px; margin-top: 0; }
}

/* ---------- Rätsel-Leiste ---------- */
main { position: relative; z-index: 2; max-width: 1100px; margin: 0 auto; padding: 0 max(12px, env(safe-area-inset-left)); }

.raetsel {
  margin: 0 auto 16px;
  padding: 14px 14px 16px;
  text-align: center;
  border-radius: var(--radius);
  background: rgba(8, 15, 45, .62);
  border: 1px solid rgba(245, 196, 81, .35);
  backdrop-filter: blur(6px);
}
.raetsel h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--gold);
}
.raetsel p { margin: 0 auto 14px; max-width: 36rem; color: var(--text-leise); font-size: .95rem; line-height: 1.45; }

.slots { display: flex; justify-content: center; margin-bottom: 14px; }
.slots > * + * { margin-left: clamp(5px, 1.8vw, 10px); }
.slot {
  width: clamp(34px, 10vw, 54px);
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 2px dashed rgba(255, 255, 255, .3);
  color: rgba(255, 255, 255, .35);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.2rem, 5vw, 1.9rem);
}
.slot.voll {
  border: 2px solid var(--gold);
  background: linear-gradient(160deg, var(--gold), var(--gold-dunkel));
  color: #3a2500;
  box-shadow: 0 4px 14px rgba(245, 196, 81, .35);
  animation: plopp .5s cubic-bezier(.3, 1.6, .5, 1);
}
@keyframes plopp { from { transform: scale(.3) rotate(-20deg); } to { transform: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn-gold { background: linear-gradient(160deg, var(--gold), var(--gold-dunkel)); color: #3a2500; box-shadow: 0 6px 18px rgba(245, 196, 81, .35); }
.btn-rot { background: linear-gradient(160deg, #e3213f, var(--rot-dunkel)); color: #fff; box-shadow: 0 6px 18px rgba(200, 16, 46, .4); }
.btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:focus-visible, .tuer:focus-visible, .ton-btn:focus-visible, .modal-zu:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* ---------- Türchen-Gitter ---------- */
.gitter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 2.4vw, 14px);
  max-width: 560px;
  margin: 0 auto;
}
@media (min-width: 700px) { .gitter { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; max-width: none; } }

.tuer {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  perspective: 700px;
  -webkit-tap-highlight-color: transparent;
}
.tuer-innen {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(245, 196, 81, .35), transparent 65%),
    #0a1233;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .7);
  font-size: clamp(1.3rem, 6.5vw, 2.6rem);
  overflow: hidden;
}
.tuer-buchstabe {
  position: absolute;
  left: 4px;
  bottom: 4px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--gold);
  color: #3a2500;
  font-family: var(--serif);
  font-weight: 700;
  font-size: .8rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
@supports not (aspect-ratio: 1) {
  .tuer { height: 0; padding-bottom: 100%; }
}
.tuer-blatt {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 12px;
  transform-origin: left center;
  transition: transform .9s cubic-bezier(.3, .8, .3, 1), filter .9s;
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, var(--a), var(--b));
  border: 2px solid rgba(255, 255, 255, .22);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .4), inset 0 0 0 5px rgba(255, 255, 255, .06);
  pointer-events: none;
}
/* Geschenkband */
.tuer-blatt::before, .tuer-blatt::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, .16);
}
.tuer-blatt::before { left: 50%; top: 0; bottom: 0; width: 12%; transform: translateX(-50%); }
.tuer-blatt::after { top: 50%; left: 0; right: 0; height: 12%; transform: translateY(-50%); }
.tuer-nr {
  position: relative;
  z-index: 1;
  width: 56%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--karte);
  color: var(--tinte);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1rem, 5vw, 2rem);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
}
.tuer-knauf {
  position: absolute;
  z-index: 1;
  right: 7%;
  top: 50%;
  width: 9%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c4, var(--gold-dunkel));
  transform: translateY(-50%);
}

.f-rot   { --a: #e3213f; --b: var(--rot-dunkel); }
.f-gruen { --a: #17915a; --b: var(--gruen-dunkel); }
.f-gold  { --a: #f7d57c; --b: var(--gold-dunkel); }
.f-blau  { --a: #3c5bd6; --b: #1b2c7c; }

.tuer:hover:not(.offen) .tuer-blatt { transform: rotateY(-14deg); }
.tuer.offen { z-index: 0; }
.tuer.offen .tuer-blatt { transform: rotateY(-108deg); filter: brightness(.55); }
.tuer.gesperrt .tuer-blatt { filter: saturate(.55) brightness(.75); }
.tuer.gesperrt .tuer-nr { opacity: .85; }
.tuer.heute:not(.offen) .tuer-blatt { animation: pulsieren 1.8s ease-in-out infinite; }
@keyframes pulsieren {
  0%, 100% { box-shadow: 0 6px 16px rgba(0, 0, 0, .4), 0 0 0 0 rgba(245, 196, 81, .8); }
  50% { box-shadow: 0 6px 16px rgba(0, 0, 0, .4), 0 0 0 9px rgba(245, 196, 81, 0); }
}
.tuer.wackeln { animation: wackeln .45s; }
@keyframes wackeln {
  20% { transform: translateX(-5px) rotate(-2deg); }
  40% { transform: translateX(5px) rotate(2deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* ---------- Footer ---------- */
.fuss { position: relative; z-index: 2; margin-top: 50px; }
.huegel { display: block; width: 100%; height: 110px; }
.fuss-inhalt {
  background: #fff;
  color: #47506b;
  text-align: center;
  font-size: .85rem;
  padding: 4px 16px 52px;
}
.fuss-inhalt p { margin: 0; }
.fuss-inhalt a { color: var(--rot); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; }
.modal[hidden] { display: none; }
.modal-hintergrund { position: absolute; inset: 0; background: rgba(3, 6, 20, .72); backdrop-filter: blur(3px); animation: einblenden .25s; }
.modal-karte {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--karte);
  color: var(--tinte);
  border-radius: 24px 24px 0 0;
  padding: 26px 22px calc(26px + env(safe-area-inset-bottom));
  border-top: 6px solid var(--rot);
  box-shadow: 0 -10px 50px rgba(0, 0, 0, .5);
  animation: hochfahren .35s cubic-bezier(.2, .9, .3, 1);
  text-align: center;
}
@media (min-width: 600px) {
  .modal { place-items: center; padding: 20px; }
  .modal-karte { border-radius: 24px; }
}
@keyframes einblenden { from { opacity: 0; } }
@keyframes hochfahren { from { transform: translateY(40px); opacity: 0; } }

.modal-zu {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 30px;
  line-height: 1;
  color: #6b7390;
  cursor: pointer;
}
.m-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gruen);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.m-icon { font-size: 3.4rem; line-height: 1; margin: 14px 0 6px; }
.modal-karte h2 { margin: 6px 0 8px; font-family: var(--serif); font-size: 1.6rem; line-height: 1.15; color: var(--rot-dunkel); }
.m-text { margin: 0 auto 16px; max-width: 30rem; font-size: 1.05rem; line-height: 1.5; color: #333c58; }
.m-bild { display: block; width: 100%; height: auto; border-radius: 14px; margin: 10px 0 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.m-preis { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: var(--gruen); margin: 0 0 12px; }
.m-code {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 10px 16px;
  border: 2px dashed var(--rot);
  border-radius: 12px;
  background: #fff;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .08em;
  color: var(--rot-dunkel);
  cursor: pointer;
}
.m-code small { font-family: var(--sans); font-weight: 600; letter-spacing: 0; font-size: .75rem; color: #6b7390; }
.m-zitat { font-family: var(--serif); font-style: italic; font-size: 1.25rem; }
.m-buchstabe {
  margin: 18px auto 0;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(160deg, #fff3c9, #f9dd8f);
  color: #5a3d00;
  font-size: .95rem;
}
.m-buchstabe b {
  display: block;
  margin: 6px auto 0;
  width: 58px;
  height: 70px;
  line-height: 70px;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--gold), var(--gold-dunkel));
  font-family: var(--serif);
  font-size: 2.4rem;
  color: #3a2500;
  box-shadow: 0 6px 16px rgba(201, 149, 42, .45);
  animation: plopp .6s .3s cubic-bezier(.3, 1.6, .5, 1) both;
}

/* Einzelne 3D-Figur im Türchen */
.figur3d {
  height: clamp(220px, 60vw, 290px);
  margin: 10px -6px 2px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 30%, #2a3f8f, #0b1433 75%);
  cursor: grab;
  touch-action: pan-y;
  overflow: hidden;
}
.figur3d canvas { display: block; width: 100%; height: 100%; }
.figur3d.ersatz { display: grid; place-items: center; font-size: 4.5rem; cursor: default; }
.m-hinweis { margin: 0 0 8px; font-size: .78rem; color: #6b7390; }

/* Songtext */
.m-lied {
  margin: 4px 0 20px;
  padding: 18px 14px 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #ecdcb4;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
}
.m-lied h3 { margin: 0 0 14px; font-family: var(--serif); font-size: 1.15rem; line-height: 1.25; color: var(--gruen); }
.lied-teil { margin: 0 0 16px; }
.lied-teil p { margin: 0; font-family: var(--serif); font-size: 1rem; line-height: 1.55; color: #333c58; }
.lied-name {
  display: block;
  margin-bottom: 4px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8a91a8;
}
.lied-teil.refrain { padding: 10px 8px; border-radius: 12px; background: linear-gradient(160deg, #fff6d9, #fbe6a8); }
.lied-teil.refrain p { font-weight: 700; font-style: italic; color: var(--rot-dunkel); }
.lied-teil.refrain .lied-name { color: var(--gold-dunkel); }

.lied-play { margin: 0 0 18px; min-width: 210px; }

.finale-btn { margin: 0 0 18px; }
.m-zweitlink { margin-top: 12px; }
.m-zweitlink a { font-weight: 700; color: var(--rot-dunkel); }

/* Formular */
.formular { display: grid; gap: 12px; text-align: left; margin-top: 8px; }
.formular label { font-size: .85rem; font-weight: 700; color: #47506b; display: grid; gap: 5px; }
.formular input[type="text"], .formular input[type="email"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid #d5d9e6;
  border-radius: 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--tinte);
  background: #fff;
}
.formular input:focus { outline: none; border-color: var(--gruen); }
.formular .haken { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; line-height: 1.4; }
.formular .haken input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.formular .haken a { color: var(--rot); }
.f-meldung { min-height: 1.3em; font-size: .92rem; font-weight: 600; text-align: center; margin: 0; }
.f-meldung.fehler { color: var(--rot); }
.f-meldung.ok { color: var(--gruen); }
#f-wort { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; text-align: center; }

/* Tanzender Roboter (Überraschung) */
.robo-tanz { width: 170px; height: 190px; margin: 6px auto 10px; }
.robo-tanz svg { width: 100%; height: 100%; overflow: visible; }
.robo-tanz .koerper { animation: huepfen .6s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.robo-tanz .arm-l { animation: winkenL .6s ease-in-out infinite alternate; transform-origin: 42px 92px; }
.robo-tanz .arm-r { animation: winkenR .6s ease-in-out infinite alternate; transform-origin: 128px 92px; }
.robo-tanz .auge { animation: zwinkern 2.4s infinite; transform-origin: center; transform-box: fill-box; }
@keyframes huepfen { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-12px) rotate(4deg); } }
@keyframes winkenL { from { transform: rotate(20deg); } to { transform: rotate(-70deg); } }
@keyframes winkenR { from { transform: rotate(70deg); } to { transform: rotate(-20deg); } }
@keyframes zwinkern { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 54px;
  z-index: 60;
  transform: translate(-50%, 30px);
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: #fff;
  color: var(--tinte);
  font-weight: 600;
  font-size: .95rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.sichtbar { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Emoji-Regen ---------- */
.regen { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.regen span {
  position: absolute;
  top: -60px;
  animation: fallen linear forwards;
  will-change: transform;
}
@keyframes fallen {
  to { transform: translate(var(--x), 115vh) rotate(var(--r)); }
}

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