/* Foil pop (foil pass): one light vocabulary for every foil outside play, and the pack opener beats.
   Animated properties are transform and opacity only. Reduced motion keeps the still look. */
.finish-pop{position:absolute;display:block;pointer-events:none!important;z-index:3;border-radius:4.75% / 3.5%;overflow:hidden}
.finish-pop[hidden]{display:none}
/* The card itself is never painted over at rest: the measured finish (art foil, Yu-Gi-Oh! lettering,
   stamps) shows exactly as before. The pop is motion only: a light catch and a short glint burst. */
/* Light catch: one bright band crosses when the card appears, is hovered, or is revealed. */
.fx-catch{position:absolute;inset:0;overflow:hidden;border-radius:inherit}
.fx-catch::before{content:'';position:absolute;top:-25%;bottom:-25%;left:0;width:55%;background:linear-gradient(100deg,transparent 12%,#ffffff70 46%,#fff0c0a0 52%,transparent 88%);mix-blend-mode:overlay;
 transform:translateX(-170%) skewX(-12deg);opacity:0}
.fx-catching .fx-catch::before,.fx-catching.fx-catch::before{animation:fx-catch .66s cubic-bezier(.3,.7,.2,1) both}
:is(.zoom-card-surface,[data-finish-surface]):hover>.finish-pop .fx-catch::before{animation:fx-catch .66s cubic-bezier(.3,.7,.2,1) both}
@keyframes fx-catch{0%{transform:translateX(-170%) skewX(-12deg);opacity:1}100%{transform:translateX(300%) skewX(-12deg);opacity:1}}
/* Glints: four-point stars that twinkle on their own clocks. */
.fx-glints{position:absolute;inset:0}
.fx-glint{position:absolute;width:calc(9% * var(--fx-s,1));aspect-ratio:1;translate:-50% -50%;background:#fff;opacity:0;transform:scale(0);
 clip-path:polygon(50% 0,57% 43%,100% 50%,57% 57%,50% 100%,43% 57%,0 50%,43% 43%)}
/* Glints only play as a short burst when the card is shown (.fx-burst), then the card is left clean. */
.fx-burst .fx-glint{animation:fx-twinkle calc(var(--fx-d,2.4s) * .6) ease-in-out 2 calc(var(--fx-dl,0s) * -.25)}
@keyframes fx-twinkle{0%,100%{opacity:0;transform:scale(0) rotate(0)}42%{opacity:1;transform:scale(1) rotate(40deg)}58%{opacity:.85;transform:scale(.75) rotate(55deg)}}
@media (prefers-reduced-motion:reduce){.fx-glint,.fx-catch::before{animation:none!important}}

/* ---------- Pack opener beats (all three games share the dialog) ---------- */
/* Pack wrapper sheen: an oversized band that moves by transform instead of repainting the gradient. */
.pack-dialog .pack-sheen{overflow:hidden;background:none;animation:none}
.pack-dialog .pack-sheen::before{content:'';position:absolute;top:-20%;bottom:-20%;left:0;width:60%;background:linear-gradient(105deg,transparent 15%,#ffffff40 45%,#9fe3ff33 50%,#ffd0f233 55%,transparent 85%);
 transform:translateX(-170%) skewX(-10deg);animation:pack-sheen-move 3.2s ease-in-out infinite}
@keyframes pack-sheen-move{0%{transform:translateX(-170%) skewX(-10deg)}100%{transform:translateX(260%) skewX(-10deg)}}
/* Slice: a glowing seam races across the top crimp, a flash, then the strip flies off and the pack drops away. */
.pack-slice{position:absolute;left:0;right:0;top:8.5%;height:3px;pointer-events:none;z-index:4;transform-origin:0 50%;transform:scaleX(0);opacity:0;
 background:linear-gradient(90deg,#ff5fd2,#fff 55%,#9ff0ff);box-shadow:0 0 10px 2px #ff7ad9,0 0 22px 6px #ffffff88;border-radius:3px}
.pack-wrapper.tearing .pack-slice{animation:pack-slice .34s cubic-bezier(.6,0,.4,1) forwards}
/* The light is sized by the box, so it is gone before the box's sides (a tall pack showed it as a hard-edged grey slab). */
.pack-flash{position:absolute;inset:-30%;pointer-events:none;z-index:5;opacity:0;background:radial-gradient(ellipse 50% 45% at 50% 20%,#fff 0%,#fff8 30%,transparent 100%)}
.pack-wrapper.tearing .pack-flash{animation:pack-flash .5s .3s ease-out both}
.pack-wrapper.tearing .pack-crimp.top{animation:pack-strip .42s .3s cubic-bezier(.3,.6,.4,1) forwards}
.pack-wrapper.tearing .pack-body{animation:pack-rip-jolt .44s cubic-bezier(.4,0,.2,1) forwards}
@keyframes pack-slice{0%{transform:scaleX(0);opacity:1}100%{transform:scaleX(1);opacity:1}}
@keyframes pack-flash{0%{opacity:0}30%{opacity:1}100%{opacity:0}}
@keyframes pack-rip-down{0%,45%{transform:translateY(0) scale(1)}55%{transform:translateY(-8px) scale(1.04)}100%{transform:translateY(60%) scale(.88);opacity:0}}
/* Deal: the cards rise out of the pack as one stack, then fan into the hand. */
.pack-dialog:not(.pack-dealt) .pack-card{transform:translate(calc((var(--pack-n,10) / 2 - var(--i)) * 100% * .55),-60%) scale(.8);opacity:0}
.pack-dealt .pack-card{transition:transform .5s cubic-bezier(.2,.8,.2,1),opacity .25s,filter .3s;transition-delay:calc(var(--i) * 40ms + 60ms),calc(var(--i) * 40ms),0s}
/* Open: the pack jolts as its top tears off and stays put; the cards fly out of the opening one by one and
   arc down into the hand face down, then the torn pack sinks away and the big card comes up. */
@keyframes pack-rip-jolt{0%,62%{transform:none}78%{transform:translateY(-7px) scale(1.035)}100%{transform:none}}
.pack-ghost{z-index:70;pointer-events:none;cursor:default}
.pack-ghost .pack-body{animation:none}
.pack-ghost .pack-crimp.top,.pack-ghost .pack-slice,.pack-ghost .pack-flash,.pack-ghost .pack-sheen{display:none}
.pack-ghost .pack-wrap-art,.pack-ghost .pack-sheen{clip-path:inset(8.5% 0 0 0 round 0 0 6px 6px)}
.pack-ghost::before{content:"";position:absolute;z-index:6;left:6%;right:6%;top:2%;height:14%;pointer-events:none;border-radius:50%;background:radial-gradient(ellipse at 50% 60%,#fffbe8cc 0,#ffe3a055 38%,transparent 72%);filter:blur(5px);animation:pack-mouth .9s ease-out both}
@keyframes pack-mouth{0%{opacity:0;transform:scaleX(.4)}35%{opacity:1;transform:none}100%{opacity:.55}}
.pack-flying .pack-card{transition:none!important}
.pack-focus-card.pack-await{opacity:0}
/* A big pull's glow stays under the header: it may spread sideways and down, never over the title and buttons. */
.pack-focus{clip-path:inset(-4px -40px -80px -40px)}
/* Flip: a quick turn with a soft settle, lifting off the table as it goes (the lift is set in pack-preview.js). */
@media (prefers-reduced-motion:no-preference){.pack-focus-card>span{transition:transform .6s cubic-bezier(.3,1.18,.45,1)}.pack-card>span{transition:transform .5s cubic-bezier(.3,1.18,.45,1)}}
.pack-focus-card.pack-rising{animation:pack-rise .46s cubic-bezier(.2,.8,.2,1) both}
@keyframes pack-rise{0%{transform:translateY(42%) scale(.82);opacity:0}70%{transform:translateY(-2%) scale(1.03);opacity:1}100%{transform:none;opacity:1}}
/* Reveal: the flip lands with a light catch and a burst of glints; better pulls rise with a glow, the best get rays. */
.pack-face>.fx-glints,.pack-face>.fx-catch{z-index:3;pointer-events:none}
/* Tease: a face-down rare glows gold behind its back before the flip. */
.pack-focus-card.pack-tease>.pack-backlight{opacity:.75;background:#f0c75e;animation:pack-tease 1.1s ease-in-out infinite alternate}
.pack-focus-card.pack-tease>.pack-card-back{box-shadow:inset 0 0 0 3px #f0c75e99,inset 0 0 24px #f0c75e55}
@keyframes pack-tease{from{opacity:.35}to{opacity:.85}}
.pack-focus-card.pack-pop{animation:pack-pop .42s cubic-bezier(.2,.8,.2,1)}
@keyframes pack-pop{0%{scale:1}35%{scale:1.07}100%{scale:1}}
.pack-rays{position:absolute;left:50%;top:50%;width:190%;aspect-ratio:1;translate:-50% -50%;pointer-events:none;border-radius:50%;opacity:0;transform:translateZ(-8px);
 background:repeating-conic-gradient(color-mix(in srgb,var(--tier,#fff6d0) 70%,#fff) 0 5deg,transparent 5deg 20deg);
 -webkit-mask:radial-gradient(circle,#000 12%,transparent 64%);mask:radial-gradient(circle,#000 12%,transparent 64%)}
.pack-focus-card.pack-hit-big .pack-rays{animation:pack-rays 1.6s ease-out both}
@keyframes pack-rays{0%{opacity:0;scale:.4;rotate:0deg}25%{opacity:.9;scale:1;rotate:20deg}100%{opacity:0;scale:1.15;rotate:70deg}}
/* Rarity line: pops in under the revealed card. */
.pack-focus-card.revealed~.pack-focus-meta .pack-rarity>*{animation:pack-meta-in .34s .12s cubic-bezier(.2,.8,.2,1) both}
@keyframes pack-meta-in{from{opacity:0;transform:translateY(6px) scale(.9)}to{opacity:1;transform:none}}
/* Swipe: the big card flicks away with a tilt and the next one comes up from underneath the stack. */
.pack-focus-card.pack-slide-next{animation:pack-under-next .34s cubic-bezier(.2,.8,.2,1)}
.pack-focus-card.pack-slide-prev{animation:pack-under-prev .34s cubic-bezier(.2,.8,.2,1)}
@keyframes pack-under-next{from{translate:0 5%;scale:.92;opacity:.35}to{translate:0 0;scale:1;opacity:1}}
@keyframes pack-under-prev{from{translate:0 5%;scale:.92;opacity:.35}to{translate:0 0;scale:1;opacity:1}}
.pack-fling{position:absolute;pointer-events:none;z-index:20;border-radius:4.6%/3.3%;overflow:hidden;box-shadow:0 24px 40px #000a}
.pack-fling>img{display:block;width:100%;height:100%;object-fit:contain}
@media (prefers-reduced-motion:reduce){.pack-ghost{display:none}.pack-focus-card.pack-await{opacity:1}.pack-dialog .pack-sheen::before,.pack-wrapper.tearing *,.pack-dealt .pack-focus-card,.pack-focus-card.pack-pop,.pack-focus-card>.pack-rays,.pack-focus-card.revealed~.pack-focus-meta .pack-rarity>*{animation:none!important}.pack-fling{display:none}}
.pack-face>.finish-pop .fx-glints{display:none}
/* A big pull invites the phone tilt: the button glows gold until it is used. */
.pack-tilt.pack-tilt-hint:not([aria-pressed="true"]){color:var(--gold,#e8b95b);border-color:#e8b95b99;animation:pack-tilt-hint 1.2s ease-in-out infinite alternate}
@keyframes pack-tilt-hint{from{opacity:.7}to{opacity:1}}
@media (prefers-reduced-motion:reduce){.pack-tilt.pack-tilt-hint{animation:none}}
/* Pack show (4.3.49): every price tier turns over a step bigger than the last. */
/* Charge: a purple-or-better pull trembles and glows in its own colour before it turns. */
.pack-focus-card.pack-charge>.pack-backlight{opacity:1;background:var(--charge,#f0c75e);animation:pack-charge-glow var(--charge-ms,600ms) cubic-bezier(.5,0,.9,.6) both}
.pack-focus-card.pack-charge>.pack-card-back{box-shadow:inset 0 0 0 3px color-mix(in srgb,var(--charge) 70%,transparent),inset 0 0 34px color-mix(in srgb,var(--charge) 55%,transparent);animation:pack-charge-back var(--charge-ms,600ms) ease-in both}
@keyframes pack-charge-glow{from{opacity:.35;scale:.9}to{opacity:1;scale:1.12}}
@keyframes pack-charge-back{from{filter:brightness(1)}to{filter:brightness(1.5) saturate(1.2)}}
/* The pop grows with the tier; the rays last longer for gold and orange, and orange's spin twice as fast. */
.pack-focus-card.pack-pop[data-level="2"]{animation-name:pack-pop-2}.pack-focus-card.pack-pop[data-level="3"]{animation-name:pack-pop-3;animation-duration:.5s}
.pack-focus-card.pack-pop:is([data-level="4"],[data-level="5"]){animation-name:pack-pop-4;animation-duration:.62s}
@keyframes pack-pop-2{0%{scale:1}35%{scale:1.09}100%{scale:1}}
@keyframes pack-pop-3{0%{scale:1}30%{scale:1.12}62%{scale:.985}100%{scale:1}}
@keyframes pack-pop-4{0%{scale:1}26%{scale:1.17}56%{scale:.97}80%{scale:1.02}100%{scale:1}}
.pack-focus-card.pack-hit-big[data-level="4"] .pack-rays{animation-duration:2s}
.pack-focus-card.pack-hit-grail .pack-rays{animation:pack-rays-grail 2.5s ease-out both}
@keyframes pack-rays-grail{0%{opacity:0;scale:.4;rotate:0deg}20%{opacity:1;scale:1.1;rotate:30deg}100%{opacity:0;scale:1.3;rotate:150deg}}
/* Ring, embers and the room's flash sit on the dialog above the stage, so they are never clipped. */
.pack-ring{position:fixed;z-index:30;pointer-events:none;border-radius:6%/4.4%;box-shadow:0 0 0 3px var(--ring),0 0 26px 6px color-mix(in srgb,var(--ring) 60%,transparent),inset 0 0 22px color-mix(in srgb,var(--ring) 50%,transparent)}
.pack-ember{position:fixed;z-index:31;pointer-events:none;border-radius:50%}
.pack-room-flash{position:fixed;inset:0;z-index:29;pointer-events:none;background:radial-gradient(circle at 50% 42%,color-mix(in srgb,var(--flash) 70%,#fff) 0,color-mix(in srgb,var(--flash) 45%,transparent) 30%,transparent 72%);mix-blend-mode:screen}
/* Gold and up: the table dims for a moment so the card has the stage to itself. */
.pack-dialog .pack-hand,.pack-dialog .pack-actions,.pack-dialog .pack-header{transition:filter .5s ease,opacity .5s ease}
.pack-dialog.pack-spotlight .pack-hand,.pack-dialog.pack-spotlight .pack-actions,.pack-dialog.pack-spotlight .pack-header{filter:brightness(.42) saturate(.7)}
/* One of the pack's three best lands with a glint along its edge. */
.pack-card.pack-best-land{box-shadow:0 0 0 2px #fff6d099,0 0 22px #ffe39a88}
@media (prefers-reduced-motion:reduce){.pack-ring,.pack-ember,.pack-room-flash{display:none}.pack-focus-card.pack-charge>*{animation:none!important}.pack-dialog.pack-spotlight *{filter:none!important}}
/* Flip (4.3.50): the front is loaded before it turns; the price frame, its glow and the hand's tier border fade in only once
   the face has landed, so the turn shows the real back then the real front, never a flat grey or empty slab. */
.pack-focus-card.pack-flipping>:is(.pack-frame,.pack-backlight){opacity:0!important;transition:none}
.pack-card.pack-flipping::before,.pack-card.pack-flipping::after{opacity:0!important;transition:none}

/* The 3D pack (pack3d.js): the canvas fills the pack's body under the seam and the flash; the 2D art, crimps and sheen step aside.
   Its float only lifts (the model turns itself). While its photo loads the place stays empty, so the 2D pack never shows first. */
.pack-3d-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none}
.pack-wrapper.pack-3d .pack-wrap-art,.pack-wrapper.pack-3d .pack-crimp,.pack-wrapper.pack-3d .pack-sheen{display:none}
.pack-wrapper.pack-3d:not(.tearing):not(.pack-ghost) .pack-body{animation-name:pack-float-3d}
@keyframes pack-float-3d{50%{transform:translateY(-8px)}}
.pack-ghost.pack-3d .pack-wrap-art{clip-path:none}
/* A flat-only set's real photo (a cardboard box) as the 2D pack: the drawn wrapper, crimps and sheen step aside. */
.pack-photo-img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block;pointer-events:none}
.pack-wrapper.pack-photo .pack-wrap-art,.pack-wrapper.pack-photo .pack-crimp,.pack-wrapper.pack-photo .pack-sheen{display:none}
.pack-ghost.pack-photo .pack-photo-img{clip-path:inset(8.5% 0 0 0)}
