:root {
  --navy: #0b1f3a;
  --navy-2: #13325c;
  --sea: #1f6fa8;
  --foam: #e8f4fb;
  --gold: #ffc94a;
  --gold-2: #ffb31a;
  --red: #e2463f;
  --ink: #142238;
  --muted: #5b6b82;
  --card: #fffdf8;
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 55%, var(--sea) 100%);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.sky { position: fixed; inset: 0; pointer-events: none; }
.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 15%, #fff, transparent),
    radial-gradient(1px 1px at 70% 8%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 30%, #fff, transparent),
    radial-gradient(1px 1px at 40% 35%, #fff, transparent),
    radial-gradient(1px 1px at 10% 45%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 22%, #fff, transparent),
    radial-gradient(1px 1px at 92% 52%, #fff, transparent);
  opacity: .8;
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .4; } }

#app {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px 140px;
  min-height: 100dvh;
}

.screen { display: none; animation: rise .5s ease both; }
.screen.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* Intro */
#s-intro { text-align: center; color: #fff; padding-top: 4vh; }
.lighthouse-wrap { position: relative; width: 140px; height: 300px; margin: 0 auto 8px; }
.lighthouse { width: 100%; height: 100%; position: relative; z-index: 2; }
.lamp { animation: glow 2s ease-in-out infinite alternate; }
@keyframes glow { to { fill: #fff3c4; } }
.beam {
  position: absolute; top: 46px; left: 50%; width: 900px; height: 90px;
  margin-left: -450px; z-index: 1;
  background: radial-gradient(ellipse at center, rgba(255, 220, 120, .55) 0%, rgba(255, 220, 120, 0) 60%);
  clip-path: polygon(50% 45%, 100% 0, 100% 100%, 50% 55%, 0 100%, 0 0);
  animation: sweep 6s linear infinite;
  transform-origin: 50% 50%;
}
@keyframes sweep { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }

.eyebrow { font-weight: 600; letter-spacing: .02em; color: var(--gold); margin: 0 0 6px; }
.card .eyebrow { color: var(--sea); }
.title {
  font-family: 'Baloo 2', sans-serif; font-weight: 800;
  font-size: clamp(36px, 10vw, 48px); line-height: 1.05; margin: 0 0 22px;
}
.h2 { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 28px; line-height: 1.15; margin: 0 0 6px; }
.lead { color: var(--muted); margin: 0 0 18px; line-height: 1.55; }

/* Card */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 26px 22px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  position: relative;
}
.invite { text-align: center; border-top: 8px solid var(--gold); }
.invite .title { font-size: 30px; margin-bottom: 0; color: var(--sea); }
.age {
  display: inline-grid; place-items: center; width: 1.6em; height: 1.6em;
  background: var(--red); color: #fff; border-radius: 50%; font-size: 1.1em;
  transform: rotate(-8deg); margin: 0 .1em;
}
.name {
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: clamp(46px, 14vw, 64px);
  line-height: 1; margin: 8px 0 12px; color: var(--navy);
  text-shadow: 3px 3px 0 var(--gold);
}
.facts { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; }
.facts li {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  background: var(--foam); border-radius: 14px; margin-bottom: 8px;
}
.facts span { font-size: 22px; line-height: 1.2; }
.facts b { display: block; }
.facts small { color: var(--muted); font-size: 14px; line-height: 1.4; }
.hint { font-size: 14px; color: var(--muted); margin: 0 0 18px; }

/* Buttons */
.actions { display: grid; gap: 10px; margin-top: 8px; }
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none; text-align: center;
  font: 600 16px/1.2 'Be Vietnam Pro', sans-serif; padding: 14px 18px; border-radius: 999px;
  min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .1s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.big { font-size: 18px; min-height: 56px; }
.btn.primary { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: var(--navy); box-shadow: 0 6px 0 #c98800; }
.btn.primary:active { box-shadow: 0 2px 0 #c98800; transform: translateY(4px); }
.btn.danger { background: var(--red); color: #fff; box-shadow: 0 6px 0 #a52a24; }
.btn.ghost { background: var(--foam); color: var(--navy); }
.btn.link { background: none; color: var(--muted); min-height: 40px; font-weight: 500; }
.btn[disabled] { opacity: .55; pointer-events: none; }
#s-intro .btn { width: min(320px, 100%); }

/* Form */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field small { color: var(--muted); font-weight: 400; }
.field input, textarea {
  width: 100%; font: 16px 'Be Vietnam Pro', sans-serif; padding: 13px 14px; border-radius: 12px;
  border: 2px solid #d7e3ee; background: #fff; color: var(--ink);
}
.field input:focus, textarea:focus { outline: none; border-color: var(--sea); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stepper { display: flex; align-items: center; border: 2px solid #d7e3ee; border-radius: 12px; overflow: hidden; background: #fff; }
.stepper input { border: 0; text-align: center; padding: 12px 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper button { border: 0; background: var(--foam); width: 44px; height: 48px; font-size: 22px; color: var(--navy); cursor: pointer; }
.error { color: var(--red); min-height: 1.2em; margin: 0 0 6px; font-size: 14px; }
.declining .attending-only { display: none; }

/* Recorder */
.stage {
  position: relative; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden;
  background: var(--navy); margin-bottom: 10px;
}
.stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
#live { transform: scaleX(-1); }
.placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #cfe3f3; }
.placeholder span { font-size: 48px; }
.has-video .placeholder { display: none; }
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 800 120px 'Baloo 2', sans-serif; color: #fff; background: rgba(11, 31, 58, .35);
  text-shadow: 0 4px 20px rgba(0, 0, 0, .4);
}
.rec-badge {
  position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, .55); color: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 600;
}
.rec-badge i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.progress { height: 8px; background: #d7e3ee; border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.progress > div { height: 100%; width: 0; background: var(--sea); transition: width .25s linear; }
#rec-progress > div { background: var(--red); }
.upload p { margin: 10px 0 6px; text-align: center; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.inapp {
  background: #fff4d6; border: 1px solid #ffd77a; border-radius: 12px; padding: 12px 14px;
  font-size: 14px; line-height: 1.5; margin-bottom: 12px;
}
.text-wish { margin-top: 16px; padding: 12px 14px; background: var(--foam); border-radius: 14px; }
.text-wish summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.text-wish textarea { margin: 10px 0; resize: vertical; }
#btn-skip { width: 100%; margin-top: 6px; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0 0 18px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 62px; top: 8px; bottom: 8px; width: 3px; background: var(--foam); border-radius: 3px; }
.timeline li { display: grid; grid-template-columns: 52px 1fr; gap: 22px; padding: 10px 0; position: relative; }
.timeline li::before {
  content: ''; position: absolute; left: 56px; top: 16px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--gold); border: 3px solid var(--card); box-shadow: 0 0 0 2px var(--gold-2);
}
.timeline time { font-weight: 800; font-family: 'Baloo 2', sans-serif; font-size: 18px; color: var(--sea); padding-top: 2px; }
.timeline b { display: block; font-size: 17px; }
.timeline small { color: var(--muted); }

/* Waves */
.waves { position: fixed; left: 0; right: 0; bottom: 0; height: 110px; z-index: 0; pointer-events: none; }
.waves svg { width: 200%; height: 100%; animation: drift 12s linear infinite; }
.w1 { fill: rgba(255, 255, 255, .12); }
.w2 { fill: rgba(255, 255, 255, .2); }
@keyframes drift { to { transform: translateX(-50%); } }

/* Confetti */
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 50; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
