/* The end of the opening film and Mochi's first gift share one set and one composition. */
html #modal.first-gift::backdrop{background:#e9efe5 url('./assets/onboarding/welcome-workshop-landscape.webp') center / cover no-repeat!important;backdrop-filter:none!important}
@media(max-aspect-ratio:4/5){html #modal.first-gift::backdrop{background-image:url('./assets/onboarding/welcome-workshop-portrait.webp')!important}}
html body:not(.v2l-typing) #modal.first-gift[open]:has(>.first-reveal){position:fixed!important;inset:0!important;margin:0!important;width:100vw!important;height:100dvh!important;max-width:none!important;max-height:none!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;background:#e9efe5 url('./assets/onboarding/welcome-workshop-landscape.webp') center/cover no-repeat!important;overflow:hidden!important}
html #modal.first-gift[open]>.first-reveal{position:absolute!important;inset:0!important;display:block!important;width:100%!important;height:100%!important;margin:0!important;overflow:hidden;isolation:isolate;background:#e9efe5 url('./assets/onboarding/welcome-workshop-landscape.webp') center/cover no-repeat!important}
html #modal.first-gift[open]>.first-reveal>h2{position:absolute;z-index:3;top:6%;left:5%;width:90%;height:auto!important;margin:0!important;color:#74478f;text-align:center;font-size:clamp(27px,4.2vw,54px)!important;line-height:1.08;text-shadow:0 3px 0 #fff9e9,0 8px 18px #84609a45}
html #modal.first-gift[open]>.first-reveal>.first-reveal-instruction{position:absolute;z-index:4;left:50%;bottom:calc(4% + env(safe-area-inset-bottom));transform:translateX(-50%);width:auto!important;height:auto!important;min-height:48px;padding:10px 24px;border:3px solid #fffaf0;border-radius:999px;background:#fff5de;color:#694781;font-size:clamp(16px,2vw,23px);white-space:nowrap;box-shadow:0 5px 0 #d6b79d,0 8px 16px #76576330}
html #modal.first-gift[open]>.first-reveal>.first-box{position:absolute!important;z-index:2;left:50%;bottom:13%;transform:translateX(-50%);width:min(47vw,440px)!important;height:auto!important;aspect-ratio:392 / 370;max-height:none!important;margin:0!important;filter:drop-shadow(0 18px 13px #7d544a55)}
/* Only one basket exists on screen at a time: the inner lid/base wait behind the sleeve. */
html #modal.first-gift[open] .first-box:not(.unwrapped)>:is(.first-box-base,.first-box-front,.first-lid-window,.first-toy-window,.first-box-glow,.first-box-sparkles){visibility:hidden!important}
/* Keep the prize in the basket from the start. The opaque lid uncovers it;
   no delayed visibility switch may make it pop into an already-open basket. */
html #modal.first-gift[open] .first-box.unwrapped>.first-toy-window{display:block!important;opacity:1!important;visibility:visible!important;clip-path:none!important;animation:none!important}
html #modal.first-gift[open] .first-box .first-box-toy{scale:1!important;transform:translateY(24%) scale(.82);transform-origin:50% 94%!important}
html #modal.first-gift[open] .first-box.opening .first-box-toy{animation:first-gift-prize-rise 2.3s cubic-bezier(.25,.62,.24,1) both!important}
html #modal.first-gift[open] .first-box.opened .first-box-toy{opacity:1!important;visibility:visible!important;transform:none!important;animation:none!important}
@keyframes first-gift-prize-rise{from{transform:translateY(24%) scale(.82)}to{transform:translateY(0) scale(1)}}
@media(prefers-reduced-motion:reduce){html #modal.first-gift[open] .first-box.opening .first-box-toy{animation:none!important;transform:none!important}}
/* The wrapper image has transparent side padding; align its visible bamboo rim to the base below. */
html #modal.first-gift[open] .first-box-wrapper{position:absolute;z-index:7;inset:-8% auto auto -6%;width:112%;height:115%;object-fit:fill;pointer-events:none;filter:drop-shadow(0 8px 6px #75544830)}
html #modal.first-gift[open] .first-box.unwrapped .first-box-wrapper{visibility:hidden!important}
html #modal.first-gift[open] .first-box.unwrapped:not(.opening){animation:first-unwrap-settle .34s cubic-bezier(.25,1.4,.45,1) both}
@keyframes first-unwrap-settle{from{transform:translateX(-50%) scale(.97)}to{transform:translateX(-50%) scale(1)}}
html #modal.first-gift[open] .first-box .first-hand{z-index:8}
html #modal.first-gift[open] .mochi-gift{position:absolute!important;z-index:1;left:50%;bottom:calc(13% + min(44.34vw,415px) - 65px);translate:-50% 0;width:min(18vw,170px)!important;height:auto!important;object-fit:contain;pointer-events:none;filter:drop-shadow(0 10px 9px #684e6440);animation:none}
html #modal.first-gift[open] .mochi-gift-hop{animation:mochi-gift-hop .7s cubic-bezier(.34,1.6,.5,1) both}
html #modal.first-gift[open]>.first-reveal>.first-reveal-action:not([hidden]){position:absolute;z-index:5;left:50%;bottom:calc(4% + env(safe-area-inset-bottom));transform:translateX(-50%);width:min(320px,80vw)!important;margin:0!important}
html #modal.first-gift[open]>.first-reveal>.first-reveal-action:not([hidden])~*{display:none}
html #modal.first-gift[open]:has(.first-reveal-action:not([hidden])) .first-reveal-instruction{bottom:calc(11% + env(safe-area-inset-bottom));background:transparent;border:0;box-shadow:none}
@media(max-aspect-ratio:4/5){
 html body:not(.v2l-typing) #modal.first-gift[open]:has(>.first-reveal){background-image:url('./assets/onboarding/welcome-workshop-portrait.webp')!important}
 html #modal.first-gift[open]>.first-reveal{background-image:url('./assets/onboarding/welcome-workshop-portrait.webp')!important}
 html #modal.first-gift[open]>.first-reveal>h2{top:17%;font-size:clamp(29px,8vw,40px)!important}
 html #modal.first-gift[open]>.first-reveal>.first-box{width:min(82vw,360px)!important;bottom:15%}
 /* Keep Mochi's face above the case rim even in the short Safari content viewport. */
 html #modal.first-gift[open] .mochi-gift{bottom:calc(15% + min(77.4vw,340px) - 18px);width:min(42vw,170px)!important}
 html #modal.first-gift[open]>.first-reveal>.first-reveal-instruction{bottom:calc(7% + env(safe-area-inset-bottom))}
 html #modal.first-gift[open]>.first-reveal>.first-reveal-action:not([hidden]){bottom:calc(6% + env(safe-area-inset-bottom))}
 html #modal.first-gift[open]:has(.first-reveal-action:not([hidden])) .first-reveal-instruction{bottom:calc(13% + env(safe-area-inset-bottom))}
}
/* The final greeting floats above the toy instead of being printed across the basket. */
html #modal.first-gift[open]:has(.first-box.opened)>.first-reveal>.first-reveal-instruction{top:auto;bottom:calc(13% + min(44.34vw,415px) + 20px);min-height:0;padding:9px 22px;background:linear-gradient(180deg,#fffdf7,#fff1dc);border:2px solid #fffaf2;border-radius:20px;color:#69467f;font-size:clamp(20px,2.4vw,26px);font-weight:800;line-height:1.2;letter-spacing:.01em;box-shadow:0 5px 0 #d9bb9e,0 11px 24px #6f4d7338;text-shadow:none}
html #modal.first-gift[open]:has(.first-box.opened)>.first-reveal>.first-reveal-instruction::after{content:"";position:absolute;left:50%;bottom:-8px;width:14px;height:14px;transform:translateX(-50%) rotate(45deg);background:#fff1dc;border-right:2px solid #fffaf2;border-bottom:2px solid #fffaf2;border-radius:2px}
@media(max-aspect-ratio:4/5){html #modal.first-gift[open]:has(.first-box.opened)>.first-reveal>.first-reveal-instruction{bottom:calc(15% + min(77.4vw,340px) + 20px);font-size:clamp(21px,5.7vw,26px)}}
/* Keep the presenting friend visible when Meet replaces the unwrap hint. */
html #modal.first-gift[open]>.first-reveal>.first-reveal-action:not([hidden])~.mochi-gift{display:block}
/* Landscape tablets: one wide presentation, with Mochi beside the gift.
   The case keeps its original aspect ratio throughout unwrap/lid/reveal. */
@media(min-width:768px) and (min-height:500px) and (min-aspect-ratio:1/1){
 html #modal.first-gift[open]>.first-reveal{--gift-width:min(48vw,600px,64dvh);--gift-center:62%;--gift-bottom:17%}
 html #modal.first-gift[open]>.first-reveal>h2{top:max(10%,calc(env(safe-area-inset-top) + 28px));font-size:clamp(38px,4.2vw,58px)!important}
 html #modal.first-gift[open]>.first-reveal>.first-box{left:var(--gift-center);bottom:var(--gift-bottom);width:var(--gift-width)!important}
 html #modal.first-gift[open] .mochi-gift{left:24%;bottom:26%;width:min(27vw,310px,33dvh)!important}
 html #modal.first-gift[open]>.first-reveal>.first-reveal-instruction,
 html #modal.first-gift[open]>.first-reveal>.first-reveal-action:not([hidden]){left:var(--gift-center);bottom:max(6%,calc(env(safe-area-inset-bottom) + 24px));min-width:170px;font-size:clamp(21px,2.2vw,28px)}
 html #modal.first-gift[open]:has(.first-box.opened)>.first-reveal>.first-reveal-instruction{left:var(--gift-center);top:22%;bottom:auto;min-width:0;padding:10px 26px;font-size:clamp(23px,2.6vw,32px)}
}
/* Portrait iPads use the vertical room, without inheriting phone-sized art. */
@media(min-width:768px) and (max-aspect-ratio:1/1){
 html #modal.first-gift[open]>.first-reveal{--gift-width:min(66vw,600px,51dvh)}
 html #modal.first-gift[open]>.first-reveal>h2{top:max(10%,calc(env(safe-area-inset-top) + 28px));font-size:clamp(38px,5vw,58px)!important}
 html #modal.first-gift[open]>.first-reveal>.first-box{left:50%;width:var(--gift-width)!important;bottom:17%}
 html #modal.first-gift[open] .mochi-gift{left:50%;bottom:calc(17% + min(62.3vw,566px,48.14dvh) - 32px);width:min(29vw,280px,24dvh)!important}
 html #modal.first-gift[open]>.first-reveal>.first-reveal-instruction,
 html #modal.first-gift[open]>.first-reveal>.first-reveal-action:not([hidden]){left:50%;bottom:max(7%,calc(env(safe-area-inset-bottom) + 24px));font-size:clamp(21px,2.8vw,28px)}
 html #modal.first-gift[open]:has(.first-box.opened)>.first-reveal>.first-reveal-instruction{left:78%;top:32%;bottom:auto;font-size:clamp(23px,3vw,32px)}
}
@media(prefers-reduced-motion:reduce){html #modal.first-gift[open] .first-box.unwrapped:not(.opening){animation:none}}

/* Meet is the next action; the redundant greeting must never cover Mochi. */
html #modal.first-gift[open]:has(.first-box.opened)>.first-reveal>.first-reveal-instruction{visibility:hidden!important}

html #modal.first-gift[open]>.first-reveal>.first-reveal-action:not([hidden]){transform:translateX(-50%)!important}
