[data-gift-scene] {
  --local-scene-ink: var(--scene-ink, #120921);
  --local-scene-plum: var(--scene-plum, #6424a3);
  --local-scene-hot: var(--scene-hot, #ff4ea6);
  --local-scene-pop: var(--scene-pop, #edf62c);
  --local-scene-paper: var(--scene-paper, #fff7d9);
  inline-size: 100%;
}

.gift-scene-frame {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 2px solid var(--local-scene-pop);
  background: var(--local-scene-ink);
  box-shadow: 3px 3px 0 var(--local-scene-hot);
  color: var(--local-scene-paper);
  font-family: "Courier New", monospace;
  text-align: center;
}

.gift-scene-theatre {
  position: relative;
  overflow: hidden;
  height: clamp(140px, 31vw, 185px);
  color: #fff8e7;
  background:
    radial-gradient(ellipse at 50% 85%, color-mix(in srgb, var(--local-scene-plum), transparent 28%), transparent 70%),
    radial-gradient(circle, color-mix(in srgb, var(--local-scene-hot), transparent 36%) 0 1px, transparent 1.5px) 0 0 / 16px 16px;
}

.gift-scene-line {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: .7rem .85rem;
  border-top: 1px dashed var(--local-scene-hot);
  font: 700 clamp(.875rem, 2vw, 1rem)/1.35 "Courier New", monospace;
}

.scene-sprite {
  display: block;
  inline-size: 70px;
  block-size: auto;
  image-rendering: pixelated;
  filter: drop-shadow(2px 3px #170c2d);
}

.scene-glyph {
  display: block;
  line-height: 1;
  font-family: Arial, sans-serif;
  font-weight: 900;
}

.scene-photo {
  display: block;
  box-sizing: border-box;
  inline-size: clamp(53px, 14vw, 88px);
  aspect-ratio: 1.12;
  margin: 0;
  padding: 4px 4px 8px;
  border: 1px solid #150e21;
  background: #fff7e7;
  box-shadow: 3px 3px #150e21;
}

.scene-photo img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: contain;
  background: #efdbc6;
}

.scene-photo-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
}

.scene-sash {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-end: 6px;
  translate: -50% 0;
  inline-size: max-content;
  max-inline-size: 90%;
  padding: 3px 6px;
  border: 1px solid #221032;
  background: var(--local-scene-pop);
  color: var(--accent-ink, #27133e);
  font: 800 .67rem/1.2 "Courier New", monospace;
  box-shadow: 2px 2px #221032;
}

.scene-window {
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  inline-size: min(280px, calc(100% - 25px));
  border: 2px solid #150827;
  background: #fff7e7;
  color: #211230;
  box-shadow: 4px 4px var(--local-scene-hot);
}

.scene-window-bar {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 4px 7px;
  border-bottom: 2px solid #150827;
  background: var(--scene-window, #2510a6);
  color: var(--scene-window-text, #fff);
  font-size: .73rem;
  line-height: 1.15;
  text-align: left;
}

.scene-window-body { padding: 8px 9px; }

.scene-slip {
  box-sizing: border-box;
  inline-size: max-content;
  max-inline-size: 49%;
  display: grid;
  gap: 3px;
  align-content: center;
  min-block-size: 37px;
  padding: 5px 8px;
  border: 1px solid #241632;
  border-bottom: 2px dashed #8b7190;
  background: #fff8e6;
  color: #280b34;
  box-shadow: 3px 3px #241632;
  font-size: .73rem;
  line-height: 1.15;
}

@keyframes scene-pop {
  0% { opacity: 0; transform: scale(.65); }
  60% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes scene-rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Doorbell */
.scene-door {
  position: absolute;
  inset-block-end: -7px;
  inset-inline-start: 50%;
  translate: -50% 0;
  inline-size: 86px;
  block-size: 132px;
  perspective: 240px;
  border: 5px groove #f1b27c;
  border-bottom: 0;
  background: #ffe89d;
  box-shadow: 0 0 28px #e89e7b74;
}

.scene-door::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  border: 6px solid #a9404b;
  background:
    radial-gradient(circle at 79% 54%, #ffdd45 0 3px, #8e4505 3px 4px, transparent 5px),
    linear-gradient(#b35a50, #681845);
  box-shadow: inset 0 0 0 2px #d97767;
  transform-origin: left;
  animation: scene-door-open 690ms 400ms ease-out both;
}

.scene-door-tulip { position: absolute; inset: 33px auto auto 1px; animation: scene-rise 460ms 580ms both; }
.scene-doorbell {
  position: absolute;
  inset: 52% auto auto calc(50% + 56px);
  padding: 4px 7px;
  border: 1px solid #291230;
  background: #fff69f;
  color: #381134;
  box-shadow: 3px 3px #180e24;
  font-weight: 900;
  font-size: .75rem;
  animation: scene-pop 390ms both;
}

.scene-door-chime {
  position: absolute;
  inset: 12% auto auto calc(50% - 78px);
  color: color-mix(in srgb, var(--local-scene-pop), var(--local-scene-paper) 36%);
  font-size: 2.1rem;
  animation: scene-pop 480ms 200ms both;
}
@keyframes scene-door-open { to { transform: rotateY(-66deg); } }

/* Rattling gift and computer alert */
.scene-rattler {
  position: absolute;
  inset: 48% auto auto 50%;
  translate: -50% -50%;
  inline-size: 105px;
  animation: scene-rattles 1.15s cubic-bezier(.4,0,.2,1) both;
}
.scene-rattle-mark { position: absolute; inset-block-start: 24%; color: color-mix(in srgb, var(--local-scene-pop), var(--local-scene-paper) 36%); font-size: 2.7rem; animation: scene-pop 350ms 450ms both; }
.scene-rattle-mark.left { inset-inline-end: calc(50% + 63px); rotate: -18deg; }
.scene-rattle-mark.right { inset-inline-start: calc(50% + 63px); rotate: 15deg; }
@keyframes scene-rattles {
  0%, 20% { transform: translateY(18px) rotate(-2deg); }
  39%, 74% { transform: translateY(-9px) rotate(-17deg) scale(1.05); }
  54%, 87% { transform: translateY(1px) rotate(15deg) scale(.96); }
  100% { transform: rotate(-4deg); }
}

.scene-alert-window { transform: rotate(-3deg); animation: scene-pop 360ms both; }
.scene-alert-window .scene-window-body { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: center; font-size: .78rem; }
.scene-error-symbol { margin: 1px 4px 2px; padding: 4px 11px; border: 2px solid #572035; background: #fff13f; color: #38122b; font-size: 1.65rem; }
.scene-meter { grid-column: 1 / -1; overflow: hidden; height: 13px; border: 1px solid #272037; background: #e3d8ef; }
.scene-meter span { display: block; width: 100%; height: 100%; background: repeating-linear-gradient(90deg,#1c0e8c 0 5px,#e9ccf7 5px 6px); transform-origin: left; animation: scene-progress 750ms 290ms steps(7,end) both; }
@keyframes scene-progress { from { transform: scaleX(0); } }

/* Arcade claw and vending machines */
.scene-machine-label {
  position: relative;
  z-index: 2;
  display: block;
  padding: 4px 3px;
  background: #2e0f6c;
  color: #fff7d8;
  font-size: .7rem;
}

.scene-claw-cabinet,
.scene-vending-machine {
  position: absolute;
  inset: auto auto -1px 50%;
  translate: -50% 0;
  inline-size: 145px;
  block-size: 132px;
  overflow: hidden;
  border: 4px ridge #f77ebc;
  background: #8bd3dc;
  box-shadow: 6px 6px #2b124c;
}

.scene-claw-cabinet::after {
  position: absolute;
  inset: 22px auto 3px 9px;
  width: 15px;
  background: #fff8;
  content: "";
  transform: skewX(-12deg);
}

.scene-claw-mechanism {
  position: absolute;
  inset: 18px auto auto 50%;
  translate: -50% 0;
  width: 31px;
  height: 72px;
  animation: scene-claw-lower 1.24s ease-in-out both;
}

.scene-claw-mechanism i { position: absolute; display: block; background: #4d2c70; }
.scene-claw-mechanism i:first-child { inset: 0 auto 16px 13px; width: 5px; height: 56px; }
.scene-claw-mechanism i:nth-child(2),
.scene-claw-mechanism i:nth-child(3) { inset-block-start: 52px; width: 6px; height: 20px; border-radius: 40%; }
.scene-claw-mechanism i:nth-child(2) { inset-inline-start: 5px; rotate: 34deg; }
.scene-claw-mechanism i:nth-child(3) { inset-inline-end: 4px; rotate: -34deg; }
.scene-claw-spare { position: absolute; inset-block-end: 1px; inline-size: 45px; }
.scene-claw-spare.left { inset-inline-start: 5px; rotate: -13deg; }
.scene-claw-spare.right { inset-inline-end: 5px; rotate: 15deg; }
.scene-claw-prize { position: absolute; inset: auto auto 1px 50%; inline-size: 46px; translate: -50% 0; animation: scene-prize-catch 1.24s both; }
@keyframes scene-claw-lower { 0%, 100% { transform: translateY(-39px); } 48%, 57% { transform: translateY(0); } }
@keyframes scene-prize-catch { 0%, 57% { transform: translateY(0); } 100% { transform: translateY(-40px); } }

.scene-vending-machine { border-color: #5a86f6; background: #4328ad; }
.scene-vending-display {
  position: absolute;
  inset: 27px 22px auto 5px;
  display: flex;
  justify-content: space-around;
  gap: 1px;
  padding: 7px 3px;
  border: 2px inset #b9ebea;
  background: #c2eff0;
}
.scene-vending-display .scene-sprite { inline-size: 30px; }
.scene-vending-coins {
  position: absolute;
  inset: 49px 1px auto auto;
  writing-mode: vertical-rl;
  color: #fef15b;
  font-size: .76rem;
  font-weight: bold;
}
.scene-vending-slot { position: absolute; inset: auto 12px 15px 12px; block-size: 18px; border: 2px inset #a89bdd; background: #20122b; }
.scene-vended-tulip { position: absolute; inset: auto auto 2px 50%; translate: -50% 0; inline-size: 47px; animation: scene-vending-drop 600ms 460ms ease-out both; }
@keyframes scene-vending-drop {
  0% { opacity: 0; transform: translateY(-26px) scale(.5); }
  65% { opacity: 1; transform: translateY(8px) rotate(10deg); }
  100% { opacity: 1; transform: rotate(-11deg); }
}

/* Main gags */
.scene-van-road {
  position: absolute;
  inset: auto 0 0;
  height: 47px;
  border-top: 3px solid #eea2d9;
  background:
    linear-gradient(90deg, #ffed69 0 28px, transparent 28px) 0 55% / 50px 3px repeat-x,
    #342436;
  animation: scene-road-move 1.7s linear both;
}

.scene-van {
  position: absolute;
  inset: auto auto 33px 50%;
  display: flex;
  align-items: end;
  width: 116px;
  transform: translateX(-52%);
  animation: scene-drive 1.97s cubic-bezier(.24,.32,.44,.99) both;
}

.scene-van-cargo, .scene-van-cab { display: block; box-sizing: border-box; border: 2px solid #22152d; border-radius: 4px; }
.scene-van-cargo { width: 76px; height: 53px; padding-top: 17px; background: var(--local-scene-hot); color: #2b0a35; font-size: .68rem; }
.scene-van-cab { position: relative; width: 42px; height: 42px; margin-inline-start: -2px; background: var(--local-scene-pop); }
.scene-van-cab::before { position: absolute; inset: 3px 4px auto; height: 21px; border: 1px solid #2d1540; background: #ccfaff; content: ""; }
.scene-van-cab .scene-sprite { position: absolute; top: -3px; left: 6px; width: 28px; }
.scene-wheel { position: absolute; bottom: -8px; width: 21px; height: 21px; border: 2px solid #22152d; border-radius: 50%; background: radial-gradient(circle,#f9eeee 0 32%,#38203c 37%); }
.scene-wheel.rear { left: 12px; }
.scene-wheel.front { right: 5px; }
.scene-van-receipt { position: absolute; inset: 29% auto auto 50%; translate: -50% 0; rotate: -8deg; animation: scene-pop 370ms 1.52s both; }
@keyframes scene-drive {
  0% { inset-inline-start: 0; transform: translateX(-108%); }
  35%, 54% { inset-inline-start: 50%; transform: translateX(-56%) rotate(-3deg); }
  100% { inset-inline-start: 100%; transform: translateX(10%) rotate(4deg); }
}
@keyframes scene-road-move { to { background-position: -110px 55%, 0 0; } }

.scene-judge-podium, .scene-podium {
  position: absolute;
  inset: auto auto 0 calc(50% - min(111px, 39%));
  inline-size: 117px;
  block-size: 57px;
  border: 4px ridge #e99968;
  border-bottom: 0;
  background: linear-gradient(90deg,#803346,#b76069 15% 84%,#69273f);
  color: #fff4ca;
  font-size: .65rem;
}
.scene-judge-podium strong, .scene-podium strong { position: absolute; inset: 25px 3px auto; }
.scene-judge-avatar {
  position: absolute;
  inset: -45px 22px auto auto;
  inline-size: 28px;
  block-size: 32px;
  border: 2px solid #2a112d;
  border-radius: 46% 46% 35% 35%;
  background:
    radial-gradient(circle at 34% 61%, #271127 0 2px, transparent 2.5px),
    radial-gradient(circle at 66% 61%, #271127 0 2px, transparent 2.5px),
    linear-gradient(#53425b 0 23%, #ffd0a2 23%);
  box-shadow: 4px 0 #e7daf2, -4px 0 #e7daf2;
  animation: scene-rise 440ms both;
}
.scene-judge-avatar::after {
  position: absolute;
  inset: 24px -9px auto;
  block-size: 15px;
  border: 2px solid #150c1a;
  border-radius: 40% 40% 0 0;
  background: radial-gradient(circle at 50% 0, #fff8e8 0 6px, #23152b 7px);
  content: "";
}
.scene-judge-scales { position: absolute; left: 25%; top: -26px; translate: -50% 0; color: color-mix(in srgb, var(--local-scene-pop), var(--local-scene-paper) 36%); text-shadow: 2px 2px #421259; font-size: 2.2rem; }
.scene-evidence { position: absolute; inset: 26% auto auto calc(50% + 37px); rotate: 7deg; animation: scene-rise 450ms 220ms both; }
.scene-gavel { position: absolute; inset: 17% auto auto calc(50% - 26px); width: 40px; height: 6px; border-radius: 3px; background: #ba643c; transform-origin: right; animation: scene-whack .74s 650ms both; }
.scene-gavel::after { position: absolute; inset: -8px auto auto 1px; width: 12px; height: 22px; border: 2px solid #431b38; border-radius: 3px; background: #db8e46; content: ""; }
.scene-verdict {
  position: absolute;
  z-index: 2;
  inset: 49% auto auto calc(50% + 20px);
  inline-size: max-content;
  padding: 4px 6px;
  color: #4e104e;
  background: #ffe8ef;
  border: 3px double #b81970;
  font-size: .75rem;
  rotate: -12deg;
  box-shadow: 2px 2px #46142f;
  animation: scene-pop 340ms 1.23s both;
}
@keyframes scene-whack { 0%, 30% { transform: rotate(37deg); } 65% { transform: rotate(-28deg); } 100% { transform: rotate(-13deg); } }

.scene-printer {
  position: absolute;
  inset: auto auto 8px calc(50% - 102px);
  width: 113px;
  height: 76px;
  border: 4px ridge #dbd6eb;
  border-radius: 7px 7px 2px 2px;
  background: #9990ab;
  box-shadow: 3px 4px #261434;
}
.scene-printer-tray { position: absolute; inset: auto 11px -4px; height: 21px; background: #746587; border: 2px inset #b8adce; }
.scene-printer-front { position: absolute; inset: auto -4px -4px; height: 17px; border: 2px ridge #dbd6eb; background: #c1b7d1; }
.scene-printer-screen { position: absolute; inset: 10px 5px auto 5px; color: #ffdb93; background: #42275f; padding: 3px; border: 1px inset #6e5e86; font-size: .62rem; animation: scene-jam 360ms 980ms both; }
.scene-printer-paper { position: absolute; z-index: 1; inset: 15px auto auto 50%; width: 61px; translate: -50% 0; animation: scene-print 1.28s ease-out both; }
.scene-printer-apology { position: absolute; inset: 24% auto auto calc(50% + 13px); max-inline-size: 43%; rotate: 6deg; animation: scene-pop 500ms 1.37s both; }
@keyframes scene-print {
  0% { opacity: 0; transform: translateY(0) scaleY(.03); }
  34% { opacity: 1; transform: translateY(-39px) scaleY(.49); }
  74% { opacity: 1; transform: translateY(-71px) rotate(-8deg); }
  100% { transform: translateY(-61px) rotate(13deg) scaleY(.9); }
}
@keyframes scene-jam { 0% { opacity: 0; } 100% { opacity: 1; } }

.scene-support-window { animation: scene-pop 450ms both; }
.scene-support-window .scene-window-body { display: flex; align-items: center; justify-content: space-around; gap: 8px; }
.scene-caller { position: relative; }
.scene-caller .scene-sprite { width: clamp(54px, 15vw, 80px); }
.scene-phone { position: absolute; inset: 2px -12px auto auto; color: #fa489d; text-shadow: 1px 1px #40124d; font-size: 2rem; animation: scene-ring 850ms .25s both; }
.scene-support-reply { border-bottom-style: solid; animation: scene-pop 350ms 1.04s both; }
@keyframes scene-ring { 25%, 60% { rotate: 16deg; } 40%, 75% { rotate: -18deg; } }

.scene-podium { bottom: 16px; inset-inline-start: calc(50% - min(112px, 39%)); background: linear-gradient(90deg,#46105c,#7f3294 15% 84%,#46105c); border-color: #d791df; }
.scene-spokesperson { position: absolute; z-index: -1; inset: -67px auto auto 24px; inline-size: 75px; animation: scene-rise 650ms 160ms both; }
.scene-microphones { position: absolute; inset: -28px 22px auto; display: flex; justify-content: space-between; }
.scene-microphones i { position: relative; display: block; inline-size: 4px; block-size: 38px; background: #d784b6; border: 1px solid #1b0d2a; rotate: -19deg; }
.scene-microphones i:nth-child(2) { rotate: 0deg; }
.scene-microphones i:nth-child(3) { rotate: 19deg; }
.scene-microphones i::before { position: absolute; top: -4px; left: -4px; inline-size: 10px; block-size: 12px; border: 1px solid #160b20; border-radius: 50%; background: #f5e2f3; content: ""; }
.scene-witness { position: absolute; inset: 19% auto auto calc(50% + 22px); rotate: 9deg; animation: scene-rise 570ms 850ms both; }
.scene-press-flash { position: absolute; inset: 10% auto auto calc(50% + 82px); color: #ffef89; font-size: 2.1rem; animation: scene-pop 490ms .9s both; }

.scene-nesting { position: absolute; inset: 0; }
.scene-nesting .scene-sprite {
  position: absolute;
  inset: auto auto 16px 50%;
  translate: -50% 0;
  inline-size: clamp(49px, 16vw, 87px);
  scale: calc(1 - var(--scene-i) * .20);
  animation: scene-unbox 510ms calc(var(--scene-i) * .43s) both;
}
@keyframes scene-unbox {
  0% { opacity: 0; transform: translateY(6px) scale(.22); }
  55% { opacity: 1; transform: translateY(-19px) scale(1.1); }
  100% { opacity: 1; transform: translateX(calc((var(--scene-i) - 1) * 54px)); }
}
.scene-nesting .scene-sprite:nth-child(2) { rotate: -12deg; }
.scene-nesting .scene-sprite:nth-child(3) { rotate: 9deg; }
.scene-box-spill { position: absolute; inset: 0; animation: scene-rise 450ms 1.46s both; padding-block-end: 46px; }
.scene-box-spill .scene-photo { rotate: calc(-16deg + var(--scene-i) * 13deg); }

/* Album landings */
.scene-fridge {
  position: absolute;
  inset: auto auto -10px 50%;
  translate: -50% 0;
  inline-size: min(283px, calc(100% - 16px));
  block-size: 130px;
  box-sizing: border-box;
  padding: 5px 7px;
  border: 4px ridge #c1e3f2;
  border-radius: 17px 17px 0 0;
  background: linear-gradient(97deg, #8cb8d0,#e2f2ed);
  box-shadow: 5px 5px #170c2a;
}
.scene-fridge::before { position: absolute; inset: 39px auto auto 7px; width: 4px; height: 28px; border-radius: 4px; background: #104b6a; content: ""; }
.scene-fridge-logo { color: #194364; font-size: .65rem; }
.scene-fridge-photos { padding-block-start: 8px; }
.scene-fridge-photos .scene-photo {
  position: relative;
  rotate: calc(-7deg + var(--scene-i) * 6deg);
  animation: scene-rise 430ms calc(var(--scene-i) * .13s) both;
}
.scene-fridge-photos .scene-photo::after {
  position: absolute;
  inset: -5px auto auto 50%;
  translate: -50% 0;
  inline-size: 11px;
  block-size: 11px;
  border: 1px solid #352442;
  border-radius: 50%;
  background: var(--local-scene-hot);
  box-shadow: 1px 1px #352442;
  content: "";
}
.scene-fridge-photos .scene-photo:nth-child(2)::after { background: var(--local-scene-pop); }
.scene-fridge-photos .scene-photo:nth-child(3)::after { background: #36ecd5; }

.scene-album-window .scene-photo { width: clamp(47px, 13vw, 73px); }
.scene-minimizing-window { inline-size: min(160px, 65%); transform-origin: left bottom; animation: scene-minimize 720ms 270ms cubic-bezier(.6,0,.35,1) both; }
.scene-minimizing-window .scene-sprite { margin-inline: auto; width: 40px; }
@keyframes scene-minimize { to { opacity: .15; transform: translate(-105px, 100px) scale(.07); } }

.scene-confetti-photos { position: absolute; inset: 0; }
.scene-confetti-photos .scene-photo { rotate: calc(-8deg + var(--scene-i) * 7deg); animation: scene-rise 510ms calc(var(--scene-i) * .11s) both; }
.scene-confetti { position: absolute; inset: 0; }
.scene-confetti i {
  position: absolute;
  inset: 0 auto auto var(--scene-x);
  inline-size: 7px;
  block-size: 13px;
  background: var(--local-scene-pop);
  animation: scene-falling-paper 1.23s calc(var(--scene-i) * 17ms) cubic-bezier(.2,.68,.43,1) both;
}
.scene-confetti i:nth-child(3n+1) { background: var(--local-scene-hot); }
.scene-confetti i:nth-child(3n+2) { background: #38eddb; }
@keyframes scene-falling-paper {
  0% { opacity: 0; transform: translateY(-16px) rotate(0); }
  12%, 67% { opacity: .95; }
  100% { opacity: .25; transform: translateY(clamp(130px, 31vw, 178px)) rotate(var(--scene-turn)); }
}
