/* Lottery Ball Styling */
.lottery-ball {
    /* Set up the container for the lottery ball */
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, 
                               #ff5c5c 0%, 
                               #d80000 60%, 
                               #8d0000 100%);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3),
               inset 0 -3px 10px rgba(0, 0, 0, 0.4),
               inset 0 5px 15px rgba(255, 255, 255, 0.5);
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;    margin-right: 12px;
    animation: lotteryBallBounce 2.5s cubic-bezier(0.28, 0.84, 0.42, 1) 1;
    animation-fill-mode: forwards;
    cursor: pointer;
    
    /* Add texture to the lottery ball */
    background-image: 
        repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0px, rgba(255,255,255,.04) 2px, transparent 2px, transparent 4px),
        radial-gradient(circle at 35% 35%, 
                       #ff5c5c 0%, 
                       #d80000 60%, 
                       #8d0000 100%);
    
    /* Add a subtle bounce animation on hover */
    transition: transform 0.2s ease;
}

.lottery-ball:hover {
    animation-play-state: paused;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4),
               inset 0 -3px 10px rgba(0, 0, 0, 0.4),
               inset 0 5px 15px rgba(255, 255, 255, 0.6);
}

/* Smaller lottery ball for typing indicator */
.typing-ball {
    width: 28px;
    height: 28px;
    margin-right: 8px;
}

.typing-ball .ball-number {
    font-size: 16px;
}

/* Number inside the lottery ball */
.ball-number {
    color: white;
    font-size: 26px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1;
    font-family: 'Arial', sans-serif;
    position: relative;
    z-index: 2;    /* Ensure number stays stable during ball animation */
    animation: counterRotate 2.5s cubic-bezier(0.28, 0.84, 0.42, 1) 1;
    animation-fill-mode: forwards;
}

/* Counter-rotate the number to keep it upright during ball rotation */
@keyframes counterRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

/* Enhanced bouncing animation with realistic physics */
@keyframes lotteryBallBounce {
    0% { 
        transform: translateY(0) rotate(0deg) scale(1);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.5);
    }
    
    12% { 
        transform: translateY(-25px) rotate(45deg) scale(1.02);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.6);
    }
    
    25% { 
        transform: translateY(0) rotate(90deg) scale(0.98);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.5);
    }
    
    37% { 
        transform: translateY(-15px) rotate(135deg) scale(1.01);
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.35),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.55);
    }
    
    50% { 
        transform: translateY(0) rotate(180deg) scale(0.99);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.5);
    }
    
    62% { 
        transform: translateY(-8px) rotate(225deg) scale(1.005);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.52);
    }
    
    75% { 
        transform: translateY(0) rotate(270deg) scale(0.995);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.5);
    }
    
    87% { 
        transform: translateY(-3px) rotate(315deg) scale(1.002);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.51);
    }
    
    100% { 
        transform: translateY(0) rotate(360deg) scale(1);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3),
                   inset 0 -3px 10px rgba(0, 0, 0, 0.4),
                   inset 0 5px 15px rgba(255, 255, 255, 0.5);
    }
}

/* Add a subtle rotation animation */
@keyframes rotate {
    0% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
    100% { transform: rotate(0); }
}

/* Responsive sizing for mobile */
@media (max-width: 768px) {
    .lottery-ball {
        width: 40px;
        height: 40px;
    }
    
    .ball-number {
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    .lottery-ball {
        width: 36px;
        height: 36px;
    }
    
    .ball-number {
        font-size: 18px;
    }
}
