:root {
  --background: #f3ede4;
  --surface: #fffdf9;
  --surface-warm: #e9ded1;
  --burgundy: #6d2838;
  --burgundy-accent: #7c3042;
  --text-muted: #765f5d;
  --border: #d8c8bb;
  --danger-soft: #f7e8e7;
  --shadow: 0 18px 50px rgb(90 55 49 / 10%);
  --radius: 10px;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--burgundy);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--background); }

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 14% 8%, rgb(255 253 249 / 72%) 0 12%, transparent 30%),
    radial-gradient(circle at 88% 92%, rgb(233 222 209 / 56%) 0 10%, transparent 32%),
    var(--background);
  color: var(--burgundy);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.page-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(30px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(30px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: grid;
  place-items: center;
}

.card {
  width: 100%;
  border: 1px solid rgb(216 200 187 / 88%);
  border-radius: var(--radius);
  background: rgb(255 253 249 / 95%);
  box-shadow: var(--shadow);
}

.invitation-card {
  max-width: 610px;
  padding: clamp(30px, 6vw, 52px) clamp(22px, 7vw, 60px) clamp(30px, 6vw, 44px);
  text-align: center;
  animation: card-arrive 700ms cubic-bezier(.2,.75,.2,1) both;
}

.sticker {
  display: block;
  width: clamp(155px, 31vw, 205px);
  height: auto;
  max-height: 190px;
  object-fit: contain;
  margin: 0 auto 16px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  line-height: 1.05;
  text-wrap: balance;
}

h1 { font-size: clamp(2.15rem, 7vw, 3.55rem); }
h2 { font-size: clamp(2rem, 5vw, 2.85rem); }

.invitation-card h1 {
  max-width: 18ch;
  margin-inline: auto;
  font-size: clamp(1.65rem, 4.6vw, 2.5rem);
  font-weight: 500;
  line-height: 1.06;
}

.invitation-card .lead {
  max-width: 460px;
  margin: 16px auto 0;
  line-height: 1.5;
}

.lead {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: clamp(.95rem, 2.4vw, 1.08rem);
  line-height: 1.6;
}

.invitation-actions {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  min-height: 48px;
  margin-top: 24px;
  margin-bottom: 88px;
}

.button {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 12px 28px;
  font-size: .93rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 150ms ease, background 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.button:active { transform: scale(.97); }
.button:focus-visible, .icon-button:focus-visible, .choice:focus-visible, .tab:focus-visible,
input:focus-visible, textarea:focus-visible, .calendar-day:focus-visible {
  outline: 3px solid rgb(124 48 66 / 24%);
  outline-offset: 3px;
}

.button-primary { background: var(--burgundy-accent); color: var(--surface); }
.button-primary:hover { background: var(--burgundy); }
.button-primary:disabled { opacity: .58; cursor: wait; }
.button-secondary { border-color: var(--burgundy-accent); background: var(--surface); }
.button-ghost { border-color: var(--border); background: transparent; color: var(--text-muted); }

.invitation-actions > .button-primary { width: 112px; min-width: 112px; padding-inline: 12px; }
.no-zone { position: relative; width: 112px; min-width: 112px; padding-top: 0; isolation: isolate; }
.no-zone .button-secondary { width: 112px; padding-inline: 12px; }
.no-label { display: inline-block; transform-origin: center; }
.tease {
  position: absolute;
  z-index: 1;
  top: calc(100% + 12px);
  right: -12px;
  width: 160px;
  height: 72px;
  color: var(--burgundy);
  font-family: "Marck Script", "Cormorant Garamond", cursive;
  font-size: 1.2rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: .005em;
  line-height: 1.05;
  opacity: 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  pointer-events: none;
  transition: opacity 140ms ease;
}
.tease-label { position: absolute; top: 24px; left: 0; display: block; width: 100%; text-align: center; text-wrap: balance; transform: rotate(8deg); transform-origin: center; }
.tease-arrow { position: absolute; top: -48px; left: 74px; display: block; width: 120px; height: 76px; overflow: visible; }
.tease-arrow path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.no-zone.is-rejected .button-secondary {
  animation: reject-jolt 360ms cubic-bezier(.36,.07,.19,.97);
}
.no-zone.is-rejected .no-label { animation: label-jolt 310ms 45ms cubic-bezier(.36,.07,.19,.97); }
.no-zone.is-annoyed .button-secondary {
  background: var(--surface-warm);
  border-color: var(--burgundy);
  font-weight: 800;
  animation: annoyed-rattle 600ms cubic-bezier(.36,.07,.19,.97);
}
.no-zone.is-annoyed .no-label { animation: label-annoyed 540ms 35ms linear; }
.no-zone.is-shaking .button-secondary { font-weight: 800; animation: furious-shake 620ms linear; }
.no-zone.is-shaking .no-label { animation: label-panic 72ms linear 9; }
.no-zone.is-exploding { pointer-events: none; }
.no-zone.is-exploding .tease { opacity: 0; }
.no-zone.is-exploding .button-secondary { animation: button-blast 170ms ease-in forwards; }
.no-zone.is-destroyed { pointer-events: none; }
.no-zone.is-destroyed .tease { opacity: 0; }
.no-zone.is-destroyed .button-secondary {
  visibility: hidden;
}
.no-zone.is-destroyed::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 112px;
  height: 48px;
  border: 1px solid rgb(109 40 56 / 32%);
  border-radius: 8px;
  background: rgb(233 222 209 / 22%);
  transform: translateX(-50%);
  animation: empty-slot 380ms ease both;
}
.explosion { position: absolute; z-index: 4; left: 50%; bottom: 24px; width: 1px; height: 1px; pointer-events: none; }
.explosion .boom-cloud {
  position: absolute;
  z-index: 1;
  left: -82px;
  top: -75px;
  width: 164px;
  height: 144px;
  background: #e5aa63;
  clip-path: polygon(50% 0,59% 18%,75% 4%,76% 25%,97% 18%,84% 41%,100% 51%,81% 61%,94% 83%,70% 78%,66% 100%,49% 82%,34% 98%,31% 76%,7% 84%,20% 61%,0 50%,19% 39%,5% 18%,29% 25%,29% 3%,42% 19%);
  filter: drop-shadow(2px 0 0 var(--burgundy)) drop-shadow(-2px 0 0 var(--burgundy)) drop-shadow(0 2px 0 var(--burgundy)) drop-shadow(0 -2px 0 var(--burgundy));
  animation: boom-pop 900ms cubic-bezier(.15,.8,.24,1) both;
}
.explosion .boom-word {
  position: absolute;
  z-index: 3;
  left: -57px;
  top: -38px;
  color: var(--burgundy);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: .025em;
  text-shadow: 2px 2px 0 #fff4db;
  transform: rotate(-8deg);
  animation: boom-word 880ms ease-out both;
}
.explosion .shockwave { position: absolute; z-index: 0; left: -20px; top: -20px; width: 40px; height: 40px; border: 3px solid rgb(124 48 66 / 72%); border-radius: 50%; animation: shockwave 800ms ease-out both; }
.explosion i { position: absolute; z-index: 0; left: -3px; top: -5px; width: 6px; height: 31px; border-radius: 2px; background: var(--burgundy-accent); transform-origin: 3px 61px; animation: cartoon-ray 900ms ease-out both; }
.explosion i:nth-of-type(3n) { width: 10px; height: 10px; border-radius: 50%; background: #ca776f; }
.explosion .smoke { position: absolute; z-index: 2; width: 22px; height: 22px; border: 2px solid var(--burgundy); border-radius: 50%; background: var(--surface); animation: smoke-puff 900ms ease-out both; }
.explosion .smoke-one { left: -78px; top: -33px; --puff-x: -30px; --puff-y: -28px; }
.explosion .smoke-two { left: 55px; top: -48px; --puff-x: 28px; --puff-y: -32px; animation-delay: 30ms; }
.explosion .smoke-three { left: 58px; top: 28px; --puff-x: 35px; --puff-y: 24px; animation-delay: 55ms; }
.explosion .smoke-four { left: -70px; top: 32px; --puff-x: -34px; --puff-y: 25px; animation-delay: 80ms; }
.explosion .smoke-five { left: -18px; top: -74px; --puff-x: -8px; --puff-y: -36px; animation-delay: 45ms; }
.explosion .smoke-six { left: 1px; top: 55px; --puff-x: 10px; --puff-y: 38px; animation-delay: 95ms; }
.quiet-message { min-height: 22px; margin: 14px 0 0; color: var(--text-muted); font-size: .84rem; }
.quiet-message.has-copy { position: relative; top: -75px; width: min(180px, calc(50% - 8px)); margin: 13px 0 0 calc(50% + 8px); text-align: left; animation: reveal 240ms ease both; }

.invitation-card.is-leaving { animation: invitation-leave 480ms cubic-bezier(.6,0,.8,.3) both; }
.acceptance-card { max-width: 520px; padding: 50px 26px; text-align: center; animation: lift-in 420ms ease both; }
.acceptance-card p:last-child { margin: 14px 0 0; color: var(--text-muted); }
.acceptance-card.is-leaving { animation: acceptance-leave 360ms ease both; }

.form-card { max-width: 680px; padding: clamp(24px, 5vw, 42px); animation: lift-in 430ms ease both; }
.form-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 30px; }
.form-header .eyebrow { margin: 0; }
.progress-dots { display: flex; align-items: center; gap: 8px; }
.progress-dot { width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--border); padding: 0; }
.progress-dot.is-complete { background: rgb(109 40 56 / 62%); }
.progress-dot.is-current { width: 9px; height: 9px; background: var(--burgundy-accent); box-shadow: 0 0 0 4px rgb(124 48 66 / 10%); }

.form-step { animation: step-in 260ms ease both; }
.form-step:not([data-step="0"]) { margin-top: -8px; }
#movie-title { margin-bottom: 20px; }
.question { margin: 13px 0 22px; color: var(--text-muted); font-size: .93rem; line-height: 1.55; }
.calendar { max-width: 420px; margin: 26px auto 0; border: 1px solid var(--border); border-radius: 9px; padding: 14px; background: #fffdfa; }
.calendar-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin-bottom: 12px; text-align: center; }
.calendar-head strong { font-size: .9rem; text-transform: capitalize; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--background); }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekdays { margin-bottom: 4px; color: var(--text-muted); font-size: .68rem; font-weight: 700; text-align: center; }
.weekdays span { padding: 6px 0; }
.calendar-day { aspect-ratio: 1; min-width: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; font-size: .8rem; cursor: pointer; }
.calendar-day:hover { border-color: var(--border); background: var(--background); }
.calendar-day.is-selected { border-color: var(--burgundy); background: var(--burgundy-accent); color: var(--surface); font-weight: 700; }
.calendar-day.is-today:not(.is-selected) { border-color: var(--border); font-weight: 800; }
.calendar-blank { aspect-ratio: 1; }
.selection-note { min-height: 21px; margin: 14px 0 0; color: var(--text-muted); font-size: .82rem; text-align: center; }

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { position: relative; min-height: 48px; border: 1px solid var(--border); border-radius: 8px; padding: 12px 36px 12px 13px; background: var(--surface); color: var(--burgundy); font-size: .85rem; font-weight: 600; line-height: 1.35; text-align: left; cursor: pointer; transition: background 170ms ease, border-color 170ms ease, transform 140ms ease; }
.choice:active { transform: scale(.985); }
.choice::after { content: ""; position: absolute; top: 50%; right: 13px; width: 15px; height: 15px; border: 1px solid var(--border); border-radius: 50%; transform: translateY(-50%); }
.choice.is-selected { border-color: var(--burgundy-accent); background: var(--surface-warm); }
.choice.is-selected::after { content: "✓"; display: grid; place-items: center; border-color: var(--burgundy-accent); background: var(--burgundy-accent); color: white; font-size: .62rem; }
.custom-field { margin-top: 16px; animation: reveal 220ms ease both; }
.custom-field label { display: block; margin-bottom: 7px; color: var(--text-muted); font-size: .78rem; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--burgundy); padding: 13px 14px; font-size: 16px; caret-color: var(--burgundy-accent); }
input::placeholder, textarea::placeholder { color: #9d8986; }
textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.subtle-note { margin: 18px 0 0; padding-left: 11px; border-left: 2px solid var(--border); color: var(--text-muted); font-size: .76rem; line-height: 1.5; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 8px; padding: 3px; background: var(--background); }
.tab { min-height: 42px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: .78rem; font-weight: 700; cursor: pointer; }
.tab.is-active { background: var(--surface); color: var(--burgundy); box-shadow: 0 2px 9px rgb(90 55 49 / 8%); }
.tab-panel { animation: reveal 200ms ease both; }
.field-error { display: none; margin: 13px 0 0; border-left: 2px solid var(--burgundy-accent); padding: 7px 10px; background: var(--danger-soft); color: var(--burgundy); font-size: .78rem; }
.field-error.is-visible { display: block; animation: reveal 180ms ease both; }
.form-step.has-error { animation: error-pulse 420ms ease; }
.character-count { margin-top: 7px; color: var(--text-muted); font-size: .7rem; text-align: right; }
.submit-error { margin: 20px 0 0; border: 1px solid #cfa8a8; border-radius: 8px; padding: 12px; background: var(--danger-soft); font-size: .8rem; line-height: 1.5; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-actions .button-ghost { margin-right: auto; }

.final-card { max-width: 650px; padding: clamp(28px, 5.5vw, 50px) clamp(30px, 6vw, 54px) clamp(30px, 6vw, 54px); animation: lift-in 500ms ease both; }
.final-card h2 { margin-top: -5px; }
.final-lines { margin: 19px 0 28px; color: #604745; font-size: clamp(.94rem, 2vw, 1rem); font-weight: 500; line-height: 1.7; }
.final-lines p { margin: 7px 0; }
.official-note { margin: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 18px 0; font-size: .76rem; }
.official-note div { display: grid; grid-template-columns: minmax(120px, 1fr) 1.4fr; gap: 14px; padding: 5px 0; }
.official-note dt { color: var(--text-muted); font-weight: 700; }
.official-note dd { margin: 0; }
.signature { margin: 34px 0 0; font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.55rem; font-style: italic; text-align: right; }
.heart { color: var(--burgundy-accent); font-style: normal; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

@keyframes card-arrive { from { opacity: 0; transform: translateY(15px) scale(.985); } }
@keyframes lift-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes step-in { from { opacity: 0; transform: translateX(8px); } }
@keyframes reveal { from { opacity: 0; transform: translateY(-5px); } }
@keyframes reject-jolt { 0%,100% { transform: translate(0) rotate(0); } 25% { transform: translateX(-3px) rotate(-1deg); } 50% { transform: translateX(3px) rotate(1deg); } 75% { transform: translateX(-2px) rotate(-.5deg); } }
@keyframes label-jolt { 0%,100% { transform: translate(0) scale(1); } 35% { transform: translateX(2px) scale(1.02); } 70% { transform: translateX(-2px); } }
@keyframes annoyed-rattle { 0%,100% { transform: translate(0) rotate(0) scale(1); } 14% { transform: translate(-6px,1px) rotate(-2deg) scale(1.03); } 28% { transform: translate(6px,-2px) rotate(2deg) scale(1.05); } 43% { transform: translate(-5px,-1px) rotate(-1.7deg) scale(1.04); } 58% { transform: translate(5px,2px) rotate(1.8deg) scale(1.03); } 74% { transform: translate(-3px,0) rotate(-1deg) scale(1.02); } 88% { transform: translate(2px,-1px) rotate(.6deg); } }
@keyframes label-annoyed { 0%,100% { transform: translate(0) scale(1); } 20% { transform: translate(2px,-1px) scale(1.09); } 40% { transform: translate(-3px,1px) scale(1.04); } 60% { transform: translate(3px,0) scale(1.08); } 80% { transform: translate(-2px,-1px) scale(1.03); } }
@keyframes furious-shake { 0%,100% { transform: translate(0) rotate(0) scale(1); } 12% { transform: translate(-7px,2px) rotate(-3deg) scale(1.04); } 25% { transform: translate(7px,-3px) rotate(3deg) scale(1.06); } 38% { transform: translate(-5px,-2px) rotate(-2deg) scale(.98); } 52% { transform: translate(6px,3px) rotate(3deg) scale(1.05); } 66% { transform: translate(-7px,0) rotate(-3deg) scale(1.02); } 80% { transform: translate(5px,-2px) rotate(2deg) scale(1.04); } 92% { transform: translate(-2px,1px) rotate(-1deg); } }
@keyframes label-panic { 0%,100% { transform: translate(0) scale(1); } 25% { transform: translate(-2px,1px) scale(1.12); } 50% { transform: translate(2px,-1px) scale(.96); } 75% { transform: translate(-1px,-1px) scale(1.08); } }
@keyframes button-blast { to { opacity: 0; transform: scale(.15) rotate(8deg); } }
@keyframes boom-pop { 0% { opacity: 0; transform: scale(.04) rotate(-22deg); } 24% { opacity: 1; transform: scale(1.18) rotate(5deg); } 48% { opacity: 1; transform: scale(.98) rotate(-3deg); } 72% { opacity: 1; transform: scale(1.06) rotate(1deg); } 100% { opacity: 0; transform: scale(1.15); } }
@keyframes boom-word { 0% { opacity: 0; transform: rotate(-8deg) scale(.15); } 24% { opacity: 1; transform: rotate(-8deg) scale(1.2); } 58% { opacity: 1; transform: rotate(-5deg) scale(1); } 82% { opacity: 1; transform: rotate(-8deg) scale(1.08); } 100% { opacity: 0; transform: rotate(-8deg) scale(.84); } }
@keyframes shockwave { 0% { opacity: 0; transform: scale(.2); } 18% { opacity: .8; } 100% { opacity: 0; transform: scale(4.8); } }
@keyframes cartoon-ray { 0% { opacity: 0; transform: rotate(var(--angle)) translateY(-16px) scale(.2); } 22% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--angle)) translateY(-104px) scale(.55); } }
@keyframes smoke-puff { 0% { opacity: 0; transform: scale(.2); } 22% { opacity: 1; transform: scale(.9); } 100% { opacity: 0; transform: translate(var(--puff-x), var(--puff-y)) scale(1.9); } }
@keyframes empty-slot { from { opacity: 0; transform: translateX(-50%) scale(.78); } }
@keyframes acceptance-leave { to { opacity: 0; transform: translateY(-10px) scale(.97); } }
@keyframes invitation-leave { to { opacity: 0; transform: translateY(-28px) scale(.84) rotate(-2deg); } }
@keyframes error-pulse { 50% { transform: translateX(3px); } }

@media (max-width: 520px) {
  .page-shell { align-items: start; padding-top: calc(20px + env(safe-area-inset-top)); }
  .invitation-card { margin: auto 0; }
  .acceptance-card { align-self: center; justify-self: center; }
  .invitation-actions { gap: 12px; }
  .button { padding-inline: 23px; }
  .no-zone { width: 112px; min-width: 112px; padding-top: 0; }
  .tease { right: -8px; width: 156px; font-size: 1.15rem; }
  .quiet-message.has-copy { width: min(180px, calc(50% - 6px)); margin-left: calc(50% + 6px); }
  .choices { grid-template-columns: 1fr; gap: 8px; }
  .choice { min-height: 46px; }
  .calendar { margin-inline: -4px; padding: 10px 8px; }
  .calendar-grid { gap: 2px; }
  .official-note div { grid-template-columns: 1fr; gap: 1px; padding: 7px 0; }
}

@media (min-width: 768px) and (min-height: 700px) {
  .invitation-card .sticker { width: 195px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
