/* Reset default body margins to prevent fixed popup from shifting */
body {
    margin: 0; /* Removes browser or theme margins that could offset the popup */
}

/* Cyberpunk-themed spin wheel popup */
#stw-popup {
    position: fixed !important; /* Fixes popup to the viewport, stays in place */
    top: 0; left: 0; /* Starts at top-left corner */
    width: 100%; /* Full viewport width */
    height: 100vh; /* Full viewport height for true centering */
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 30, 0.9)); /* Dark gradient for cyberpunk aesthetic */
    z-index: 2147483647 !important; /* Highest z-index to stay above all elements */
    font-family: 'Orbitron', sans-serif; /* Futuristic font */
    backdrop-filter: blur(5px); /* Subtle blur for depth */
    animation: neon-flicker 5s infinite alternate; /* Flickering neon effect */
    box-sizing: border-box; /* Ensures padding/borders don’t increase size */
    overflow: hidden; /* Prevents scrolling, keeps popup fixed */
}

/* Neon flicker animation for background */
@keyframes neon-flicker {
    0%, 100% { opacity: 1; } /* Fully visible */
    50% { opacity: 0.98; } /* Slightly dim for flicker */
}

/* Inner popup container, centered with absolute positioning */
.stw-popup-inner {
    position: absolute; /* Positions relative to #stw-popup */
    top: 50%; left: 50%; /* Places top-left corner at center of screen */
    transform: translate(-50%, -50%); /* Offsets by half its size for dead center */
    display: flex; /* Flexbox for internal layout (wheel and instructions) */
    gap: 20px; /* Space between left and right sections */
    max-width: 1100px; /* Limits width for large screens */
    width: 100%; /* Uses most of available space */
    max-height: 90vh; /* Caps height to fit viewport */
    background: linear-gradient(45deg, #111, #222); /* Dark gradient */
    padding: 50px; /* Minimal padding to avoid shifting */
    border-radius: 16px; /* Rounded corners */
    box-shadow: 0 0 50px rgba(255, 0, 255, 0.4), 0 0 30px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(255, 134, 31, 0.2); /* Neon glows */
    border: 2px solid #ff861f; /* Neon orange border */
    animation: pulse-glow 2s ease-in-out infinite; /* Pulsing glow effect */
    box-sizing: border-box; /* Ensures padding doesn’t affect width */
    overflow-y: auto; /* Allows scrolling within popup if content is tall */
}

/* Pulsing glow animation for inner container */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 50px rgba(255, 0, 255, 0.4), 0 0 30px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(255, 134, 31, 0.2); } /* Base glow */
    50% { box-shadow: 0 0 70px rgba(255, 0, 255, 0.6), 0 0 40px rgba(0, 255, 255, 0.5), inset 0 0 30px rgba(255, 134, 31, 0.3); } /* Brighter glow */
    100% { box-shadow: 0 0 50px rgba(255, 0, 255, 0.4), 0 0 30px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(255, 134, 31, 0.2); } /* Base glow */
}

/* Left side containing the wheel */
.stw-left {
    flex: 1 1 500px; /* Takes available space, minimum 500px */
    text-align: center; /* Centers wheel and result text */
    position: relative; /* Positions pointer relative to this */
}

/* Wheel container */
.stw-wheel-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    overflow: visible; /* 🔧 This line fixes clipping of glow */
    
}

/* Wheel SVG element */
#stw-wheel {
    width: 100%;
    height: auto;
    border-radius: 50%;
    background: #222;
    overflow: visible !important; /* 🔧 Ensures glow is not clipped */
    backface-visibility: hidden; /* 🔧 GPU rendering */
    transform-style: preserve-3d; /* 🔧 GPU rendering */
    box-shadow: 0 0 15px #ff00ff, inset 0 0 10px #00c0ff;
    transition: transform 4s ease-out;
    animation: slow-spin 20s linear infinite;
}


/* Pointer image */
.stw-pointer {
    position: absolute; /* Positions above wheel */
    top: -60px; /* Offset above wheel */
    left: 50%; /* Centers horizontally */
    transform: translateX(-50%) rotate(0deg); /* Centers and upright */
    width: 90px; /* Pointer size */
    height: auto; /* Maintains aspect ratio */
    z-index: 2147483647; /* Stays on top */
    pointer-events: none; /* Ignores clicks */
    filter: drop-shadow(0 0 10px #00c0ff) drop-shadow(0 0 20px #ff861f); /* Neon glows */
}

/* Pointer animation during spin */
.stw-pointer.animate {
    animation: stw-pendulum 0.4s infinite ease-in-out; /* Pendulum swing */
}

/* Pendulum animation keyframes */
@keyframes stw-pendulum {
    0% { transform: translateX(-50%) rotate(0deg); } /* Center */
    25% { transform: translateX(-50%) rotate(5deg); } /* Right tilt */
    50% { transform: translateX(-50%) rotate(0deg); } /* Center */
    75% { transform: translateX(-50%) rotate(-5deg); } /* Left tilt */
    100% { transform: translateX(-50%) rotate(0deg); } /* Center */
}

/* Right side with instructions and button */
.stw-right {
    flex: 1 1 300px; /* Takes available space, minimum 300px */
    display: flex; /* Flexbox for vertical layout */
    flex-direction: column; /* Stacks vertically */
    justify-content: center; /* Centers content vertically */
    padding: 10px; /* Minimal padding */
    color: #fff; /* White text */
}

/* Popup title */
.stw-title {
    font-size: 28px; /* Large text */
    margin-bottom: 10px; /* Space below */
    color: #ff861f; /* Neon orange */
    text-shadow: 0 0 8px #ff861f; /* Neon glow */
}

/* Instructions list */
.stw-instructions {
    padding-left: 20px; /* Indents for bullets */
    margin-bottom: 20px; /* Space below */
    color: #ccc; /* Light gray text */
}

/* Instruction items */
.stw-instructions li {
    margin-bottom: 6px; /* Space between items */
}

/* GDPR checkbox container */
.stw-gdpr {
    font-size: 14px; /* Smaller text */
    margin-bottom: 15px; /* Space below */
    display: flex; /* Flexbox for layout */
    align-items: center; /* Aligns vertically */
    gap: 8px; /* Space between checkbox and text */
}

/* GDPR checkbox styling */
.stw-gdpr input[type="checkbox"] {
    transform: scale(1.2); /* Larger checkbox */
    accent-color: #ff861f; /* Neon orange */
}

/* Spin button */
#stw-spin {
    margin-top: 40px; /* Space above */
    padding: 18px 40px; /* Large padding */
    font-size: 1.4rem; /* Large text */
    background: linear-gradient(90deg, #ff861f, #ff00ff); /* Orange to magenta */
    color: #fff; /* White text */
    border: none; /* No border */
    border-radius: 8px; /* Rounded corners */
    cursor: pointer; /* Hand cursor */
    transition: all 0.3s ease; /* Smooth hover effect */
    font-weight: bold; /* Bold text */
    text-transform: uppercase; /* Uppercase */
    letter-spacing: 2px; /* Spaced-out text */
    box-shadow: 0 0 20px rgba(255, 134, 31, 0.5); /* Neon glow */
}

/* Spin button hover effect */
#stw-spin:hover {
    background: linear-gradient(90deg, #cc5300, #cc00cc); /* Darker gradient */
    box-shadow: 0 0 30px rgba(255, 134, 31, 0.8); /* Brighter glow */
    transform: scale(1.05); /* Slight zoom */
}

/* Result display */
#stw-result {
    margin-top: 30px; /* Space above */
    padding: 0px; /* Padding */
    font-size: 1.5rem; /* Large text */
    background: rgba(0, 0, 0, 0.3); /* Semi-transparent background */
    border-radius: 6px; /* Rounded corners */
}

/* Countdown timer */
.stw-countdown {
    margin-top: 10px; /* Space above */
    color: #00ffcc; /* Neon cyan */
    font-size: 1.2rem; /* Smaller text */
}

/* Close button */
#stw-close {
    position: absolute; /* Top-right corner */
    top: 10px; right: 10px; /* Offset */
    background: none; /* No background */
    border: none; /* No border */
    font-size: 28px; /* Large text */
    color: #fff; /* White text */
    cursor: pointer; /* Hand cursor */
    z-index: 10000; /* Stays on top */
    text-shadow: 0 0 8px #ff861f; /* Neon glow */
}

/* Mobile layout adjustments */
@media (max-width: 768px) { /* For screens smaller than 768px */
    .stw-popup-inner {
        flex-direction: column; /* Stacks sections vertically */
        gap: 15px; /* Smaller gap */
        padding: 15px; /* Reduced padding */
        width: 95%; /* Uses most of screen */
        max-height: 85vh; /* Caps height */
        top: 50%; /* Maintains vertical center */
        left: 50%; /* Maintains horizontal center */
        transform: translate(-50%, -50%); /* Keeps dead center */
    }

    .stw-left, .stw-right {
        flex: 1 1 100%; /* Full width */
    }

    .stw-wheel-container {
        max-width: 100%; /* Fits smaller screens */
    }

    .stw-pointer {
        top: -30px; /* Closer to wheel */
        width: 60px; /* Smaller pointer */
    }

    #stw-spin {
        padding: 14px 20px; /* Smaller padding */
        font-size: 1.2rem; /* Smaller text */
    }
}

/* Desktop only */
.stw-desktop-only {
    display: block;
}
.stw-mobile-only {
    display: none;
}

/* Mobile overrides */
@media screen and (max-width: 768px) {
    .stw-desktop-only {
        display: none !important;
    }
    .stw-mobile-only {
        display: block !important;
    }
}

/* Side Tab */
#stw-side-tab {
    position: fixed;
    bottom: 100px;
    left: 20px; /* Hidden off-screen by default */
    width: 150px;
    height: 80px;
    background: linear-gradient(45deg, #111, #222);
    border: 2px solid #ff861f;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255, 134, 31, 0.5);
    z-index: 2147483646; /* Below popup but above most elements */
    cursor: pointer;
    transition: left 0.3s ease;
}

#stw-side-tab:hover, #stw-side-tab.active {
    left: 0; /* Slide in on hover or when active */
}

.stw-tab-content {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 10px;
}

.stw-tab-wheel-container {
    width: 50px;
    height: 50px;
    margin-right: 10px;
}

#stw-tab-wheel {
    /* width: 100%; */
    height: 100%;
    border-radius: 50%;
    background: #222;
    box-shadow: 0 0 2px #00c0ff;
    animation: slow-spin 20s linear infinite; /* Slow rotation */
}

@keyframes slow-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.stw-tab-text {
    display: flex;
    flex-direction: column;
    color: #00ffcc;
    font-size: 12px;
    text-shadow: 0 0 5px #00ffcc;
}

#stw-tab-status {
    font-weight: bold;
}

#stw-tab-countdown {
    font-size: 10px;
}

@media screen and (max-width: 768px) {
    .stw-pointer {
        position: absolute !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 99999 !important;
        width: 60px !important;
        height: auto !important;
        top: -30px !important; /* Try lowering it for visibility */
        left: 50% !important;
        transform: translateX(-50%) rotate(0deg) !important;
        background: none !important;
        content: none !important;
    }
}

/* Slow spin animation for main wheel */
#stw-wheel.spinning {
    animation: none;
    box-shadow: 0 0 25px #ff00ff, 0 0 45px #ff00ff, inset 0 0 20px #00c0ff; /* 🔥 Glow intensifies when spinning */
}


@media screen and (max-width: 768px) {
    .stw-pointer {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        z-index: 2147483647 !important;
        width: 60px !important;
        height: auto !important;
        top: -30px !important;
        left: 50% !important;
        transform: translateX(-50%) rotate(0deg) !important;
        background: none !important;
        content: none !important;
        pointer-events: none !important;
    }

    .stw-wheel-container {
        overflow: visible !important; /* Ensures glow and pointer aren't clipped */
    }
}
