:root {
  --bg: #0f2a1d;
  --bg-2: #163d2a;
  --card: #fffaf3;
  --ink: #2a1f1a;
  --muted: #7a6a60;
  --red: #c8102e;
  --red-dark: #9b0c23;
  --gold: #e8b923;
  --line: #e6dccf;
  --radius: 14px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 70%) fixed;
  line-height: 1.5;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px 64px;
  position: relative;
  z-index: 1;
}

h1, h2 { line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
h2:first-child { margin-top: 0; }

.hero { text-align: center; color: #fff; margin-bottom: 24px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 8px; }
.tagline { opacity: .85; margin: 0 auto; max-width: 480px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
  margin-bottom: 20px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }

label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
input, select, textarea {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: transparent; }
textarea { resize: vertical; }

.person, .exclusion {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.person .p-name { flex: 1 1 35%; }
.person .p-wish { flex: 1 1 65%; }
.exclusion select { flex: 1; }

@media (max-width: 520px) {
  .person { flex-wrap: wrap; }
  .person .p-name { flex: 1 1 calc(100% - 52px); }
  .person .p-wish { flex: 1 1 100%; order: 3; }
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: none;
}
.primary {
  display: block; width: 100%; margin-top: 28px; padding: 14px;
  background: var(--red); color: #fff; font-weight: 700; font-size: 1.1rem;
}
.primary:hover { background: var(--red-dark); }
.ghost {
  background: transparent; border: 1px dashed var(--muted); color: var(--ink); padding: 8px 14px;
}
.ghost:hover { border-style: solid; }
.remove {
  flex: 0 0 40px; height: 40px; background: transparent; color: var(--muted); font-size: 1rem;
}
.remove:hover { color: var(--red); background: #f5ebe0; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .875rem; }
.center { text-align: center; }
.error { color: var(--red); font-weight: 600; margin: 16px 0 0; }

#links { list-style: none; padding: 0; margin: 0; }
#links li {
  display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
#links li:last-child { border-bottom: none; }
#links .who { font-weight: 600; flex: 0 0 auto; max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#links input { flex: 1; font-size: .8rem; color: var(--muted); }
#links button { flex: 0 0 auto; padding: 8px 12px; background: var(--bg-2); color: #fff; }
#links button.done { background: var(--gold); color: var(--ink); }

/* Reveal */
.reveal-card { text-align: center; margin-top: 8vh; }
.event-name { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; color: var(--red); font-weight: 700; margin: 0; }
.reveal-card h1 { margin: 8px 0; }

.gift {
  position: relative; width: 120px; height: 120px; margin: 28px auto 8px; display: block;
  background: none; transition: transform .2s;
}
.gift:hover { transform: rotate(-4deg) scale(1.05); }
.gift .box, .gift .lid {
  position: absolute; left: 50%; transform: translateX(-50%);
  background: var(--red);
  background-image: linear-gradient(90deg, transparent 42%, var(--gold) 42%, var(--gold) 58%, transparent 58%);
  border-radius: 6px;
}
.gift .box { bottom: 0; width: 100px; height: 80px; }
.gift .lid { top: 14px; width: 116px; height: 26px; z-index: 1; transition: transform .6s cubic-bezier(.5,-.5,.5,1.5), opacity .6s; }
.gift .lid::before, .gift .lid::after {
  content: ""; position: absolute; top: -18px; width: 26px; height: 22px;
  border: 6px solid var(--gold); border-radius: 50% 50% 0 50%;
}
.gift .lid::before { left: 30px; transform: rotate(-20deg); }
.gift .lid::after { right: 30px; transform: rotate(20deg) scaleX(-1); }
.gift.opened { pointer-events: none; }
.gift.opened .lid { transform: translate(-50%, -80px) rotate(-25deg); opacity: 0; }
.gift.opened .box { animation: shrink .5s .4s forwards; }
@keyframes shrink { to { transform: translateX(-50%) scale(0); opacity: 0; } }

#r-result { animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
.recipient { font-size: clamp(2rem, 8vw, 3rem); font-weight: 800; color: var(--red); margin: 0 0 8px; word-break: break-word; }
.wish { background: #f5ebe0; border-radius: 10px; padding: 10px 14px; margin: 0 auto 16px; max-width: 420px; }
.details { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin: 16px 0; }
.details div { display: flex; flex-direction: column; }
.details dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.details dd { margin: 0; font-weight: 700; }
.note { font-style: italic; border-top: 1px solid var(--line); padding-top: 12px; }

a { color: var(--gold); }
.card a { color: var(--red); }

/* Snow */
.snow, .snow::before, .snow::after {
  position: fixed; inset: -100px 0 0 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(3px 3px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 80px 120px, #fff 50%, transparent 51%),
    radial-gradient(4px 4px at 150px 60px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 200px 170px, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 260px 90px, #fff 50%, transparent 51%);
  background-size: 300px 200px;
  opacity: .5;
  animation: snow 18s linear infinite;
}
.snow::before { content: ""; background-size: 220px 260px; animation-duration: 25s; opacity: .35; }
.snow::after  { content: ""; background-size: 400px 300px; animation-duration: 12s; opacity: .25; }
@keyframes snow { to { background-position: 0 600px; } }
@media (prefers-reduced-motion: reduce) {
  .snow, .snow::before, .snow::after { animation: none; }
  .gift, .gift .lid, #r-result { transition: none; animation: none; }
}
