* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100vh;
    min-height: 100vh;
    background: 
        linear-gradient(135deg, #001c33, #3777a5, #5cb6f6),
        url('./fundojogo.png') center top / auto 100% no-repeat fixed;
    background-blend-mode: overlay;
    
    font-family: 'Segoe UI', Arial, sans-serif;
    color: white;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="%23ffffff11"/></svg>') repeat;
    pointer-events: none;
    animation: floatBg 30s linear infinite;
}

@keyframes floatBg {
    from { transform: translate(0, 0); }
    to { transform: translate(100px, 100px); }
}

.container {
    text-align: center;
    z-index: 2;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    width: 100%;
    margin-bottom: 50px;
}

.header .logo {
    max-width: 280px;
    margin: 0 auto;
    display: block;
}

.wheel-wrapper {
    position: relative;
    width: min(90vw, 420px);
    height: min(90vw, 420px);
    margin: 0 auto 40px;
    max-width: 420px;
    max-height: 420px;
    flex-shrink: 0;
}

.glow {
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle, rgba(91, 174, 242, 0.7) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(30px);
    animation: pulseGlow 4s infinite alternate;
    z-index: 1;
}

#wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 
        0 0 80px rgba(255, 255, 255, 0.9),
        inset 0 0 60px rgba(0,0,0,0.5),
        0 20px 40px rgba(0,0,0,0.6);
    z-index: 2;
    cursor: pointer;
}

.pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-top: 60px solid #FFD700;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.7));
    z-index: 10;
    animation: wiggle 2s infinite ease-in-out;
}

.spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 130px;
    height: 130px;
    background: linear-gradient(145deg, #ffffff, #c5c5c5);
    border: none;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    color: #1a0033;
    cursor: pointer;
    box-shadow: 
        0 12px 35px rgba(0,0,0,0.6),
        inset 0 5px 15px rgba(255,255,255,0.4);
    z-index: 5;
    transition: all 0.2s ease;
    animation: pulseBtn 2s infinite;
    user-select: none;
}

.spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 15px 45px rgba(0, 128, 255, 0.8);
}

.spin-btn:active {
    transform: translate(-50%, -50%) scale(0.92);
}

.footer p {
    font-size: 15px;
    opacity: 0.85;
    margin-top: 20px;
}

/* Popup */
.popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 30, 69, 0.716);
    backdrop-filter: blur(12px);
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.4s ease;
}

.popup.show {
    display: flex;
}

.popup-content {
    background: rgb(200, 239, 255);
    color: #333;
    padding: 50px 35px 40px;
    border-radius: 28px;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 25px 70px rgba(0,0,0,0.6);
    animation: popIn 0.7s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    position: relative;
    overflow: hidden;
}

.popup-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: linear-gradient(90deg, #3763a5, #8bc9f2);
}

.popup-content h2 {
    color: #3768a5;
    font-size: 34px;
    margin-bottom: 18px;
    font-weight: 800;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 40px;
    cursor: pointer;
    color: #1e508d;
    transition: 0.3s;
    font-weight: bold;
}

.close:hover {
    transform: rotate(90deg) scale(1.2);
}

/* Imagem da pelota no popup - CENTRALIZADA e mais bonita */
#prize-image {
    animation: popIn 0.9s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    max-width: 320px;
    width: 80%;
    height: auto;
    display: block;
    margin: 20px auto 10px auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0);
    border-radius: 20px;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5));
}

/* Animações */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-18px); }
}

@keyframes pulseGlow {
    from { opacity: 0.6; transform: scale(1); }
    to { opacity: 1; transform: scale(1.05); }
}

@keyframes wiggle {
    0%, 100% { transform: translateX(-50%) rotate(-4deg); }
    50% { transform: translateX(-50%) rotate(4deg); }
}

@keyframes pulseBtn {
    0%, 100% { 
        box-shadow: 0 12px 35px rgba(0, 162, 255, 0.6), inset 0 5px 15px rgba(255,255,255,0.4);
    }
    50% { 
        box-shadow: 0 20px 50px rgb(0, 162, 255), inset 0 8px 20px rgba(255,255,255,0.6);
    }
}

@keyframes popIn {
    from { 
        transform: scale(0.4) translateY(120px); 
        opacity: 0; 
    }
    to { 
        transform: scale(1) translateY(0); 
        opacity: 1; 
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsivo */
@media (max-width: 480px) {
    .wheel-wrapper {
        width: 340px;
        height: 340px;
    }
    .spin-btn {
        width: 110px;
        height: 110px;
        font-size: 18px;
    }
    .popup-content {
        padding: 40px 25px;
    }
    #prize-image {
        max-width: 280px;
    }
}

/* ==================== PANTALLAS ==================== */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
    z-index: 1;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

#start-screen {
    background: 
        linear-gradient(135deg, #000e33, #377ba5, #5cc0f6),
        url('./fundojogo.png') center top / auto 100% no-repeat fixed;
    background-blend-mode: overlay;
}

.start-content {
    text-align: center;
    animation: float 6s ease-in-out infinite;
    width: 100%;
    max-width: 500px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 60px;
}

.start-logo {
    max-width: 500px;
    width: 80%;
    filter: drop-shadow(0 15px 30px rgba(0,0,0,0.6));
}

.play-button {
    padding: 18px 50px;
    font-size: 28px;
    font-weight: bold;
    color: #1a0033;
    background: linear-gradient(145deg, #ededed, #ffffff);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.play-button:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 25px 60px rgba(255, 255, 255, 0.6);
}

.play-button:active {
    transform: translateY(-4px) scale(1.02);
}

.home-button-container {
    margin-top: 40px;
    text-align: center;
}

.home-btn {
    padding: 14px 32px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.4s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.home-btn i {
    font-size: 22px;
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: #FFD700;
    color: #FFD700;
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(255, 215, 0, 0.4);
}

/* Tela de captura de pelotas */
#catch-screen {
    background: 
        linear-gradient(135deg, #000e33, #377ba5, #5cc0f6),
        url('./fundojogo.png') center top / auto 100% no-repeat fixed;
    background-blend-mode: overlay;
}

#balls-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 280px);
    overflow: hidden;
    margin-top: 20px;
}

/* ---------- BOLAS CAINDO COM GIRO SUAVE ---------- */
.ball {
    position: absolute;
    top: -100px; /* começa fora da tela */
    left: 0; /* posição horizontal é definida no JS */
    width: 80px;
    height: 80px;
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    animation: fall linear forwards, wiggleBall 1.8s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
    transition: transform 0.1s ease;
    transform-origin: center;
}

.ball:active {
    transform: scale(1.3);
}

/* Queda usando 'top' (evita conflito com rotate) */
@keyframes fall {
    from {
        top: -100px;
    }
    to {
        top: calc(100vh + 100px);
    }
}

/* Giro suave de um lado pro outro */
@keyframes wiggleBall {
    0%, 100% {
        transform: rotate(-12deg);
    }
    50% {
        transform: rotate(12deg);
    }
}

/* Tela de resultado */
#result-screen {
    background: 
        linear-gradient(135deg, #000e33, #377ba5, #5cc0f6),
        url('./fundojogo.png') center top / auto 100% no-repeat fixed;
    background-blend-mode: overlay;
    text-align: center;
}

/* Responsivo para bolas */
@media (max-width: 480px) {
    .ball {
        width: 65px;
        height: 65px;
    }

    @keyframes wiggleBall {
        0%, 100% {
            transform: rotate(-15deg);
        }
        50% {
            transform: rotate(15deg);
        }
    }
}