@import url('https://fonts.googleapis.com/css2?family=Fredoka+One:wght@400&family=Fredoka:wght@300;400;500&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Fredoka', cursive;
}

body {
    background: url('bg.jpg') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#gameContainer {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 600px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#score {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: bold;
    color: #333;
    z-index: 10;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

#score.pulse {
    animation: scorePulse 0.5s ease;
}

@keyframes scorePulse {
    0% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.2);
    }

    100% {
        transform: translateX(-50%) scale(1);
    }
}

#startScreen,
#gameOverScreen,
#howToPlayScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

h1 {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
    text-align: center;
    padding: 0 20px;
}

button {
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 5px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

button:active {
    transform: translateY(0);
}

#finalScore {
    font-size: 24px;
    color: #333;
    margin-bottom: 30px;
}

.controls {
    margin-top: 20px;
    font-size: 14px;
    color: #999;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Preloader styles */
#preloader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('bg.jpg') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 30;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#preloader h2 {
    color: white;
    font-size: 24px;
    margin-bottom: 10px;
}

/* How to Play screen */
#howToPlayScreen h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.instructions {
    max-width: 80%;
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.6;
}

.instruction-step {
    display: flex;
    align-items: center;
    margin: 15px 0;
    text-align: left;
}

.step-icon {
    width: 40px;
    padding: 3%;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-weight: bold;
}

/* Particle effect */
.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
}

/* Ball trail effect */
.ball-trail {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 4;
}

/* Responsive design */
@media (max-width: 480px) {
    #gameContainer {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    h1 {
        font-size: 40px;
    }

    .instructions {
        max-width: 90%;
    }
}

p {
    color: #fff;
}