/* Wheel Modal Entry Animations */
@keyframes wheelOverlayFade {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

@keyframes wheelContentPop {
    0% {
        transform: scale(0.5) translateY(50px);
        opacity: 0;
    }

    60% {
        transform: scale(1.05) translateY(-10px);
        opacity: 1;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes titleSlideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.wheel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 11000;
    display: none;
    align-items: center;
    justify-content: center;
    /* Removed basic transition, using animation on active */
}

.wheel-overlay.active {
    display: flex;
    animation: wheelOverlayFade 0.4s ease-out forwards;
}

.wheel-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: none;
    background: radial-gradient(circle at center, rgba(30, 15, 45, 0.85) 0%, rgba(5, 10, 15, 0.98) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;

    /* Prevent mobile shifting */
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    contain: layout style;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .wheel-wrapper {
        padding: 10px;
        justify-content: flex-start;
        padding-top: 60px;
    }
}

/* Staggered Animations for Children when Active */
.wheel-overlay.active .wheel-title {
    animation: titleSlideDown 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.wheel-overlay.active .spin-counter {
    animation: titleSlideDown 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
    /* Delay */
    opacity: 0;
    /* Start hidden */
}

.wheel-overlay.active .wheel-container {
    animation: wheelContentPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
    /* Delay */
    opacity: 0;
    /* Start hidden */
}

.wheel-overlay.active .wheel-footer-note {
    animation: titleSlideDown 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s forwards;
    opacity: 0;
}


.wheel-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: all 0.2s;
}

.wheel-close-btn:hover {
    background: rgba(255, 0, 0, 0.5);
    border-color: red;
}

/* Wheel Container */
.wheel-container {
    position: relative;
    width: 90vw;
    max-width: 400px;
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Premium Glow behind the wheel */
    filter: drop-shadow(0 0 40px rgba(221, 0, 255, 0.3));

    /* Prevent mobile shifting without clipping */
    contain: layout style;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
    .wheel-container {
        width: 85vw;
        max-width: 350px;
        /* Prevent overflow on small screens */
        overflow: visible;
    }
}

/* Outer Ring / Frame - PREMIUM NEON */
@keyframes rotateGlow {
    0% {
        filter: hue-rotate(0deg);
    }

    100% {
        filter: hue-rotate(360deg);
    }
}

.wheel-outer-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: transparent;
    z-index: 10;

    border: 8px solid #33203b;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
    /* very faint outer glow to simulate depth */
    pointer-events: none;
}

/* The SVG Container */
#main-wheel {
    width: 100%;
    height: 100%;
    z-index: 5;
    /* transition handled in JS */
    /* IOS Stability */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform-style: flat;
    overflow: visible !important;

    position: relative;
    contain: layout;
    transform: translateZ(0) rotate(0deg);
    -webkit-transform: translateZ(0) rotate(0deg);
}

/* Ensure SVG doesn't cause layout shifts */
#main-wheel svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    position: absolute;
    top: 0;
    left: 0;
}

/* Pointer - Simple White Triangle */
.wheel-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
}

.wheel-pointer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 35px solid #fff;
    /* Solid white */
}

/* Center Hub - Solid Red */
.wheel-center-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: #FF3B5D;
    /* the nice light red/pink */
    border: 5px solid #ffa4af;
    /* light pink border */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wheel-center-hub:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.spin-btn {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #fff;
    font-weight: 800;
    font-size: 1.3rem;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    letter-spacing: 0px;
    line-height: 1.1;
    text-shadow: none;
    /* Removed neon */
}

.spin-btn span {
    font-size: 1.2rem;
    color: #ffffff;
    font-weight: 800;
    margin-bottom: 0px;
    text-transform: none;
    /* Changed from uppercase to match screenshot more closely */
    text-shadow: none;
    letter-spacing: 0px;
}

/* Result Popup */
/* Premium Result Popup */
.wheel-result-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 85%;
    max-width: 340px;
    background: linear-gradient(135deg, rgba(30, 45, 70, 0.95), rgba(15, 25, 40, 0.98));
    border: 2px solid rgba(255, 215, 0, 0.5);
    padding: 35px 25px;
    border-radius: 24px;
    text-align: center;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.wheel-result-popup.active {
    transform: translate(-50%, -50%) scale(1);
    animation: popupGlow 2s infinite alternate;
}

@keyframes popupGlow {
    from {
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 215, 0, 0.1), 0 0 20px rgba(255, 215, 0, 0.2);
    }

    to {
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(255, 215, 0, 0.3), 0 0 40px rgba(255, 215, 0, 0.5);
    }
}

.wheel-result-popup h3 {
    color: #fff;
    margin: 0 0 15px;
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ffca2c, #fff, #ffc107);
    background-size: 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.wheel-result-popup p {
    color: #e2e8f0;
    margin-bottom: 25px;
    font-size: 1.15rem;
    font-weight: 500;
}

.wheel-result-popup button {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #111;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-weight: 900;
    cursor: pointer;
    font-size: 1.15rem;
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.wheel-result-popup button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 152, 0, 0.6);
}

/* Title and Counter Styles */
.wheel-title {
    text-align: center;
    margin-bottom: 20px;
    z-index: 100;
}

.wheel-title h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 50%, #e0b0ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-transform: uppercase;
    text-shadow: 0 10px 30px rgba(221, 0, 255, 0.4);
    letter-spacing: 3px;
}

.wheel-title h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
    color: #0ff;
    text-transform: uppercase;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
    letter-spacing: 8px;
    margin-top: 5px;
}

.spin-counter {
    margin-bottom: 25px;
    padding: 12px 28px;
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.15), rgba(0, 0, 0, 0.7));
    border: 1.5px solid rgba(255, 215, 0, 0.5);
    border-radius: 50px;
    color: #ffd700;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.2), inset 0 0 10px rgba(255, 215, 0, 0.1);
    z-index: 100;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}


.wheel-footer-note {
    margin-top: 30px;
    max-width: 85%;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 18px 25px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.5));
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.wheel-toast {
    position: absolute;
    top: 220px;
    /* Adjust based on title/counter height */
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(220, 38, 38, 0.95);
    /* Red error bg */
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 280px;
    justify-content: center;
    text-align: center;
}

.wheel-toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.wheel-toast.success {
    background: rgba(34, 197, 94, 0.9);
    /* Green */
}


/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}