* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #87CEEB;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#score-display {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 2rem;
    color: white;
    text-shadow: 2px 2px 0 #333;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}

#score-display.visible {
    opacity: 1;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.title {
    font-size: 3rem;
    color: white;
    text-shadow: 3px 3px 0 #2d5a3d;
    margin-bottom: 10px;
    letter-spacing: 4px;
    animation: float 2s ease-in-out infinite;
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    animation: pulse 1.5s ease-in-out infinite;
}

.game-over-title {
    font-size: 2.5rem;
    color: #ff6b6b;
    text-shadow: 3px 3px 0 #333;
    margin-bottom: 20px;
}

.final-score, .best-score {
    font-size: 1.5rem;
    color: white;
    margin: 5px 0;
}

.best-score {
    color: #ffd700;
}

#reward-display {
    margin-top: 20px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #2d5a3d, #4a8f5c);
    border-radius: 10px;
    text-align: center;
    animation: celebrate 0.5s ease-out;
}

#reward-display.hidden {
    display: none;
}

.reward-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

.discount-code {
    color: #ffd700;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 0 #333;
}

#play-again-btn {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: inherit;
    background: #4a8f5c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s, background 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#play-again-btn:hover {
    background: #5aa36c;
    transform: scale(1.05);
}

#play-again-btn:active {
    transform: scale(0.95);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes celebrate {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    #game-container {
        max-width: 100%;
        border-radius: 0;
    }
    
    #gameCanvas {
        border-radius: 0;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .game-over-title {
        font-size: 1.8rem;
    }
    
    #score-display {
        font-size: 1.5rem;
        top: env(safe-area-inset-top, 10px);
        left: env(safe-area-inset-left, 10px);
    }
}

@media (max-height: 400px) {
    .title {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .game-over-title {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .final-score, .best-score {
        font-size: 1.2rem;
    }
    
    #play-again-btn {
        padding: 10px 25px;
        margin-top: 15px;
    }
}
