:root {
    --napoli-blue: #00ADEF;
    --napoli-white: #FFFFFF;
    --gold: #FFD700;
    --lava-red: #FF4500;
    --dark-bg: #1a1a1a;
    --glass-bg: rgba(255, 255, 255, 0.1);
}

body {
    margin: 0;
    padding: 10px;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #005f87 0%, #002f4b 100%);
    color: var(--napoli-white);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    width: 100vw;
    box-sizing: border-box;
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.game-header {
    text-align: center;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

h1 {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    margin: 0;
    background: linear-gradient(to right, var(--napoli-white), var(--napoli-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.2;
}

.score-container {
    font-size: clamp(1rem, 2vw, 1.5rem);
    background: var(--glass-bg);
    padding: 5px 15px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 5px;
    display: inline-block;
}

#score {
    color: var(--gold);
    font-weight: bold;
}

.game-area {
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    overflow: hidden;
    border: 4px solid var(--napoli-blue);
    /* Aggressive responsive scaling */
    width: 60vh;
    height: 60vh;
    max-width: 600px;
    max-height: 600px;
    aspect-ratio: 1/1;
    flex-shrink: 1;
}

canvas {
    background-image: url('assets/background.png');
    background-size: cover;
    background-position: center;
    display: block;
    width: 100%;
    height: 100%;
    /* Dark overlay to make sprites pop */
    box-shadow: inset 0 0 0 1000px rgba(0, 0, 0, 0.4);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.overlay-content {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--gold);
    margin-bottom: 10px;
}

.instructions {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: #ccc;
    margin-bottom: 20px;
}

button {
    padding: 10px 30px;
    font-size: clamp(1rem, 2vw, 1.2rem);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--napoli-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 173, 239, 0.4);
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 173, 239, 0.6);
}

.btn-secondary {
    background: var(--gold);
    color: #333;
    margin-top: 10px;
}

input[type="text"] {
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid var(--napoli-blue);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    margin: 10px 0;
    width: 200px;
    text-align: center;
}

.leaderboard-container {
    margin-top: 15px;
    max-height: 150px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 10px;
}

#leaderboardList {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

#leaderboardList li {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
}

.eruption-warning {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 69, 0, 0.95);
    color: white;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 900;
    text-align: center;
    box-shadow: 0 10px 30px rgba(255, 69, 0, 0.5);
    z-index: 100;
    animation: pulse 0.8s infinite;
    border: 2px solid #fff;
}

.controls-hint {
    flex-shrink: 0;
    font-size: clamp(0.8rem, 2vw, 1rem);
    color: #aaa;
}

@keyframes pulse {
    0% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.1);
    }

    100% {
        transform: translateX(-50%) scale(1);
    }
}

.police-chase .game-area {
    animation: siren 0.5s infinite;
    border-color: red;
}

@keyframes siren {
    0% {
        box-shadow: inset 0 0 50px 20px rgba(0, 0, 255, 0.5);
        border-color: blue;
    }

    50% {
        box-shadow: inset 0 0 50px 20px rgba(255, 0, 0, 0.5);
        border-color: red;
    }

    100% {
        box-shadow: inset 0 0 50px 20px rgba(0, 0, 255, 0.5);
        border-color: blue;
    }
}