/*
 * Mystery Reveal Overlay
 * Full-screen animated reveal for Mystery category product wishes.
 */

/* ── Overlay ──────────────────────────────────────────── */
.wly-mystery {
    position: fixed;
    inset: 0;
    z-index: 9997;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
    background: radial-gradient(ellipse at 50% 30%, #1e0a4e 0%, #0d0d14 60%, #000 100%);
}

.wly-mystery--visible { opacity: 1; }

.wly-mystery--out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

/* ── Background stars ─────────────────────────────────── */
.wly-mystery__stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.wly-mystery__star {
    position: absolute;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    animation: wly-star-pulse linear infinite;
}

@keyframes wly-star-pulse {
    0%, 100% { opacity: 0;   transform: scale(0.4); }
    50%       { opacity: 0.9; transform: scale(1);   }
}

/* ── Glowing orb behind main content ─────────────────── */
.wly-mystery__orb {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.25) 0%, transparent 70%);
    pointer-events: none;
    animation: wly-orb-breathe 4s ease-in-out infinite;
}

@keyframes wly-orb-breathe {
    0%, 100% { transform: scale(1);    opacity: 0.6; }
    50%       { transform: scale(1.15); opacity: 1;   }
}

/* ── Phase 1: Entry text ──────────────────────────────── */
.wly-mystery__entry {
    position: absolute;
    text-align: center;
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 2;
}

.wly-mystery__entry--in {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.wly-mystery__entry--out {
    opacity: 0;
    transform: scale(1.1) translateY(-30px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.wly-mystery__logo {
    font-size: clamp(2.8rem, 8vw, 5.5rem);
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1;
    text-shadow:
        0 0 30px rgba(124, 58, 237, 0.9),
        0 0 80px rgba(124, 58, 237, 0.5),
        0 0 120px rgba(124, 58, 237, 0.2);
}

.wly-mystery__tagline {
    font-size: clamp(1.1rem, 3.5vw, 1.8rem);
    color: rgba(255, 255, 255, 0.65);
    margin-top: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.06em;
}

/* ── Phase 2: Slot machine ────────────────────────────── */
.wly-mystery__slot-wrap {
    position: absolute;
    width: min(540px, 90vw);
    text-align: center;
    opacity: 0;
    transform: translateY(60px) scale(0.95);
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 2;
}

.wly-mystery__slot-wrap--in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.wly-mystery__slot-wrap--out {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.wly-mystery__slot-label {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(167, 139, 250, 0.7);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.wly-mystery__slot-box {
    background: rgba(124, 58, 237, 0.08);
    border: 1.5px solid rgba(124, 58, 237, 0.35);
    border-radius: 1.25rem;
    padding: 1.5rem 2rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(124, 58, 237, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Top and bottom fade masks */
.wly-mystery__slot-box::before,
.wly-mystery__slot-box::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 36px;
    z-index: 3;
    pointer-events: none;
}
.wly-mystery__slot-box::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(15, 8, 40, 0.95), transparent);
}
.wly-mystery__slot-box::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(15, 8, 40, 0.95), transparent);
}

.wly-mystery__slot-item {
    display: block;
    font-size: clamp(1.3rem, 3.5vw, 2rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    min-height: 1.3em;
    text-shadow: 0 0 20px rgba(124, 58, 237, 0.6);
    transition: opacity 0.06s ease;
}

.wly-mystery__slot-item--flash {
    animation: wly-slot-flash 0.09s ease;
}

@keyframes wly-slot-flash {
    0%   { opacity: 0; transform: translateY(6px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Scanning line effect */
.wly-mystery__slot-scan {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(124, 58, 237, 0.8), transparent);
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    opacity: 0;
    animation: wly-slot-scan 0.8s linear infinite;
}

@keyframes wly-slot-scan {
    0%   { opacity: 0; top: 20%; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { opacity: 0; top: 80%; }
}

/* ── Phase 3: Countdown ───────────────────────────────── */
.wly-mystery__countdown {
    position: absolute;
    top: calc(50% - 160px);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    z-index: 3;
}

.wly-mystery__countdown--in  { opacity: 1; }
.wly-mystery__countdown--out { opacity: 0; transition: opacity 0.25s ease; }

.wly-mystery__count {
    font-size: clamp(5rem, 15vw, 9rem);
    font-weight: 900;
    color: transparent;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    line-height: 1;
    display: block;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(124, 58, 237, 0.8));
}

.wly-mystery__count--pulse {
    animation: wly-count-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes wly-count-in {
    0%   { opacity: 0; transform: scale(0.2) rotate(-10deg); filter: drop-shadow(0 0 60px rgba(124,58,237,1)); }
    60%  { opacity: 1; transform: scale(1.2) rotate(3deg);   filter: drop-shadow(0 0 40px rgba(124,58,237,0.9)); }
    100% { opacity: 1; transform: scale(1)   rotate(0deg);   filter: drop-shadow(0 0 20px rgba(124,58,237,0.6)); }
}

.wly-mystery__count--out {
    animation: wly-count-out 0.25s ease forwards;
}

@keyframes wly-count-out {
    to { opacity: 0; transform: scale(1.4); }
}

/* ── Phase 4: Product reveal ──────────────────────────── */
.wly-mystery__reveal {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 2;
    overflow-y: auto;
}

.wly-mystery__reveal--in {
    opacity: 1;
    pointer-events: all;
}

.wly-mystery__reveal-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(167, 139, 250, 0.8);
    font-weight: 700;
}

/* Product card */
.wly-mystery__card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 1.5rem;
    width: min(460px, 92vw);
    text-align: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    transform: scale(0.65) translateY(50px);
    transition: opacity 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(124, 58, 237, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.wly-mystery__card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(167, 139, 250, 0.5), transparent);
}

.wly-mystery__card--in {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.wly-mystery__rarity {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.9rem;
    border-radius: 9999px;
    border: 1px solid currentColor;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.4s ease 0.15s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s;
}

.wly-mystery__card--in .wly-mystery__rarity {
    opacity: 1;
    transform: scale(1);
}

.wly-mystery__img-wrap {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1.1rem;
    background: rgba(255, 255, 255, 0.04);
}

.wly-mystery__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

.wly-mystery__card--in .wly-mystery__img {
    opacity: 1;
    transform: scale(1);
}

.wly-mystery__product-name {
    font-size: clamp(1.1rem, 3vw, 1.45rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.4rem;
    line-height: 1.25;
}

.wly-mystery__product-desc {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.55;
}

/* Claim button */
.wly-mystery__claim {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 1rem;
    padding: 0.9rem 2.5rem;
    border-radius: 9999px;
}

.wly-mystery__claim--in {
    opacity: 1;
    transform: translateY(0);
}

.wly-mystery__claim:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
}

/* ── Rarity colour tokens ──────────────────────────────── */
.wly-mystery__rarity--legendary { color: #f59e0b; border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.12); }
.wly-mystery__rarity--epic      { color: #8b5cf6; border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.12); }
.wly-mystery__rarity--rare      { color: #3b82f6; border-color: rgba(59, 130, 246, 0.35);  background: rgba(59, 130, 246, 0.12); }
.wly-mystery__rarity--uncommon  { color: #10b981; border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.12); }
.wly-mystery__rarity--common    { color: #9ca3af; border-color: rgba(156, 163, 175, 0.35);background: rgba(156, 163, 175, 0.1); }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .wly-mystery__card    { padding: 1.1rem; border-radius: 1.25rem; }
    .wly-mystery__reveal  { gap: 0.9rem; padding: 1rem; }
    .wly-mystery__claim   { font-size: 0.92rem; padding: 0.8rem 1.8rem; }
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .wly-mystery,
    .wly-mystery__entry,
    .wly-mystery__slot-wrap,
    .wly-mystery__card,
    .wly-mystery__rarity,
    .wly-mystery__img,
    .wly-mystery__claim {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
