/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(180deg, #1a0a00 0%, #2d1810 100%);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: 800px;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(255, 150, 50, 0.3);
    border-radius: 12px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #87CEEB 0%, #FFA500 50%, #FF6B35 100%);
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(
        180deg, 
        rgba(135, 206, 235, 0.95) 0%, 
        rgba(255, 165, 0, 0.95) 50%, 
        rgba(255, 107, 53, 0.95) 100%
    );
    backdrop-filter: blur(5px);
    z-index: 10;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

/* Title styling */
.title-container {
    text-align: center;
    margin-bottom: 30px;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 
        3px 3px 0 #D2691E,
        6px 6px 0 rgba(0, 0, 0, 0.2);
    letter-spacing: 2px;
    animation: titleBounce 2s ease-in-out infinite;
}

@keyframes titleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 1.2rem;
    color: #2d1810;
    margin-top: 10px;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
}

/* Instructions */
.instructions {
    background: rgba(255,255,255,0.3);
    padding: 20px 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.4);
}

.instructions p {
    font-size: 1.1rem;
    color: #2d1810;
    margin: 8px 0;
    font-weight: 500;
}

/* Buttons */
.btn-start, .btn-restart {
    background: linear-gradient(180deg, #FF4444 0%, #CC0000 100%);
    border: none;
    padding: 20px 60px;
    border-radius: 50px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 0 #990000,
        0 12px 20px rgba(0,0,0,0.3);
    transition: all 0.15s ease;
    animation: buttonPulse 1.5s ease-in-out infinite;
}

.btn-start:hover, .btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 11px 0 #990000,
        0 15px 25px rgba(0,0,0,0.35);
}

.btn-start:active, .btn-restart:active {
    transform: translateY(4px);
    box-shadow: 
        0 4px 0 #990000,
        0 6px 15px rgba(0,0,0,0.3);
}

@keyframes buttonPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.btn-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    letter-spacing: 2px;
}

.high-score-display {
    margin-top: 30px;
    font-size: 1.2rem;
    color: #2d1810;
    background: rgba(255,255,255,0.3);
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 600;
}

/* Game Over Screen */
.game-over-content {
    text-align: center;
}

.game-over-title {
    font-size: 4rem;
    color: #fff;
    text-shadow: 
        4px 4px 0 #990000,
        8px 8px 0 rgba(0,0,0,0.3);
    margin-bottom: 30px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.score-display {
    background: rgba(255,255,255,0.3);
    padding: 25px 50px;
    border-radius: 20px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.score-display p {
    font-size: 1.8rem;
    color: #2d1810;
    margin: 10px 0;
    font-weight: 600;
}

.score-display span {
    color: #fff;
    text-shadow: 2px 2px 0 #990000;
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 5;
    transition: opacity 0.3s ease;
}

#hud.hidden {
    opacity: 0;
}

.score-hud {
    background: rgba(0,0,0,0.4);
    padding: 10px 30px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.2);
}

#currentScore {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .game-container {
        border-radius: 0;
        max-width: 100%;
        max-height: 100vh;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .instructions {
        padding: 15px 25px;
    }
    
    .btn-start, .btn-restart {
        padding: 15px 45px;
    }
    
    .btn-text {
        font-size: 1.2rem;
    }
}

/* Touch feedback */
@media (hover: none) {
    .btn-start:active, .btn-restart:active {
        transform: scale(0.95);
    }
}
