.gift-screen {
  position: relative;
  isolation: isolate;
  min-inline-size: 0;
  padding: clamp(1.2rem, 5vw, 1.9rem);
  border: 1px solid #af8c574f;
  border-radius: .85rem;
  background:
    radial-gradient(ellipse at 50% 0%, #2b3f5b 0, transparent 55%),
    #15243b;
  color: var(--paper, #f9f3e7);
}

.gift-screen::before {
  position: absolute;
  z-index: -1;
  inset: .4rem;
  border: 1px solid #cdad7233;
  border-radius: .62rem;
  content: "";
  pointer-events: none;
}

.gift-heading {
  margin: .15rem 0 1.3rem;
  text-align: center;
}

.gift-heading h1 {
  margin: 0;
  color: inherit;
  font-family: var(--serif, serif);
  font-size: clamp(1.65rem, 7.5vw, 2.25rem);
  font-weight: 650;
  letter-spacing: .02em;
  line-height: 1.2;
}

.gift-stage {
  position: relative;
  display: grid;
  overflow: hidden;
  min-inline-size: 0;
  padding: .15rem .06rem .33rem;
}

.gift-card-shell {
  position: relative;
  z-index: 2;
  grid-area: 1 / 1;
  min-inline-size: 0;
}

.gift-card {
  overflow: hidden;
  border: 1px solid #daa866;
  border-radius: .66rem;
  background:
    repeating-linear-gradient(115deg, #8b602708 0, #8b602708 .5px, transparent .5px, transparent 5px),
    #faf1df;
  color: var(--ink, #152339);
  box-shadow: 0 5px 22px #080e1c5e;
}

.gift-card-main {
  position: relative;
  padding: 1rem clamp(.85rem, 4vw, 1.4rem) 1.2rem;
  text-align: center;
}

.gift-card-main::before {
  position: absolute;
  inset: .35rem .35rem 0;
  border: 1px solid #936e3c46;
  border-bottom: 0;
  border-radius: .35rem .35rem 0 0;
  pointer-events: none;
  content: "";
}

.gift-shuttlecock {
  display: block;
  width: 3.5rem;
  height: auto;
  margin: 0 auto .5rem;
  color: #8a6332;
}

.gift-ticket-kind {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .48rem;
  margin: 0 0 .52rem;
  color: #71502b;
  font: 750 1.12rem/1.25 var(--serif, serif);
  letter-spacing: .12em;
}

.gift-ticket-kind::before,
.gift-ticket-kind::after {
  width: 1.1rem;
  height: 1px;
  background: #b78a51;
  content: "";
}

.gift-event-name {
  max-width: 15ch;
  margin: 0 auto;
  color: var(--navy, #111d32);
  overflow-wrap: anywhere;
  font-family: var(--serif, serif);
  font-size: clamp(1.28rem, 5.6vw, 1.65rem);
  font-weight: 650;
  line-height: 1.15;
  text-wrap: balance;
}

.gift-card-details {
  position: relative;
  display: grid;
  gap: .7rem;
  margin: 0;
  padding: .85rem clamp(.95rem, 4.5vw, 1.6rem) 1.1rem;
  border-top: 1px dashed #9d7444;
}

.gift-card-details::before,
.gift-card-details::after {
  position: absolute;
  top: -.42rem;
  width: .84rem;
  height: .84rem;
  border: 1px solid #daa866;
  border-radius: 50%;
  background: #1a2b44;
  pointer-events: none;
  content: "";
}

.gift-card-details::before {
  left: -.42rem;
}

.gift-card-details::after {
  right: -.42rem;
}

.gift-card-details dt {
  margin: 0 0 .12rem;
  color: #71502b;
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .12em;
}

.gift-card-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: .99rem;
  font-weight: 650;
  line-height: 1.4;
}

.gift-after[hidden] {
  display: none;
}

.gift-after {
  animation: gift-after-appear .35s ease-out both;
}

.gift-wish {
  margin: 1rem 0;
  color: #f5e8d2;
  font-size: .97rem;
  line-height: 1.65;
  text-align: center;
}

.gift-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 .42rem;
  margin: .5rem 0 -.5rem;
}

.gift-actions .button-quiet {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding-inline: .48rem;
  color: #e8c998;
  font-size: .87rem;
}

.gift-actions .button-quiet:focus-visible {
  outline: 2px solid #ffd892;
  outline-offset: 2px;
}

.gift-box {
  position: absolute;
  bottom: .25rem;
  left: 50%;
  z-index: 4;
  display: block;
  width: min(100%, 18.55rem);
  height: auto;
  overflow: visible;
  transform: translateX(-50%);
  pointer-events: none;
}

.gift-light,
.gift-spark {
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

.gift-light {
  bottom: 12%;
  left: 50%;
  z-index: 1;
  width: 100%;
  height: 72%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 70%, #ffd2a193, #f9b55638 30%, transparent 65%);
}

.gift-spark {
  bottom: 31%;
  left: 50%;
  z-index: 3;
  width: .24rem;
  height: .24rem;
  border-radius: 2px;
  background: #f4d8a0;
  box-shadow: 0 0 10px #eac182;
}

.gift-spark-one {
  --spark-x: -36px;
  --spark-y: -112px;
}

.gift-spark-two {
  --spark-x: 67px;
  --spark-y: -134px;
}

.gift-spark-three {
  --spark-x: -98px;
  --spark-y: -77px;
}

.gift-spark-four {
  --spark-x: 89px;
  --spark-y: -92px;
}

.gift-screen.is-opening .gift-card-shell {
  animation: gift-ticket-rise 3.29s both;
}

.gift-screen.is-opening .gift-box {
  animation: gift-box-fade .74s 2.41s ease-in both;
}

.gift-screen.is-opening .gift-bow-left {
  animation: gift-bow-left .78s .34s both;
}

.gift-screen.is-opening .gift-bow-right {
  animation: gift-bow-right .78s .34s both;
}

.gift-screen.is-opening .gift-bow-knot {
  animation: gift-knot .55s .53s both;
}

.gift-screen.is-opening .gift-ribbon-wrap,
.gift-screen.is-opening .gift-ribbon-lid {
  animation: gift-ribbon-slide .69s .53s both;
}

.gift-screen.is-opening .gift-lid {
  animation: gift-lid-lift 1.38s 1.15s both;
}

.gift-screen.is-opening .gift-light {
  animation: gift-light-bloom 1.65s 1.35s ease both;
}

.gift-screen.is-opening .gift-spark {
  animation: gift-spark-float 1.05s 1.65s ease-out both;
}

.gift-screen.is-opening .gift-spark:nth-of-type(even) {
  animation-delay: 1.78s;
}

.gift-lid,
.gift-bow-left,
.gift-bow-right,
.gift-bow-knot,
.gift-ribbon-wrap,
.gift-ribbon-lid {
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes gift-bow-left {
  from { opacity: 1; transform: translate(0, 0) rotate(0); }
  42% { opacity: 1; transform: translate(-13px, -8px) rotate(-22deg); }
  to { opacity: 0; transform: translate(-70px, 43px) rotate(-73deg); }
}

@keyframes gift-bow-right {
  from { opacity: 1; transform: translate(0, 0) rotate(0); }
  46% { opacity: 1; transform: translate(16px, -7px) rotate(21deg); }
  to { opacity: 0; transform: translate(75px, 42px) rotate(72deg); }
}

@keyframes gift-knot {
  0% { opacity: 1; transform: translateY(0); }
  36% { opacity: 1; transform: translateY(-6px) rotate(14deg); }
  100% { opacity: 0; transform: translateY(27px) rotate(72deg) scale(.45); }
}

@keyframes gift-ribbon-slide {
  0% { opacity: 1; transform: translate(0, 0); }
  44% { opacity: .9; transform: translate(-6px, 3px) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-28px, 20px) rotate(-10deg); }
}

@keyframes gift-lid-lift {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  30% { opacity: 1; transform: translate(-6px, -35px) rotate(-8deg); }
  64% { opacity: .92; transform: translate(-34px, -58px) rotate(-18deg); }
  100% { opacity: 0; transform: translate(-58px, -88px) rotate(-25deg); }
}

@keyframes gift-ticket-rise {
  0%, 47% {
    opacity: 0;
    transform: translateY(62%) rotate(-4deg) scale(.39);
    clip-path: inset(0 0 83% 0 round .66rem);
  }

  57% {
    opacity: 1;
    transform: translateY(24%) rotate(-4deg) scale(.54);
    clip-path: inset(0 0 38% 0 round .66rem);
    animation-timing-function: cubic-bezier(.15, .7, .18, 1);
  }

  76% {
    opacity: 1;
    transform: translateY(-4%) rotate(1.5deg) scale(.95);
    clip-path: inset(0 0 0 0 round .66rem);
  }

  90% {
    opacity: 1;
    transform: translateY(1%) rotate(-.4deg) scale(1);
    clip-path: inset(0 0 0 0 round .66rem);
  }

  100% {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
    clip-path: inset(0 0 0 0 round .66rem);
  }
}

@keyframes gift-box-fade {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, 9%); }
}

@keyframes gift-light-bloom {
  0%, 100% { opacity: 0; }
  35%, 58% { opacity: 1; }
}

@keyframes gift-spark-float {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  24% { opacity: .95; }
  100% { opacity: 0; transform: translate(var(--spark-x), var(--spark-y)) rotate(90deg); }
}

@keyframes gift-ticket-dissolve {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes gift-after-appear {
  from { opacity: 0; transform: translateY(.25rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .gift-screen.is-opening .gift-card-shell {
    animation: gift-ticket-dissolve .14s ease both;
  }

  .gift-screen.is-opening .gift-box,
  .gift-screen.is-opening .gift-light,
  .gift-screen.is-opening .gift-spark {
    display: none;
    animation: none;
  }

  .gift-after {
    animation: none;
  }
}
