/* A dedicated stage: perspective, foil, shadows and the result all share one space. */
body.pack-opening-active {overflow:hidden}
/* The frame (position, size, no border, the paper colour, the backdrop) is set by opening-experience.mjs before this
   stylesheet loads; see THEATER_FRAME there. */
dialog.opening-theater {--slab-radius:6.96%/4.46%;isolation:isolate;font-family:var(--body,'Manrope',sans-serif);z-index:1000;--pack-width:clamp(210px,min(24vw,40vh),340px);--pack-height:calc(var(--pack-width)*1.44);--slab-depth:22px;--orbit-radius:calc(var(--pack-width)*2.05);--slab-width:clamp(210px,24vw,310px)}
.opening-theater button {font:inherit;cursor:pointer;color:inherit;-webkit-tap-highlight-color:transparent}

/* Controls on the stage sit on glass: the shared outlined button with a translucent fill. */
.opening-theater wa-button[appearance=outlined]::part(base) {background:var(--glass-surface)}

/* Real glass on the stage is the HUD only: the back button and the settings capsule (two blurred elements, neither animated). */
.opening-back::part(base),.opening-settings {backdrop-filter:blur(var(--glass-blur));-webkit-backdrop-filter:blur(var(--glass-blur))}
.opening-back::part(base):active {transform:none}
.opening-settings wa-button::part(base) {background:transparent;border-color:transparent;box-shadow:none}
.opening-settings wa-button::part(base)::after {background:var(--wa-color-neutral-fill-quiet);box-shadow:none}
.opening-settings wa-button[aria-pressed=true]::part(base) {background:var(--wa-color-brand-fill-quiet);box-shadow:none}
.opening-theater wa-button[aria-pressed=true]::part(base) {background:var(--wa-color-brand-fill-quiet)}
.opening-theater button:disabled {cursor:default}
.opening-theater button:focus-visible {outline:2px solid var(--crimson-500);outline-offset:7px}
.opening-aura {position:absolute;width:min(100vw,1000px);height:80vh;left:50%;top:5%;transform:translateX(-50%);background:radial-gradient(ellipse,rgba(var(--pack-rgb),.11),transparent 65%);transition:background 1s}
.opening-grain {position:absolute;inset:0;opacity:.025;background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23n)' opacity='.5' d='M0 0h180v180H0z'/%3E%3C/svg%3E")}
.opening-hud {position:absolute;inset:24px 28px auto;display:flex;align-items:center;gap:16px;z-index:10}
.opening-brand {display:flex;align-items:center;gap:10px;font:600 var(--text-body) var(--display);letter-spacing:.5px;color:var(--ink)}
.opening-brand>svg {width:27px;height:29px;color:var(--ink)}
.opening-back:disabled {opacity:.2}
.opening-settings {border-radius:var(--radius-pill);padding:3px;gap:2px;background:var(--glass-sheen),var(--glass-fill);border:1px solid var(--glass-edge);box-shadow:var(--glass-edges),var(--glass-shadow-soft);display:flex;margin-left:auto}
.opening-pack-label {position:absolute;top:10.5%;left:50%;transform:translateX(-50%);display:grid;gap:7px;text-align:center;text-transform:uppercase;transition:opacity .4s}
.opening-pack-label>span {font-size:var(--text-label);color:var(--ink-soft);letter-spacing:3px}
.opening-pack-label>b {font:500 20px var(--display);letter-spacing:3px;color:var(--ink)}

/* Live terms sit under the pack name on the stage; the shuffle is the commit. */
.opening-terms {margin:6px auto 0;max-width:560px;font-size:var(--text-secondary);line-height:1.5;letter-spacing:0;text-transform:none;color:var(--ink-soft)}
.opening-terms b {color:var(--ink)}
.opening-terms-fine {display:block;max-width:560px;margin:0 auto;font-size:var(--text-secondary);letter-spacing:0;text-transform:none;color:var(--muted)}
.opening-sell-confirm {display:grid;gap:12px;text-align:left}
.opening-sell-confirm>p {margin:0;font-size:var(--text-body);line-height:1.55;color:var(--ink-soft)}
.opening-sell-confirm b,.opening-sold b {color:var(--teal-400)}
.opening-sell-confirm-actions {display:flex;gap:10px}
.opening-sell-confirm-actions>wa-button {flex:1;min-width:0}
.opening-sell-confirm>.opening-loader {display:inline-block;vertical-align:middle;margin-right:10px}
.opening-sold {display:grid;gap:12px;justify-items:start}
/* The next step spans the copy column, like the SELL and KEEP row it replaces. */
.opening-result-actions>.opening-sold {flex:1;min-width:0}
.opening-sold>.opening-sell-confirm-actions {justify-self:stretch}
/* The outcome is one line: its label and the note beside it (the note wraps under on a narrow column). */
.opening-outcome {display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
.opening-outcome>p {flex:1 1 14em;margin:0;font-size:var(--text-body);color:var(--ink-soft);text-wrap:pretty}
@media(max-width:600px) {.opening-outcome>p {flex-basis:100%}}
.opening-camera {position:absolute;width:100%;height:var(--pack-height);top:46%;left:50%;transform:translate(-50%,-50%) scale(calc(1 + var(--tension,0)*.06));perspective:1400px;perspective-origin:50% 42%;touch-action:pan-y;transition:transform .25s linear}

/* Reel tension: the stage closes in while the ring spins down (--tension is the reel's progress, set per frame). */
.opening-tension {position:absolute;inset:0;pointer-events:none;opacity:0;background:radial-gradient(ellipse at 50% 46%,transparent 38%,var(--paper) 100%);transition:opacity .25s linear}
.opening-theater[data-phase=shuffling] .opening-tension {opacity:calc(var(--tension,0)*.8)}
.opening-orbit.is-dragging {transition:none}
.opening-orbit.is-dragging .opening-spoke {cursor:grabbing}

/* The turn is a registered angle and is what transitions, so each pack's lean and fade (derived from it) move in step with the ring. */
@property --orbit-turn {syntax:'<angle>';inherits:true;initial-value:0deg}
.opening-orbit {position:absolute;width:var(--pack-width);height:var(--pack-height);left:50%;top:0;margin-left:calc(var(--pack-width)/-2);transform-style:preserve-3d;transform:translateZ(calc(var(--orbit-radius)*-1)) rotateY(var(--orbit-turn));transition:--orbit-turn .85s cubic-bezier(.2,.75,.16,1)}
.opening-spoke {cursor:grab;position:absolute;inset:0;transform:rotateY(calc(var(--slot)*var(--orbit-step,30deg))) translateZ(var(--orbit-radius)) translateY(var(--spoke-lift,0px)) scale(var(--spoke-scale,1));transform-style:preserve-3d;border:0;background:transparent;transition:opacity .7s,filter .5s,transform .6s cubic-bezier(.2,.75,.16,1);outline:none!important}
.opening-orbit.is-settling {transition-duration:.4s}
.opening-orbit.is-wheeling {transition:--orbit-turn .2s cubic-bezier(.25,.8,.3,1)}
.opening-spoke.is-selected .opening-pack-front {filter:brightness(1.12)}
.opening-orbit:not(.is-dragging) .opening-spoke:hover .opening-pack-front {filter:brightness(1.2)}

/* --face is the pack's angle from the viewer (-180..180deg). The body turns back 60% of it, so a pack leans at most 72deg and its back never comes round;
   the fade runs on the face, which is also the 3D pack's stand-in (pack-3d.mjs reads its opacity and brightness). */
.opening-pack-body {position:absolute;inset:0;transform-style:preserve-3d;--face:calc(mod(calc(var(--slot)*var(--orbit-step,30deg) + var(--orbit-turn) + 180deg),360deg) - 180deg);--fade:clamp(0,calc((cos(var(--face)) - cos(100deg))/(cos(50deg) - cos(100deg))),1);transform:rotateY(calc(var(--face)*-.6))}
.opening-pack-body>.opening-pack-front {opacity:var(--fade)}
.opening-spoke:focus-visible .opening-pack-front {filter:brightness(1.25)}

/* The 3D pack (pack-3d.mjs) draws on a canvas inside the perspective container and mirrors the stand-in elements,
   whose wrapper images stay hidden for the whole opening. Without WebGL or flat pack art the images show instead. */
.opening-pack-3d {position:absolute;left:0;top:-50%;width:100%;height:260%;pointer-events:none}
.opening-tear-stage>.opening-pack-3d {top:0;height:100%;z-index:3}
.opening-theater[data-pack3d] .opening-spoke .opening-foil,.opening-theater[data-pack3d] .opening-rip-skin>.opening-foil {visibility:hidden}
.opening-spoke:focus-visible .opening-foil {filter:hue-rotate(var(--foil-hue,0deg)) saturate(var(--foil-saturation,1)) brightness(1.15) drop-shadow(0 0 9px var(--crimson-400))}
.opening-foil {display:block;position:relative;width:100%;height:100%;filter:hue-rotate(var(--foil-hue,0deg)) saturate(var(--foil-saturation,1)) brightness(var(--foil-brightness,1));transform-style:preserve-3d}
.opening-foil>img {display:block;width:100%;height:100%;object-fit:contain;user-select:none;pointer-events:none;filter:drop-shadow(0 20px 24px #0007)}
.opening-foil-light {position:absolute;inset:0;mask-image:var(--foil-mask);mask-position:center;mask-size:contain;mask-repeat:no-repeat;background:linear-gradient(115deg,transparent 20%,#fff0 35%,#fff1 45%,#fff5 49%,transparent 56%);mix-blend-mode:screen;opacity:.2;pointer-events:none;animation:opening-foil-breathe 7s ease-in-out infinite}
.opening-controls {position:absolute;bottom:max(35px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);text-align:center;z-index:8;width:min(90%,500px)}
.opening-choice-row {display:flex;align-items:center;justify-content:center;gap:25px}
.opening-shuffle {--wa-form-control-padding-inline:2.2em;letter-spacing:2px}
.opening-commit-status {position:absolute;bottom:13%;left:50%;width:90%;transform:translateX(-50%);display:none;place-items:center;gap:12px;text-align:center}
.opening-commit-status>b {font-size:var(--text-lead);font-weight:500}
.opening-commit-status>small {font-size:var(--text-secondary);color:var(--muted)}
.opening-loader {width:25px;height:25px;border:1px solid color-mix(in srgb, var(--ink-soft) 8%, transparent);border-top-color:var(--crimson-400);border-radius:50%;animation:opening-spin 1.4s linear infinite}
.opening-theater[data-phase=committing] .opening-controls,.opening-theater[data-phase=committing] .opening-pack-label {opacity:0;pointer-events:none}
.opening-theater[data-phase=committing] .opening-spoke:not(.is-selected) {opacity:0;pointer-events:none}
.opening-theater[data-phase=shuffling] .opening-controls {pointer-events:none;opacity:.55}

/* Tear stage. The pack stays on the carousel's anchor (same spot as .opening-camera), splits down a jagged centre line and the halves pull apart to the left and right; the slab rises out of the gap into the sealed stage's anchor, so the next scene starts without a jump. */
.opening-rip-half {position:absolute;inset:0;transform-style:preserve-3d}
.opening-rip-skin {position:absolute;inset:0;display:block;--foil-brightness:1.12;-webkit-box-reflect:below -4px linear-gradient(transparent 25%,#fff2)}
.opening-rip-left>.opening-rip-skin {clip-path:polygon(0 0,50% 0,50% 100%,0 100%)}
.opening-rip-right>.opening-rip-skin {clip-path:polygon(50% 0,100% 0,100% 100%,50% 100%)}
.opening-rip-left {transform-origin:0 100%;animation:opening-half-left 1.5s .5s cubic-bezier(.3,.5,.25,1) both}
.opening-rip-right {transform-origin:100% 100%;animation:opening-half-right 1.5s .5s cubic-bezier(.3,.5,.25,1) both}
.opening-rip-shard {position:absolute;left:50%;top:var(--sy);width:11px;height:8px;margin-left:-5px;background:linear-gradient(135deg,#fff,rgba(var(--pack-rgb),.9) 55%,var(--raised));clip-path:polygon(0 30%,55% 0,100% 45%,70% 100%,15% 85%);opacity:0;animation:opening-shard .8s var(--sd) cubic-bezier(.2,.6,.3,1) both}
.opening-slab-anchor {position:absolute;left:50%;top:46%;width:var(--slab-width);aspect-ratio:.64;margin-left:calc(var(--slab-width)/-2);margin-top:calc(var(--slab-width)/.64/-2);transform-style:preserve-3d}
.opening-rising-slab {position:absolute;inset:0;transform-style:preserve-3d;animation:opening-slab-emerge 1.7s .5s cubic-bezier(.3,.6,.2,1) both}
@property --tilt-x {syntax:'<angle>';inherits:false;initial-value:0deg}
@property --tilt-y {syntax:'<angle>';inherits:false;initial-value:0deg}
@property --flip {syntax:'<angle>';inherits:false;initial-value:0deg}
@property --flip-z {syntax:'<length>';inherits:false;initial-value:0px}
@property --flip-scale {syntax:'<number>';inherits:false;initial-value:1}
.opening-theater[data-phase=sealed] {cursor:pointer}
.opening-theater[data-phase=sealed] .opening-hud {cursor:auto}
.opening-sealed-button {position:absolute;inset:0;width:100%;height:100%;padding:0;background:transparent;border:0;transform-style:preserve-3d;transform:rotateX(var(--tilt-x)) rotateY(var(--tilt-y));transition:--tilt-x .3s ease-out,--tilt-y .3s ease-out}
.opening-slab-back {position:absolute;inset:0;display:block;container-type:size;border-radius:var(--slab-radius);background:linear-gradient(115deg,color-mix(in srgb, var(--foil-mid) 10%, transparent),color-mix(in srgb, var(--foil-lo) 4%, transparent) 25%,#fff1 50%,color-mix(in srgb, var(--foil-lo) 11%, transparent) 75%,color-mix(in srgb, var(--foil-hi) 14%, transparent));box-shadow:0 22px 60px #0008;overflow:hidden;transform:translateZ(calc(var(--slab-depth)/2))}
/* The rim is a layer inside the back, sized from the back's width like everything on it, and the corners are a share
   of the box: the face-down card that waits for the clues is laid out smaller and scaled up to the sealed slab's
   place, and must look the same. Measured on the phone's 230px slab (3px rim, 16px corners). */
.opening-slab-back::before {content:'';position:absolute;inset:0;border-radius:inherit;border:1.3cqw solid color-mix(in srgb, var(--foil-mid) 42%, transparent);box-shadow:inset 0 0 0 .87cqw color-mix(in srgb, var(--foil-hi) 25%, transparent),inset 0 0 0 2.17cqw color-mix(in srgb, var(--line-strong) 36%, transparent),inset 0 0 0 3.04cqw color-mix(in srgb, var(--foil-mid) 15%, transparent);pointer-events:none}

/* Acrylic slab edges: four frosted faces around the panel, inset by its corner radius, so the sealed slab and the pulled card have real thickness when tilted or flipped. */
.opening-slab-depth {position:absolute;inset:0;transform-style:preserve-3d;pointer-events:none}

/* Acrylic picks up the pack's colour: the same gradient, lighter and translucent. */

/* Acrylic as stacked rounded plates: six translucent layers from the front face to the back give a smooth, round-cornered edge at any angle, in the same neutral foil as the back's rim. */
.opening-slab-depth>i {position:absolute;inset:0;border-radius:var(--slab-radius);border:1px solid color-mix(in srgb,var(--foil-mid) 18%,transparent);background:color-mix(in srgb,var(--foil-mid) 5%,transparent);transform:translateZ(calc(var(--slab-depth)/2 - 1px - var(--i)*(var(--slab-depth) - 2px)/5))}
.slab-label {position:absolute;top:3.3%;left:5.5%;right:5.5%;height:13%;background:linear-gradient(145deg,color-mix(in srgb, var(--foil-mid) 7%, transparent),var(--well));border:1px solid color-mix(in srgb, var(--foil-mid) 28%, transparent);border-radius:var(--radius-xs);display:flex;flex-direction:column;justify-content:center;align-items:flex-start;padding-left:10%;box-shadow:inset 0 0 0 2px #0008}
.slab-label>b {font:600 clamp(12px,1.6vw,20px) var(--display);letter-spacing:2px}
.slab-label>span {font-size:2.17cqw;letter-spacing:.74cqw;color:var(--foil-lo);margin-top:1.3cqw}
.slab-label>i {position:absolute;right:5%;top:30%;font:400 2.17cqw var(--body);color:var(--foil-lo);writing-mode:vertical-rl}
.slab-inlay {position:absolute;inset:20% 6% 7%;background:linear-gradient(140deg,var(--raised),var(--well) 58%,var(--raised));border:1px solid color-mix(in srgb, var(--foil-mid) 25%, transparent);box-shadow:inset 0 0 0 3px #0006,0 0 0 2px color-mix(in srgb, var(--foil-hi) 7%, transparent);border-radius:var(--radius-s);overflow:hidden;display:grid;place-items:center}
.slab-topo {position:absolute;inset:-20%;background:repeating-radial-gradient(ellipse at 100% 0%,transparent 0 5.22cqw,color-mix(in srgb, var(--foil-mid) 7%, transparent) 5.65cqw 6.09cqw,transparent 6.52cqw 13.04cqw);transform:rotate(-12deg)}
.slab-brand {position:relative;display:flex;flex-direction:column;align-items:center;gap:7.39cqw;transform:translateY(-5%);filter:drop-shadow(0 1px 1px #000)}
.slab-brand>svg {width:26%;min-width:45px;height:62px;color:var(--foil-mid)}
.slab-brand>b {font:700 italic clamp(32px,4.5vw,54px)/.85 var(--display);letter-spacing:-2px;background:linear-gradient(145deg,var(--foil-hi),var(--foil-lo) 55%,var(--foil-hi));background-clip:text;color:transparent;text-align:center}
.slab-seal {position:absolute;bottom:6%;font-size:2.17cqw;letter-spacing:.57cqw;color:var(--foil-lo)}
.slab-bottom {position:absolute;bottom:2.6%;left:0;right:0;text-align:center;font-size:1.74cqw;letter-spacing:.48cqw;color:var(--foil-lo)}
.slab-shine {position:absolute;inset:-30%;background:linear-gradient(115deg,transparent 22%,rgba(255,255,255,.025) 36%,rgba(255,255,255,.07) 48%,rgba(255,255,255,.025) 60%,transparent 76%);transform:translateX(-30%);animation:opening-slab-shine 7s ease-in-out infinite;pointer-events:none}
.opening-theater[data-phase=sealed] .opening-clues {position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:37px;padding-bottom:2vh}
.opening-clue.visible {opacity:1;transform:none;filter:none}
.opening-clue>span {display:block;color:var(--ink-soft);font-size:var(--text-label);letter-spacing:4px;margin-bottom:13px}
.opening-result-layout {position:absolute;z-index:1;inset:12% 12% 10%;display:grid;grid-template-columns:1.1fr 1fr;gap:8%;align-items:center;perspective:1400px}
.opening-result-art {position:relative;height:100%;min-height:0;display:grid;place-items:center;perspective:1200px}

/* The mover carries the slab from the sealed anchor into the column; the turn happens in place once the clues are done. */
.opening-card-move {min-height:0;min-width:0;position:relative;width:100%;height:100%;display:grid;place-items:center;transform-style:preserve-3d}
/* Until the flip the card stays where it waited and the clues sit beside it (the stage offsets both from their result
   places); on the flip both glide home over the turn's .9s. */
.opening-card-move.is-gliding,.opening-copy-move.is-gliding {transition:transform .9s cubic-bezier(.3,.1,.2,1)}

/* One transform for the card: the turn animates --flip/--flip-z/--flip-scale, the pointer tilt lives in --tilt-x/--tilt-y and transitions on its own, so the two never fight or snap. */
.opening-card-turn {min-height:0;max-height:100%;position:relative;width:min(100%,340px);height:min(100%,520px);transform-style:preserve-3d;transform:rotateX(var(--tilt-x)) rotateY(calc(var(--flip) + var(--tilt-y))) translateZ(var(--flip-z)) scale(var(--flip-scale));transition:--tilt-x .3s ease-out,--tilt-y .3s ease-out}
.opening-card-turn.is-facedown {--flip:180deg}

/* Face down, the edges hug the slab back (90% wide, .64); they follow the photo from the moment the turn is edge-on (edge-back comes off then). */
.opening-card-turn:is(.is-facedown,.edge-back)>.opening-slab-depth {width:90%;height:auto;aspect-ratio:.64;top:50%;transform:translate(-50%,-50%)}
.opening-result-back,.opening-result-front {position:absolute;inset:0;backface-visibility:hidden;transform-style:preserve-3d}
.opening-result-back {transform:rotateY(180deg);width:90%;height:auto;aspect-ratio:.64;left:5%;top:50%;bottom:auto;margin-top:calc(-45% / .64)}

.opening-result-front {display:flex;align-items:center;justify-content:center;overflow:visible}

/* The shell and the edge faces take the photo's aspect (set on the turning card on load); the faces sit on the card itself so both halves of the flip show them. */
.opening-card-turn>.opening-slab-depth {inset:0 auto;left:50%;height:100%;width:auto;aspect-ratio:var(--card-aspect,.59);transform:translateX(-50%)}
.opening-slab-shell {position:relative;display:block;height:100%;max-width:100%;aspect-ratio:var(--card-aspect,.59);transform-style:preserve-3d}
.opening-slab-shell>img {display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 24px 30px #0008) drop-shadow(0 0 30px rgba(var(--hit-rgb),.12));user-select:none;transform:translateZ(calc(var(--slab-depth)/2))}
.image-unavailable .opening-slab-shell {visibility:hidden}
.opening-result-copy {position:relative}
.opening-copy-move {position:relative;min-width:0;max-width:420px;perspective:1400px}

/* The copy column is one two-sided panel: the clues build up on its front while the card waits face down, and on the
   flip the panel turns over with the card (same keyframes, same direction) to show the full result on its back, like
   a page. Both faces share one grid cell, so the column keeps the result's size from the start and nothing moves. */
.opening-copy-turn {position:relative;display:grid;min-width:0;transform-style:preserve-3d}
.opening-copy-turn>* {grid-area:1/1;backface-visibility:hidden;min-width:0}
/* Both faces fill the panel, so the turn is about the panel's centre and the result never jumps sideways when it
   settles (a narrower back would be mirrored to the other side while turned). */
.opening-clue-face {align-self:center}
.opening-copy-turn>.opening-result-copy {transform:rotateY(180deg)}
.opening-copy-turn.is-turned {transform:rotateY(-180deg);animation:opening-copy-turn .9s linear backwards}
.opening-copy-turn.is-settled {transform:none}
.opening-copy-turn.is-settled>.opening-result-copy {transform:none}
.opening-copy-turn.is-settled>.opening-clue-face {visibility:hidden}
@keyframes opening-copy-turn {
  0%{transform:rotateY(0);animation-timing-function:cubic-bezier(.55,0,.8,.2)}
  42%{transform:rotateY(-88deg) scale(1.03);animation-timing-function:cubic-bezier(.15,.7,.3,1)}
  58%{transform:rotateY(-185deg) scale(1.05);animation-timing-function:cubic-bezier(.3,0,.3,1)}
  100%{transform:rotateY(-180deg)}
}
@keyframes opening-copy-out {to{opacity:0;transform:translateY(-6px)}}
@keyframes opening-copy-in {from{opacity:0;transform:translateY(10px)}}
/* The value starts rolling when the page turns, not while it is still on the hidden back. */
.opening-result-copy[inert] .opening-roll-digit>span {animation-play-state:paused}
.opening-clue-face>.opening-clues {display:flex;flex-direction:column;align-items:flex-start;gap:30px}
.opening-clue-face .opening-clue {text-align:left}
.opening-clue-face .opening-clue>strong {font-size:clamp(26px,3vw,40px)}

/* The rarity chip takes the hit colour the stage sets per card. */
.opening-hit-rarity {font-size:var(--text-label);letter-spacing:2px;color:rgb(var(--hit-rgb))}
/* The rarity and, on a free preview, its one PREVIEW tag share the top line of the copy. */
.opening-result-tags {display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.opening-preview-tag {font-size:var(--text-label);letter-spacing:2px}
.opening-result-copy>h2 {font:500 clamp(26px,3.2vw,44px)/1.14 var(--display);letter-spacing:-1px;margin:18px 0 12px;text-wrap:balance}
/* A long card name (most graded listings) steps down a size on wide screens, so it stays within two or three lines
   and the value keeps the larger figure. */
@media(min-width:801px) {.opening-result-copy>h2.is-long {font-size:clamp(24px,2.3vw,32px);letter-spacing:-.5px}}
.opening-result-grade {font-size:var(--text-secondary);color:var(--ink-soft);line-height:1.7;margin:0 0 25px}
.opening-result-value>span {font-size:var(--text-label);color:var(--muted);letter-spacing:.5px}
.opening-result-actions {display:flex;gap:10px;margin:9px 0 18px}
.opening-sell {flex:1.5;min-width:0}
.opening-keep {flex:1;min-width:0}
.opening-again {margin-top:4px}
@keyframes opening-spin {to{transform:rotate(360deg)}}
@keyframes opening-foil-breathe {0%,100%{opacity:.1;transform:translateX(-7%)}50%{opacity:.65;transform:translateX(6%)}}

/* The halves pull apart in the pack's own plane, each pivoting on its bottom outer corner, so the top opens into a V and the slab rises from inside the bag. */
@keyframes opening-shard {0%{transform:translateZ(2px) translate(0,0) rotate(0);opacity:0}12%{opacity:1}100%{transform:translateZ(2px) translate(var(--dx),var(--dy)) rotate(var(--dr));opacity:0}}

/* --emerge-scale and --emerge-y (set by the stage) start the card centred in the bag's body and smaller than it. */
@keyframes opening-slab-shine {0%,100%{transform:translateX(-18%);opacity:.6}50%{transform:translateX(14%);opacity:1}}
.opening-result-value {padding-top:0;border:0;gap:4px}
.opening-result-value>strong {font-size:38px}
@media(min-height:900px) {.opening-camera,.opening-rip-anchor,.opening-slab-anchor {top:45%}
.opening-controls {bottom:8%}
.opening-result-layout {inset:14% 16% 13%}
}
@media(max-width:800px) {dialog.opening-theater {--pack-width:210px;--slab-width:240px}
.opening-hud {inset:18px 20px auto;gap:12px}
.opening-brand {font-size:var(--text-secondary)}
.opening-result-layout {inset:12% 7% 7%;gap:5%}
.opening-result-copy>h2 {font-size:28px}
.opening-result-actions {gap:7px}
.opening-sell,.opening-keep {--wa-form-control-padding-inline:.8em}
.opening-result-grade {font-size:var(--text-label)}
}
@media(max-width:600px) {.opening-sell-confirm,.opening-sold {text-align:center;justify-items:center}
.opening-outcome {justify-content:center}
.opening-terms {font-size:var(--text-secondary)}
dialog.opening-theater {--pack-width:190px;--slab-depth:16px;--slab-width:230px}
.opening-hud {inset:max(16px,env(safe-area-inset-top)) 16px auto;gap:10px}
.opening-brand {font-size:var(--text-secondary);gap:7px}
.opening-brand>svg {width:23px;height:26px}
.opening-settings {gap:7px}
.opening-pack-label {top:18%;gap:7px}
.opening-pack-label>b {font-size:16px;letter-spacing:2px}
.opening-pack-label>span {font-size:var(--text-label)}
.opening-camera {top:46%;perspective:900px}
.opening-controls {bottom:max(35px,env(safe-area-inset-bottom))}
.opening-choice-row {gap:23px}
.opening-shuffle {--wa-form-control-padding-inline:1.9em}
.opening-commit-status {bottom:16%}
.opening-commit-status>b {font-size:var(--text-body)}
.opening-sealed-stage {inset:19% 0 20%}
.opening-tear-stage {inset:20% 0 18%}
.opening-rising-slab {width:220px}
.opening-clues {gap:35px}
.opening-clue>strong {font-size:33px}
.opening-result-layout {inset:16% 8% max(28px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:17px;justify-content:center}
.opening-result-art {width:100%;height:auto;flex:1;min-height:0;max-height:48vh}
/* The card box has the card's own shape, so the photo fills it and the acrylic edges match the photo on the turn. */
.opening-card-turn {width:min(52vw,230px,28vh);height:auto;aspect-ratio:.59}
/* A narrow screen has no room for the desktop's door-like swing (the push toward the camera applied after the turn
   carries the card sideways): the push comes first, so the card turns about its own centre line. */
.opening-card-turn {transform:translateZ(var(--flip-z)) rotateX(var(--tilt-x)) rotateY(calc(var(--flip) + var(--tilt-y))) scale(var(--flip-scale))}
.opening-copy-move {width:100%;flex:none;max-width:340px;align-self:center}
.opening-result-copy {text-align:center}
.opening-result-tags {justify-content:center}
.opening-clue-face {align-self:start}
.opening-clue-face>.opening-clues {flex-direction:row;justify-content:center;align-items:start;gap:22px}
.opening-clue-face .opening-clue {text-align:center}
.opening-clue-face .opening-clue>span {letter-spacing:1.4px;margin-bottom:6px}
.opening-clue-face .opening-clue>strong {font-size:18px}
.opening-hit-rarity {font-size:var(--text-label);letter-spacing:1.5px}
.opening-result-copy>h2 {font-size:23px;margin:10px 0 6px;letter-spacing:-.5px}
.opening-result-grade {font-size:var(--text-label);margin:0 0 12px}

.opening-result-value>span {font-size:var(--text-label)}

.opening-result-actions {margin:6px 0 9px;gap:9px}
.opening-result-back {width:90%;left:5%}
/* Card above, copy below: only the card turns. The panel stays flat; the clues fade out as the turn starts and the
   result fades in where they were as the face comes round. */
.opening-copy-turn>.opening-result-copy {transform:none;opacity:0}
.opening-copy-turn.is-turned {transform:none;animation:none}
.opening-copy-turn.is-turned>.opening-clue-face {animation:opening-copy-out .3s cubic-bezier(.4,0,1,1) both}
.opening-copy-turn.is-turned>.opening-result-copy {opacity:1;animation:opening-copy-in .5s .4s cubic-bezier(.2,.8,.2,1) backwards}
.opening-copy-turn.is-settled>.opening-result-copy {opacity:1}
}
@media(max-height:700px) and (max-width:600px) {dialog.opening-theater {--pack-width:155px;--slab-width:195px}
.opening-pack-label {top:18%}
.opening-controls {bottom:20px}
.opening-camera,.opening-rip-anchor,.opening-slab-anchor {top:48%}
.opening-result-layout {inset:15% 9% 16px;gap:8px}
.opening-result-art {max-height:36vh}
.opening-result-copy>h2 {font-size:19px;margin:7px 0 3px}
.opening-result-value>strong {font-size:30px}
.opening-result-grade {margin-bottom:7px}
}
/* Skip mode (the HUD's bolt, data-fast) is a cross-fade: the script fades the ring out and the face-up result in, and
   the result rests in its end state like reduced motion (none of the reveal's own animations or transitions, no flash).
   The status line shows only if the result keeps it waiting. */
.opening-theater[data-fast=true][data-phase=committing]:not([data-hold]) .opening-commit-status {display:none}
.opening-theater[data-fast=true]:is([data-phase=reveal],[data-phase=result]) :is(*,*::before,*::after) {animation:none!important;transition:none!important}
.opening-theater[data-fast=true] .opening-result-copy {opacity:1;transform:none}
.opening-theater[data-fast=true] .opening-reveal-flash {display:none}
/* A rarity word that stands still (skip mode, reduced motion) is one whole word, centred and sized to fit the width:
   a clipped repeat would read as another rarity (UNCOMMON cut to COMMON). */
.opening-theater[data-fast=true] .opening-reveal-word {left:50%;transform:translate(-50%,-50%);font-size:min(300px,30vw,calc(94vw/(var(--chars,8)*.74)))}
.opening-theater[data-fast=true] .opening-reveal-word>span:not(:first-child) {display:none}
@media(prefers-reduced-motion:reduce) {.opening-theater .opening-reveal-word {left:50%;transform:translate(-50%,-50%);font-size:min(300px,30vw,calc(94vw/(var(--chars,8)*.74)))}
.opening-theater .opening-reveal-word>span:not(:first-child) {display:none}}
@media(prefers-reduced-motion:reduce) {.opening-theater *,.opening-theater *:before,.opening-theater *:after {animation:none!important;transition:none!important}
.opening-result-copy {opacity:1;transform:none}
.opening-copy-turn.is-turned {transform:none}
.opening-copy-turn.is-turned>.opening-clue-face {visibility:hidden}
.opening-rip-half {opacity:0}
.opening-rip-shard {display:none}
.opening-rising-slab {opacity:1}
.opening-clue {filter:none}
.opening-card-turn {transform:none}
}
.opening-clue {text-align:center;opacity:0;transform:translateY(14px) scale(.95);filter:blur(5px);transition:opacity .45s,transform .65s cubic-bezier(.2,.8,.2,1),filter .4s;max-width:90vw}
.opening-clue>strong {font:500 clamp(28px,4vw,46px) var(--display);text-shadow:0 0 35px color-mix(in srgb, var(--ink) 8%, transparent);letter-spacing:-.5px;display:inline-block;max-width:90vw;text-wrap:balance}
.opening-theater[data-phase=result] .opening-result-back {visibility:hidden}
@keyframes opening-back-away {0%,35%{opacity:1}52%,100%{opacity:0}}
.opening-image-fallback {position:absolute;inset:10%;border:1px solid color-mix(in srgb, var(--ink-soft) 16%, transparent);border-radius:var(--radius-l);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;background:var(--panel)}
.opening-image-fallback>svg {width:55px;height:60px;color:var(--muted)}
.opening-image-fallback>span {font-size:var(--text-secondary);color:var(--ink-soft)}

/* Land the visual pulse on the same midpoint as the reveal sound. */

/* The category's reveal world (src/assets/scenes) stays faint during selection and opens up behind the card. */
.opening-scene {position:absolute;inset:-3%;background-image:var(--opening-scene);background-size:cover;background-position:center;filter:blur(9px) saturate(.85);opacity:.13;transform:scale(1.07);transition:opacity 1.1s,filter 1.1s,transform 9s ease-out}
.opening-scene-shade {position:absolute;inset:0;background:linear-gradient(90deg,#0004,#000a 64%,#000b),linear-gradient(0deg,#000c,transparent 60%,#0007)}
.opening-theater[data-phase=sealed] .opening-scene {opacity:.22}
.opening-theater[data-phase=clues] .opening-scene {opacity:.4;filter:blur(6px) saturate(.75);transform:scale(1.04)}
@media(max-width:600px) {.opening-scene-shade {background:linear-gradient(0deg,#000e,#000a 45%,#0004 80%,#000b)}
.opening-theater[data-phase=reveal] .opening-scene,.opening-theater[data-phase=result] .opening-scene {opacity:.76;background-position:38% center}
.opening-theater[data-category=onepiece] .opening-scene {background-position:25% center}
}
@media(prefers-reduced-motion:reduce) {.opening-scene {transform:none!important;transition:none!important}
}

/* ── Emotion curve (docs/web/opening-emotion.md). Stage content only; HUD and control skins stay above. ── */

/* 1 · Anticipation. The camera eases in to its resting distance (ending exactly where the tear anchors sit) and the room dims around the ring. */
.opening-spot {position:absolute;inset:0;background:radial-gradient(ellipse 62% 54% at 50% 46%,transparent 34%,color-mix(in srgb,var(--paper) 72%,transparent) 100%)}
.opening-spot::after {content:"";position:absolute;inset:0;opacity:0;transition:opacity .45s .15s;background:radial-gradient(ellipse 34% 48% at 50% 44%,transparent 40%,color-mix(in srgb,var(--paper) 60%,transparent) 100%)}
.opening-theater[data-entry] .opening-spot {animation:opening-fade-in 1.2s ease-out both}
@keyframes opening-fade-in {from{opacity:0}}

/* Idle sheen: --pack-sheen turns the 3D studio (pack-3d.mjs), so the softbox glints slide across the foil and back. */
@property --pack-sheen {syntax:'<number>';inherits:false;initial-value:0}
.opening-theater[data-pack3d][data-phase=select]:not([data-lowfx]) .opening-camera {animation:opening-sheen 4.5s 1.8s ease-in-out infinite}
@keyframes opening-sheen {0%,71%,100%{--pack-sheen:0}24%,47%{--pack-sheen:1}}

/* Live layer: only when the stage has audience data; it shows while the reel spins. */
.opening-live {justify-self:center;display:inline-flex;align-items:center;gap:8px;height:24px;padding:0 10px;border-radius:var(--radius-pill);font:600 var(--text-label) var(--display);letter-spacing:1.5px;color:var(--crimson-400);background:color-mix(in srgb,var(--paper) 70%,transparent);border:1px solid color-mix(in srgb,var(--crimson-500) 40%,transparent);opacity:0;transition:opacity .4s}
.opening-live>i {width:6px;height:6px;border-radius:50%;background:var(--crimson-500)}
.opening-theater[data-phase=shuffling] .opening-live {opacity:1}

/* 2 · Tension. On the lock (after the hush) the chosen pack lifts into its own light and the rest of the ring drops away; the torn pack keeps the lift. */
.opening-pack-front {filter:brightness(.58);position:absolute;inset:0;-webkit-box-reflect:below -4px linear-gradient(transparent 25%,#fff2);transition:filter .4s}
.opening-theater[data-locked] .opening-spoke.is-selected {--spoke-lift:var(--pick-lift);transition-delay:0s,0s,.15s}
.opening-theater[data-locked] .opening-spoke:not(.is-selected) .opening-pack-front {filter:brightness(.3);transition-delay:.15s}
.opening-theater[data-locked] .opening-spot::after {opacity:1}
.opening-rip-anchor {position:absolute;left:50%;top:46%;width:var(--pack-width);height:var(--pack-height);margin:calc(var(--pack-height)/-2) 0 0 calc(var(--pack-width)/-2);transform-style:preserve-3d;z-index:3;transform:translateY(var(--pick-lift))}


/* 3 · Burst. The burst is the same for every tier; the rarity colour waits for the flip (data-tier and data-heat are set on the turn), then the edge light takes it, as hot as the tier. */
.opening-theater[data-tier=common] {--heat:.3}
.opening-theater[data-tier=uncommon] {--heat:.55}
.opening-theater[data-tier=rare] {--heat:.75}
.opening-theater[data-tier=epic] {--heat:.9}
.opening-theater[data-tier=legendary] {--heat:1}

.opening-rip-burst {position:absolute;inset:0;pointer-events:none;transform-style:preserve-3d}
@keyframes opening-fragment {0%{transform:translateZ(3px) translate(0,0) rotate(0) scale(.6);opacity:0}10%{opacity:1}100%{transform:translateZ(3px) translate(var(--dx),calc(var(--dy) + 60px)) rotate(var(--dr)) scale(1);opacity:0}}

.opening-result-value {border-top:1px solid color-mix(in srgb, var(--ink-soft) 7%, transparent);padding-top:23px;display:flex;flex-direction:column;gap:9px;animation:opening-fade-in .2s both}
.opening-result-value>strong {font:500 clamp(38px,4.5vw,62px)/1.1 var(--display);letter-spacing:-1.5px;color:var(--ink);font-variant-numeric:tabular-nums;line-height:1.1}



/* 4 · Afterglow. The buyback lock slides in under the value; "Open another pack" waits longer the better the pull. */
.opening-lock {display:inline-flex;align-items:center;gap:10px;min-height:32px;margin:12px 0 4px;padding:0 12px;border-radius:var(--radius-pill);background:color-mix(in srgb,var(--teal-400) 10%,transparent);border:1px solid color-mix(in srgb,var(--teal-400) 50%,transparent);color:var(--teal-400);font:600 var(--text-label) var(--display);letter-spacing:1.5px;font-variant-numeric:tabular-nums}
.opening-lock:not(.is-in) {visibility:hidden}
.opening-lock>b {font-size:var(--text-body);letter-spacing:0}
.opening-lock>time {color:color-mix(in srgb,var(--teal-400) 75%,var(--ink-soft));letter-spacing:.5px}
.opening-lock.is-in {animation:opening-lock-in .32s cubic-bezier(.2,.8,.2,1) both}
@keyframes opening-lock-in {from{opacity:0;transform:translateY(-10px)}}
.opening-result-copy.is-final>.opening-again {animation:opening-again-in .3s var(--again-delay,1.5s) both}
@keyframes opening-again-in {from{opacity:0;visibility:hidden}to{opacity:1;visibility:visible}}
.opening-theater[data-phase=result] .opening-card-turn {touch-action:none}
@media(max-width:600px) {.opening-lock {margin:4px auto 2px}
}
@media(prefers-reduced-motion:reduce) {.opening-rip-burst {display:none}
}

/* A photo wider than the card box (.64, the box on every screen) fits by width: shell and edges share that box, centred. */
/* Encased cards (already in a grading slab): the Pack Land acrylic fades as the card comes round edge-on, so the photo stands alone on its shadow; the back and the edge-on rim still have thickness. */
.opening-card-turn.is-encased:not(.is-facedown,.edge-back)>.opening-slab-depth {opacity:0;transition:opacity .25s ease-out}
.opening-card-turn.is-encased:not(.is-facedown,.edge-back) .opening-slab-shell>img {transform:none}
.opening-card-turn.is-wide .opening-slab-shell {width:100%;height:auto}
.opening-card-turn.is-wide:not(.is-facedown,.edge-back)>.opening-slab-depth {top:50%;bottom:auto;width:100%;height:auto;transform:translate(-50%,-50%)}

/* Cinematic v2: a wide selection, an intimate seal shot, then a centered hero.
   Light has a direction and a single endpoint; the result keeps the card readable. */
.opening-theater {--pick-lift:calc(var(--pack-height)*-.03);--heat:0;--opening-primary:var(--brand-primary,var(--crimson-500));--opening-accent:var(--brand-accent,var(--teal-400));--focus-scale:1.24}
.opening-world {position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:-1;background:#000}
.opening-theater .opening-scene {opacity:.07;filter:blur(8px) saturate(.4)}
.opening-theater[data-phase=sealed] .opening-scene,.opening-theater[data-phase=clues] .opening-scene {opacity:.1;filter:blur(8px) saturate(.4)}
.opening-theater[data-phase=reveal] .opening-scene,.opening-theater[data-phase=result] .opening-scene {opacity:.18;filter:blur(6px) saturate(.5);transform:scale(1.025)}
/* The room keeps the clues' tone through the inhale and the turn: no tint or brightening before the face lands. */
.opening-theater[data-phase=reveal]:not([data-revealed]) .opening-scene {opacity:.1;filter:blur(8px) saturate(.4);transform:scale(1.04)}
.opening-theater .opening-aura {background:radial-gradient(ellipse at 50% 45%,color-mix(in srgb,var(--opening-primary) 8%,transparent),transparent 64%)}
.opening-theater[data-phase=result] .opening-aura {opacity:.45}
.opening-theater[data-entry] .opening-camera {animation:opening-arrive .85s cubic-bezier(.16,.8,.2,1) both}
.opening-theater[data-pack3d][data-phase=select][data-entry]:not([data-lowfx]) .opening-camera {animation:opening-arrive .85s cubic-bezier(.16,.8,.2,1) both,opening-sheen 4.5s 1.8s ease-in-out infinite}
@keyframes opening-arrive {from{opacity:0;transform:translate(-50%,-43%) scale(.78)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}
.opening-theater[data-phase=committing] .opening-camera {transform:translate(-50%,-50%) scale(var(--focus-scale));transition:transform .65s cubic-bezier(.2,.8,.2,1)}
.opening-theater[data-phase=committing] .opening-spoke.is-selected {--spoke-scale:1}
.opening-theater[data-phase=committing] .opening-commit-status {display:grid;bottom:9%}
.opening-tear-stage,.opening-sealed-stage {position:absolute;inset:0;perspective:1400px;perspective-origin:50% 42%}
.opening-rip-pack {position:absolute;inset:0;transform-style:preserve-3d}
/* The halves open like a pod: the seam snaps open (each half swings out about its outer edge, toward the camera), the
   card shows inside, the halves hang open while it slides up, then they fall away. */
@keyframes opening-half-left {0%{transform:translate(0,0) rotateZ(0) rotateY(0);opacity:1;animation-timing-function:cubic-bezier(.1,.8,.3,1)}14%{transform:translate(-3%,0) rotateZ(-2deg) rotateY(-30deg);opacity:1;animation-timing-function:cubic-bezier(.4,0,.6,1)}42%{transform:translate(-9%,2%) rotateZ(-7deg) rotateY(-42deg);opacity:1;animation-timing-function:cubic-bezier(.5,0,.75,.4)}100%{transform:translate(-95%,28%) rotateZ(-42deg) rotateY(-60deg);opacity:0}}
@keyframes opening-half-right {0%{transform:translate(0,0) rotateZ(0) rotateY(0);opacity:1;animation-timing-function:cubic-bezier(.1,.8,.3,1)}14%{transform:translate(3%,0) rotateZ(2deg) rotateY(30deg);opacity:1;animation-timing-function:cubic-bezier(.4,0,.6,1)}42%{transform:translate(9%,3%) rotateZ(8deg) rotateY(44deg);opacity:1;animation-timing-function:cubic-bezier(.5,0,.75,.4)}100%{transform:translate(95%,36%) rotateZ(48deg) rotateY(65deg);opacity:0}}
.opening-rising-slab {width:100%}
.opening-rip-burst>i {position:absolute;left:50%;top:var(--sy);width:calc(10px*var(--sz));height:calc(7px*var(--sz));margin-left:-5px;background:linear-gradient(135deg,var(--foil-hi),var(--foil-mid) 55%,var(--foil-lo));clip-path:polygon(0 30%,55% 0,100% 45%,70% 100%,15% 85%);opacity:0;animation:opening-fragment .8s calc(.08s + var(--sd)) cubic-bezier(.15,.65,.3,1) both}

@media(max-width:600px) {.opening-theater {--focus-scale:1.3}
.opening-rip-anchor,.opening-slab-anchor {top:47%}
}
@media(max-height:700px) {dialog.opening-theater {--pack-width:clamp(140px,27vh,205px);--slab-width:clamp(170px,29vh,220px)}
.opening-pack-label {top:14%}
.opening-camera,.opening-rip-anchor,.opening-slab-anchor {top:47%}
}

/* ── Two climaxes (docs/web/opening-two-climax-direction.md) ── */

/* The pick. The pack is knocked about from the click: slow, small knocks that come closer and harder, ending on a
   squeeze, wider and shorter, with the foil flaring (keyframes from shakeKeyframes(), run on the wrapper only; the 3D
   pack mirrors the stand-in's transform and brightness). The camera closes in over the first, slow knocks and the ring
   drops away, so the burst stage takes over the same framing. The sheen runs the length of the shake (beats.shake). */
.opening-theater[data-phase=committing] .opening-camera {transition:transform .7s cubic-bezier(.2,.8,.2,1)}
.opening-theater[data-phase=committing] .opening-spoke:not(.is-selected) {transition:opacity .3s,filter .3s,transform .6s cubic-bezier(.2,.75,.16,1)}
.opening-theater[data-phase=committing][data-shake] .opening-commit-status {display:none}
.opening-theater[data-shake] .opening-spoke.is-selected .opening-pack-front {transform-origin:50% 78%}
.opening-theater[data-shake] .opening-camera {animation:opening-shake-sheen 1.9s cubic-bezier(.6,0,.9,.6) both}
@keyframes opening-shake-sheen {0%{--pack-sheen:0}55%{--pack-sheen:-.6}100%{--pack-sheen:1}}

/* The held breath: the shake is over but the result is not in yet. The squeeze lets go, then the pack breathes slowly
   (a little larger and brighter, never shaking) while the softbox drifts over the foil and the status reads under it. */
.opening-theater[data-hold] .opening-spoke.is-selected .opening-pack-front {transform-origin:50% 78%;animation:opening-hold-in .5s ease-out both,opening-hold 3.2s .5s ease-in-out infinite}
.opening-theater[data-hold] .opening-camera {animation:opening-sheen 6.4s ease-in-out infinite}
@keyframes opening-hold-in {from{transform:scale(1.045,.94);filter:brightness(1.6)}to{transform:none;filter:brightness(1.12)}}
@keyframes opening-hold {0%,100%{transform:none;filter:brightness(1.12)}50%{transform:scale(1.018);filter:brightness(1.3)}}

/* The burst. The squeeze holds until pop (.08s), then releases with an overshoot; the halves peel open from the seam
   on the same frame, and the card, which sits inside the bag between its front and its back, slides up out of it and
   comes forward to rest at land (1.4s). Every delay below counts from the stage's first frame. */
.opening-rip-pack {animation:opening-pack-pop .3s linear both}
@keyframes opening-pack-pop {
  0%,27%{transform:scale(calc(var(--focus-scale)*1.035),calc(var(--focus-scale)*.955))}
  55%{transform:scale(calc(var(--focus-scale)*1.07))}
  100%{transform:scale(var(--focus-scale))}
}
.opening-rip-left {animation:opening-half-left 1.05s .08s linear both}
.opening-rip-right {animation:opening-half-right 1.05s .08s linear both}
.opening-rip-shard {animation-delay:calc(var(--sd)*.12)}
/* Transform only: an opacity change would flatten the slab's 3D edges onto its face while it moves. With the 3D pack
   the card is inside the bag: the pack draws its back half under the card and its front half over it (two layers,
   pack-3d.mjs), so the card shows through the seam as the halves peel open, at its emerging size (no more than 80% of
   the bag's body). It slides up a little (staying inside the bag's height, rise .6s) and only once the halves have
   fallen away comes forward into place (land 1.4s). Without WebGL the wrapper is one flat image, so the card is drawn
   in front of it instead, hidden until the halves start to part and growing out of the seam from 45% of that size. */
.opening-tear-stage>.opening-slab-anchor {z-index:4;animation:opening-slab-wait .1s step-end}
@keyframes opening-slab-wait {from,to{visibility:hidden}}
.opening-theater[data-pack3d] .opening-tear-stage>.opening-slab-anchor {z-index:3;animation:none}
.opening-theater[data-pack3d] .opening-tear-stage>.opening-pack-3d {z-index:5}
.opening-theater[data-pack3d] .opening-tear-stage>.opening-pack-3d.is-under {z-index:2}
.opening-theater[data-pack3d] .opening-rising-slab {--emerge-from:var(--emerge-scale,.6)}
.opening-rising-slab {animation:opening-slab-emerge 1.32s .08s linear both}
@keyframes opening-slab-emerge {
  0%{transform:translateY(var(--emerge-y,55px)) scale(var(--emerge-from,calc(var(--emerge-scale,.6)*.45)));animation-timing-function:cubic-bezier(.25,.6,.3,1)}
  39%{transform:translateY(var(--emerge-top,-60px)) scale(var(--emerge-scale,.6));animation-timing-function:cubic-bezier(.45,0,.2,1)}
  100%{transform:none}
}

/* The wait for the second action: the card back floats and a reflection crosses it. Nothing on screen asks to tap. */
.opening-sealed-stage .opening-slab-anchor {animation:opening-float 3.4s ease-in-out infinite}
@keyframes opening-float {0%,100%{transform:translateY(0)}50%{transform:translateY(-9px)}}
.opening-theater[data-phase=sealed] .slab-shine {animation-duration:6s}


/* The second climax. Each clue lands on a small push on the card (no light, no colour); the third is the strongest.
   Separate keyframe names restart the push per clue. */
.opening-theater[data-clue="0"] .opening-card-turn.is-facedown {animation:opening-clue-push-0 .36s ease-out}
.opening-theater[data-clue="1"] .opening-card-turn.is-facedown {animation:opening-clue-push-1 .36s ease-out}
.opening-theater[data-clue="2"] .opening-card-turn.is-facedown {animation:opening-clue-push-2 .5s ease-out}
@keyframes opening-clue-push-0 {40%{--flip-scale:1.02}}
@keyframes opening-clue-push-1 {40%{--flip-scale:1.03}}
@keyframes opening-clue-push-2 {30%{--flip-scale:1.055;--flip-z:24px}}

/* The face lands with its highlight: the sheen crosses the card on the impact frame, not while it is still face down. */

/* The value rolls in digit by digit as the copy arrives; the resting transform is the final digit, so reduced
   motion shows it still. */
.opening-roll {display:inline-flex;align-items:flex-start;height:1.1em;overflow:hidden}
.opening-roll-digit {display:block;height:1.1em;overflow:hidden}
.opening-roll-digit>span {display:block;transform:translateY(calc(var(--n)*-1.1em));animation:opening-roll .55s calc(.1s + var(--i)*.05s) cubic-bezier(.25,.7,.2,1) backwards}
.opening-roll-digit i {display:block;height:1.1em;font-style:normal;text-align:center}
.opening-roll-mark {display:block;height:1.1em}
@keyframes opening-roll {from{transform:translateY(0)}}


/* The stage holds the keyboard focus for the space bar; the container itself draws no ring. */
dialog.opening-theater:focus {outline:none}

/* The stage light: one element for the whole opening, aimed by spot() in px. The source is above the frame and never
   shown: a straight column of light from the top edge down to the subject (a wide haze and a brighter core; both fade out sideways through
   their own gradients, so no edge is ever visible) and an elliptical pool on the floor under the subject. It moves and resizes by transform only and fades by opacity, so it follows the pack, then the card,
   without ever popping. */
.opening-root {display:contents}
.opening-theater {--spot-light:color-mix(in srgb,var(--ink) 92%,var(--foil-hi))}
.opening-spotlight {position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none;opacity:0;transition:opacity .45s ease-out}
.opening-theater[data-spot]:not([data-spot=off]) .opening-spotlight {opacity:1}
.opening-spot-haze {position:absolute;inset:0;filter:blur(6px)}
.opening-spot-beam,.opening-spot-core,.opening-spot-pool {position:absolute;left:0;top:0;transform-origin:0 0;transition:transform .6s cubic-bezier(.2,.8,.2,1)}
.opening-spot-beam,.opening-spot-core {width:100px;height:100px;transform:translateX(calc(var(--beam-x,0)*1px)) scale(var(--beam-sx,1),var(--beam-sy,1))}
.opening-spot-beam,.opening-spot-core {-webkit-mask-image:linear-gradient(#000,rgba(0,0,0,.7) 55%,rgba(0,0,0,.45));mask-image:linear-gradient(#000,rgba(0,0,0,.7) 55%,rgba(0,0,0,.45))}
.opening-spot-beam {background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--spot-light) 4%,transparent) 14%,color-mix(in srgb,var(--spot-light) 10%,transparent) 34%,color-mix(in srgb,var(--spot-light) 12%,transparent) 50%,color-mix(in srgb,var(--spot-light) 10%,transparent) 66%,color-mix(in srgb,var(--spot-light) 4%,transparent) 86%,transparent)}
.opening-spot-core {background:linear-gradient(90deg,transparent 26%,color-mix(in srgb,var(--spot-light) 6%,transparent) 38%,color-mix(in srgb,var(--spot-light) 12%,transparent) 50%,color-mix(in srgb,var(--spot-light) 6%,transparent) 62%,transparent 74%)}
.opening-spot-pool {width:100px;height:100px;border-radius:50%;transform:translate(calc(var(--pool-x,0)*1px),calc(var(--pool-y,0)*1px)) scale(var(--pool-sx,1),var(--pool-sy,1));background:radial-gradient(closest-side,color-mix(in srgb,var(--spot-light) 26%,transparent),color-mix(in srgb,var(--spot-light) 9%,transparent) 55%,transparent)}
.opening-spotlight.is-snap *,.opening-spotlight.is-snap {transition:none!important}
/* The close-up follows the camera's .36s push; the light breathes while the card back waits and flares with the burst. */
.opening-theater[data-phase=committing] :is(.opening-spot-beam,.opening-spot-core,.opening-spot-pool) {transition-duration:.36s}
.opening-theater[data-phase=sealed] .opening-spot-haze {animation:opening-spot-breathe 3.4s ease-in-out infinite}
.opening-theater[data-phase=tearing] .opening-spot-haze {animation:opening-spot-flare .6s .06s ease-out both}
@keyframes opening-spot-breathe {50%{opacity:.8}}
@keyframes opening-spot-flare {0%{filter:blur(10px) brightness(1)}10%{filter:blur(10px) brightness(2.2)}100%{filter:blur(10px) brightness(1)}}

/* ── The second climax, rebuilt (2026-11-09) ──

   The inhale (.55s, beats.inhale): the room drops to near black, the stage light is already pulled, the clues fade
   and the card draws back a little with a tremor. No colour yet. */
.opening-theater[data-inhale] .opening-world {opacity:.15;transition:opacity .4s ease-in}
.opening-theater[data-inhale] .opening-card-turn.is-facedown {animation:opening-inhale .55s ease-in both}
.opening-theater[data-inhale] .slab-shine {opacity:0}
@keyframes opening-inhale {0%{--flip-scale:1;--tilt-y:0deg}60%{--flip-scale:.95;--tilt-y:0deg}70%{--tilt-y:1.5deg}80%{--tilt-y:-1.5deg}90%{--tilt-y:1.2deg}100%{--flip-scale:.94;--tilt-y:0deg}}

/* The flip: out of the inhale the card whips over, edge-on at .38s, square to the camera
   and punched forward at .52s (the impact), then settles. */
.opening-card-turn.is-turning {animation:opening-card-turn .9s linear backwards}
@keyframes opening-card-turn {
  0%{--flip:180deg;--flip-z:0px;--flip-scale:.94;animation-timing-function:cubic-bezier(.55,0,.8,.2)}
  42%{--flip:92deg;--flip-z:150px;--flip-scale:1.08;animation-timing-function:cubic-bezier(.15,.7,.3,1)}
  58%{--flip:-5deg;--flip-z:90px;--flip-scale:1.15;animation-timing-function:cubic-bezier(.3,0,.3,1)}
  80%{--flip:2deg;--flip-z:18px;--flip-scale:1.02}
  100%{--flip:0deg;--flip-z:0px;--flip-scale:1}
}
.is-turning>.opening-result-back {animation:opening-back-off .9s both}
@keyframes opening-back-off {0%,41%{opacity:1}43%,100%{opacity:0}}

/* The sparks travel with the card (inside the mover, behind the card). Their resting state is the settled look, so
   reduced motion shows them still. */
.opening-reveal-light {position:absolute;left:50%;top:50%;width:0;height:0;transform:translateZ(-90px);transform-style:preserve-3d;pointer-events:none}
.opening-reveal-light>* {position:absolute;left:0;top:0}
.opening-reveal-sparks>i {position:absolute;left:0;top:0;transform:translate(calc(var(--sx)*var(--sr)*min(42vw,420px)),calc(var(--sy)*var(--sr)*min(42vh,360px)));animation:opening-spark-out 1.1s calc(.5s + var(--sd)) cubic-bezier(.08,.8,.2,1) both}
.opening-reveal-sparks b {display:block;width:var(--sz);height:var(--sz);margin:calc(var(--sz)/-2);border-radius:50%;background:color-mix(in srgb,var(--ink) 70%,rgb(var(--hit-rgb)));box-shadow:0 0 8px rgba(var(--hit-rgb),.9);opacity:.55;animation:opening-spark-drift var(--st) calc(1.6s + var(--sd)) ease-in-out infinite alternate}
@keyframes opening-spark-out {0%{transform:translate(0,0) scale(1.8);opacity:0}8%{opacity:1}100%{transform:translate(calc(var(--sx)*var(--sr)*min(42vw,420px)),calc(var(--sy)*var(--sr)*min(42vh,360px)));opacity:1}}
@keyframes opening-spark-drift {0%{transform:translateY(0);opacity:.55}50%{opacity:.15}100%{transform:translateY(-34px);opacity:.6}}

/* The stage layer: the rarity word in giant outline type behind everything, the card and the copy included (the
   result layout sits one layer above it), drifting slowly once it lands; and the
   flash on the impact frame above the content, which rushes in from the edges like the rest of the light. */
.opening-reveal-stage {position:absolute;inset:0;z-index:0;pointer-events:none;overflow:hidden}
.opening-reveal-word {position:absolute;left:0;top:var(--reveal-y,50%);display:flex;gap:.35em;white-space:nowrap;transform:translate(-8%,-50%);font:800 clamp(110px,19vw,300px)/1 var(--display);letter-spacing:-.02em;color:transparent;-webkit-text-stroke:1.5px rgba(var(--hit-rgb),.9);opacity:calc(.08 + var(--heat,.3)*.08);animation:opening-word-in 1.2s .5s cubic-bezier(.1,.8,.2,1) both,opening-word-drift 30s 1.7s linear infinite}
@keyframes opening-word-in {0%{opacity:0;transform:translate(-8%,-50%) scale(1.5)}12%{opacity:.85}100%{opacity:calc(.08 + var(--heat,.3)*.08);transform:translate(-8%,-50%) scale(1)}}
@keyframes opening-word-drift {to{transform:translate(-33%,-50%)}}
.opening-reveal-flash {position:absolute;inset:0;z-index:9;pointer-events:none;opacity:0;background:color-mix(in srgb,var(--ink) 10%,transparent);box-shadow:inset 0 0 34vmax rgba(var(--hit-rgb),.9),inset 0 0 16vmax color-mix(in srgb,var(--ink) 30%,transparent);animation:opening-flash .7s .5s ease-out both}
@keyframes opening-flash {0%{opacity:0}7%{opacity:calc(.55 + var(--heat,.3)*.4)}100%{opacity:0}}
/* The room comes back on the impact frame, brighter than before: the category scene shows through the colour. */
.opening-theater[data-revealed] .opening-world {transition:opacity .3s .48s}
.opening-theater[data-revealed] .opening-scene {opacity:.34;filter:blur(4px) saturate(.9);transition:opacity .8s .5s,filter .8s .5s}
.opening-theater {--reveal-y:50%}
@media(max-width:600px) {.opening-theater {--reveal-y:40%}
.opening-reveal-word {font-size:clamp(90px,30vw,160px)}
}

@media(prefers-reduced-motion:reduce) {.opening-reveal-flash {display:none}
}

/* The rarity light comes in from the edges of the stage, never from a disc behind the card: the centre stays black
   and the scene shows through. Nothing before the flip carries colour or light: the edges stay black through the clues
   and the inhale, the pull's colour rushes in on the impact frame and settles to a level set by the tier
   (--heat: common .3 … legendary 1). */
.opening-theater {--edge-rgb:205,205,215}
.opening-theater[data-heat] {--edge-rgb:var(--hit-rgb)}
.opening-edge {position:absolute;inset:0;z-index:0;pointer-events:none;opacity:calc(.35 + var(--heat,.3)*.4);box-shadow:inset 0 0 24vmax rgba(var(--edge-rgb),.42),inset 0 -12vmax 20vmax -8vmax rgba(var(--edge-rgb),.3)}
.opening-theater:not([data-revealed]) .opening-edge {opacity:0}
.opening-theater[data-revealed] .opening-edge {animation:opening-edge-flare 1.6s .5s cubic-bezier(.15,.7,.25,1) both}
/* Opacity only: scaling the layer below 1 would show its border as a frame. */
@keyframes opening-edge-flare {0%{opacity:0}6%{opacity:1}100%{opacity:calc(.35 + var(--heat,.3)*.4)}}

/* The card's glare: the acrylic over the photo catches light as one broad, soft sheet that drifts across once as the
   face lands and stays faint, with a hairline catch on the top edge. No narrow stripe. */
.opening-card-glare {position:absolute;inset:0;border-radius:var(--radius-l);overflow:hidden;pointer-events:none;transform:translateZ(calc(var(--slab-depth)/2 + 1px))}
.opening-card-glare>b {position:absolute;inset:-10% -60%;background:linear-gradient(112deg,transparent 22%,rgba(255,255,255,.03) 36%,rgba(255,255,255,.08) 48%,rgba(255,255,255,.03) 60%,transparent 76%);opacity:.5;transform:translateX(16%)}
.opening-card-glare::after {content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 1px 0 rgba(255,255,255,.16),inset 1px 0 0 rgba(255,255,255,.05)}
.opening-card-turn.is-turning .opening-card-glare>b {animation:opening-glare 2.6s .48s cubic-bezier(.2,.7,.2,1) both}
@keyframes opening-glare {0%{opacity:0;transform:translateX(-22%)}20%{opacity:1}100%{opacity:.5;transform:translateX(16%)}}
/* The photo and its glare are separate 3D layers inside the face; each hides its own back, so nothing of the face shows
   through the card back while it is turned away. */
.opening-result-front .opening-slab-shell>* {backface-visibility:hidden;-webkit-backface-visibility:hidden}

/* A phone held sideways has very little height. The pack label moves up into the header row (between the logo and
   the settings), and the result fits under the header: the card takes the full height on the left, the details sit
   beside it in compact type and scroll on their own if a long name still needs more room. */
@media(max-height:500px) and (min-width:601px) {.opening-pack-label {top:28px;gap:3px}
.opening-result-layout {inset:76px 6% 10px;grid-template-columns:minmax(0,.8fr) 1fr;grid-template-rows:100%;gap:5%}
.opening-card-turn {height:100%;width:auto;max-width:100%;aspect-ratio:.64}
.opening-copy-move {align-self:stretch;max-height:100%;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none}
.opening-copy-turn {min-height:100%;align-content:center}
.opening-result-copy>h2 {font-size:20px;margin:6px 0 3px}
.opening-result-grade {margin:0 0 6px}
.opening-result-value {padding-top:8px;gap:2px}
.opening-result-value>strong {font-size:28px}
.opening-lock {margin:6px 0 2px}
.opening-result-actions {margin:6px 0 4px}
}

/* Small phones (an SE-sized screen): the details tighten so the card keeps about a third of the height. Nothing is
   cut; long names still wrap. */
@media(max-height:600px) and (max-width:600px) {.opening-result-layout {inset:80px 7% 10px;gap:6px}
.opening-result-art {max-height:none}
.opening-result-copy>h2 {font-size:16px;margin:5px 0 2px}
.opening-result-grade {margin-bottom:4px}
.opening-result-value {padding-top:4px;gap:0}
.opening-result-value>strong {font-size:24px}
.opening-lock {margin:2px auto 0}
.opening-result-actions {margin:6px 0 2px}
.opening-again {margin-top:0}
}

/* After KEEP or SELL the outcome carries Open another pack itself (finish()), so the small link steps aside. */
.opening-result-copy.is-done .opening-again {display:none}
.opening-outcome-note:empty {display:none}
