/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Prevent text selection and improve touch responsiveness */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Game container */
#game-container {
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 900px;
    width: 100%;
}

/* Game header */
#game-header {
    margin-bottom: 20px;
}

#game-header h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #ffd700;
}

#game-info {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: bold;
}

#game-info span {
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Canvas styling */
#gameCanvas {
    border: 3px solid #ffd700;
    border-radius: 10px;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
    display: block;
    margin: 0 auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    /* Touch-friendly properties */
    touch-action: none;
    cursor: pointer;
}

/* Game controls */
#game-controls {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 1.1em;
}

#game-controls strong {
    color: #ffd700;
    font-size: 1.2em;
}

/* Menu and game over screens */
#menu-screen, #game-over-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 15px;
    border: 2px solid #ffd700;
    text-align: center;
    min-width: 300px;
}

#menu-screen h2, #game-over-screen h2 {
    color: #ffd700;
    font-size: 2em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#menu-screen p, #game-over-screen p {
    font-size: 1.2em;
    margin-bottom: 15px;
    line-height: 1.4;
}

/* Buttons */
button {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    margin: 10px;
}

button:hover {
    background: linear-gradient(45deg, #ffed4e, #ffd700);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 900px) {
    #game-container {
        padding: 15px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 800px;
    }
    
    #game-header h1 {
        font-size: 2em;
    }
    
    #game-info {
        flex-direction: column;
        gap: 5px;
        font-size: 1em;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    #game-header h1 {
        font-size: 1.8em;
    }
    
    #menu-screen, #game-over-screen {
        padding: 30px 20px;
        min-width: 250px;
    }
    
    #menu-screen h2, #game-over-screen h2 {
        font-size: 1.6em;
    }
    
    button {
        padding: 12px 25px;
        font-size: 1.1em;
    }
}

/* Game state indicators */
.game-playing #menu-screen {
    display: none;
}

.game-over #game-over-screen {
    display: block !important;
}

.game-paused #gameCanvas {
    opacity: 0.5;
}

/* Score highlighting */
#score.score-increase {
    animation: scoreFlash 0.3s ease-in-out;
}

@keyframes scoreFlash {
    0% { color: #ffffff; }
    50% { color: #ffd700; transform: scale(1.1); }
    100% { color: #ffffff; }
}

/* Lives indicator colors */
#lives.lives-critical {
    color: #ff4444;
    animation: livesWarning 1s infinite;
}

@keyframes livesWarning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}