@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Lobster&display=swap');

body {
    margin: 0;
    padding: 0;
    background-color: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
}

#game-container {
    position: relative;
    width: 320px;
    height: 480px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    background: #333;
    /* Fallback background */
    border-radius: 8px;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #444, #111);
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas */
}

#score {
    display: none;
    /* Hidden by default at start */
    position: absolute;
    top: 10px;
    left: 10px;
    font-family: 'Fredoka One', cursive, sans-serif;
    font-size: 28px;
    color: #fff9e6;
    /* Cream/light gold color */
    letter-spacing: 1px;

    /* Text stroke/outline effect */
    -webkit-text-stroke: 1px #5c3a21;

    /* Layered shadows for glow, drop shadow, and bevel effect */
    text-shadow:
        1px 1px 0 #3e2615,
        2px 2px 0 #3e2615,
        3px 3px 0 #3e2615,
        4px 4px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 204, 0, 0.4);

    pointer-events: none;
    z-index: 10;
    transition: transform 0.1s ease-out;
}

/* Animation class to be added via JS when score increases */
.score-pulse {
    animation: scoreBump 0.3s ease-out;
}

@keyframes scoreBump {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3) rotate(-3deg);
        color: #ffeb99;
        text-shadow: 1px 1px 0 #3e2615, 2px 2px 0 #3e2615, 3px 3px 0 #3e2615, 4px 4px 8px rgba(0, 0, 0, 0.9), 0 0 20px rgba(255, 204, 0, 0.8);
    }

    100% {
        transform: scale(1);
    }
}

/* Floating points animation styling */
.floating-points {
    position: absolute;
    font-family: 'Fredoka One', cursive, sans-serif;
    font-size: 24px;
    color: #ffcc00;
    -webkit-text-stroke: 1px #5c3a21;
    text-shadow: 2px 2px 0 #3e2615, 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10;
    animation: floatUp 0.8s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translateY(-40px) scale(0.8);
    }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #000;
    pointer-events: auto;
    /* Catch clicks on screens */
    transition: opacity 0.3s;
}

#start-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

#start-btn {
    position: relative;
    z-index: 2;
    margin-top: 280px;
    /* Lowers the button on the screen */
    padding: 15px 40px;
    font-size: 32px;
    background: #e31837;
    /* Coca-Cola red */
    color: white;
    border: 3px solid white;
    box-shadow: 0 6px 0 #900, 0 10px 20px rgba(0, 0, 0, 0.5);
    border-radius: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    /* Removed uppercase for script font */
    animation: pulse 1.5s infinite;
}

#gameover-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

#game-over-controls {
    position: absolute;
    bottom: 350px;
    width: 100%;
    display: flex;
    justify-content: center;
    /* Center horizontally */
    align-items: center;
    z-index: 2;
}

#restart-btn {
    padding: 5px 15px;
    font-size: 16px;
    /* Scaled up slightly since script fonts are naturally smaller */
    background: #e31837;
    /* Switched to Coca-Cola red to match start button and font style */
    color: white;
    border: 3px solid white;
    box-shadow: 0 5px 0 #900, 0 10px 20px rgba(0, 0, 0, 0.5);
    /* Matching shadow style for red button */
    border-radius: 30px;
    margin: 0;
    cursor: pointer;
    font-weight: bold;
    animation: pulse 1.5s infinite;
    /* Pulsing effect for interaction focus */
    transition: transform 0.1s;
}

#restart-btn:active {
    box-shadow: 0 2px 0 #900, 0 5px 10px rgba(0, 0, 0, 0.5);
    transform: translateY(3px);
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

h1 {
    font-size: 36px;
    margin-bottom: 10px;
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00;
}

p {
    font-size: 18px;
}

button {
    padding: 10px 20px;
    font-size: 18px;
    background: #ffcc00;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    color: #333;
    font-weight: bold;
    box-shadow: 0 4px 0 #cc9900;
}

button:active {
    box-shadow: 0 2px 0 #cc9900;
    transform: translateY(2px);
}

#cta-btn {
    background: #00ff00;
    box-shadow: 0 4px 0 #009900;
    color: #000;
    font-size: 24px;
    padding: 15px 30px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}