/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 100%);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Game Container */
#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Canvas */
#gameCanvas {
    border: none;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 70%, #90EE90 100%);
    display: block;
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Game UI */
#gameUI {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Start Screen */
#startScreen {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
}

.title h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: bounce 2s infinite;
}

.title p {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    margin-bottom: 2rem;
    opacity: 0.9;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.instructions {
    margin-top: 2rem;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    opacity: 0.8;
    line-height: 1.6;
}

.instructions p {
    margin: 0.5rem 0;
}

.touchHint {
    margin-top: 1rem;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

.touchHint p {
    margin: 0;
    font-weight: bold;
    color: #FFD93D;
}

/* Game Buttons */
.gameBtn {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    pointer-events: all;
    margin: 10px;
    min-width: 150px;
}

.gameBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.gameBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Game HUD */
#gameHUD {
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px;
    background: transparent;
}

.score {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(50, 50, 50, 0.9));
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    margin-bottom: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.score::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.score.score-updated::before {
    left: 100%;
}

.score.score-celebration {
    animation: scoreCelebration 0.6s ease-out;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 165, 0, 0.9));
    color: #000;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

@keyframes scoreCelebration {
    0% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(2deg); }
    100% { transform: scale(1.1); }
}

.score.score-milestone {
    animation: milestonePulse 1s ease-in-out;
    background: linear-gradient(135deg, rgba(255, 0, 150, 0.9), rgba(255, 100, 200, 0.9));
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

@keyframes milestonePulse {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.15); }
    50% { transform: scale(1.1); }
    75% { transform: scale(1.2); }
}

/* Difficulty/Level display removed from UI */

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pauseBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
}

.pauseBtn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Game Over Screen */
#gameOverScreen {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    text-align: center;
}

.gameOverContent h2 {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 2rem;
    color: #FF6B6B;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.scoreDisplay {
    margin-bottom: 2rem;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
}

.scoreDisplay p {
    margin: 0.5rem 0;
    font-weight: bold;
}

/* Pause Screen */
#pauseScreen {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
}

.pauseContent h2 {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 2rem;
    color: #FFD93D;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Full Screen Touch Area */
.fullScreenTouch {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: all;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    background: transparent;
    cursor: pointer;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gameBtn {
        padding: 15px 30px;
        font-size: 1.3rem;
        min-width: 140px;
        margin: 8px;
    }
    
    
    .score {
        padding: 10px 18px;
        font-size: 1.5rem;
    }
    
    /* Difficulty display removed */
    
    .pauseBtn {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }
    
}

@media (max-width: 480px) {
    .gameBtn {
        padding: 12px 25px;
        font-size: 1.1rem;
        min-width: 120px;
        margin: 6px;
    }
    
    
    .score {
        padding: 8px 14px;
        font-size: 1.3rem;
    }
    
    /* Difficulty display removed */
    
    .pauseBtn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
}

/* Landscape orientation for mobile */
@media (orientation: landscape) and (max-height: 500px) {
    .title h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .title p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .instructions {
        margin-top: 1rem;
        font-size: 0.8rem;
    }
    
    .gameBtn {
        padding: 10px 25px;
        font-size: 1.1rem;
        margin: 5px;
    }
    
    
    .score {
        padding: 6px 12px;
        font-size: 1.2rem;
    }
    
    /* Difficulty display removed */
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .gameBtn:active {
        transform: scale(0.95);
    }
    
    .pauseBtn:active {
        transform: scale(0.9);
    }
    
    .fullScreenTouch {
        touch-action: manipulation;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #gameCanvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    }
    
    #gameCanvas {
        background: linear-gradient(to bottom, #2C3E50 0%, #34495E 70%, #27AE60 100%);
    }
}