:root {
  --bg: #f2f9f4;
  --card: #ffffff;
  --ink: #1f3527;
  --muted: #6b8574;
  --accent: #2e8b57;
  --accent-soft: #e4f4e9;
  --gold: #a8d5b5;
  --border: #cfe7d7;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 0%, #d6f0de 0, transparent 50%),
              radial-gradient(circle at 100% 100%, #e8f6ec 0, transparent 50%),
              var(--bg);
  padding: 32px 16px;
}

.confetti {
  position: fixed; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(circle, var(--accent) 2px, transparent 2.5px),
    radial-gradient(circle, var(--gold) 2px, transparent 2.5px),
    radial-gradient(circle, #6fbf8a 2px, transparent 2.5px);
  background-size: 90px 90px, 130px 130px, 70px 70px;
  background-position: 0 0, 40px 60px, 20px 30px;
}

.card {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(46, 139, 87, .15);
  overflow: hidden;
}

.hero {
  text-align: center;
  padding: 48px 24px 32px;
  background: linear-gradient(160deg, #cdebd7, #ffffff);
}
.eyebrow { margin: 0; color: var(--muted); font-size: 14px; letter-spacing: .05em; text-transform: uppercase; }
h1 { margin: 8px 0 0; font-weight: 600; font-size: 20px; color: var(--accent); }
.name {
  font-family: "Dancing Script", cursive;
  font-size: clamp(44px, 12vw, 64px);
  line-height: 1.1;
  margin: 8px 0 16px;
}
.age-badge {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--accent); color: #fff;
  box-shadow: 0 0 0 6px rgba(255,255,255,.7);
}
.age-badge span { font-size: 32px; font-weight: 600; line-height: 1; }
.age-badge small { font-size: 12px; }
.message { max-width: 420px; margin: 20px auto 0; line-height: 1.6; }
.birthday { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.note {
  display: inline-block; margin: 16px auto 0; padding: 8px 16px;
  background: rgba(255,255,255,.75); border-radius: 999px;
  font-weight: 500; color: var(--accent);
}
.note[hidden], .link[hidden] { display: none; }

.gallery { padding: 24px; border-top: 1px dashed var(--border); }
.gallery[hidden] { display: none; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gallery-grid img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px;
  cursor: zoom-in; transition: transform .2s;
  box-shadow: 0 6px 20px rgba(46, 139, 87, .15);
}
.gallery-grid img:nth-child(odd):last-child { grid-column: span 2; aspect-ratio: 4 / 3; }
.gallery-grid img:hover { transform: scale(1.02); }
.lightbox {
  position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.85);
  display: grid; place-items: center; padding: 16px; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 12px; }

.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 20px 24px; border-bottom: 1px dashed var(--border);
}
.countdown div { text-align: center; background: var(--accent-soft); border-radius: 12px; padding: 10px 4px; }
.countdown b { display: block; font-size: 24px; color: var(--accent); font-variant-numeric: tabular-nums; }
.countdown span { font-size: 12px; color: var(--muted); }

.details { padding: 24px; display: grid; gap: 16px; }
.detail { display: flex; gap: 14px; align-items: flex-start; }
.icon { font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 12px; flex: none; }
.detail small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.detail p { margin: 2px 0 0; line-height: 1.5; }
.link { color: var(--accent); font-size: 14px; text-decoration: none; font-weight: 500; }

section h2 { font-family: "Dancing Script", cursive; font-size: 32px; text-align: center; margin: 0 0 16px; color: var(--accent); }

.rsvp { padding: 24px; background: #f7fcf8; border-top: 1px dashed var(--border); }
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
input, select, textarea {
  font: inherit; color: inherit;
  padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.choice { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.choice label { display: flex; align-items: center; gap: 10px; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: auto; accent-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
button {
  font: inherit; font-weight: 600; color: #fff;
  background: var(--accent); border: 0; border-radius: 999px;
  padding: 14px; cursor: pointer; transition: transform .1s, opacity .2s;
}
button:hover { opacity: .9; }
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
.actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; align-items: center; }
.btn-no {
  background: #fff; color: var(--muted); border: 1px solid var(--border);
  font-weight: 500; font-size: 14px; padding: 13px 10px;
  transition: left .25s ease, top .25s ease;
}
.btn-no.running {
  position: fixed; z-index: 20; width: auto; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.btn-no.gave-up { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

.thanks { text-align: center; padding: 8px 0 4px; }
.thanks-emoji { font-size: 64px; animation: pop .6s ease; }
.thanks h3 { margin: 8px 0; font-size: 22px; color: var(--accent); }
.thanks p { margin: 0 0 18px; line-height: 1.6; }
.btn-ghost { background: var(--accent-soft); color: var(--accent); }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

.confetti-piece {
  position: fixed; top: -12px; z-index: 30; width: 8px; height: 14px; border-radius: 2px;
  pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.05);
  animation: fall linear forwards;
}
@keyframes fall { to { top: 105vh; transform: rotate(720deg) translateX(40px); } }

.status { margin: 0; text-align: center; min-height: 1.4em; font-size: 14px; }
.status.ok { color: #2e8b57; }
.status.err { color: #c0392b; }

.wishes { padding: 24px; border-top: 1px dashed var(--border); }
.wishes ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-height: 360px; overflow-y: auto; }
.wishes li { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; line-height: 1.5; }
.wishes li b { display: block; font-size: 14px; color: var(--accent); }
.wishes li.empty { background: none; text-align: center; color: var(--muted); }

footer { text-align: center; padding: 20px; color: var(--muted); font-size: 14px; }

@media (max-width: 420px) {
  .row { grid-template-columns: 1fr; }
  .countdown b { font-size: 20px; }
}
