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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    touch-action: manipulation;
    overflow-x: hidden;
}

.container {
    max-width: 100vw;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    color: white;
    font-size: clamp(1.5em, 4vw, 2.5em);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.instructions {
    text-align: center;
    color: white;
    font-size: 1.2em;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.lottery-machine {
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.machine-body {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.garagara-container {
    width: min(90vw, 500px);
    height: min(90vw, 500px);
    position: relative;
    touch-action: none;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

.garagara-container:active {
    cursor: grabbing;
}

.garagara-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
}

.ball-output {
    position: relative;
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.ball {
    width: clamp(40px, 8vw, 60px);
    height: clamp(40px, 8vw, 60px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    position: absolute;
    transition: all 0.3s ease;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    font-size: clamp(0.8em, 4vw, 1.2em);
    transform: translateY(-200px) scale(0);
}

.ball.appear {
    animation: ball-appear 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes ball-appear {
    0% { 
        transform: translateY(-200px) scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: translateY(-100px) scale(1.2) rotate(180deg);
        opacity: 1;
    }
    80% {
        transform: translateY(10px) scale(0.9) rotate(300deg);
    }
    100% { 
        transform: translateY(0) scale(1) rotate(360deg);
        opacity: 1;
    }
}

.garagara-spinning {
    animation: spin-garagara 2s ease-out;
}

@keyframes spin-garagara {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(var(--spin-amount, 720deg)); }
}

.ball.first-prize {
    background: linear-gradient(145deg, #FFD700, #FFA500);
}

.ball.second-prize {
    background: linear-gradient(145deg, #C0C0C0, #808080);
}

.ball.third-prize {
    background: linear-gradient(145deg, #CD7F32, #8B4513);
}

.ball.fourth-prize {
    background: linear-gradient(145deg, #FF6B6B, #FF5252);
}

.ball.fifth-prize {
    background: linear-gradient(145deg, #4ECDC4, #26C6DA);
}

.ball.no-prize {
    background: linear-gradient(145deg, #9E9E9E, #616161);
}

.controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
}

.reset-btn {
    padding: 12px 24px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(145deg, #4ECDC4, #26C6DA);
    color: white;
    box-shadow: 0 8px 15px rgba(78, 205, 196, 0.3);
}

.reset-btn:hover {
    background: linear-gradient(145deg, #26C6DA, #00BCD4);
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(78, 205, 196, 0.4);
}

.result-area {
    text-align: center;
}

.result {
    font-size: clamp(1.2em, 4vw, 1.8em);
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
}

.balls-left {
    font-size: clamp(1em, 3vw, 1.2em);
    color: #666;
}

.prize-info {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    margin-top: auto;
}

.prize-info h3 {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    font-size: clamp(1.2em, 4vw, 1.5em);
}

.prize-info ul {
    list-style: none;
    display: grid;
    gap: 8px;
}

.prize-info li {
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    font-size: clamp(0.8em, 3vw, 1em);
}

.first-prize {
    background: linear-gradient(145deg, #FFD700, #FFA500);
}

.second-prize {
    background: linear-gradient(145deg, #C0C0C0, #808080);
}

.third-prize {
    background: linear-gradient(145deg, #CD7F32, #8B4513);
}

.fourth-prize {
    background: linear-gradient(145deg, #FF6B6B, #FF5252);
}

.fifth-prize {
    background: linear-gradient(145deg, #4ECDC4, #26C6DA);
}

.no-prize {
    background: linear-gradient(145deg, #9E9E9E, #616161);
}

.ball.selected {
    z-index: 1000;
}

.congratulations {
    animation: celebrate 1s ease-in-out;
    color: #FF6B6B;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@media (max-width: 768px) {
    .prize-info {
        display: none;
    }
    
    .container {
        padding: 5px;
    }
    
    .lottery-machine {
        margin-bottom: 10px;
    }
}