/* ==========================================================================
   /widgets/ — the app's gallery + pack opening, on the web.
   Lifted from 24QWN: ContentView (gallery), WidgetTagsView, WidgetFilterBar,
   WidgetsCounter, WidgetDetailView, PackOpeningView, Pack3DView.
   ========================================================================== */

.wg {
    --tile-r: 26px;
    --key-h: 74px;
}

/* ---- header ------------------------------------------------------------ */

.wg-head {
    position: relative;
    padding-top: 30px;
    text-align: center;
}

.wg-tags {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    transform: rotate(-1.5deg);
}

.wg-tags__row {
    display: flex;
    gap: 2px;
    justify-content: center;
}

.wg-tags__row + .wg-tags__row {
    margin-top: 0;
}

.wg-pill {
    display: inline-grid;
    place-items: center;
    height: 33px;
    padding: 1px 12px 0;
    border-radius: 10px;
    background: var(--white);
    color: #a1bed9;
    font-family: var(--font-pixel);
    font-size: 23px;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    line-height: 1;
}

.wg-tagimg {
    position: relative;
    display: block;
    width: calc(var(--w) * 1px);
    height: 33px;
}

.wg-tagimg img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.25s ease, transform 0.35s var(--ease-pop);
}

.wg-tagimg .on {
    opacity: 0;
}

.wg-tagimg.is-on .on {
    opacity: 1;
}

.wg-tagimg.is-on img {
    transform: scale(1.04) rotate(-2deg);
}

.wg-title {
    display: block;
    width: max-content;
    margin: 6px auto 0;
    font-size: clamp(72px, 11vw, 132px);
}

.wg-count {
    margin-top: 14px;
    font-family: var(--font-pixel);
    font-size: 15px;
    text-transform: uppercase;
    color: var(--white);
    text-shadow: 0 1px 8px rgba(0, 60, 140, 0.35);
}

.wg-count [data-wg-owned] {
    display: inline-block;
    min-width: 1.4em;
    padding: 0 6px;
    border-radius: 6px;
    background: var(--lime);
    color: var(--ink);
    text-shadow: none;
}

.wg-intro {
    max-width: 520px;
    margin: 16px auto 0;
    padding: 14px 22px;
    border-radius: 26px;
    background: rgba(253, 253, 253, 0.5);
    border: 1px solid rgba(253, 253, 253, 0.8);
    box-shadow: 0 0 26px rgba(255, 255, 255, 0.8) inset;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    transform: rotate(-0.6deg);
}

.wg-head__cta {
    margin-top: 26px;
}

.wg-head__cta .qw-btn {
    animation: wg-bob 2.6s ease-in-out infinite;
}

.wg-head__stars {
    position: absolute;
    top: 40px;
    left: 50%;
    margin-left: 180px;
    width: 120px;
    height: auto;
    pointer-events: none;
    animation: wg-twinkle 3s ease-in-out infinite;
}

/* packs floating around the title (Pack3DView-ish) */
.wg-peek {
    position: absolute;
    z-index: 2;
    width: clamp(170px, 17vw, 250px);
}

.wg-peek--core {
    top: 250px;
    right: max(0px, calc(50% - 560px));
    rotate: 9deg;
}

.wg-peek--limited {
    top: 260px;
    left: max(0px, calc(50% - 560px));
    width: clamp(140px, 13vw, 200px);
    rotate: -11deg;
}

.wg-peek--limited .wg-pack__tilt {
    animation-delay: -2s;
}

.wg-peek__sticker {
    position: absolute;
    left: -6%;
    top: -34%;
    width: 72%;
    height: auto;
    rotate: -14deg;
    filter: drop-shadow(0 8px 12px rgba(0, 60, 140, 0.25));
    transition: transform 0.4s var(--ease-pop);
    pointer-events: none;
}

.wg-peek:hover .wg-peek__sticker {
    transform: scale(1.1) rotate(6deg);
}

@media (max-width: 1000px) {
    .wg-head .wg-peek {
        display: none;
    }
}

@keyframes wg-bob {
    0%,
    100% {
        transform: translateY(0) rotate(-1deg);
    }
    50% {
        transform: translateY(-5px) rotate(1deg);
    }
}

@keyframes wg-twinkle {
    0%,
    100% {
        opacity: 0.9;
        transform: rotate(0) scale(1);
    }
    50% {
        opacity: 0.55;
        transform: rotate(8deg) scale(0.92);
    }
}

/* ---- filter bar (WidgetFilterBar) ------------------------------------- */

.wg-gallery {
    margin-top: 44px;
}

.wg-barwrap {
    position: sticky;
    top: 12px;
    z-index: 30;
    width: min(440px, 100%);
    margin: 0 auto;
}

.wg-bar {
    display: flex;
    gap: 6px;
    height: calc(var(--key-h) + 12px);
    padding: 6px;
    border-radius: var(--bar-r);
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(253, 253, 253, 0.55), 0 14px 30px rgba(160, 20, 20, 0.28);
}

.wg-bar.is-shake {
    animation: wg-shake 0.5s linear;
}

@keyframes wg-shake {
    0%,
    100% {
        transform: translateX(0);
    }
    16% {
        transform: translateX(-7px);
    }
    33% {
        transform: translateX(7px);
    }
    50% {
        transform: translateX(-6px);
    }
    66% {
        transform: translateX(5px);
    }
    83% {
        transform: translateX(-3px);
    }
}

.wg-bar__keys {
    flex: 1;
    display: flex;
    gap: 6px;
    min-width: 0;
}

.wg-key {
    position: relative;
    flex: 1;
    min-width: 0;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: #d7e0ea;
    box-shadow: inset 0 2px 2px rgba(22, 22, 22, 0.2);
    transition: transform 0.28s var(--ease-pop), background-color 0.2s;
    overflow: hidden;
}

.wg-key--lead {
    border-radius: 52px 20px 20px 52px;
}

.wg-key--trail {
    border-radius: 20px 52px 52px 20px;
}

.wg-key img {
    grid-area: 1 / 1;
    width: 54px;
    height: 54px;
    max-width: 90%;
    object-fit: contain;
    transition: opacity 0.2s ease, transform 0.35s var(--ease-pop);
}

.wg-key .on {
    opacity: 0;
}

.wg-key[aria-pressed='true'] .on {
    opacity: 1;
}

.wg-key[aria-pressed='true'] .off {
    opacity: 0;
}

.wg-key--core[aria-pressed='true'] {
    background: radial-gradient(ellipse at center, #ffdbf6 0%, #ffcdf2 100%);
    box-shadow: inset 2px -4px 9px #f79ad8, inset 1px -3px 6px #ec66b2, inset -2px 4px 8px #fff6fc;
}

.wg-key--limited[aria-pressed='true'] {
    background: radial-gradient(ellipse at center, #f8e6a3 0%, #f1d67b 100%);
    box-shadow: inset 0 -3px 9px #ffae34, inset 0 -2px 6px #e5820a, inset -2px 4px 8px #fffff6;
}

.wg-key--physiq[aria-pressed='true'] {
    background: radial-gradient(ellipse at center, #c6ea76 0%, #ace13c 100%);
    box-shadow: inset 2px -3px 9px #82ad26, inset 1px -2px 6px #5f8c18, inset -2px 4px 8px #f6ffec;
}

.wg-key--favs[aria-pressed='true'] {
    background: radial-gradient(ellipse at center, #ffe1ee 0%, #ffc3dc 100%);
    box-shadow: inset 2px -4px 9px #ff9cc6, inset 1px -3px 6px #ff64a5, inset -2px 4px 8px #fff6fc;
}

.wg-key--favs img {
    width: 62px;
    height: 62px;
}

.wg-key:hover img {
    transform: scale(1.1) rotate(-8deg);
}

.wg-key:active {
    transform: scale(0.94);
}

.wg-bar__more {
    flex: 0 0 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: var(--item-r);
    background: var(--blue);
    color: var(--white);
    font-family: var(--font-pixel);
    font-size: 17px;
    text-transform: uppercase;
    box-shadow: inset 0 -4px 10px rgba(0, 50, 140, 0.3), inset 0 4px 8px rgba(255, 255, 255, 0.25);
    transition: transform 0.28s var(--ease-pop);
}

.wg-bar__more svg {
    width: 0;
    height: 18px;
    transition: width 0.25s var(--ease-pop);
}

.wg-bar__more[aria-expanded='true'] svg {
    width: 18px;
}

.wg-bar__more[aria-expanded='true'] span {
    display: none;
}

.wg-bar__more:hover {
    transform: scale(1.04) rotate(-2deg);
}

.wg-bar__more:active {
    transform: scale(0.95);
}

/* dropdown panel under the bar */
.wg-panel {
    position: absolute;
    left: 50%;
    top: calc(100% + 12px);
    width: min(360px, 100%);
    padding: 16px 18px 14px;
    border-radius: 30px;
    background: var(--white);
    box-shadow: 0 18px 40px rgba(0, 50, 120, 0.25);
    text-align: center;
    transform: translateX(-50%);
    animation: wg-drop 0.4s var(--ease-pop);
}

.wg-panel[hidden] {
    display: none;
}

@keyframes wg-drop {
    from {
        opacity: 0;
        transform: translate(-50%, -12px) scale(0.92);
    }
}

.wg-panel__label {
    font-family: var(--font-pixel);
    font-size: 12px;
    text-transform: uppercase;
    color: #8b8d93;
}

.wg-panel__chips {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.wg-chip {
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: #e9eef4;
    font-family: var(--font-pixel);
    font-size: 14px;
    text-transform: uppercase;
    transition: transform 0.25s var(--ease-pop), background-color 0.2s;
}

.wg-chip[aria-checked='true'] {
    background: var(--ink);
    color: var(--lime);
}

.wg-chip:hover {
    transform: rotate(-3deg) scale(1.05);
}

.wg-panel__reset {
    margin-top: 10px;
    font-family: var(--font-pixel);
    font-size: 12px;
    text-transform: uppercase;
    color: var(--blue);
}

/* ---- gallery board ----------------------------------------------------- */

.wg-board {
    position: relative;
    margin-top: 46px;
    padding: 30px clamp(14px, 3vw, 34px) 34px;
    border-radius: 44px;
    background: rgba(253, 253, 253, 0.22);
    border: 1px solid rgba(253, 253, 253, 0.65);
    box-shadow: 0 0 46px rgba(255, 255, 255, 0.7) inset, 0 18px 40px rgba(0, 60, 140, 0.1);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* WidgetsCounter: lime tab with rounded top corners */
.wg-counter {
    position: absolute;
    left: 50%;
    bottom: 100%;
    padding: 8px 18px 6px;
    border-radius: 20px 20px 0 0;
    background: var(--lime);
    font-family: var(--font-pixel);
    font-size: 13px;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    transform: translateX(-50%);
}

.wg-counter.is-bump {
    animation: wg-bump 0.5s var(--ease-pop);
}

@keyframes wg-bump {
    40% {
        transform: translateX(-50%) scale(1.18) rotate(-3deg);
    }
}

.wg-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 30px 22px;
}

@media (max-width: 1100px) {
    .wg-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .wg-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 22px 14px;
    }
}

.wg-tile {
    position: relative;
    text-align: center;
    animation: qw-pop 0.7s var(--ease-pop) backwards;
    animation-delay: calc(var(--i, 0) * 35ms);
}

.wg-tile[hidden] {
    display: none;
}

.wg-tile__card {
    position: relative;
    display: block;
    aspect-ratio: 1;
    border-radius: var(--tile-r);
    text-decoration: none;
    transition: transform 0.45s var(--ease-pop);
}

.wg-tile:nth-child(odd) .wg-tile__card {
    --tilt: -2deg;
}

.wg-tile:nth-child(even) .wg-tile__card {
    --tilt: 1.6deg;
}

.wg-tile__art {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: var(--tile-r);
    overflow: hidden;
    /* not yours yet: widget sits small on the transparent-pixel checker */
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #dcdee3 25%, transparent 25%),
        linear-gradient(-45deg, #dcdee3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #dcdee3 75%),
        linear-gradient(-45deg, transparent 75%, #dcdee3 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    box-shadow: 0 0 0 3px rgba(253, 253, 253, 0.9), 0 12px 24px rgba(0, 60, 140, 0.16);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.wg-tile__art img {
    width: 74%;
    height: auto;
    border-radius: 18%;
    filter: grayscale(0.15) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.12));
    opacity: 0.88;
    transition: width 0.5s var(--ease-pop), opacity 0.3s, filter 0.3s;
}

/* owned: the checker goes away, the widget fills the tile */
.wg-tile.is-owned .wg-tile__art {
    background: none;
    box-shadow: 0 14px 26px rgba(0, 60, 140, 0.22);
}

.wg-tile.is-owned .wg-tile__art img {
    width: 100%;
    border-radius: 0;
    opacity: 1;
    filter: none;
}

.wg-tile__badge {
    position: absolute;
    left: -6px;
    top: -8px;
    padding: 4px 8px 3px;
    border-radius: 4px;
    background: var(--lime);
    font-family: var(--font-pixel);
    font-size: 11px;
    line-height: 1;
    text-transform: uppercase;
    transform: rotate(-8deg) scale(0);
    transition: transform 0.4s var(--ease-pop);
    box-shadow: 0 3px 0 rgba(22, 22, 22, 0.12);
}

.wg-tile.is-owned .wg-tile__badge {
    transform: rotate(-8deg) scale(1);
}

.wg-tile.is-fresh .wg-tile__card {
    animation: wg-fresh 0.9s var(--ease-pop);
}

@keyframes wg-fresh {
    0% {
        transform: scale(0.6) rotate(-12deg);
    }
    60% {
        transform: scale(1.1) rotate(4deg);
    }
}

@media (hover: hover) {
    .wg-tile__card:hover {
        transform: rotate(var(--tilt)) scale(1.06);
        animation: wg-wiggle 0.6s var(--ease-pop);
    }
}

@keyframes wg-wiggle {
    0% {
        transform: rotate(0) scale(1);
    }
    30% {
        transform: rotate(calc(var(--tilt) * -2)) scale(1.08);
    }
    60% {
        transform: rotate(calc(var(--tilt) * 1.5)) scale(1.05);
    }
    100% {
        transform: rotate(var(--tilt)) scale(1.06);
    }
}

.wg-tile__card:active {
    transform: scale(0.95);
}

/* heart (BadgeLike): sticker in the bottom-right corner */
.wg-heart {
    position: absolute;
    right: -8px;
    top: calc(100% - 50px);
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    transition: transform 0.35s var(--ease-pop);
}

.wg-tile__box {
    position: relative;
}

.wg-tile .wg-heart {
    top: auto;
    bottom: -10px;
    right: -10px;
}

.wg-heart img {
    width: 100%;
    height: 100%;
    filter: grayscale(1) brightness(1.15) drop-shadow(0 3px 5px rgba(0, 40, 100, 0.25));
    opacity: 0.85;
    transition: filter 0.25s, opacity 0.25s;
}

.wg-heart[aria-pressed='true'] img {
    filter: drop-shadow(0 3px 6px rgba(255, 64, 150, 0.45));
    opacity: 1;
}

.wg-heart:hover {
    transform: scale(1.14) rotate(-10deg);
}

.wg-heart.is-pop {
    animation: wg-heartpop 0.5s var(--ease-pop);
}

@keyframes wg-heartpop {
    40% {
        transform: scale(1.45) rotate(12deg);
    }
}

.wg-tile__name {
    margin-top: 12px;
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 15px;
    line-height: 1.1;
    text-transform: lowercase;
    color: var(--ink);
}

.wg-tile__meta {
    margin-top: 5px;
}

/* rarity chips */
.wg-rar {
    display: inline-block;
    padding: 3px 8px 2px;
    border-radius: 6px;
    background: var(--white);
    color: var(--blue);
    font-family: var(--font-pixel);
    font-size: 11px;
    line-height: 1.1;
    text-transform: uppercase;
    white-space: nowrap;
}

.wg-rar--rare {
    background: #f8e6a3;
    color: #a2560a;
}

.wg-rar--ultra-rare {
    background: var(--pink);
    color: var(--white);
}

.wg-rar--secret {
    background: var(--ink);
    color: var(--lime);
}

.wg-empty {
    padding: 30px 0 10px;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 15px;
    text-transform: uppercase;
}

.wg-empty img {
    width: 110px;
    height: auto;
    margin: 0 auto 10px;
    animation: wg-bob 2.4s ease-in-out infinite;
}

.wg-empty[hidden] {
    display: none;
}

/* ---- packs section ---------------------------------------------------- */

.wg-packs {
    margin-top: 80px;
    scroll-margin-top: 20px;
}

.wg-packs__head {
    text-align: center;
}

.wg-packs__title {
    display: block;
    width: max-content;
    margin: 8px auto 0;
    --accent: var(--lime);
    color: var(--lime);
    font-size: clamp(50px, 8vw, 88px);
}

.wg-packs__lead {
    max-width: 520px;
    margin: 12px auto 0;
    font-size: 16px;
    color: var(--white);
    text-shadow: 0 1px 8px rgba(0, 60, 140, 0.35);
}

.wg-packs__lead .qw-hand {
    display: block;
    font-size: 24px;
    color: var(--white);
    transform: rotate(-2deg);
}

.wg-left-line {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 12px 3px;
    border-radius: 6px;
    background: var(--white);
    color: var(--blue);
    text-shadow: none;
    font-family: var(--font-pixel);
    font-size: 12px;
    text-transform: uppercase;
    transform: rotate(1.5deg);
    box-shadow: 0 3px 0 rgba(0, 60, 140, 0.12);
}

.wg-packrow {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 34px;
}

.wg-packcell {
    position: relative;
    text-align: center;
}

.wg-pack {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    perspective: 900px;
    touch-action: manipulation;
}

.wg-pack__tilt {
    position: relative;
    display: block;
    transform-style: preserve-3d;
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
    transition: transform 0.5s var(--ease-pop);
    animation: wg-float 4.5s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * -1.3s);
}

.wg-pack.is-live .wg-pack__tilt {
    transition: transform 0.08s linear;
}

@keyframes wg-float {
    0%,
    100% {
        translate: 0 0;
        rotate: -1.5deg;
    }
    50% {
        translate: 0 -10px;
        rotate: 1.5deg;
    }
}

.wg-pack__img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 22px 26px rgba(0, 50, 130, 0.35));
}

/* the core pack art carries a soft reflection underneath: crop it off */
.wg-pack--core .wg-pack__img {
    aspect-ratio: 482 / 515;
    object-fit: cover;
    object-position: 50% 0;
}

.wg-packrow .wg-pack__tilt {
    display: inline-block;
    vertical-align: bottom;
}

.wg-packrow .wg-pack__img {
    width: auto;
    height: clamp(240px, 24vw, 310px);
}

/* foil shine that follows the pointer (Pack3DView specular) */
.wg-pack__shine {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 8px;
    background: linear-gradient(
        115deg,
        transparent calc(var(--sx, 30%) - 22%),
        rgba(255, 255, 255, 0.55) var(--sx, 30%),
        rgba(255, 240, 255, 0.15) calc(var(--sx, 30%) + 8%),
        transparent calc(var(--sx, 30%) + 22%)
    );
    mix-blend-mode: soft-light;
    opacity: var(--so, 0.5);
    -webkit-mask: var(--pack) 50% 0 / 100% auto no-repeat;
    mask: var(--pack) 50% 0 / 100% auto no-repeat;
    transition: opacity 0.3s;
}

.wg-pack:hover .wg-pack__shine {
    --so: 1;
}

.wg-packcell--physiq .wg-pack__img {
    filter: drop-shadow(0 22px 26px rgba(0, 50, 130, 0.35)) saturate(0.7);
}

.wg-packcell.is-nope .wg-pack {
    animation: wg-shake 0.5s linear;
}

.wg-pack__tag {
    display: block;
    height: 33px;
    width: auto;
    margin: 14px auto 0;
    transform: rotate(-3deg);
}

.wg-pack__name {
    margin-top: 10px;
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 22px;
    line-height: 1.1;
    color: var(--white);
    text-shadow: 0 2px 10px rgba(0, 60, 140, 0.35);
}

.wg-pack__line {
    margin-top: 4px;
    font-family: var(--font-pixel);
    font-size: 12px;
    text-transform: uppercase;
    color: var(--ink);
}

.wg-packcell.is-empty .wg-pack {
    filter: grayscale(0.7);
    opacity: 0.75;
}

.wg-odds {
    max-width: 640px;
    margin: 46px auto 0;
    padding: 24px clamp(18px, 4vw, 34px);
    text-align: center;
    transform: rotate(-0.6deg);
}

.wg-odds__title {
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 22px;
    text-transform: lowercase;
}

.wg-odds__list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    margin-top: 14px;
    text-align: left;
    font-size: 14px;
}

.wg-odds__list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.wg-odds__note {
    margin-top: 16px;
    font-size: 14px;
    line-height: 1.55;
    color: #3d4250;
}

@media (max-width: 760px) {
    .wg-packrow .wg-pack__img {
        height: 250px;
    }

    .wg-packrow {
        display: flex;
        gap: 0;
        margin: 26px calc(-1 * var(--gutter)) 0;
        padding: 10px 0 6px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .wg-packrow::-webkit-scrollbar {
        display: none;
    }

    .wg-packcell {
        flex: 0 0 72%;
        scroll-snap-align: center;
        padding: 0 8px;
    }

    .wg-packcell:first-child {
        margin-left: 14%;
    }

    .wg-packcell:last-child {
        margin-right: 14%;
    }

    .wg-odds__list {
        grid-template-columns: 1fr;
    }
}

/* ---- detail sheet (WidgetDetailView) ---------------------------------- */

.wg-detail,
.wg-open {
    position: fixed;
    inset: 0;
    z-index: 70;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.wg-detail {
    display: grid;
    place-items: center;
    padding: 20px 16px;
    background: rgba(30, 110, 200, 0.28);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.wg-detail[hidden],
.wg-open[hidden] {
    display: none;
}

.wg-detail.is-open {
    opacity: 1;
}

.wg-detail__panel {
    position: relative;
    width: min(480px, 100%);
    padding: 26px 22px 18px;
    border-radius: 44px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(46, 157, 255, 0.55), rgba(139, 201, 255, 0.4)),
        url('/app/main/background.webp') center / cover;
    box-shadow: 0 3px 50px 3px rgba(255, 255, 255, 0.95) inset, 0 30px 70px rgba(0, 40, 110, 0.35);
    overflow: hidden;
    transform: translateY(40px) scale(0.94);
    transition: transform 0.5s var(--ease-pop);
}

/* sky checker like the app's detail backdrop */
.wg-detail__panel::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.16) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.16) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.16) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.16) 75%);
    background-size: 40px 40px;
    background-position: 0 0, 0 20px, 20px -20px, -20px 0;
    pointer-events: none;
}

.wg-detail__panel > * {
    position: relative;
    z-index: 1;
}

.wg-detail.is-open .wg-detail__panel {
    transform: none;
}

.wg-detail__tag {
    display: block;
    height: 40px;
    width: auto;
    margin: 0 auto;
    transform: rotate(-3deg);
}

.wg-detail__stage {
    position: relative;
    width: min(340px, 80vw);
    aspect-ratio: 1;
    margin: 6px auto 0;
    display: grid;
    place-items: center;
}

.wg-ring {
    position: absolute;
    inset: -2%;
    width: 104%;
    height: 104%;
    overflow: visible;
    animation: wg-spin 40s linear infinite;
    pointer-events: none;
}

.wg-ring text {
    font-family: var(--font-pixel);
    font-size: 19px;
    letter-spacing: 0.08em;
    fill: rgba(253, 253, 253, 0.92);
}

.wg-detail.is-owned .wg-ring text {
    fill: var(--lime);
}

@keyframes wg-spin {
    to {
        transform: rotate(360deg);
    }
}

.wg-detail__art {
    width: 70%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 22%;
    overflow: hidden;
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
    box-shadow: 0 18px 36px rgba(0, 50, 120, 0.25);
    animation: wg-detail-in 0.55s var(--ease-pop);
}

.wg-detail__art img {
    width: 82%;
    height: auto;
    border-radius: 16%;
    opacity: 0.92;
}

.wg-detail.is-owned .wg-detail__art {
    background: none;
}

.wg-detail.is-owned .wg-detail__art img {
    width: 100%;
    border-radius: 0;
    opacity: 1;
}

@keyframes wg-detail-in {
    from {
        transform: scale(0.7) rotate(-8deg);
        opacity: 0;
    }
}

.wg-heart--big {
    right: 9%;
    top: auto;
    bottom: 10%;
    width: 60px;
    height: 60px;
}

.wg-detail__nav {
    position: absolute;
    top: 50%;
    width: 42px;
    height: 42px;
    margin-top: -21px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(253, 253, 253, 0.6);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.9) inset;
    transition: transform 0.3s var(--ease-pop);
}

.wg-detail__nav svg {
    width: 20px;
    height: 20px;
}

.wg-detail__nav--prev {
    left: -14px;
}

.wg-detail__nav--next {
    right: -14px;
}

.wg-detail__nav:hover {
    transform: scale(1.12);
}

.wg-detail__name {
    margin-top: 6px;
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 34px;
    line-height: 1;
    color: var(--white);
    text-shadow: 0 2px 0 rgba(0, 60, 140, 0.25), 0 4px 16px rgba(0, 60, 140, 0.3);
}

.wg-detail__chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.wg-detail__chip {
    display: inline-block;
    padding: 3px 8px 2px;
    border-radius: 6px;
    background: rgba(253, 253, 253, 0.8);
    font-family: var(--font-pixel);
    font-size: 11px;
    line-height: 1.1;
    text-transform: uppercase;
}

.wg-detail__desc {
    max-width: 380px;
    margin: 12px auto 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
}

.wg-detail__capsule {
    margin-top: 16px;
    padding: 6px;
    border-radius: var(--bar-r);
    background: rgba(253, 253, 253, 0.35);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8) inset;
}

.wg-detail__capsule .qw-btn {
    width: 100%;
    min-height: var(--item-h);
}

.wg-detail__back {
    margin-top: 12px;
    padding: 8px 26px 6px;
    border-radius: 999px;
    background: rgba(253, 253, 253, 0.5);
    font-family: var(--font-pixel);
    font-size: 15px;
    text-transform: uppercase;
    color: var(--white);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.9) inset;
    transition: transform 0.3s var(--ease-pop);
}

.wg-detail__back:hover {
    transform: scale(1.06) rotate(-2deg);
}

/* ---- pack opening overlay (PackOpeningView) --------------------------- */

.wg-open {
    overflow: hidden;
    background: linear-gradient(180deg, var(--sky-deep), var(--sky));
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.wg-open::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/app/main/background.webp') center / cover;
}

.wg-open::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: 0 3px 60px 6px rgba(255, 255, 255, 0.95) inset;
    pointer-events: none;
}

.wg-open.is-open {
    opacity: 1;
}

.wg-open > * {
    position: absolute;
    z-index: 1;
}

.wg-open__x {
    top: 18px;
    left: 18px;
    z-index: 5;
}

.wg-open__rays {
    left: 50%;
    bottom: -4vh;
    width: min(140vw, 900px);
    height: auto;
    transform: translateX(-50%) scale(0.6);
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.9s var(--ease-pop);
    pointer-events: none;
}

.wg-open.is-cut .wg-open__rays {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.wg-open__intro,
.wg-open__decks,
.wg-open__done {
    inset: 0;
}

.wg-open__intro[hidden],
.wg-open__decks[hidden],
.wg-open__done[hidden] {
    display: none;
}

.wg-open__swipe {
    position: absolute;
    left: 50%;
    top: max(4vh, 20px);
    width: min(78vw, 380px);
    height: auto;
    transform: translateX(-50%) rotate(-3deg);
    filter: drop-shadow(0 10px 16px rgba(0, 60, 140, 0.25));
    animation: wg-sticker-in 0.6s var(--ease-pop) 0.15s backwards;
    pointer-events: none;
}

@keyframes wg-sticker-in {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.4) rotate(-14deg);
    }
}

.wg-open__packzone {
    position: absolute;
    left: 50%;
    top: calc(max(4vh, 20px) + min(57vw, 280px));
    bottom: 70px;
    width: min(86vw, 440px);
    transform: translateX(-50%);
    display: grid;
    place-items: center;
    perspective: 1000px;
    cursor: grab;
    touch-action: none;
}

.wg-open__packzone:active {
    cursor: grabbing;
}

.wg-open img {
    -webkit-user-drag: none;
}

.wg-open__pack {
    --t: 15%;
    position: relative;
    width: min(78vw, 400px, calc((100dvh - 340px) * 0.85));
    aspect-ratio: var(--ar, 0.83);
    transform-style: preserve-3d;
    transform: translateY(var(--dy, 0px)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.45s var(--ease-pop);
    animation: wg-pack-in 0.8s var(--ease-pop);
}

.wg-open__pack.is-drag {
    transition: none;
}

@keyframes wg-pack-in {
    from {
        transform: translateY(60vh) rotate(12deg);
    }
}

.wg-open__half {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 0;
    filter: drop-shadow(0 26px 30px rgba(0, 50, 130, 0.35));
    transition: transform 0.9s var(--ease-out), opacity 0.6s ease;
}

.wg-open__half--top {
    clip-path: polygon(0 0, 100% 0, 100% calc(var(--t) - 1.2%), 92% calc(var(--t) + 1.2%), 84% calc(var(--t) - 1.2%), 76% calc(var(--t) + 1.2%), 68% calc(var(--t) - 1.2%), 60% calc(var(--t) + 1.2%), 52% calc(var(--t) - 1.2%), 44% calc(var(--t) + 1.2%), 36% calc(var(--t) - 1.2%), 28% calc(var(--t) + 1.2%), 20% calc(var(--t) - 1.2%), 12% calc(var(--t) + 1.2%), 4% calc(var(--t) - 1.2%), 0% calc(var(--t) + 1.2%));
}

.wg-open__half--body {
    clip-path: polygon(0% calc(var(--t) + 1.2%), 4% calc(var(--t) - 1.2%), 12% calc(var(--t) + 1.2%), 20% calc(var(--t) - 1.2%), 28% calc(var(--t) + 1.2%), 36% calc(var(--t) - 1.2%), 44% calc(var(--t) + 1.2%), 52% calc(var(--t) - 1.2%), 60% calc(var(--t) + 1.2%), 68% calc(var(--t) - 1.2%), 76% calc(var(--t) + 1.2%), 84% calc(var(--t) - 1.2%), 92% calc(var(--t) + 1.2%), 100% calc(var(--t) - 1.2%), 100% 100%, 0 100%);
}

.wg-open__pack.is-torn .wg-open__half--top {
    transform: translate(46%, -70vh) rotate(38deg);
    opacity: 0;
}

.wg-open__pack.is-torn .wg-open__half--body {
    transform: translateY(80vh) rotate(-6deg);
    transition: transform 0.9s cubic-bezier(0.6, -0.3, 0.7, 0.4) 0.3s, opacity 0.5s ease 0.6s;
    opacity: 0;
}

.wg-open__pack.is-torn .wg-pack__shine {
    opacity: 0;
}

.wg-open__pack .wg-pack__shine {
    opacity: 0.8;
}

.wg-open__hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 26px;
    text-align: center;
    pointer-events: none;
}

.wg-open__hint span {
    font-family: var(--font-pixel);
    font-size: 15px;
    text-transform: uppercase;
    color: transparent;
    background: linear-gradient(90deg, #0b6fd0 0%, #8ac3ff 45%, #0b6fd0 60%) 0 0 / 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: wg-shimmer 2.2s linear infinite;
    filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 2px #fff);
}

@keyframes wg-shimmer {
    from {
        background-position: 150% 0;
    }
    to {
        background-position: -100% 0;
    }
}

.wg-open.is-cut .wg-open__intro .wg-open__hint,
.wg-open.is-cut .wg-open__swipe {
    opacity: 0;
    transition: opacity 0.3s;
}

/* decks */
.wg-open {
    --card: min(56vw, 34vh, 235px);
}

.wg-open__header {
    position: absolute;
    left: 50%;
    top: max(3vh, 16px);
    width: min(72vw, 330px);
    height: auto;
    transform: translateX(-50%) rotate(-2deg);
    filter: drop-shadow(0 10px 16px rgba(0, 60, 140, 0.25));
    transition: transform 0.8s var(--ease-pop), opacity 0.5s ease;
    animation: wg-sticker-in 0.6s var(--ease-pop) backwards;
    pointer-events: none;
}

.wg-open__decks.is-lifted .wg-open__header {
    transform: translate(-50%, -160px) rotate(-2deg);
    opacity: 0;
}

.wg-deck {
    position: absolute;
    left: 50%;
    width: var(--card);
    height: var(--card);
    margin-left: calc(var(--card) / -2);
}

.wg-deck--top {
    top: calc(28% - var(--card) / 2);
    z-index: 2;
}

.wg-deck--bottom {
    top: calc(70% - var(--card) / 2);
    cursor: pointer;
    touch-action: none;
    border-radius: 24px;
    z-index: 3;
}

.wg-deck--bottom:focus-visible {
    outline-offset: 10px;
}

.wg-card {
    position: absolute;
    inset: 0;
    transform: translate(var(--x, 0px), var(--y, 0px)) rotate(var(--r, 0deg));
    perspective: 900px;
}

.wg-card__inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}

.wg-card__face {
    position: absolute;
    inset: 0;
    border-radius: 22%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    overflow: hidden;
    box-shadow: 0 14px 28px rgba(0, 40, 100, 0.28);
}

.wg-card__face--back {
    background: url('/app/payment/card_back.webp') center / cover;
}

.wg-card__face--front {
    transform: rotateY(180deg);
    background: var(--white);
}

.wg-card__face--front img {
    width: 100%;
    height: 100%;
}

.wg-card.is-front .wg-card__face--front {
    transform: none;
}

.wg-card__label {
    position: absolute;
    left: 50%;
    bottom: -14px;
    z-index: 2;
    display: flex;
    gap: 4px;
    transform: translateX(-50%) rotate(-3deg);
    white-space: nowrap;
}

.wg-card__new {
    padding: 4px 8px 3px;
    border-radius: 4px;
    background: var(--lime);
    font-family: var(--font-pixel);
    font-size: 12px;
    line-height: 1;
    text-transform: uppercase;
}

.wg-card__label .wg-rar {
    font-size: 12px;
    padding: 4px 8px 3px;
}

.wg-card__name {
    position: absolute;
    left: 50%;
    top: calc(100% + 24px);
    padding: 5px 14px 3px;
    border-radius: 999px;
    background: var(--white);
    font-family: var(--font-pixel);
    font-size: 16px;
    line-height: 1.1;
    color: var(--ink);
    white-space: nowrap;
    transform: translateX(-50%) rotate(2deg);
    box-shadow: 0 6px 14px rgba(0, 60, 140, 0.2);
}

.wg-deck--top .wg-card:not(:last-child) .wg-card__label,
.wg-deck--top .wg-card:not(:last-child) .wg-card__name {
    display: none;
}

.wg-open__wow {
    position: absolute;
    left: 50%;
    top: calc(28% - var(--card) / 2 - 40px);
    z-index: 4;
    width: min(46vw, 230px);
    height: auto;
    transform: translateX(-10%) rotate(10deg) scale(0);
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 10px 16px rgba(160, 0, 80, 0.3));
}

.wg-open__wow.is-pop {
    animation: wg-wow 1.6s var(--ease-pop) forwards;
}

@keyframes wg-wow {
    0% {
        opacity: 0;
        transform: translateX(-10%) rotate(-10deg) scale(0.2);
    }
    18% {
        opacity: 1;
        transform: translateX(-10%) rotate(10deg) scale(1.1);
    }
    30%,
    80% {
        opacity: 1;
        transform: translateX(-10%) rotate(6deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-10%) rotate(6deg) scale(0.9);
    }
}

.wg-open__foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.wg-open__foot .wg-open__hint {
    position: static;
}

.wg-open__auto,
.wg-open__again {
    padding: 8px 20px 6px;
    border-radius: 999px;
    background: rgba(253, 253, 253, 0.55);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.9) inset;
    font-family: var(--font-pixel);
    font-size: 13px;
    text-transform: uppercase;
    color: var(--ink);
    transition: transform 0.3s var(--ease-pop);
}

.wg-open__auto:hover,
.wg-open__again:hover {
    transform: scale(1.06) rotate(-2deg);
}

.wg-open__auto[hidden] {
    display: none;
}

/* done */
.wg-open__done {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: max(3vh, 16px) 16px 22px;
}

.wg-open__done .wg-open__header {
    position: static;
    transform: rotate(-2deg);
    flex: 0 0 auto;
    max-height: 36vh;
    width: auto;
    max-width: min(76vw, 340px);
}

.wg-strip {
    width: 100vw;
    margin-top: 18px;
    overflow: hidden;
    flex: 0 0 auto;
}

.wg-strip__track {
    display: flex;
    gap: 16px;
    width: max-content;
    padding: 10px 0;
    animation: wg-marquee 18s linear infinite;
}

.wg-strip__item {
    position: relative;
    width: clamp(110px, 16vh, 150px);
    flex: 0 0 auto;
}

.wg-strip__item:nth-child(odd) {
    transform: rotate(-4deg);
}

.wg-strip__item:nth-child(even) {
    transform: rotate(3deg) translateY(8px);
}

.wg-strip__item img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 12px 18px rgba(0, 50, 120, 0.28));
}

.wg-strip__item .wg-card__new {
    position: absolute;
    left: -4px;
    top: -6px;
    transform: rotate(-8deg);
}

@keyframes wg-marquee {
    to {
        transform: translateX(-50%);
    }
}

.wg-open__sum {
    margin-top: 16px;
    max-width: 420px;
    padding: 9px 18px 7px;
    border-radius: 999px;
    background: var(--white);
    font-family: var(--font-pixel);
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
    text-transform: uppercase;
    color: var(--ink);
    box-shadow: 0 8px 20px rgba(0, 60, 140, 0.2);
    transform: rotate(-1.5deg);
}

.wg-open__sum b {
    display: inline-block;
    padding: 0 6px;
    border-radius: 5px;
    background: var(--lime);
    font-weight: 400;
}

.wg-open__capsule {
    display: flex;
    gap: 6px;
    width: min(420px, 100%);
    margin-top: auto;
    padding: 6px;
    border-radius: var(--bar-r);
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(253, 253, 253, 0.55), 0 16px 34px rgba(160, 20, 20, 0.35);
    animation: wg-cap-in 0.7s var(--ease-pop) 0.3s backwards;
}

@keyframes wg-cap-in {
    from {
        transform: translateY(140%);
    }
}

.wg-open__capsule .qw-btn {
    flex: 1;
    min-height: var(--item-h);
    padding: 8px 12px;
}

.wg-open__again {
    margin-top: 12px;
}

.wg-open__again[disabled] {
    opacity: 0.6;
}

/* hide the page's signup capsule while an overlay is up */
body.wg-lock {
    overflow: hidden;
}

body.wg-lock .qw-capsule {
    transform: translate(-50%, 160%);
    transition: transform 0.4s var(--ease-out);
}

/* ---- mobile ------------------------------------------------------------ */

@media (max-width: 640px) {
    .wg {
        --key-h: 62px;
        --tile-r: 22px;
    }

    .wg-tags {
        transform: rotate(-1.5deg) scale(0.86);
        margin: -4px 0;
    }

    .wg-pill {
        font-size: 20px;
        padding: 1px 9px 0;
    }

    .wg-title {
        font-size: 84px;
    }

    .wg-intro {
        font-size: 15px;
    }

    .wg-head__stars {
        top: 14px;
        left: auto;
        right: 0;
        margin: 0;
        width: 64px;
    }

    .wg-intro {
        font-size: 14px;
        padding: 12px 16px;
    }

    .wg-gallery {
        margin-top: 34px;
    }

    .wg-bar__more {
        flex-basis: 88px;
        font-size: 15px;
    }

    .wg-key img {
        width: 44px;
        height: 44px;
    }

    .wg-key--favs img {
        width: 52px;
        height: 52px;
    }

    .wg-board {
        margin-left: calc(-1 * var(--gutter) + 6px);
        margin-right: calc(-1 * var(--gutter) + 6px);
        padding: 26px 14px 28px;
        border-radius: 34px;
    }

    .wg-tile__name {
        font-size: 14px;
    }

    .wg-heart {
        width: 40px;
        height: 40px;
    }

    .wg-detail {
        place-items: end center;
        padding: 10px 8px;
    }

    .wg-detail__panel {
        padding: 22px 16px 14px;
        border-radius: 36px;
    }

    .wg-detail__stage {
        width: min(290px, 74vw);
    }

    .wg-detail__nav--prev {
        left: -6px;
    }

    .wg-detail__nav--next {
        right: -6px;
    }

    .wg-detail__name {
        font-size: 28px;
    }
}

@media (max-height: 760px) and (max-width: 640px) {
    .wg-detail__stage {
        width: min(250px, 66vw);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wg-ring,
    .wg-pack__tilt,
    .wg-strip__track,
    .wg-head__cta .qw-btn,
    .wg-head__stars {
        animation: none !important;
    }
}

.wg-open[data-pack='limited'] .wg-open__pack {
    --t: 17%;
}
