/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
    touch-action: manipulation; /* Prevent double-tap zoom on mobile */
}

body {
    background-color: #000;
    overflow: hidden;
    color: #fff;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    user-select: none; /* Prevent text selection */
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-color: #000;
}

/* UI Elements */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    padding: 10px;
    pointer-events: none;
}

#stats-panel {
    display: flex;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.7);
    border-bottom: 2px solid #30cfd0;
    padding: 10px 20px;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 0 10px rgba(48, 207, 208, 0.5);
}

.stat {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.stat-label {
    font-weight: bold;
    margin-right: 5px;
    color: #30cfd0;
}

#score, #level, #enemies {
    color: #fff;
    font-size: 1.2em;
}

#health-bar {
    width: 150px;
    height: 15px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

#health-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, #ff0000, #ff6b6b);
    transition: width 0.3s ease;
}

/* Pause Menu */
#pause-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    display: none;
}

.pause-content {
    background-color: rgba(16, 24, 32, 0.9);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #30cfd0;
    box-shadow: 0 0 20px rgba(48, 207, 208, 0.7);
    max-width: 400px;
    width: 100%;
}

/* Game Over Screen */
#game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    display: none;
}

.game-over-content {
    background-color: rgba(16, 24, 32, 0.9);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.7);
    max-width: 400px;
    width: 100%;
}

.final-stats {
    margin: 20px 0;
    text-align: left;
}

.final-stats p {
    margin: 10px 0;
    font-size: 1.1em;
}

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.start-content {
    background-color: rgba(16, 24, 32, 0.9);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #30cfd0;
    box-shadow: 0 0 20px rgba(48, 207, 208, 0.7);
    max-width: 400px;
    width: 100%;
}

.start-content h1 {
    font-size: 2.5em;
    margin-bottom: 30px;
    color: #30cfd0;
    text-shadow: 0 0 10px rgba(48, 207, 208, 0.7);
}

/* Buttons */
button {
    background: linear-gradient(to right, #30cfd0, #330867);
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(48, 207, 208, 0.5);
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(48, 207, 208, 0.8);
}

button:active {
    transform: scale(0.95);
}

#play-again-btn {
    background: linear-gradient(to right, #ff6b6b, #833ab4);
}

/* Controls Info */
.controls-info {
    margin-top: 20px;
    text-align: left;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 5px;
}

.controls-info h3 {
    text-align: center;
    margin-bottom: 10px;
    color: #30cfd0;
}

.controls-info p {
    margin: 5px 0;
}

/* Mobile Touch Controls */
#mobile-controls {
    position: fixed;       
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;        
    z-index: 1;
    display: none;         
    pointer-events: auto;  
    margin-bottom: 0;     
    padding: 0 20px;      
    box-sizing: border-box;
}

#joystick-area {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: rgba(48, 207, 208, 0.2);
    border: 2px solid rgba(48, 207, 208, 0.5);
    touch-action: none; /* prevent scroll during touch */
    pointer-events: auto;
    user-select: none;
}

#joystick {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(48, 207, 208, 0.8);
    box-shadow: 0 0 10px rgba(48, 207, 208, 0.7);
    pointer-events: none; /* knob doesn't capture events */
}

#shoot-button {
    position: absolute;
    bottom: 40px;
    right: 40px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(255, 107, 107, 0.8);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 1.1em;
    user-select: none;
    pointer-events: auto;
    touch-action: manipulation;
    cursor: pointer;
}

#pause-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    user-select: none;
    pointer-events: auto;
    touch-action: manipulation;
    cursor: pointer;
    z-index: 10000;
}

/* Responsive Design */
@media (max-width: 768px) {
    #stats-panel {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stat {
        margin-bottom: 5px;
    }
    
    .pause-content, .game-over-content, .start-content {
        max-width: 90%;
        padding: 20px;
    }
    
    .start-content h1 {
        font-size: 2em;
    }
    
    button {
        padding: 10px 20px;
        font-size: 1em;
    }
    
    #health-bar {
        width: 100px;
    }
    
    /* Show mobile controls on small screens */
    #mobile-controls {
        display: block;
        pointer-events: auto;
    }
    
    /* Adjust controls info for mobile */
    .mobile-controls-info {
        display: block;
    }
    
    .desktop-controls-info {
        display: none;
    }
}

/* For very small screens */
@media (max-width: 480px) {
    #joystick-area {
        width: 100px;
        height: 100px;
        bottom: 50px;
        left: 15px;
    }

    
    #joystick {
        width: 40px;
        height: 40px;
    }

     #shoot-button {
        width: 70px;
        height: 70px;
        bottom: 60px;
        right: 30px;
        font-size: 1em;
    }
    
    .stat-label, #score, #level, #enemies {
        font-size: 0.9em;
    }
    
    #health-bar {
        width: 80px;
        height: 12px;
    }
    
    #pause-button {
        width: 35px;
        height: 35px;
        top: 15px;
        right: 15px;
        font-size: 1em;
    }
}

/* By default, show desktop controls info and hide mobile controls info */
.controls-info.mobile-controls-info {
    display: none;
}

/* For small screens, show mobile controls info and hide desktop */
@media (max-width: 768px) {
    .controls-info.desktop-controls-info {
        display: none;
    }
    .controls-info.mobile-controls-info {
        display: block;
    }
}
