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

body {
    background-color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Courier New', Courier, monospace;
}

.game-container {
    position: relative;
    width: 800px;
    height: 600px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

canvas {
    display: block;
    background-color: #87CEEB; /* Sky blue background as fallback */
    image-rendering: pixelated; /* For crisp pixel art */
}

#score {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 300px;
}

#restartButton {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#restartButton:hover {
    background-color: #45a049;
}

.hidden {
    display: none;
}

.overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 300px;
    z-index: 10;
}

#startScreen h2, #gameOver h2 {
    margin-bottom: 20px;
    color: #4CAF50;
}

#startScreen p {
    margin-bottom: 15px;
}

#startButton, #restartButton {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#startButton:hover, #restartButton:hover {
    background-color: #45a049;
}

.sound-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    z-index: 20;
}

.sound-button:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Improved mobile detection */
@media (max-width: 1024px), (pointer: coarse) {
    /* Mobile-specific styles can go here */
} 