:root {
    --primary: #FF6B6B;
    --primary-glow: #FF6B6Baa;
    --background: #2B2D42;
    --card-bg: #454964;
    --text: #EDF2F4;
    --accent: #4ECDC4;
    --border-radius: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

.star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    pointer-events: none;
    animation: twinkle ease-in-out infinite;
    will-change: opacity, transform; /* PERFORMANCE: Added for smoother animations */
}

.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

body {
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(78, 205, 196, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255, 107, 107, 0.05) 0%, transparent 50%);
}

.container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.title {
    text-align: center;
    margin-bottom: 2rem;
    color: #FFF;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 0 15px var(--primary-glow);
}

.spinner-display {
    background: rgba(69, 73, 100, 0.92); /* PERFORMANCE: Increased opacity to compensate for removed blur */
    /* backdrop-filter: blur(10px); REMOVED FOR PERFORMANCE */
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 0 20px var(--primary-glow);
    transition: all 0.3s ease;
}

.spinner-display:hover {
    box-shadow: 0 0 30px var(--primary-glow);
    transform: translateY(-2px);
}

@keyframes float-chest {
    0%, 100% { 
        transform: translateY(0) rotate(0deg);
    }
    50% { 
        transform: translateY(-8px) rotate(2deg);
    }
}

.current-prize {
    margin-bottom: 1rem;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    background: rgba(20, 30, 45, 0.9); /* PERFORMANCE: Slightly increased opacity */
    padding: 1.25rem;
    border-radius: 1rem;
    box-shadow: 0 0 25px rgba(255, 107, 107, 0.4);
    border: 2px solid rgba(255, 107, 107, 0.6);
    transition: all 0.3s ease;
}

.prize-image {
    max-width: 150px;
    height: auto;
    border-radius: 10px;
    transition: transform 0.3s ease, opacity 0.2s ease;
    filter: drop-shadow(0 0 8px rgba(78, 205, 196, 0.3));
    cursor: pointer;
    will-change: transform; /* PERFORMANCE: Added for smoother animations */
}

.current-prize .prize-image {
    animation: float-chest 3s ease-in-out infinite;
}

.current-prize .prize-image.landed {
    animation: none;
}

.prize-image:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 12px rgba(78, 205, 196, 0.5));
}

.prize-image.cycling {
    animation: none;
    transform: scale(0.95);
    opacity: 0.8;
}

#prizeName {
    font-size: 1.2rem;
    font-weight: 700;
    color: #FFF;
    text-transform: uppercase;
    padding: 0.5rem;
}

.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-claim {
    background: #FFB347;
    border: 2px solid #FFB347;
    box-shadow: 0 0 15px rgba(255, 179, 71, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-claim:hover:not(:disabled) {
    background: #FFA726;
    box-shadow: 0 5px 15px rgba(255, 179, 71, 0.6);
    transform: translateY(-2px);
}

.prize-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.prize-card {
    background: rgba(69, 73, 100, 0.92); /* PERFORMANCE: Increased opacity to compensate for removed blur */
    /* backdrop-filter: blur(10px); REMOVED FOR PERFORMANCE - This was the BIGGEST impact (14 cards!) */
    border-radius: 0.75rem;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.prize-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 3px 10px rgba(78, 205, 196, 0.2);
}

.prize-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    margin-bottom: 0.25rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    border-radius: 0.5rem;
}

.prize-card p {
    font-size: 0.8rem;
    color: #FFF;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message {
    text-align: center;
    margin: 1rem 0;
    padding: 1rem;
    border-radius: var(--border-radius);
    background: rgba(69, 73, 100, 0.92); /* PERFORMANCE: Increased opacity to compensate for removed blur */
    /* backdrop-filter: blur(10px); REMOVED FOR PERFORMANCE */
    animation: slideUp 0.5s ease-out;
    font-size: 1.1rem;
}

.success {
    border: 2px solid #FFB347;
    color: #FFF;
    background: rgba(43, 45, 66, 0.95); /* PERFORMANCE: Slightly increased opacity */
    font-weight: bold;
}

.error {
    border: 2px solid #FF6B6B;
    color: #FF6B6B;
}

h3 {
    margin-bottom: 1rem;
    text-align: center;
    color: #FFF;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .controls {
        flex-direction: column;
    }
    
    .prize-image {
        max-width: 100px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }

    .username-input {
        flex-direction: column;
        gap: 0.5rem;
    }

    .username-input input {
        width: 100%;
    }

    .username-input button {
        width: 100%;
    }
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.bouncing-logo {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(78, 205, 196, 0.3));
}

.prize-claim-form {
    background: rgba(69, 73, 100, 0.92); /* PERFORMANCE: Increased opacity to compensate for removed blur */
    /* backdrop-filter: blur(10px); REMOVED FOR PERFORMANCE */
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
}

#confirmProfileBtn {
    margin: 1rem auto;
    display: block;
}

.won-prize {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(43, 45, 66, 0.95); /* PERFORMANCE: Slightly increased opacity */
    border-radius: 1rem;
    border: 2px solid var(--accent);
    box-shadow: 
        0 0 20px rgba(78, 205, 196, 0.2),
        inset 0 0 15px rgba(78, 205, 196, 0.1);
    position: relative;
    overflow: hidden;
}

.won-prize::before,
.won-prize::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, var(--accent), transparent);
    border-radius: 50%;
    opacity: 0.1;
    animation: float 3s ease-in-out infinite;
}

.won-prize::before {
    top: -20px;
    left: -20px;
}

.won-prize::after {
    bottom: -20px;
    right: -20px;
    animation-delay: -1.5s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(5px, -5px); }
}

.won-prize .prize-image {
    transform: scale(1.2);
    margin: 1rem 0;
    filter: drop-shadow(0 0 15px rgba(78, 205, 196, 0.4));
    animation: float-chest 3s ease-in-out infinite;
}

.won-prize p {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.4);
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.username-input {
    display: flex;
    gap: 1rem;
    max-width: 400px;
    margin: 2.5rem auto;
}

.username-input input {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 2px solid var(--primary);
    background: rgba(43, 45, 66, 0.95); /* PERFORMANCE: Slightly increased opacity */
    color: var(--text);
    font-size: 1rem;
}

.username-input input:focus {
    outline: none;
    box-shadow: 0 0 10px var(--primary-glow);
}

#usernameMessage {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.user-profile {
    margin: 1.5rem auto;
    text-align: center;
}

.profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}


.loading-container {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid var(--primary);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    will-change: transform; /* PERFORMANCE: Added for smoother spinner */
}

.loading-text {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}



#step3 .prize-claim-form {
    background: rgba(69, 73, 100, 0.92); /* PERFORMANCE: Increased opacity to compensate for removed blur */
    /* backdrop-filter: blur(10px); REMOVED FOR PERFORMANCE */
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
}

#step3 .won-prize {
    margin: 1.5rem 0;
}

#step3 .profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}


#confirmedUsername {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text);
    margin-top: 0.5rem;
    text-align: center;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

/* Loading Animation */
.confirm-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
    min-height: 300px;
}

.loading-prize-container {
    margin: 2rem 0;
}

.floating-prize {
    animation: floatingPrize 3s ease-in-out infinite;
    width: 120px;
    height: 120px;
    object-fit: contain;
    will-change: transform; /* PERFORMANCE: Added for smoother animation */
}

@keyframes floatingPrize {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.05);
    }
}

.loading-text-sequence {
    font-size: 1.1rem;
    color: var(--text);
    text-align: center;
    min-height: 2em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.loading-dots::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80% { content: '...'; }
}

/* Step 4 Styles */
.btn-verify {
    background: linear-gradient(45deg, #FF8800, #FFB302);
    color: white;
    margin: 2rem auto;
    font-size: 1.2rem;
    padding: 1.2rem 2.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 136, 0, 0.4);
    animation: pulseButton 2s infinite;
}

@keyframes pulseButton {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(78, 205, 196, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(78, 205, 196, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(78, 205, 196, 0.4);
    }
}

.btn-verify::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    from {
        transform: translateX(-100%) rotate(45deg);
    }
    to {
        transform: translateX(100%) rotate(45deg);
    }
}

.btn-verify:hover {
    background: linear-gradient(45deg, #FFB302, #FF8800);
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(255, 136, 0, 0.7);
    animation: none;
}

.btn-verify:active {
    transform: translateY(1px);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.5);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-animation {
    margin-bottom: 2rem;
}

.checkmark-circle {
    width: 80px;
    height: 80px;
    position: relative;
    margin: 0 auto;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: circleScale 0.3s ease-out;
}

.checkmark {
    border-right: 3px solid var(--accent);
    border-bottom: 3px solid var(--accent);
    width: 30px;
    height: 50px;
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%) rotate(45deg);
    animation: checkmarkDraw 0.4s ease-out 0.4s forwards;
    opacity: 0;
}

@keyframes circleScale {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

@keyframes checkmarkDraw {
    from {
        opacity: 0;
        width: 0;
        height: 0;
    }
    to {
        opacity: 1;
        width: 30px;
        height: 50px;
    }
}



.btn-back {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    margin: 1rem auto;
    align-self: flex-start;
}

@media (min-width: 768px) {
    .btn-back {
        align-self: center;
        margin: 1rem auto;
        display: block;
    }
}

.btn-back:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
    transform: translateY(-2px);
}


/* Custom Popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* PERFORMANCE: Increased opacity to compensate for removed blur */
    /* backdrop-filter: blur(4px); REMOVED FOR PERFORMANCE */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 90%;
    width: 400px;
    position: relative;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.popup-overlay.active .popup-content {
    transform: translateY(0);
}

.popup-message {
    color: var(--text);
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.popup-close {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--primary-glow);
}