#set-detail {
  box-sizing: border-box;
  max-width: calc(100vw - 32px);
  width: min(840px, 90vw);
  max-height: calc(100dvh - 34px);
  margin: auto;
  inset: 0;
  border: 0;
  padding: 0;
  border-radius: 19px;
  background: #f3f4f2;
  color: var(--unbox-ink);
  box-shadow: 0 24px 90px rgb(10 22 23 / 24%);
}
#set-detail:not([open]), #set-detail [hidden] { display: none !important; }
#set-detail::backdrop { background: rgb(11 22 23 / 61%); }
#set-detail .viewer-shell {
  height: min(78dvh, 740px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}
.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 2.2vw, 28px) clamp(20px, 3vw, 36px) 0;
}
#custom-set .viewer-head p {
  margin: 0 0 4px;
  color: #4f6158;
  font: 500 12px/1.25 Arial,sans-serif;
  letter-spacing: .04em;
}
#custom-set .viewer-title { margin: 0; color: var(--unbox-ink); font: 400 clamp(28px, 3.2vw, 44px)/1.05 Georgia,serif; letter-spacing: -.05em; }
#set-detail .set-close { width: 44px; height: 44px; background: rgb(255 255 255 / 60%); }
#set-detail .set-close svg { width: 22px; height: 22px; }
.viewer-viewport {
  position: relative;
  min-height: 0;
  margin: 10px 10px 0;
  isolation: isolate;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}
#set-detail[data-view="ready"] .viewer-viewport { cursor: grab; }
#set-detail .viewer-viewport.is-dragging { cursor: grabbing; }
.viewer-viewport canvas, .viewer-viewport .viewer-poster {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.viewer-viewport .viewer-poster { padding: 4%; pointer-events: none; }
#custom-set .viewer-status {
  min-height: 1.5em;
  margin: 8px 18px 20px;
  text-align: center;
  color: #4b584e;
  font: 400 14px/1.5 Arial,sans-serif;
}

#custom-set {
  --unbox-ink: #182f27;
  padding-top: clamp(38px, 4.3vw, 66px);
  color: var(--unbox-ink);
}
#custom-set .set-heading, #custom-set .unbox-stage {
  width: var(--home-frame);
  margin-inline: auto;
}
#custom-set .set-heading {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 3%;
  margin-bottom: clamp(14px, 1.65vw, 24px);
  padding: 0;
}
#custom-set .set-heading h2 {
  margin: 0;
  font: 400 var(--section-title)/1.08 var(--book-face);
  letter-spacing: -.047em;
  color: var(--unbox-ink);
  text-wrap: balance;
}
#custom-set .set-heading p {
  max-width: 54ch;
  margin: 0;
  color: #37463e;
  font: 400 clamp(14px, 1.14vw, 17px)/1.48 Arial, sans-serif;
}
.set-heading strong { display: block; margin-top: .18em; color: var(--unbox-ink); font-weight: 600; }
#custom-set .unbox-stage {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  display: grid;
  grid-template-columns: 1fr 2fr;
  aspect-ratio: 3.65;
  overflow: hidden;
  border-radius: clamp(8px, 1.05vw, 15px);
  background: #b5cbd8 url("assets/custom-set/dessert/unbox-studio.webp") center / 100% 100% no-repeat;
}
.unbox-reference {
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  min-width: 0;
  padding: 0 7.5% 0 9%;
}
.unbox-reference .photo-mount {
  position: relative;
  margin: 0;
  width: 82%;
  background: #f8f4e9;
  padding: .66cqw .66cqw .62cqw;
  border: 1px solid rgb(255 255 255 / .75);
  transform: rotate(-1.5deg);
  box-shadow: 0 1px 2px rgb(43 47 39 / 25%), .35cqw .7cqw 1cqw -.32cqw rgb(46 62 65 / 29%);
}
.photo-mount img { width: 100%; height: auto; display: block; aspect-ratio: 4/3; object-fit: cover; }
.photo-mount figcaption {
  padding: .68cqw .2cqw 0;
  text-align: center;
  font: italic 400 clamp(12px, 1.13cqw, 16px)/1.15 Georgia, serif;
  color: #39443d;
}
.unbox-scene {
  container-type: size;
  position: relative;
  min-width: 0;
  min-height: 0;
  isolation: isolate;
}
.unbox-carton {
  position: absolute;
  z-index: 2;
  top: var(--closed-y);
  left: var(--closed-x);
  height: var(--closed-size);
  aspect-ratio: 982/1084;
  transform: translate(-50%, -50%);
}
.unbox-stage:not([data-unbox="closed"]) .unbox-carton {
  left: var(--back-x);
  top: var(--back-y);
  height: var(--back-size);
}
.carton-bob { position: relative; width: 100%; height: 100%; }
.carton-bob, .unbox-float {
  display: block;
  animation: set-float var(--period) ease-in-out var(--offset) infinite alternate both;
}
.carton-bob { --lift: clamp(8px, 1.55cqw, 15px); --period: 2.4s; --offset: -1.25s; --tilt: 0deg; }
@keyframes set-float {
  from { transform: translateY(calc(0px - var(--lift))) rotate(var(--tilt)); }
  to   { transform: translateY(var(--lift)) rotate(var(--tilt)); }
}
.unbox-item {
  appearance: none;
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8%;
  background: transparent;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.unbox-item img {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}
.unbox-item[data-item="box"] { inset: 0; width: 100%; height: 100%; }
.unbox-stage[data-unbox="closed"] .unbox-item[data-item="box"] { cursor: pointer; }
.unbox-stage:is([data-unbox="closed"], [data-unbox="closing"]) .box-open,
.unbox-stage:is([data-unbox="open"], [data-unbox="opening"]) .box-closed { opacity: 0; }
.box-open, .box-closed { transition: opacity .3s ease; }
.unbox-open {
  position: absolute;
  left: 49%;
  top: 68%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: .55em;
  min-height: 44px;
  padding: .63em 1.08em;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 85%);
  background: rgb(18 48 52 / 61%);
  box-shadow: 0 4px 14px rgb(18 40 35 / 15%);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: white;
  font: 600 clamp(13px, 1.54cqw, 17px)/1 Arial,sans-serif;
  letter-spacing: .15em;
  cursor: pointer;
}
.unbox-open svg { width: 1.2em; height: 1.2em; }
.unbox-open:hover { background-color: rgb(18 48 52 / 78%); }
.unbox-stage:not([data-unbox="closed"]) .unbox-open { visibility: hidden; }
.unpacked-piece {
  left: var(--land-x);
  top: var(--land-y);
  height: var(--piece-height);
  aspect-ratio: var(--ratio);
  transform: translate(-50%, -50%);
}
.unbox-item[data-item="card"] {
  z-index: 3;
  --land-x: var(--card-x);
  --land-y: 58%;
  --peak-x: 35%;
  --peak-y: 26%;
  --piece-height: var(--card-size);
  --ratio: 708/983;
  --lift: clamp(12px, 2.25cqw, 22px);
  --period: 1.95s;
  --offset: -.68s;
  --tilt: -2.5deg;
}
.unbox-item[data-item="figurine"] {
  z-index: 4;
  --land-x: var(--figure-x);
  --land-y: 52%;
  --peak-x: 48%;
  --peak-y: 30%;
  --piece-height: var(--figure-size);
  --ratio: 809/895;
  --lift: clamp(10px, 1.85cqw, 18px);
  --period: 2.55s;
  --offset: -2.35s;
  --tilt: 0deg;
}
.unbox-float { position: relative; width: 100%; height: 100%; }
.unbox-stage[data-unbox="closed"] .unpacked-piece { visibility: hidden; }
@media (hover: hover) {
  .unbox-carton:hover .carton-bob, .unpacked-piece:hover .unbox-float { animation-play-state: paused; }
}
.unbox-carton:has(:focus-visible) .carton-bob,
.unpacked-piece:focus-visible .unbox-float,
.unbox-stage.motion-paused :is(.carton-bob,.unbox-float),
.unbox-stage.out-of-view :is(.carton-bob,.unbox-float),
.unbox-stage[data-unbox="closed"] .unbox-float,
#custom-set:has(dialog[open]) :is(.carton-bob,.unbox-float) { animation-play-state: paused; }
.piece-shadow {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  border-radius: 100%;
  transform: translate(-50%,-50%) rotate(-2deg);
  background: radial-gradient(ellipse, rgb(32 50 61 / 32%), rgb(53 71 81 / 12%) 46%, transparent 73%);
}
.shadow-box { top: var(--closed-shadow-y); left: var(--closed-x); width: var(--closed-shadow-size); height: 6%; }
.unbox-stage:not([data-unbox="closed"]) .shadow-box { top: 76%; left: var(--back-x); width: 21%; }
.shadow-card { left: var(--card-x); top: 90%; width: 14%; height: 3.5%; }
.shadow-figurine { left: var(--figure-x); top: 94%; width: 25%; height: 5%; }
.unbox-stage[data-unbox="closed"] :is(.shadow-card,.shadow-figurine) { opacity: 0; }
#custom-set .unbox-hint {
  margin: 0 5px 0 0;
  color: #243e40;
  font: 400 clamp(11px, .92cqw, 13px)/1.25 Arial,sans-serif;
  opacity: 0;
  visibility: hidden;
  transition: opacity .24s;
  pointer-events: none;
}
#custom-set .unbox-stage[data-unbox="open"] .unbox-hint { visibility: visible; opacity: 1; }
.unbox-tools {
  position: absolute; right: 1.6%; bottom: 4%; z-index: 5;
  display: flex; align-items: center; gap: 6px;
  pointer-events: none;
}
.unbox-tools button { pointer-events: auto; }
.unbox-motion, .unbox-repack, #set-detail .set-close {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  appearance: none; margin: 0; padding: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .66);
  background: rgb(233 242 248 / .52);
  color: #1d3933; cursor: pointer;
}
.unbox-repack { width: auto; gap: 4px; border-radius: 999px; padding: 0 11px 0 8px; font: 500 12px/1 Arial,sans-serif; }
.unbox-tools svg { width: 16px; height: 16px; }
.unbox-motion .unbox-play, .unbox-motion[aria-pressed="true"] .unbox-pause { display: none; }
.unbox-motion[aria-pressed="true"] .unbox-play { display: block; }
#set-detail .set-close { width: 44px; height: 44px; background: rgb(255 255 255 / 60%); }
.unbox-stage:not([data-unbox="open"]) .unbox-repack { visibility: hidden; }
#custom-set button:focus-visible, .viewer-viewport:focus-visible { outline: 2px solid #10472d; outline-offset: 3px; }
.unbox-announcement {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
@media (max-width: 850px) {
  #custom-set .unbox-stage { aspect-ratio: 3; }
  #custom-set .set-heading { grid-template-columns: .93fr 1fr; }
  .unbox-reference .photo-mount { width: 89%; }
  .unbox-tools { bottom: 2.8%; }
}
@media (max-width: 610px) {
  #custom-set { padding-top: 36px; }
  #custom-set .set-heading { display: block; margin-bottom: 16px; }
  #custom-set .set-heading h2 { font-size: clamp(32px, 8vw, 40px); }
  #custom-set .set-heading p { margin-top: 10px; font-size: 14px; line-height: 1.48; }
  #custom-set .unbox-stage { aspect-ratio: 1.6; border-radius: 10px; padding-bottom: 44px; }
  .unbox-reference { padding: 0 3.5% 0 9%; }
  .unbox-reference .photo-mount { width: 97%; padding: 1.12cqw 1.12cqw .95cqw; }
  .photo-mount figcaption { padding-top: 1.4cqw; font-size: clamp(10px, 2.6cqw, 12px); }
  .unbox-item[data-item="card"] { --land-y: 62%; --lift: 10px; }
  .unbox-item[data-item="figurine"] { --land-y: 56.5%; --lift: 9px; }
  .carton-bob { --lift: 7.5px; }
  .unbox-tools { right: 2%; bottom: 2%; gap: 5px; }
  .unbox-motion, .unbox-repack { width: 44px; height: 44px; }
  .unbox-repack { padding: 0; }
  .unbox-repack span { display: none; }
  .unbox-open { padding: .48em .8em; gap: .24em; font-size: 12px; }
  .shadow-card { top: 88%; }
  .shadow-figurine { top: 91%; }
  #custom-set .unbox-hint { font-size: 11px; }
  #set-detail { width: calc(100vw - 18px); max-width: calc(100vw - 18px); border-radius: 14px; }
  #set-detail .viewer-shell { height: min(78dvh, 640px); }
  #custom-set .viewer-status { margin-bottom: 15px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  #custom-set .unpacked-piece, #custom-set .carton-bob, #custom-set .unbox-float, #custom-set .box-flaps { animation: none; }
  #custom-set .unbox-float { transform: rotate(var(--tilt)); }
  #custom-set .unbox-stage *, #custom-set .unbox-stage *::after { transition: none; }
  .unbox-motion { display: none; }
}
.box-flaps {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 147.6015%;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.box-flaps .flap-strip {
  width: 2800%;
  height: 100%;
  max-width: none;
  object-fit: fill;
}
.unbox-stage {
  --closed-x: 45%; --closed-y: 48%; --closed-size: 78%;
  --closed-shadow-y: 91%; --closed-shadow-size: 29%;
  --back-x: 74.5%; --back-y: 42%; --back-size: 59%;
  --card-x: 16%; --card-size: 49%; --figure-x: 44%; --figure-size: 74%;
}
@media (max-width: 610px) {
  .unbox-stage {
    --closed-x: 47%; --closed-y: 51%; --closed-size: 78%;
    --back-x: 81.5%; --back-y: 45%; --back-size: 45%;
    --card-x: 15.8%; --card-size: 37%; --figure-x: 47.5%; --figure-size: 57%;
  }
}
.unbox-stage.flaps-ready:is([data-unbox="opening"],[data-unbox="closing"]) :is(.box-open,.box-closed) { visibility: hidden; }
.unbox-stage.flaps-ready:is([data-unbox="opening"],[data-unbox="closing"]) .box-flaps { visibility: visible; }
