:root {
  --night-1: #0b1b33;
  --night-2: #1a0f2e;
  --red: #d62f45;
  --red-dark: #9e1b30;
  --green: #1f7a55;
  --gold: #f6c453;
  --cream: #fff8ec;
  --text: #fdf6ea;
  --muted: rgba(253, 246, 234, 0.7);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(246, 196, 83, 0.18), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(214, 47, 69, 0.25), transparent 60%),
    radial-gradient(800px 500px at 0% 100%, rgba(31, 122, 85, 0.3), transparent 60%),
    linear-gradient(160deg, var(--night-1), var(--night-2));
  background-color: var(--night-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden;
}

canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#snow { z-index: 0; }
#confetti { z-index: 3; }

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 36px 28px 32px;
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  text-align: center;
  animation: rise 0.9s cubic-bezier(.2, .8, .2, 1) both;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.35em;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  margin: 4px 0 12px;
  font-family: "Mountains of Christmas", cursive;
  font-size: clamp(2.8rem, 11vw, 3.8rem);
  line-height: 1;
  background: linear-gradient(180deg, #fff 20%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(246, 196, 83, 0.35));
}

.lead { font-size: 1.05rem; line-height: 1.5; color: var(--muted); margin: 0 0 22px; }

form { display: flex; flex-direction: column; gap: 12px; }

input {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  text-align: center;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input::placeholder { color: rgba(253, 246, 234, 0.4); }
input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(246, 196, 83, 0.2); }

button {
  font: inherit;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 16px 18px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  box-shadow: 0 10px 24px rgba(214, 47, 69, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform .15s, box-shadow .15s, opacity .2s;
}
button:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(214, 47, 69, 0.5); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: progress; transform: none; }

.hint { font-size: 0.85rem; color: var(--muted); margin: 18px 0 0; }

.msg { min-height: 1.4em; margin: 14px 0 0; font-weight: 600; }
.msg.error { color: #ffb3bd; }
.msg.warn {
  color: var(--cream);
  background: rgba(214, 47, 69, 0.18);
  border: 1px solid rgba(214, 47, 69, 0.45);
  padding: 12px 14px;
  border-radius: 14px;
  animation: pop .35s ease both;
}

.shake { animation: shake .45s ease; }

.hidden { display: none; }
.view { animation: fade .5s ease both; }

/* ---------- Gift ---------- */
.stage {
  position: relative;
  height: 290px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.glow {
  position: absolute;
  bottom: 40px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 196, 83, 0.85), rgba(246, 196, 83, 0) 65%);
  opacity: 0;
  transform: scale(.3);
}

.gift { position: relative; width: 150px; height: 150px; margin-bottom: 10px; }
.gift.wobble { animation: wobble 1.6s ease-in-out both; }

.box {
  position: absolute;
  bottom: 0;
  left: 8px;
  width: 134px;
  height: 108px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 43%, var(--gold) 43%, var(--gold) 57%, transparent 57%),
    linear-gradient(160deg, var(--red), var(--red-dark));
  box-shadow: inset 0 -12px 20px rgba(0, 0, 0, 0.25), 0 18px 30px rgba(0, 0, 0, 0.35);
}

.lid {
  position: absolute;
  top: 18px;
  left: 0;
  width: 150px;
  height: 34px;
  border-radius: 8px;
  z-index: 2;
  background:
    linear-gradient(90deg, transparent 43%, #ffd56e 43%, #ffd56e 57%, transparent 57%),
    linear-gradient(180deg, #e8435a, var(--red));
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
  transform-origin: 20% 100%;
}

.bow { position: absolute; left: 50%; top: -26px; width: 0; height: 0; }
.bow i {
  position: absolute;
  top: 0;
  width: 40px;
  height: 30px;
  border: 9px solid var(--gold);
  border-radius: 50% 50% 10% 50%;
}
.bow i:first-child { right: 2px; transform: rotate(-20deg); }
.bow i:last-child { left: 2px; transform: scaleX(-1) rotate(-20deg); }
.bow::after {
  content: "";
  position: absolute;
  left: -9px;
  top: 16px;
  width: 18px;
  height: 14px;
  border-radius: 6px;
  background: #ffd56e;
}

.gift.open .lid { animation: lidOff 0.9s cubic-bezier(.3, .7, .3, 1) forwards; }
.gift.open ~ .tag,
.stage.opened .tag { animation: tagUp 1s .25s cubic-bezier(.2, 1.3, .4, 1) forwards; }
.stage.opened .glow { animation: glow 1.4s ease forwards; }

.tag {
  position: absolute;
  bottom: 70px;
  left: 50%;
  min-width: 250px;
  white-space: nowrap;
  padding: 18px 26px 20px;
  border-radius: 18px;
  background: var(--cream);
  color: #3b1d22;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, 70px) scale(.2);
  opacity: 0;
  z-index: 1;
}
.tag::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--night-1);
  opacity: .25;
}
.tag small {
  display: block;
  margin-top: 8px;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green);
}
.tag strong {
  display: block;
  font-family: "Mountains of Christmas", cursive;
  font-size: 3.2rem;
  line-height: 1.1;
  color: var(--red-dark);
}

#after { opacity: 0; transition: opacity .6s 1.2s; }
.stage.opened ~ #after { opacity: 1; }

footer {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  font-size: .8rem;
  color: rgba(253, 246, 234, 0.45);
}

/* ---------- Keyframes ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(30px) scale(.97); } }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
@keyframes wobble {
  0% { transform: rotate(0) scale(1); }
  10% { transform: rotate(-6deg) scale(1.02); }
  20% { transform: rotate(6deg); }
  30% { transform: rotate(-9deg) scale(1.04); }
  40% { transform: rotate(9deg); }
  50% { transform: rotate(-12deg) scale(1.06); }
  60% { transform: rotate(12deg); }
  70% { transform: rotate(-8deg) scale(1.08) translateY(-6px); }
  80% { transform: rotate(5deg) scale(.94) translateY(4px); }
  90% { transform: rotate(0) scale(1.1, .9); }
  100% { transform: rotate(0) scale(1); }
}
@keyframes lidOff {
  0% { transform: translate(0, 0) rotate(0); }
  40% { transform: translate(-10px, -70px) rotate(-25deg); opacity: 1; }
  100% { transform: translate(-150px, 120px) rotate(-120deg); opacity: 0; }
}
@keyframes tagUp {
  0% { opacity: 0; transform: translate(-50%, 70px) scale(.2); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, -40px) scale(1); }
}
@keyframes glow {
  0% { opacity: 0; transform: scale(.3); }
  40% { opacity: 1; transform: scale(1.2); }
  100% { opacity: .55; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; }
}
