/* 盲盒：首頁的盲盒列 + 全螢幕開箱畫面 */

.boxes { max-width: 1240px; margin: 0 auto; padding: 4px 20px 0; }
.boxes-in { background: linear-gradient(135deg, #3a2244, #24152e); border-radius: 22px; padding: 14px 16px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.boxes-in::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 12% 20%, rgba(255, 255, 255, .5) 0 1px, transparent 2px), radial-gradient(circle at 78% 30%, rgba(255, 255, 255, .45) 0 1px, transparent 2px), radial-gradient(circle at 55% 80%, rgba(255, 255, 255, .35) 0 1px, transparent 2px), radial-gradient(circle at 92% 75%, rgba(255, 255, 255, .5) 0 1px, transparent 2px), radial-gradient(circle at 33% 60%, rgba(255, 255, 255, .3) 0 1px, transparent 2px); pointer-events: none; }
.boxes-title { margin: 0 0 10px; font: 400 18px var(--font-title); color: #ffe9a8; display: flex; align-items: center; gap: 8px; position: relative; }
.boxes-title svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.box-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; position: relative; }
.box-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left; background: rgba(255, 255, 255, .08); border: 1.5px solid rgba(255, 255, 255, .16); color: #fff; border-radius: 16px; padding: 10px 14px; min-height: 68px; transition: transform .15s, background .15s, border-color .15s; }
.box-card:hover { background: rgba(255, 255, 255, .14); border-color: #ffd76a; transform: translateY(-2px); }
.box-card:hover .mini-gift { animation: gx-wiggle .5s; }
.box-info { min-width: 0; display: grid; gap: 2px; }
.box-info b { font: 400 16px var(--font-title); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.box-info small { font-size: 12.5px; color: rgba(255, 255, 255, .7); }
.box-info em { font-style: normal; font-weight: 700; }
.box-price { background: #ffd76a; color: #4a3210; border-radius: 12px; padding: 5px 10px; font-weight: 700; font-size: 13.5px; text-align: center; line-height: 1.25; white-space: nowrap; }
.box-price i { display: block; font-style: normal; font-weight: 500; font-size: 11px; opacity: .75; }

.mini-gift { width: 40px; height: 40px; position: relative; display: block; flex: none; }
.mini-gift::before { content: ''; position: absolute; left: 4px; right: 4px; bottom: 2px; height: 22px; border-radius: 4px; background: linear-gradient(90deg, transparent 40%, #ffd76a 40% 60%, transparent 60%), var(--brand); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); }
.mini-gift::after { content: ''; position: absolute; left: 1px; right: 1px; top: 9px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, transparent 40%, #ffd76a 40% 60%, transparent 60%), color-mix(in srgb, var(--brand) 82%, #fff); }
.mini-gift i { position: absolute; left: 50%; top: 0; width: 18px; height: 10px; margin-left: -9px; background: radial-gradient(circle at 25% 60%, #ffd76a 0 4px, transparent 4.5px), radial-gradient(circle at 75% 60%, #ffd76a 0 4px, transparent 4.5px); }
.mini-gift.big { transform: scale(1.5); margin: 10px 14px 10px 10px; }

/* ---------------------------------------------------------------- 全螢幕 */
html.gx-open { overflow: hidden; }
.gx { position: fixed; inset: 0; z-index: 500; color: #fff; background: radial-gradient(ellipse at 50% 42%, #4a2a5c 0%, #24132f 55%, #0f0716 100%); overflow: hidden auto; overscroll-behavior: contain; --glow: #9fb0c3; }
.gx-stars { position: fixed; inset: 0; pointer-events: none; opacity: .8; background-image: radial-gradient(circle, #fff 0 1px, transparent 1.5px), radial-gradient(circle, #ffe9a8 0 1px, transparent 1.5px), radial-gradient(circle, #fff 0 1.5px, transparent 2px); background-size: 130px 130px, 210px 190px, 330px 290px; background-position: 20px 30px, 90px 120px, 160px 60px; animation: gx-twinkle 3.2s ease-in-out infinite alternate; }
.gx-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.gx-flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 6; }
.gx-flash.go { animation: gx-flash .5s ease-out; }
.gx-top { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 12px; display: flex; gap: 8px; z-index: 8; }
.gx-icon { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .25); background: rgba(20, 8, 28, .55); color: #fff; display: grid; place-items: center; }
.gx-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gx-icon:hover { background: rgba(255, 255, 255, .18); }
.gx :focus-visible { outline: 3px solid #ffd76a; outline-offset: 2px; }

/* 大廳 */
.gx-lobby { position: relative; z-index: 2; min-height: 100%; display: grid; place-items: start center; padding: 64px 14px 40px; }
.gx-panel { width: min(100%, 560px); background: rgba(255, 255, 255, .07); border: 1.5px solid rgba(255, 255, 255, .14); border-radius: 24px; padding: 18px 18px 22px; backdrop-filter: blur(6px); }
.gx-head { display: flex; align-items: center; gap: 6px; }
.gx-head h2 { margin: 0; font: 400 24px/1.25 var(--font-title); color: #ffe9a8; }
.gx-price { margin: 2px 0 0; font-weight: 700; font-size: 17px; }
.gx-price small { font-weight: 400; font-size: 12.5px; opacity: .7; }
.gx-desc { margin: 10px 0 0; font-size: 14px; color: rgba(255, 255, 255, .82); white-space: pre-line; }
.gx-form { margin-top: 16px; background: rgba(0, 0, 0, .22); border-radius: 18px; padding: 12px 14px 10px; }
.gx-form label { font-size: 13px; color: rgba(255, 255, 255, .75); }
.gx-form-row { display: flex; gap: 8px; margin-top: 6px; }
.gx-form input { flex: 1; min-width: 0; min-height: 48px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .95); color: #2a1420; font: 700 18px ui-monospace, Menlo, monospace; letter-spacing: 1.5px; padding: 0 14px; text-transform: uppercase; }
.gx-form input::placeholder { font-weight: 400; letter-spacing: 0; color: #a99aa2; font-size: 14px; text-transform: none; }
.gx-go { min-height: 48px; padding: 0 22px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #ffe07a, #ffb52e); color: #4a2a08; font: 400 17px var(--font-title); box-shadow: 0 4px 0 #b97614, 0 8px 18px rgba(255, 181, 46, .35); transition: transform .1s, box-shadow .1s; white-space: nowrap; }
.gx-go:hover { transform: translateY(-1px); }
.gx-go:active { transform: translateY(3px); box-shadow: 0 1px 0 #b97614; }
.gx-go:disabled { opacity: .6; }
.gx-go.alt { background: linear-gradient(180deg, #ff9cba, var(--brand)); color: #fff; box-shadow: 0 4px 0 var(--brand-deep), 0 8px 18px rgba(232, 87, 126, .35); }
.gx-ghost { min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1.5px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .06); color: #fff; font-size: 14.5px; }
.gx-ghost:hover { background: rgba(255, 255, 255, .16); }
.gx-panel > .gx-ghost { width: 100%; margin-top: 10px; }
.gx-err { margin: 6px 0 0; color: #ffb3c4; font-size: 13.5px; min-height: 0; }
.gx-err:empty { display: none; }
.gx-note { margin: 8px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .62); }
.gx-sub { margin: 20px 0 8px; font: 400 15px var(--font-title); color: #ffe9a8; }
.gx-odds { display: grid; gap: 8px; }
.gx-tier { border: 1.5px solid color-mix(in srgb, var(--rc) 55%, transparent); background: color-mix(in srgb, var(--rc) 12%, transparent); border-radius: 16px; padding: 8px 10px 10px; }
.gx-tier-head { display: flex; align-items: baseline; gap: 8px; }
.gx-tier-head b { color: var(--rc); font: 400 15px var(--font-title); }
.gx-tier-head span { font-weight: 700; }
.gx-tier-head small { margin-left: auto; font-size: 12px; opacity: .65; }
.gx-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gx-items figure { margin: 0; width: 64px; }
.gx-items img { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; background: rgba(255, 255, 255, .92); border-radius: 12px; display: block; }
.gx-items figcaption { font-size: 11px; text-align: center; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.gx-history { display: grid; gap: 6px; }
.gx-history button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; min-height: 42px; padding: 4px 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); color: #fff; font-size: 13.5px; }
.gx-history span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gx-history code { font-size: 12px; opacity: .6; }

/* 開箱 */
.gx-play { position: relative; z-index: 2; min-height: 100%; overflow: clip; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 64px 14px 28px; text-align: center; }
.gx-badge { margin: 0; font-size: 13px; padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .85); }
.gx-badge.real { background: rgba(255, 215, 106, .2); color: #ffe9a8; }
.gx-stage { position: relative; width: 300px; height: 330px; max-width: 100%; }
.gx-rays { position: fixed; left: 50%; top: 42%; width: 170vmax; height: 170vmax; margin: -85vmax 0 0 -85vmax; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--glow) 55%, transparent) 0 7deg, transparent 7deg 20deg); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 46%); mask-image: radial-gradient(circle, #000 0, transparent 46%); opacity: 0; pointer-events: none; z-index: 1; transition: opacity .5s; }
.gx.opened .gx-rays { opacity: .28; animation: gx-spin 26s linear infinite; }
.gx.tier2 .gx-rays { opacity: .5; }
.gx.tier3 .gx-rays { opacity: .75; animation-duration: 14s; background: repeating-conic-gradient(from 0deg, rgba(255, 181, 46, .6) 0 6deg, transparent 6deg 15deg, rgba(255, 126, 182, .5) 15deg 21deg, transparent 21deg 30deg, rgba(127, 227, 255, .5) 30deg 36deg, transparent 36deg 45deg); }

.gx-box { position: absolute; left: 50%; bottom: 26px; width: 170px; height: 160px; margin-left: -85px; border: 0; background: none; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; transform-origin: 50% 100%; }
.gx-box:disabled { cursor: default; }
.gx-glow { position: absolute; left: 50%; top: 46%; width: 320px; height: 320px; margin: -160px 0 0 -160px; border-radius: 50%; background: radial-gradient(circle, var(--glow) 0, color-mix(in srgb, var(--glow) 35%, transparent) 32%, transparent 66%); opacity: 0; transition: opacity .4s, background .25s; pointer-events: none; }
.gx.lit1 .gx-glow { opacity: .35; }
.gx.lit2 .gx-glow { opacity: .65; }
.gx.lit3 .gx-glow { opacity: 1; animation: gx-pulse .35s ease-in-out infinite alternate; }
.gx-body { position: absolute; left: 12px; right: 12px; bottom: 0; height: 104px; border-radius: 10px; border: 4px solid #2a1420; background: linear-gradient(90deg, transparent 39%, #ffd76a 39% 61%, transparent 61%), linear-gradient(180deg, color-mix(in srgb, var(--brand) 88%, #fff), var(--brand) 55%, var(--brand-deep)); box-shadow: inset 0 -10px 0 rgba(0, 0, 0, .16), 0 14px 24px rgba(0, 0, 0, .45); }
.gx-body::after { content: ''; position: absolute; left: 0; right: 0; top: -4px; height: 10px; background: linear-gradient(90deg, transparent, var(--glow), transparent); opacity: 0; filter: blur(3px); transition: opacity .3s; }
.gx.lit2 .gx-body::after, .gx.lit3 .gx-body::after { opacity: 1; }
.gx-lid { position: absolute; left: 0; right: 0; top: 30px; height: 40px; border-radius: 10px; border: 4px solid #2a1420; background: linear-gradient(90deg, transparent 41%, #ffd76a 41% 59%, transparent 59%), linear-gradient(180deg, color-mix(in srgb, var(--brand) 70%, #fff), color-mix(in srgb, var(--brand) 92%, #fff)); z-index: 2; transform-origin: 50% 100%; }
.gx-bow { position: absolute; left: 50%; top: -30px; width: 76px; height: 32px; margin-left: -38px; }
.gx-bow::before, .gx-bow::after { content: ''; position: absolute; top: 0; width: 34px; height: 28px; border: 4px solid #2a1420; background: #ffd76a; border-radius: 60% 40% 40% 60% / 60% 60% 40% 40%; }
.gx-bow::before { left: 0; transform: rotate(-14deg); }
.gx-bow::after { right: 0; transform: scaleX(-1) rotate(-14deg); }

.gx-box.drop { animation: gx-drop .75s cubic-bezier(.3, 1.4, .5, 1) both; }
.gx-box.idle { animation: gx-idle 1.5s ease-in-out infinite; }
.gx-box.shake1 { animation: gx-shake .38s; --amp: 5deg; }
.gx-box.shake2 { animation: gx-shake .38s; --amp: 9deg; }
.gx-box.shake3 { animation: gx-shake .38s; --amp: 13deg; }
.gx-box.rumble { animation: gx-rumble .09s linear infinite; }
.gx-box.rumble .gx-lid { animation: gx-lid-pop .18s ease-in-out infinite alternate; }
.gx-box.open { pointer-events: none; }
.gx-box.open .gx-lid { animation: gx-lid-off .8s cubic-bezier(.2, .7, .3, 1) forwards; }
.gx-box.open .gx-body { animation: gx-body-out .7s .15s ease-in forwards; }
.gx-box.open .gx-glow { opacity: 1; }
.gx.done .gx-box.open .gx-lid, .gx.done .gx-box.open .gx-body { animation-duration: .01s; animation-delay: 0s; }
.gx.quake .gx-play { animation: gx-quake .4s; }

/* 卡片 */
.gx-card { position: absolute; left: 50%; top: 4px; width: 210px; height: 290px; margin-left: -105px; perspective: 900px; opacity: 0; transform: translateY(150px) scale(.2); pointer-events: none; z-index: 3; }
.gx-card.show { animation: gx-card-rise .85s cubic-bezier(.2, 1.2, .4, 1) forwards; }
.gx.done .gx-card.show { animation-duration: .01s; }
.gx-card-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, 1.3, .5, 1); }
.gx-card.flip .gx-card-in { transform: rotateY(180deg); }
.gx.done .gx-card-in { transition-duration: .01s; }
.gx-face { position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 4px solid #2a1420; overflow: hidden; }
.gx-back { background: repeating-linear-gradient(45deg, #5a3470 0 14px, #4a2a5c 14px 28px); display: grid; place-items: center; box-shadow: 0 0 40px var(--glow); }
.gx-back span { font: 400 90px var(--font-title); color: #ffe9a8; text-shadow: 0 4px 0 #2a1420; }
.gx-front { transform: rotateY(180deg); background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--rc) 22%, #fff)); color: #2a1420; display: flex; flex-direction: column; align-items: center; padding: 0 12px 12px; gap: 4px; box-shadow: 0 0 46px var(--rc), inset 0 0 0 3px color-mix(in srgb, var(--rc) 70%, #fff); }
.gx-front::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .75) 50%, transparent 65%); transform: translateX(-120%); pointer-events: none; }
.gx-card.flip .gx-front::after { animation: gx-shine 1.1s .5s ease-out; }
.gx.tier3 .gx-card.flip .gx-front::after { animation: gx-shine 1.6s .5s ease-out infinite; }
.gx-rar { align-self: stretch; margin: 0 -12px; padding: 7px 0 6px; background: var(--rc); color: #fff; font: 400 15px var(--font-title); text-shadow: 0 1px 0 rgba(0, 0, 0, .35); letter-spacing: 1px; }
.gx-pic { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; }
.gx-pic img { width: 150px; height: 150px; object-fit: contain; image-rendering: pixelated; }
.gx-card.flip .gx-pic img { animation: gx-pop .5s .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.gx-front code { font-size: 12.5px; background: color-mix(in srgb, var(--rc) 22%, #fff); padding: 1px 8px; border-radius: 6px; font-weight: 700; }
.gx-front b { font: 400 16px/1.3 var(--font-title); max-height: 2.6em; overflow: hidden; }

.gx-prompt { margin: 0; min-height: 28px; font: 400 19px var(--font-title); color: #ffe9a8; animation: gx-blink 1s ease-in-out infinite alternate; }
.gx-pips { display: flex; gap: 8px; }
.gx-pips i { width: 26px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .2); transition: background .2s, box-shadow .2s; }
.gx-pips i.on { background: var(--glow); box-shadow: 0 0 12px var(--glow); }
.gx.done .gx-pips, .gx.done .gx-prompt, .gx.done .gx-skip { display: none; }
.gx-skip { background: none; border: 0; color: rgba(255, 255, 255, .5); font-size: 13px; text-decoration: underline; min-height: 40px; padding: 0 12px; }
.gx-skip:hover { color: #fff; }
.gx-result { width: min(100%, 440px); animation: gx-fade-up .45s ease-out both; }
.gx-got { margin: 0; font: 400 19px/1.4 var(--font-title); }
.gx-fine { margin: 6px 0 0; font-size: 13px; color: rgba(255, 255, 255, .72); }
.gx-fine code { background: rgba(255, 255, 255, .14); padding: 1px 6px; border-radius: 6px; color: #ffe9a8; }
.gx-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }

@keyframes gx-twinkle { from { opacity: .45; } to { opacity: .9; } }
@keyframes gx-flash { from { opacity: var(--f, 1); } to { opacity: 0; } }
@keyframes gx-spin { to { transform: rotate(360deg); } }
@keyframes gx-pulse { from { transform: scale(.92); } to { transform: scale(1.12); } }
@keyframes gx-wiggle { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes gx-drop { 0% { transform: translateY(-120vh) rotate(-14deg); } 62% { transform: translateY(0) scale(1.12, .84); } 80% { transform: translateY(-22px) scale(.96, 1.05); } 100% { transform: none; } }
@keyframes gx-idle { 0%, 100% { transform: none; } 12% { transform: rotate(-3deg); } 24% { transform: rotate(3deg) translateY(-4px); } 36% { transform: none; } }
@keyframes gx-shake { 0%, 100% { transform: none; } 15% { transform: rotate(calc(var(--amp) * -1)) scale(1.05); } 35% { transform: rotate(var(--amp)) translateY(-10px); } 55% { transform: rotate(calc(var(--amp) * -.6)); } 75% { transform: rotate(calc(var(--amp) * .4)) scale(1.02, .97); } }
@keyframes gx-rumble { 0% { transform: translate(-3px, 1px) rotate(-2deg); } 25% { transform: translate(3px, -2px) rotate(2deg); } 50% { transform: translate(-2px, -1px) rotate(-1deg); } 75% { transform: translate(2px, 2px) rotate(1.5deg); } 100% { transform: translate(-3px, 1px) rotate(-2deg); } }
@keyframes gx-lid-pop { from { transform: none; } to { transform: translateY(-9px) rotate(-3deg); } }
@keyframes gx-lid-off { to { transform: translate(120px, -360px) rotate(160deg); opacity: 0; } }
@keyframes gx-body-out { to { transform: translateY(40px) scale(.9); opacity: 0; } }
@keyframes gx-quake { 0%, 100% { transform: none; } 20% { transform: translate(-7px, 4px); } 40% { transform: translate(6px, -5px); } 60% { transform: translate(-4px, -3px); } 80% { transform: translate(4px, 3px); } }
@keyframes gx-card-rise { 0% { opacity: 0; transform: translateY(150px) scale(.2) rotate(-12deg); } 60% { opacity: 1; transform: translateY(-16px) scale(1.06) rotate(3deg); } 100% { opacity: 1; transform: none; } }
@keyframes gx-shine { to { transform: translateX(120%); } }
@keyframes gx-pop { from { transform: scale(.3); } to { transform: none; } }
@keyframes gx-blink { from { opacity: .55; } to { opacity: 1; } }
@keyframes gx-fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 959px) { .boxes { padding: 4px 12px 0; } }
@media (max-height: 640px) { .gx-stage { transform: scale(.8); margin: -30px 0; } }
@media (prefers-reduced-motion: reduce) {
  .gx *, .gx *::before, .gx *::after { animation: none !important; transition: none !important; }
  .gx-card.show { opacity: 1; transform: none; }
}
