:root {
  --bg-top: #f9efe3;
  --bg-bottom: #f2c7a1;
  --panel: rgba(255, 250, 245, 0.84);
  --ink: #2f1c16;
  --muted: #6b5046;
  --accent: #b93f35;
  --accent-dark: #8d2a22;
  --gold: #f2c66d;
  --shadow: 0 24px 80px rgba(90, 40, 18, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.65), transparent 32%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  filter: blur(12px);
  pointer-events: none;
}

body::before {
  top: -8rem;
  right: -5rem;
}

body::after {
  bottom: -10rem;
  left: -7rem;
}

.page-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.intro {
  max-width: 44rem;
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2.6rem, 4vw, 4.9rem);
  line-height: 0.98;
}

.lede {
  margin: 1rem 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 38rem;
}

.workspace {
  display: grid;
  gap: 1.5rem;
  align-items: stretch;
}

.single-column {
  grid-template-columns: minmax(0, 860px);
}

.preview-header h2,
.preview-header p {
  margin: 0;
}

.preview-header {
  display: grid;
  gap: 0.35rem;
  padding-bottom: 1rem;
}

.preview-header p {
  color: var(--muted);
}

.panel {
  backdrop-filter: blur(20px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.controls,
.reveal-stage {
  padding: 1.25rem;
}

.gift-form {
  display: grid;
  gap: 1rem;
}

.upload-field,
.field {
  display: grid;
  gap: 0.65rem;
}

.upload-field span,
.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

input[type="file"],
input[type="email"],
input[type="text"] {
  width: 100%;
  border: 1px solid rgba(47, 28, 22, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  padding: 0.9rem 1rem;
  color: var(--ink);
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 1rem 1.3rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  color: #fff8f1;
  background: linear-gradient(180deg, #cd4a3f, #a53028);
}

button.secondary {
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(47, 28, 22, 0.14);
}

.hint,
.subtle {
  margin: 0;
  line-height: 1.5;
  color: var(--muted);
  font-size: 0.92rem;
}

.notice {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 18px;
}

.notice p {
  margin: 0 0 0.75rem;
}

.notice-error {
  background: rgba(185, 63, 53, 0.12);
  color: #7d261f;
}

.notice-success {
  background: rgba(79, 131, 94, 0.12);
  color: #214f2b;
}

.gift-card {
  position: relative;
  isolation: isolate;
  min-height: 580px;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2)),
    linear-gradient(180deg, #f6dfc8, #f2b98c);
}

.preview-image-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.gift-stage-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.stage-orb,
.stage-ring {
  position: absolute;
  border-radius: 999px;
}

.stage-orb-a {
  width: 28rem;
  height: 28rem;
  left: 50%;
  top: 49%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 252, 243, 0.84), rgba(242, 207, 167, 0.04) 68%);
}

.stage-orb-b {
  width: 18rem;
  height: 18rem;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(205, 74, 63, 0.08), rgba(205, 74, 63, 0) 72%);
}

.stage-ring {
  width: 21rem;
  height: 21rem;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  border: 18px solid rgba(255, 246, 233, 0.42);
  box-shadow:
    0 0 0 10px rgba(255, 255, 255, 0.12),
    inset 0 0 0 4px rgba(255, 235, 204, 0.28);
}

.gift-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.6s ease, opacity 0.5s ease;
}

.gift-wrap:focus-visible {
  outline: 3px solid rgba(185, 63, 53, 0.4);
  outline-offset: -8px;
}

.gift-lid {
  position: absolute;
  top: 19%;
  width: min(72%, 420px);
  height: 92px;
  background: linear-gradient(180deg, #d14d43, #a7352c);
  border-radius: 26px 26px 20px 20px;
  box-shadow: 0 14px 26px rgba(82, 24, 20, 0.24);
  transform-origin: left bottom;
  transition: transform 1s cubic-bezier(0.2, 0.75, 0.2, 1);
}

.gift-box {
  position: relative;
  width: min(68%, 390px);
  height: 270px;
  background: linear-gradient(180deg, #ca473d, #982f28);
  border-radius: 20px;
  box-shadow: 0 24px 44px rgba(82, 24, 20, 0.28);
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

.ribbon {
  position: absolute;
  background: linear-gradient(180deg, #fce9a9, var(--gold));
}

.ribbon-vertical {
  top: 0;
  bottom: 0;
  left: calc(50% - 20px);
  width: 40px;
}

.ribbon-horizontal {
  left: 0;
  right: 0;
  top: calc(50% - 18px);
  height: 36px;
}

.bow {
  position: absolute;
  top: -20px;
  width: 94px;
  height: 66px;
  border: 16px solid var(--gold);
  border-radius: 50% 50% 46% 46%;
}

.bow-left {
  left: calc(50% - 88px);
  transform: rotate(-16deg);
}

.bow-right {
  left: calc(50% - 6px);
  transform: rotate(16deg);
}

.gift-note {
  position: relative;
  z-index: 1;
  margin: 0;
  width: min(15rem, 100%);
  font-family: "Fraunces", serif;
  font-size: 1.5rem;
  line-height: 1.2;
  color: #fff7ef;
}

.gift-message-card {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 0.9rem;
  padding: 2.25rem 2rem 2rem;
  text-align: center;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.8s ease, transform 1s ease;
  background: linear-gradient(180deg, rgba(255, 248, 240, 0.72), rgba(242, 197, 156, 0.92));
  overflow-y: auto;
}

.gift-message-card.is-hidden {
  opacity: 0 !important;
  visibility: hidden;
}

.celebration-burst {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.burst-glow {
  position: absolute;
  top: 14%;
  left: 50%;
  width: 12rem;
  height: 12rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 242, 187, 0.95), rgba(255, 242, 187, 0));
  transform: translateX(-50%) scale(0.3);
  opacity: 0;
}

.spark {
  position: absolute;
  top: 22%;
  left: 50%;
  width: 1rem;
  height: 1rem;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  background: radial-gradient(circle, rgba(255, 252, 223, 1), rgba(255, 252, 223, 0.08) 72%);
  opacity: 0;
}

.confetti {
  position: absolute;
  top: 18%;
  left: 50%;
  width: 0.9rem;
  height: 1.8rem;
  border-radius: 999px;
  opacity: 0;
  transform: translate(-50%, 0) rotate(0deg);
}

.confetti-a { background: #d94a3a; }
.confetti-b { background: #f2c66d; }
.confetti-c { background: #8fc6a2; }
.confetti-d { background: #ffffff; }
.confetti-e { background: #e28c61; }
.confetti-f { background: #c95f93; }
.confetti-g { background: #83baf0; }
.confetti-h { background: #f6f0df; }

.gift-card-message {
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.6), transparent 30%),
    linear-gradient(180deg, #fff8f0, #f2c59c);
}

.reveal-kicker {
  margin: 0;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.reveal-image-frame {
  width: min(100%, 340px);
  border-radius: 24px;
  overflow: visible;
  box-shadow: 0 18px 40px rgba(47, 28, 22, 0.18);
  background: transparent;
  position: relative;
  opacity: 0;
  transform: translateY(7rem) scale(0.15) rotate(-34deg);
  transform-origin: center center;
  visibility: hidden;
  display: none;
  margin-top: 0.5rem;
}

.reveal-image {
  display: block;
  width: 100%;
  aspect-ratio: auto;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
}

.reveal-image:not([src]) {
  visibility: hidden;
}

.preview-placeholder {
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: 1.2rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.preview-frame.is-empty .reveal-image {
  display: none;
}

.preview-frame:not(.is-empty) .preview-placeholder {
  display: none;
}

.preview-message-card {
  opacity: 1;
  transform: none;
}

.gift-card-preview {
  min-height: 680px;
}

.preview-wrap {
  inset: 0 0 auto 0;
  min-height: 360px;
}

.gift-message-card h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2.2rem, 3vw, 3.6rem);
  line-height: 1;
}

.reveal-from,
.reveal-note {
  margin: 0;
  max-width: 32rem;
}

.reveal-from {
  color: var(--muted);
  font-weight: 700;
}

.reveal-note {
  font-size: 1.05rem;
  line-height: 1.7;
}

.status-row {
  display: flex;
  align-items: center;
  min-height: 2rem;
  padding-top: 1rem;
}

.status-row p {
  margin: 0;
  color: var(--muted);
}

.abuse-form {
  display: grid;
  gap: 0.9rem;
  max-width: 860px;
  padding: 1rem 1.25rem 0;
}

.abuse-form button {
  justify-self: start;
  padding: 0.75rem 1rem;
}

.gift-card.open .gift-wrap {
  opacity: 0;
  transform: translateY(-1.4rem) scale(0.9);
  pointer-events: none;
}

.gift-card.open .gift-lid {
  transform: rotate(-28deg) translate(-34px, -68px);
}

.gift-card.open .gift-message-card {
  opacity: 1;
  transform: scale(1);
  visibility: visible;
}

.gift-card.open .reveal-image-frame {
  animation: revealSpinGrow 1s cubic-bezier(0.16, 0.9, 0.24, 1) 0.08s forwards;
  visibility: visible;
  display: block;
}

.gift-card.open .burst-glow {
  animation: burstGlow 1s ease-out forwards;
}

.gift-card.open .spark-a {
  animation: sparklePop 0.95s ease-out 0.1s forwards;
}

.gift-card.open .spark-b {
  animation: sparklePop 1s ease-out 0.2s forwards;
}

.gift-card.open .spark-c {
  animation: sparklePop 0.9s ease-out 0.16s forwards;
}

.gift-card.open .spark-d {
  animation: sparklePop 1.05s ease-out 0.06s forwards;
}

.gift-card.open .confetti-a {
  animation: confettiLeftHigh 1.25s cubic-bezier(0.18, 0.82, 0.28, 1) 0.08s forwards;
}

.gift-card.open .confetti-b {
  animation: confettiRightHigh 1.3s cubic-bezier(0.18, 0.82, 0.28, 1) 0.02s forwards;
}

.gift-card.open .confetti-c {
  animation: confettiLeftLow 1.2s cubic-bezier(0.18, 0.82, 0.28, 1) 0.12s forwards;
}

.gift-card.open .confetti-d {
  animation: confettiRightLow 1.18s cubic-bezier(0.18, 0.82, 0.28, 1) 0.16s forwards;
}

.gift-card.open .confetti-e {
  animation: confettiCenterLeft 1.32s cubic-bezier(0.18, 0.82, 0.28, 1) 0.06s forwards;
}

.gift-card.open .confetti-f {
  animation: confettiCenterRight 1.28s cubic-bezier(0.18, 0.82, 0.28, 1) 0.1s forwards;
}

 .gift-card.open .confetti-g {
  animation: confettiFarLeft 1.36s cubic-bezier(0.18, 0.82, 0.28, 1) 0.04s forwards;
}

.gift-card.open .confetti-h {
  animation: confettiFarRight 1.34s cubic-bezier(0.18, 0.82, 0.28, 1) 0.14s forwards;
}

@keyframes revealSpinGrow {
  0% {
    opacity: 0;
    transform: translateY(7rem) scale(0.15) rotate(-34deg);
  }

  35% {
    opacity: 1;
    transform: translateY(-1.2rem) scale(0.58) rotate(12deg);
  }

  68% {
    opacity: 1;
    transform: translateY(0.4rem) scale(1.08) rotate(-6deg);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes burstGlow {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.3);
  }

  25% {
    opacity: 0.9;
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.5);
  }
}

@keyframes sparklePop {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.2);
  }

  30% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -3.4rem) scale(1.8);
  }
}

@keyframes confettiLeftHigh {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-190px, 170px) rotate(-220deg); }
}

@keyframes confettiRightHigh {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(195px, 165px) rotate(240deg); }
}

@keyframes confettiLeftLow {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-125px, 220px) rotate(-170deg); }
}

@keyframes confettiRightLow {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(130px, 225px) rotate(180deg); }
}

@keyframes confettiCenterLeft {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-60px, 195px) rotate(-140deg); }
}

@keyframes confettiCenterRight {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(55px, 205px) rotate(155deg); }
}

@keyframes confettiFarLeft {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-235px, 210px) rotate(-250deg); }
}

@keyframes confettiFarRight {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(235px, 215px) rotate(265deg); }
}

.gift-card-preview .gift-note {
  font-size: 1.35rem;
}

.gift-card-preview .gift-message-card {
  padding-top: 23rem;
}

@media (max-width: 860px) {
  .gift-card {
    min-height: 640px;
  }

  .gift-card-preview {
    min-height: 620px;
  }

  .gift-box {
    height: 230px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 1rem, 1120px);
    padding-top: 1.2rem;
  }

  h1 {
    font-size: 2.4rem;
  }

  .gift-card {
    min-height: 640px;
  }

  .gift-card-preview {
    min-height: 580px;
  }

  .gift-lid {
    height: 78px;
  }

  .gift-box {
    width: min(76%, 390px);
    height: 210px;
  }

  .gift-note {
    font-size: 1.2rem;
  }

  .gift-card-preview .gift-message-card {
    padding-top: 19rem;
  }

  .reveal-image-frame {
    width: min(100%, 260px);
  }

  .reveal-image {
    height: auto;
    max-height: none;
  }

  .gift-message-card {
    padding: 1.4rem 1rem 1.5rem;
    gap: 0.7rem;
  }

  .reveal-note {
    font-size: 0.98rem;
    line-height: 1.55;
  }
}
