.launch-gift {
  --gift-glide: cubic-bezier(.23, 1, .32, 1);
  --gift-exit: cubic-bezier(.55, 0, 1, .45);
  --gift-radius: 8px;
  --gift-box-crop: max(0px, calc(50% - 108px));
  --gift-video-h: min(57dvh, 30rem);
  inline-size: min(calc(100% - 24px), 43rem);
  max-block-size: calc(100dvh - 24px);
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--chalk);
  overscroll-behavior: contain;
}
.launch-gift::backdrop {
  background: radial-gradient(ellipse at 50% 45%, #160e0cd9, #0d0b0af2 77%);
  overflow: hidden;
  overscroll-behavior: contain;
}
:root:has(.launch-gift:modal) { overscroll-behavior: none; }
.launch-gift__surface, .launch-gift__stage { position: relative; }
.launch-gift__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 3vw, 36px);
  padding: 24px;
  padding-inline-end: 62px;
  border: 1px solid #6b4d3d;
  border-radius: var(--gift-radius);
  background: radial-gradient(ellipse at 0 64%, #37241c, transparent 66%), #201a17;
}
.launch-gift__heading { padding-inline-start: clamp(0px, 1.4vw, 18px); }
.launch-gift__heading .kicker { display: flex; align-items: center; gap: .55rem; margin-block-end: 14px; color: var(--accent-hover); }
.launch-gift__heading .cut-mark { block-size: .75rem; inline-size: .48rem; }
.launch-gift__heading h2 {
  font: 800 clamp(2.15rem, 3.8vw, 2.9rem)/.98 var(--display);
  text-transform: uppercase;
  text-wrap: balance;
}
.launch-gift__date { margin-block-start: 16px; color: var(--dark-muted); font-weight: 600; }
.launch-gift__player {
  position: relative;
  block-size: var(--gift-video-h);
  aspect-ratio: 9 / 16;
  border: 1px solid #664637;
  border-radius: 5px;
  background: #101010;
}
.launch-gift__player video { display: block; inline-size: 100%; block-size: 100%; border-radius: 4px; }
.launch-gift__close, .launch-gift__play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  border: 1px solid #86644f;
  border-radius: 4px;
  background: #261b16;
  color: var(--chalk);
  transition: background-color 140ms, transform 100ms var(--gift-glide);
}
.launch-gift__close {
  position: absolute;
  z-index: 3;
  inset-block-start: 8px;
  inset-inline-end: 8px;
  inline-size: 44px;
}
.launch-gift__close .icon { inline-size: 21px; block-size: 21px; }
.launch-gift__play, .launch-gift__error {
  position: absolute;
  inset-block-start: 50%;
  inset-inline: 8px;
  inline-size: fit-content;
  max-inline-size: calc(100% - 16px);
  margin-inline: auto;
  translate: 0 -50%;
}
.launch-gift__play { gap: .4rem; padding: 5px 10px; font-size: .95rem; font-weight: 600; }
.launch-gift__error { padding: .5rem; border-radius: 4px; background: #261b16; text-align: center; }
.launch-gift__actions { display: flex; justify-content: center; margin-block-start: 14px; }
.launch-gift__skip { min-block-size: 50px; border-radius: 4px; }
.launch-gift__close:active, .launch-gift__play:active, .launch-gift__skip:active { transform: scale(.98); }
.launch-gift-replay {
  min-block-size: 44px;
  padding: 0;
  border: none;
  background: transparent;
  text-align: start;
  text-decoration: underline;
  text-underline-offset: .25em;
}
.launch-gift-replay:hover { color: var(--accent-hover); }
@media (hover: hover) {
  .launch-gift__close:hover, .launch-gift__play:hover { background: #503326; }
}
.launch-gift__scene {
  display: none;
  position: absolute;
  z-index: 2;
  inset-block-start: 54%;
  inset-inline: 0;
  inline-size: min(320px, 90%);
  block-size: auto;
  margin-inline: auto;
  translate: 0 -50%;
  pointer-events: none;
}
.launch-gift__lid, .launch-gift__tissue { transform-box: fill-box; transform-origin: 50% 85%; }

@media (max-width: 39rem) {
  .launch-gift {
    --gift-video-h: max(128px, min(54dvh, 28rem, calc(100dvh - 304px)));
    inline-size: min(calc(100% - 20px), 27rem);
  }
  .launch-gift__body { grid-template-columns: 1fr; justify-items: center; gap: 12px; padding: 16px 14px; }
  .launch-gift__heading { justify-self: stretch; padding-inline: 0 40px; }
  .launch-gift__heading h2 { font-size: clamp(1.9rem, 7.6vw, 2.8rem); text-wrap: wrap; }
  .launch-gift__heading .kicker { margin-block-end: 5px; }
  .launch-gift__date { margin-block-start: 6px; font-size: .92rem; }
  .launch-gift__actions { margin-block-start: 9px; }
  .launch-gift__skip { inline-size: 100%; gap: .65rem; padding-inline: 12px; }
}
@media (max-height: 31rem) and (min-width: 34rem) {
  .launch-gift { --gift-video-h: min(65dvh, 30rem); }
  .launch-gift__body { grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 12px 62px 12px 16px; }
  .launch-gift__heading { padding-inline-end: 0; }
  .launch-gift__heading h2 { font-size: clamp(1.7rem, 6vw, 2.5rem); }
}

@supports (animation-timing-function: linear(0, 1)) {
  .launch-gift {
    --gift-glide: linear(0, .0246, .0841, .1626, .2493, .3371, .4216, .5002, .5716, .6352, .6912, .7399, .7819, .8178, .8483, .875, .9, .926, .955, .977, .991, 1);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .launch-gift { --gift-reveal-duration: 2500ms; }
  .launch-gift[open]::backdrop { animation: gift-fade 170ms var(--gift-glide) both; }
  .launch-gift[open] .launch-gift__scene { display: block; animation: gift-carton var(--gift-reveal-duration) linear both; }
  .launch-gift[open] .launch-gift__lid { animation: gift-lid 1500ms var(--gift-glide) 500ms both; }
  .launch-gift[open] .launch-gift__tissue--left { animation: gift-tissue-left 1250ms var(--gift-glide) 680ms both; }
  .launch-gift[open] .launch-gift__tissue--right { animation: gift-tissue-right 1250ms var(--gift-glide) 780ms both; }
  .launch-gift[open] .launch-gift__body { transform-origin: 50% 100%; animation: gift-unbox var(--gift-reveal-duration) linear both; }
  .launch-gift[open] .launch-gift__heading, .launch-gift[open] .launch-gift__player { animation: gift-contents var(--gift-reveal-duration) linear both; }
  .launch-gift--closing::backdrop, .launch-gift--closing .launch-gift__surface { animation: gift-out 155ms var(--gift-exit) both; }
}
@media (prefers-reduced-motion: reduce) {
  .launch-gift__close, .launch-gift__play, .launch-gift__skip { transition: none; transform: none; }
  .launch-gift__skip:is(:hover, :active) { transform: none; }
}

@keyframes gift-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gift-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes gift-carton {
  0% { opacity: 0; transform: translateY(20px) scale(.96); }
  14%, 60% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(38px) scale(.93); }
}
@keyframes gift-lid {
  from { transform: none; opacity: 1; }
  50% { transform: translate(-43px, -39px) rotate(-17deg); opacity: 1; }
  to { transform: translate(-83px, -76px) rotate(-27deg); opacity: 0; }
}
@keyframes gift-tissue-left {
  from { transform: translate(11px, 21px) scale(.86); opacity: 0; }
  43% { transform: translate(-15px, -16px) rotate(-7deg); opacity: 1; }
  to { transform: translate(-45px, -22px) rotate(-20deg); opacity: 0; }
}
@keyframes gift-tissue-right {
  from { transform: translate(-13px, 19px) scale(.87); opacity: 0; }
  45% { transform: translate(15px, -19px) rotate(9deg); opacity: 1; }
  to { transform: translate(47px, -25px) rotate(22deg); opacity: 0; }
}
@keyframes gift-unbox {
  0%, 32% { opacity: 0; transform: translateY(49%) scale(.96); clip-path: inset(0 var(--gift-box-crop) 98% round var(--gift-radius)); }
  48% { opacity: 1; transform: translateY(37%) scale(.97); clip-path: inset(0 var(--gift-box-crop) 85% round var(--gift-radius)); }
  63% { transform: translateY(20%) scale(.99); clip-path: inset(0 var(--gift-box-crop) 58% round var(--gift-radius)); }
  82% { transform: translateY(3%) scale(.998); clip-path: inset(0 0 7% round var(--gift-radius)); }
  100% { opacity: 1; transform: none; clip-path: inset(0 round var(--gift-radius)); }
}
@keyframes gift-contents { 0%, 74% { opacity: 0; } 100% { opacity: 1; } }
