/* Foil wrapper: CC0 Dumivid template, original print and motion. */
.sealed-pack {
  --pack: #e0c999; --ink: #162c2c; --foil: #c5d5d1;
  display: block; position: relative; width: 246px; aspect-ratio: 850 / 1402;
  padding: 0; border: 0; border-radius: 0; background: none; color: var(--pack);
  isolation: isolate; text-align: center; touch-action: pan-y; user-select: none;
  container-type: inline-size; filter: drop-shadow(12px 20px 14px #0008);
}
.sealed-pack:after { display: none; }
.pack-ghost { --pack: #d4e6dc; --ink: #092d30; --foil: #b7cdd0; }
.pack-jade { --pack: #f4dfad; --ink: #322748; --foil: #ddd0e6; }
.pack-physical { position: absolute; inset: 0; display: block; }
.foil-body,.foil-top { position: absolute; inset: 0; }
.foil-body { clip-path: polygon(1.3% 10%,98.7% 10%,100% 99.3%,98% 100%,2% 100%,0 99.3%); }
.foil-template { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; filter: grayscale(1) brightness(1.65); pointer-events: none; }
.foil-print { position: absolute; inset: 12% 3.3% 6.8%; overflow: hidden; background: var(--ink); border: 1px solid #ecf2da60; }
.foil-art { position: absolute; width: 100%; aspect-ratio: 1; left: 0; top: 11%; background-repeat: no-repeat; filter: saturate(.7) contrast(1.12); }
.foil-ink-shade { position: absolute; inset: 0; background: linear-gradient(180deg,var(--ink) 0%,transparent 25%,transparent 48%,var(--ink) 79%); }
.foil-brand { position: absolute; z-index: 2; top: 4%; width: 100%; left: 0; font: 600 9cqw/1.25 var(--serif); letter-spacing: 1.5cqw; text-shadow: 0 2px 8px #000a; }
.foil-brand>span { display: block; font: 2.05cqw/2.3 var(--sans); letter-spacing: 1.3cqw; }
.foil-label { position: absolute; bottom: 13%; left: 5%; width: 90%; display: flex; flex-direction: column; align-items: center; z-index: 2; }
.foil-series { font-size: 2.1cqw; letter-spacing: 1cqw; opacity: .7; margin-bottom: 2cqw; }
.foil-label>strong { font: 600 14cqw/1.2 var(--serif); text-shadow: 0 1px 10px #0009; }
.foil-description { font-size: 2.2cqw; letter-spacing: .5cqw; margin-top: 3cqw; }
.foil-rarities { display: block; margin-top: 6cqw; padding: 2cqw 4cqw; border-top: 1px solid #d9e9c84a; border-bottom: 1px solid #d9e9c84a; font-size: 2.8cqw; letter-spacing: .8cqw; }
.foil-bottom-copy { position: absolute; bottom: 3%; left: 0; width: 100%; font-size: 1.9cqw; letter-spacing: .45cqw; }
.foil-bottom-copy i,.foil-strip-copy i { font-style: normal; padding: 0 2cqw; }
.foil-reflection { position: absolute; inset: 0; background: linear-gradient(104deg,#fff1 0%,transparent 7%,#fff2 9%,#0003 12%,transparent 14%,#fff1 34%,#fff4 38%,transparent 44%,#0002 78%,#fff3 83%,transparent 88%,#0005 96%); mix-blend-mode: screen; opacity: .7; pointer-events: none; }
.foil-fold { position: absolute; top: 12%; bottom: 7%; width: 5%; border-radius: 50%; opacity: .3; background: linear-gradient(90deg,transparent,#0008,#fff9,transparent); }
.foil-fold-left { left: 4%; transform: skewY(14deg); }
.foil-fold-right { right: 3%; transform: skewY(-12deg); }
.foil-crimp { position: absolute; left: 1.5%; right: 1.5%; height: 5.5%; background: repeating-linear-gradient(90deg,#fff7 0 1px,#0005 1px 2px,transparent 2px 4px),linear-gradient(180deg,#9ba8ad,#e2e5df 30%,#697a80 80%,#d4d9d6); opacity: .85; }
.foil-crimp-bottom { bottom: .6%; border-top: 1px solid #fff5; }
.foil-top { clip-path: polygon(0 0,100% 0,98.7% 10%,1.3% 10%); transform-origin: 95% 10%; z-index: 3; }
.foil-crimp-top { top: .5%; height: 4.5%; }
.foil-strip-copy { position: absolute; left: 0; top: 6%; width: 100%; font-size: 2.4cqw; color: #273b3c; font-weight: 600; letter-spacing: .5cqw; }
.foil-mouth { position: absolute; left: 1%; right: 1%; top: 10%; height: 0; background: #030a0a; border-radius: 50%; box-shadow: 0 -2px 1px #e9e9dbb0; }
.foil-cut { position: absolute; top: 10%; left: 0; width: 100%; height: 1px; z-index: 5; background: #0618163b; }
.foil-cut>span { display: block; height: 2px; width: calc(var(--tear-progress,0)*100%); background: #fff1bb; box-shadow: 0 0 13px #fbe4a8; transition: width .08s; }
.foil-cut>i { position: absolute; left: -2px; top: -3px; border: 4px solid transparent; border-left-color: #07120f; }
.ticket-stage .sealed-pack { width: 184px; transform: rotate(-7deg); box-shadow: none; }
.ticket-stage:hover .sealed-pack { transform: rotate(-3deg) translateY(-5px); }
.ticket-stage { min-height: 410px; }

/* Fullscreen, quiet edges; all action stays in the center. */
.opening-dialog {
  width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0;
  padding: 24px 40px 26px; border: 0; border-radius: 0; overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%,#20332f 0%,#101c1d 32%,#050b0e 76%);
}
.opening-dialog[open] { display: flex; flex-direction: column; }
.opening-dialog::backdrop { background: #050b0e; }
.opening-top { position: relative; z-index: 6; flex: 0 0 auto; width: 100%; }
.opening-top h2 { font-size: 22px; color: #e9ddc3; }
.opening-top .game-eyebrow { color: #82918a; }
.opening-options { display: flex; align-items: center; gap: 8px; }
.opening-options>button { padding: 9px 12px; border: 1px solid #c8d1b824; border-radius: 30px; font-size: 10px; white-space: nowrap; color: #a6b1a8; background: #111c1e80; }
.opening-options>button[aria-pressed=true] { border-color: #cfbd8555; color: #e0c995; background: #c5ab7610; }
.opening-options>button:hover { border-color: #cfbd8599; color: #ead7b1; }
.opening-stage { flex: 1 1 0; min-height: 0; padding: 20px 0; width: 100%; }
.opening-stage>.sealed-pack { width: min(275px,calc((100dvh - 240px)*.606)); transform: rotate(-4deg); box-shadow: none; animation: foil-enter .6s cubic-bezier(.2,.7,.2,1) both; z-index: 2; }
.opening-stage>.sealed-pack:hover { filter: drop-shadow(12px 20px 14px #0008) brightness(1.07); }
.opening-stage>.sealed-pack:focus-visible { outline: 1px solid #e2ca99; outline-offset: 10px; }
.opening-stage>.pack-aura { width: min(70vw,580px); height: min(70vw,580px); border: 0; box-shadow: none; border-radius: 50%; background: radial-gradient(ellipse,#9bb8a31a,transparent 65%); }
.opening-stage>.pack-aura:after { inset: 12%; border: 1px solid #c3cbb510; }
.opening-progress { display: flex; align-items: center; justify-content: center; gap: 8px; height: 14px; flex: 0 0 14px; }
.opening-progress>span { width: 5px; height: 5px; border-radius: 50%; background: #a2b3aa33; transition: .3s; }
.opening-progress>span.seen { background: var(--dot); box-shadow: 0 0 9px color-mix(in srgb,var(--dot) 40%,transparent); }
.opening-progress>span.current { width: 22px; border-radius: 6px; }
.opening-status { color: #b2bdb4; min-height: 22px; margin: 12px 0 16px; font-size: 12px; line-height: 1.8; text-align: center; flex-shrink: 0; }
.opening-actions { min-height: 46px; flex-shrink: 0; position: relative; z-index: 6; }
.opening-actions .primary-game-button { border-radius: 30px; min-width: 210px; padding: 14px 24px; }
.opening-actions .subtle-button { color: #c2c7b5; }
.opening-dialog .tearing>.sealed-pack { animation: none; }
.opening-stage.tearing .pack-aura { animation: none; }
.tearing .foil-top { animation: foil-strip-away .68s cubic-bezier(.25,.7,.3,1) both; }
.tearing .foil-cut { opacity: 0; }
.tearing .foil-mouth { height: 8px; transition: height .3s; }
.tearing .foil-body { animation: foil-open-body .5s ease both; }
.opening-dialog .extracting>.sealed-pack { animation: foil-drop .72s cubic-bezier(.4,0,.8,.4) both; }
.extracted-stack { position: absolute; width: min(240px,calc((100dvh - 250px)*.58)); aspect-ratio: .6; opacity: 0; transform: translateY(50px) scale(.9); z-index: 1; }
.extracting .extracted-stack { animation: stack-extract .7s cubic-bezier(.16,.8,.24,1) both; }
.extracted-stack:before,.extracted-stack:after { content: ''; position: absolute; inset: 0; border: 1px solid #afac7d77; border-radius: 12px; background: #1e3331; transform: rotate(4deg) translate(6px,0); z-index: -1; }
.extracted-stack:after { transform: rotate(-3deg) translate(-6px,0); }

/* Original back design and tier reveal. */
.back-art { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 1px solid #b6b590; border-radius: 12px; overflow: hidden; background: repeating-linear-gradient(60deg,transparent 0 16px,#c3cbac06 16px 17px),repeating-linear-gradient(-60deg,transparent 0 16px,#c3cbac06 16px 17px),radial-gradient(ellipse at 30% 20%,#3d5750,#142729 75%); color: #d6c696; box-shadow: inset 0 0 30px #030e1280; }
.back-border { position: absolute; inset: 8px; border: 1px solid #c9bc8e80; border-radius: 8px; }
.back-border:before { content: ''; position: absolute; inset: 5px; border: 1px solid #c9bc8e30; border-radius: 3px; }
.back-rosette { display: block; width: 68%; margin: 0 0 12%; }
.back-rosette svg { display: block; width: 100%; fill: none; stroke: #c8bc8a; stroke-width: .7; }
.back-rosette path { fill: #c8bc8a38; }
.back-rosette .rosette-sun { fill: #d6c696; }
.back-art>strong { font: 24px/1.5 var(--serif); letter-spacing: 5px; font-weight: 400; }
.back-art>small { margin-top: 8px; font-size: 7px; letter-spacing: 2px; color: #c6ccab; }
.back-mark { position: absolute; bottom: 9%; font-size: 16px; }
.opening-stage .flip-shell { width: min(292px,calc((100dvh - 235px)*.6)); aspect-ratio: .6; animation: stage-card-arrive .45s cubic-bezier(.2,.8,.2,1) both; z-index: 3; }
.opening-stage .flip-card { transition: transform .65s cubic-bezier(.2,.65,.18,1); }
.opening-stage .card-back { padding: 0; background: none; border: 0; overflow: visible; }
.opening-stage .card-back:before,.opening-stage .card-back:after { display: none; }
.opening-stage .card-back>.back-art { font: inherit; letter-spacing: normal; }
.opening-stage .card-front { overflow: visible; }
.opening-stage .card-front>.game-card { width: 100%; border-color: var(--reveal-color); box-shadow: 0 12px 50px #0009,0 0 0 3px #030c0f,0 0 0 4px color-mix(in srgb,var(--reveal-color) 35%,transparent); }
.opening-stage .card-front .game-card-art { min-height: 0; flex: 1 1 auto; }
.opening-stage .card-front .game-card-copy { flex-shrink: 0; min-height: 128px; }
.opening-stage .card-front .game-card-bottom { flex-shrink: 0; }
.opening-stage .reveal-rays { width: min(560px,62vw); height: auto; aspect-ratio: 1; max-width: none; background: radial-gradient(ellipse,var(--reveal-color),transparent 65%); filter: blur(20px); }
.opening-stage.revealed .reveal-rays { opacity: .17; }
.rarity-intro { pointer-events: none; position: absolute; inset: -10px 0; display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 5; opacity: 0; background: radial-gradient(ellipse,#081112f5 15%,#081112ee 30%,#08111200 65%); color: var(--reveal-color); transform: scale(.88); }
.rarity-intro:before { content: ''; position: absolute; width: 300px; height: 300px; max-width: 75vw; max-height: 75vw; border: 1px solid currentColor; border-radius: 50%; opacity: .16; box-shadow: 0 0 0 18px #cdd9bd08,0 0 0 75px #cdd9bd03; }
.rarity-intro strong { font: italic 500 clamp(80px,12vw,152px)/1 var(--serif); letter-spacing: -.06em; text-shadow: 0 0 50px color-mix(in srgb,var(--reveal-color) 35%,transparent); }
.rarity-intro span { font: 18px/1.8 var(--serif); margin-top: 16px; letter-spacing: 3px; }
.rarity-intro small { color: #d3d9c49c; font-size: 8px; letter-spacing: 5px; margin-top: 12px; }
.announcing .rarity-intro { animation: rarity-title .65s cubic-bezier(.2,.7,.2,1) both; }
.announcing .flip-shell { visibility: hidden; }
.opening-particles { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; opacity: 0; mix-blend-mode: screen; }
.opening-particles:before { content: ''; position: absolute; width: 600px; height: 600px; max-width: 100%; max-height: 100%; left: 50%; top: 50%; transform: translate(-50%,-50%); background: var(--reveal-color); mask: url('assets/gacha/glow.png') center/contain no-repeat; mask-mode: luminance; opacity: .2; }
.opening-particles>i { position: absolute; left: calc(50% + var(--px)); top: calc(50% + var(--py)); width: var(--size); height: var(--size); background: var(--reveal-color); mask: url('assets/gacha/sparkle.png') center/contain no-repeat; mask-mode: luminance; opacity: 0; }
.revealed .opening-particles,.announcing .opening-particles { opacity: 1; }
.revealed .opening-particles>i,.announcing .opening-particles>i { animation: sparkle-float 2.8s var(--delay) ease-out both; }
.opening-stage.departing .flip-shell { animation: card-depart .24s ease-in both; }
.opening-stage.departing .opening-particles,.opening-stage.departing .reveal-rays { opacity: 0; transition: opacity .2s; }
.opening-dialog.results-mode { overflow-y: auto; }
.results-mode .opening-top { max-width: 1100px; margin: 0 auto; }
.results-mode .opening-stage { flex: 1 0 auto; max-width: 1100px; margin: auto; padding: 30px 0; }
.results-mode .opening-actions { bottom: -26px; padding: 16px 0; background: #091215ed; }
.results-mode .opening-progress { display: none; }
.results-mode [data-game=autoplay],.results-mode [data-game=sound] { display: none; }
.asset-credits a { text-decoration: underline; text-underline-offset: 3px; color: #e3c98b; }

@keyframes foil-enter { from { opacity: 0; transform: translateY(40px) rotate(3deg) scale(.92); } to { opacity: 1; transform: rotate(-4deg); } }
@keyframes foil-strip-away { 0% { transform: none; } 18% { transform: translate(7px,-4px) rotate(4deg); } 100% { transform: translate(160px,-120px) rotate(24deg); opacity: 0; } }
@keyframes foil-open-body { to { transform: perspective(700px) rotateX(-3deg) scaleX(1.025); } }
@keyframes foil-drop { from { transform: rotate(-4deg); opacity: 1; } to { transform: translate(30px,260px) rotate(12deg); opacity: 0; } }
@keyframes stack-extract { 0% { opacity: 0; transform: translateY(50px) scale(.9); } 35% { opacity: 1; } 100% { opacity: 1; transform: translateY(-15px) scale(1); } }
@keyframes stage-card-arrive { from { opacity: 0; transform: translateY(15px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes rarity-title { 0% { opacity: 0; transform: scale(.82); } 35%,100% { opacity: 1; transform: scale(1); } }
@keyframes sparkle-float { 0% { opacity: 0; transform: translateY(12px) scale(.2); } 20% { opacity: .65; } 100% { opacity: 0; transform: translate(calc(var(--drift)*20px),-45px) scale(.6); } }
@keyframes card-depart { to { opacity: 0; transform: translateX(-65px) rotate(-5deg) scale(.94); } }

@media(max-width:700px) {
  .ticket-stage { min-height: 320px; }
  .ticket-stage .sealed-pack { width: 158px; }
  .opening-dialog { padding: 18px 18px 22px; }
  .opening-top { align-items: flex-start; gap: 15px; }
  .opening-top h2 { font-size: 18px; }
  .opening-top .game-eyebrow { font-size: 6px; }
  .opening-options { gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 170px; }
  .opening-options>button { font-size: 9px; padding: 7px 9px; }
  .opening-options [data-game=skip] { font-size: 9px; }
  .opening-status { font-size: 10px; min-height: 36px; margin: 10px 0; }
  .opening-stage>.sealed-pack { width: min(260px,calc((100dvh - 255px)*.606)); }
  .opening-stage .flip-shell { width: min(275px,calc((100dvh - 245px)*.6)); }
  .opening-actions { gap: 18px; }
  .opening-actions .primary-game-button { min-width: 170px; padding: 13px 18px; }
  .results-mode .opening-actions { bottom: -22px; }
  .opening-stage .card-front .game-card-copy>strong { font-size: 22px; }
}
@media(max-height:650px) {
  .opening-dialog { padding: 12px 20px; }
  .opening-top h2 { font-size: 16px; margin: 0; }
  .opening-top .game-eyebrow { font-size: 6px; }
  .opening-status { min-height: 18px; font-size: 9px; margin: 5px 0; }
  .opening-actions,.opening-actions .primary-game-button { min-height: 34px; }
  .opening-actions .primary-game-button { padding: 8px 16px; font-size: 10px; }
  .opening-stage { padding: 8px 0; }
  .opening-stage .flip-shell { width: min(250px,calc((100dvh - 160px)*.6)); }
  .opening-stage>.sealed-pack { width: min(245px,calc((100dvh - 170px)*.606)); }
  .opening-stage .card-front .game-card-copy { min-height: 90px; }
  .opening-stage .card-front .game-card-copy>strong { font-size: 17px; }
  .opening-stage .card-front .game-card-summary { font-size: 8px; }
  .opening-stage .card-front .game-card-bottom { font-size: 7px; }
  .opening-stage .card-front .card-star { margin-bottom: 4px; }
  .back-art>strong { font-size: 18px; }
  .back-art>small { font-size: 5px; }
  .results-mode .opening-actions { bottom: -12px; }
}
@media(prefers-reduced-motion:reduce) {
  .opening-stage .sealed-pack,.opening-stage .flip-shell { animation: none!important; }
  .opening-particles { display: none; }
  .announcing .rarity-intro { opacity: 1; transform: none; }
  .tearing .foil-top { opacity: 0; }
}
