:root {
  --bg: #14251c;
  --bg-2: #0d1a13;
  --cream: #f7f1e3;
  --cream-dim: #d9d1bd;
  --gold: #e3bf5f;
  --red: #b3342f;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 80% at 50% 0%, #1f3a2b 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--cream);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* Sanfter Schneefall */
.snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,.6), transparent),
    radial-gradient(1.5px 1.5px at 120px 80px, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 200px 150px, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 60px 190px, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 260px 40px, rgba(255,255,255,.4), transparent);
  background-size: 300px 220px;
  animation: snow 18s linear infinite;
  opacity: .7;
}
@keyframes snow { to { background-position: 40px 220px; } }

.card {
  position: relative;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

h1 {
  margin: 0 0 10px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(30px, 9vw, 40px);
  line-height: 1.1;
}

.instruction {
  margin: 0 auto 28px;
  max-width: 300px;
  color: var(--cream-dim);
  font-size: 16px;
  line-height: 1.5;
  transition: opacity .4s ease;
}

/* Geschenk */
.gift {
  position: relative;
  display: block;
  width: min(78vw, 300px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  animation: wobble 2.6s ease-in-out infinite;
  outline: none;
}
.gift:focus-visible { outline: 2px solid var(--gold); outline-offset: 8px; border-radius: 16px; }

.gift::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(227,191,95,.28), transparent 65%);
  filter: blur(10px);
  animation: glow 2.6s ease-in-out infinite;
  z-index: -1;
}

@keyframes wobble {
  0%, 60%, 100% { transform: rotate(0) scale(1); }
  66% { transform: rotate(-4deg) scale(1.02); }
  72% { transform: rotate(4deg) scale(1.03); }
  78% { transform: rotate(-3deg) scale(1.02); }
  84% { transform: rotate(2deg) scale(1.01); }
}
@keyframes glow {
  0%, 100% { opacity: .6; transform: scale(.95); }
  50% { opacity: 1; transform: scale(1.05); }
}

.gift-svg { width: 100%; height: 100%; overflow: visible; display: block; }

.lid {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform .9s cubic-bezier(.2,.9,.3,1.2), opacity .9s ease;
}

/* Geöffnet */
.gift.open { animation: none; cursor: default; }
.gift.open::before { animation: none; opacity: 1; transform: scale(1.25); }
.gift.open .lid {
  transform: translate(70px, -150px) rotate(38deg);
  opacity: 0;
  transition: transform .9s cubic-bezier(.2,.9,.3,1), opacity .5s ease .5s;
}
.gift.shake { animation: shake .45s ease-in-out; }
@keyframes shake {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-6deg) scale(1.03); }
  40% { transform: rotate(6deg) scale(1.05); }
  60% { transform: rotate(-4deg) scale(1.04); }
  80% { transform: rotate(3deg); }
}

/* Name steigt aus der Box */
.reveal {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 115%;
  transform: translate(-50%, 30px) scale(.6);
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 0;
}
.gift.open .reveal {
  z-index: 2;
  animation: rise 1.1s cubic-bezier(.2,.9,.25,1) .35s forwards;
}
@keyframes rise {
  0%   { opacity: 0; transform: translate(-50%, 30px) scale(.6); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, -170px) scale(1); }
}

.reveal-label {
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.reveal-name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(34px, 11vw, 48px);
  line-height: 1.05;
  color: var(--cream);
  text-shadow: 0 4px 24px rgba(227,191,95,.45);
  word-break: break-word;
}
.reveal-hint {
  margin-top: 6px;
  font-size: 15px;
  color: var(--cream-dim);
  font-style: italic;
}
.reveal-hint:empty { display: none; }

.error {
  margin: 24px auto 0;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(179,52,47,.18);
  border: 1px solid rgba(179,52,47,.5);
  color: var(--cream);
  font-size: 15px;
  line-height: 1.5;
}

.foot {
  margin-top: 40px;
  font-size: 13px;
  color: rgba(247,241,227,.45);
}

@media (prefers-reduced-motion: reduce) {
  .gift, .gift::before, .snow { animation: none; }
}
