:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  background: #102d24;
  color: #27352a;
  --paper: #fff9eb;
  --gold: #f8d58a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 5vw, 4rem);
  background: radial-gradient(ellipse at 48% 34%, #28513e, transparent 70%), #102d24;
}

.snowfall {
  position: fixed;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.snowfall span {
  position: absolute;
  top: -0.5rem;
  left: var(--left);
  width: var(--size, 3px);
  height: var(--size, 3px);
  border-radius: 50%;
  background: #fff9eb;
  opacity: var(--opacity, 0.42);
  animation: fall var(--duration) var(--delay) linear infinite;
}

.snowfall span:nth-child(1) { --left: 3%; --duration: 18s; --delay: -7s; }
.snowfall span:nth-child(2) { --left: 8%; --duration: 23s; --delay: -16s; --size: 2px; }
.snowfall span:nth-child(3) { --left: 15%; --duration: 17s; --delay: -3s; }
.snowfall span:nth-child(4) { --left: 23%; --duration: 26s; --delay: -4s; --opacity: 0.28; }
.snowfall span:nth-child(5) { --left: 34%; --duration: 21s; --delay: -18s; --size: 4px; }
.snowfall span:nth-child(6) { --left: 43%; --duration: 24s; --delay: -1s; }
.snowfall span:nth-child(7) { --left: 55%; --duration: 19s; --delay: -16s; --size: 2px; }
.snowfall span:nth-child(8) { --left: 67%; --duration: 27s; --delay: -19s; }
.snowfall span:nth-child(9) { --left: 78%; --duration: 21s; --delay: -5s; --opacity: 0.31; }
.snowfall span:nth-child(10) { --left: 85%; --duration: 18s; --delay: -13s; --size: 4px; }
.snowfall span:nth-child(11) { --left: 91%; --duration: 24s; --delay: -11s; }
.snowfall span:nth-child(12) { --left: 97%; --duration: 20s; --delay: -17s; --size: 2px; }

@keyframes fall {
  35% { transform: translate(0.75rem, 35vh); }
  70% { transform: translate(-0.25rem, 70vh); }
  to { transform: translate(0.6rem, calc(100vh + 1rem)); }
}

@media (prefers-reduced-motion: reduce) {
  .snowfall { display: none; }
}

.card {
  width: min(100%, 64rem);
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  min-height: 35rem;
  overflow: hidden;
  border: 1px solid #edcc8b9c;
  border-radius: 1.5rem;
  box-shadow: 0 1.5rem 5rem #091c16aa;
}

.cover {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  text-align: center;
  color: var(--paper);
  padding: 5.25rem 1.75rem 12rem;
  background: radial-gradient(ellipse at 50% 32%, #aa3738 0%, #84272b 56%, #641c24 100%);
}
.cover::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0.8rem;
  border: 1px solid #f8d58a65;
  border-radius: 0.9rem;
  pointer-events: none;
}
.result-label {
  font-size: 0.875rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}
h1, h2 { font-family: Georgia, serif; font-weight: 500; }
h1 { margin: 0; font-size: clamp(4.6rem, 8vw, 7.3rem); line-height: 0.79; letter-spacing: -0.075em; }
h1 em { color: var(--gold); font-weight: inherit; }
.sparkle { position: absolute; color: var(--gold); }
.top { top: 2rem; right: 2rem; font-size: 1.3rem; }
.left { left: 12%; top: 41%; font-size: 2rem; }
.right { right: 13%; top: 48%; }
.illustration { position: absolute; width: 15rem; height: 10rem; bottom: 1.55rem; left: 50%; transform: translateX(-50%); }
.snowflake, .small-star { position: absolute; color: var(--gold); }
.snowflake { left: 10%; top: 12%; font-size: 1.5rem; }
.small-star { right: 13%; top: 4%; }
.tree {
  position: absolute;
  bottom: 0.75rem;
  width: 6rem;
  height: 7.6rem;
  background: repeating-linear-gradient(148deg, #446850 0 1px, #28503b 1px 5px);
  clip-path: polygon(50% 0, 72% 30%, 63% 30%, 85% 59%, 75% 59%, 100% 89%, 56% 89%, 56% 100%, 44% 100%, 44% 89%, 0 89%, 25% 59%, 15% 59%, 37% 30%, 28% 30%);
}
.tree-left { left: 0.75rem; transform: rotate(-9deg) scale(0.84); transform-origin: bottom; }
.tree-right { right: 0.55rem; transform: rotate(8deg); }
.gift {
  position: absolute;
  z-index: 1;
  bottom: 0.75rem;
  left: 4.4rem;
  width: 5.7rem;
  height: 4.5rem;
  border: 1px solid #e3a85c;
  border-radius: 0.22rem;
  background: linear-gradient(90deg, transparent 43%, #ffefc3 43% 57%, transparent 57%), linear-gradient(140deg, #ffe5a3, #d6a453);
  box-shadow: 0 0.55rem 1.15rem #3b121b50;
  transform: rotate(-8deg);
}
.gift::before {
  content: "";
  position: absolute;
  inset: 0.55rem -0.25rem auto;
  height: 0.7rem;
  border-radius: 0.12rem;
  background: #fff0bc;
}
.bow { position: absolute; top: -1.02rem; left: calc(50% - 0.1rem); }
.bow::before, .bow::after {
  content: "";
  position: absolute;
  width: 1.45rem;
  height: 0.72rem;
  border: 2px solid #fff0bc;
  border-radius: 70% 75% 20% 75%;
  transform: translateX(-90%) rotate(25deg);
}
.bow::after { transform: translateX(-8%) scaleX(-1) rotate(25deg); }
.snow { position: absolute; bottom: 0.6rem; inset-inline: 0; height: 0.14rem; border-radius: 50%; background: #f8d58aa8; }

.draw {
  display: grid;
  align-items: center;
  padding: clamp(2rem, 5vw, 4rem);
  background: radial-gradient(ellipse at top right, #f5e6c8, transparent 65%), var(--paper);
}
.draw-content { width: 100%; min-width: 0; }
h2 { color: #84272e; font-size: clamp(2.25rem, 4vw, 3.45rem); line-height: 1.05; letter-spacing: -0.045em; margin: 0 0 0.8rem; }
p { font-size: 1rem; line-height: 1.6; margin: 0; }
form { margin-top: 1.6rem; }
label { display: block; font-size: 0.9375rem; font-weight: 750; margin-bottom: 0.45rem; }
.select-wrap { position: relative; }
.select-wrap::after { content: ""; position: absolute; right: 1.15rem; top: 40%; width: 0.45rem; height: 0.45rem; border-right: 2px solid #31543d; border-bottom: 2px solid #31543d; transform: rotate(45deg); pointer-events: none; }
select, input, button { width: 100%; font: inherit; border-radius: 0.55rem; min-height: 3.25rem; }
select, input { border: 1px solid #aa9b82; color: #27352a; background: #fffdf6; padding: 0.65rem 0.85rem; }
select { appearance: none; padding-right: 2.75rem; }
.select-wrap + label { margin-top: 0.9rem; }
#invite-code { font-family: ui-monospace, monospace; }
.primary { cursor: pointer; margin-top: 1rem; padding: 0.7rem 1rem; color: #fff9eb; background: #224e38; border: 1px solid transparent; font-weight: 750; }
.primary:hover:not(:disabled) { background: #153c2a; }
.primary:disabled { opacity: 0.55; cursor: default; }
:focus-visible { outline: 3px solid #ad5526; outline-offset: 3px; }
.result-label { color: #3c634d; margin-bottom: 0.4rem; }
#recipient { font-size: clamp(3.15rem, 5vw, 4.7rem); overflow-wrap: anywhere; }
.error { margin-top: 0.75rem; color: #84272e; }

@media (max-width: 45rem) {
  .card { grid-template-columns: 1fr; max-width: 31rem; min-height: auto; }
  .cover { padding: 2.85rem 1rem 7.4rem; }
  h1 { font-size: clamp(3.5rem, 12vw, 5rem); }
  .illustration { bottom: 0.85rem; transform: translateX(-50%) scale(0.60); transform-origin: bottom; }
  .draw { padding: 1.65rem clamp(1.25rem, 6vw, 2rem) 1.85rem; }
}
