:root {
    --primary-color: #00f3ff;
    --secondary-color: #ff0055;
    --bg-color: #0a0a12;
    --text-color: #ffffff;
    --font-primary: 'Orbitron', sans-serif;
    --font-secondary: 'Roboto', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-secondary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 20px;
}

.score-label, .health-label, .wave-label, .lives-label, .ammo-label {
    font-family: var(--font-primary);
    font-size: 14px;
    opacity: 0.8;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}

#score-board {
    position: absolute;
    top: 20px;
    left: 20px;
}

#score-value {
    font-family: var(--font-primary);
    font-size: 32px;
    font-weight: 700;
}

#wave-board {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
}

#wave-value {
    font-family: var(--font-primary);
    font-size: 32px;
    font-weight: 700;
}

#health-board {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 200px;
}

#lives-board {
    position: absolute;
    bottom: 50px; /* Above health bar */
    left: 20px;
}

#lives-value {
    font-family: var(--font-primary);
    font-size: 24px;
    font-weight: 700;
}

#health-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 5px;
    border-radius: 2px;
    overflow: hidden;
}

#health-bar {
    width: 100%;
    height: 100%;
    background-color: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
    transition: width 0.2s ease-out;
}

#ammo-board {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    text-align: right;
}

#ammo-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 5px;
    border-radius: 2px;
    overflow: hidden;
}

#ammo-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #00aaff, #00ffff);
    box-shadow: 0 0 10px var(--primary-color);
    transition: width 0.2s ease-out;
}

#ammo-value {
    font-family: var(--font-primary);
    font-size: 18px;
    font-weight: 700;
    margin-top: 5px;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    z-index: 10;
    transition: opacity 0.3s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

h1 {
    font-family: var(--font-primary);
    font-size: 64px;
    margin-bottom: 10px;
    color: var(--primary-color);
    text-transform: uppercase;
    text-shadow: 0 0 20px var(--primary-color);
    letter-spacing: 4px;
}

p {
    font-size: 18px;
    margin-bottom: 20px;
    color: #cccccc;
}

p.tip {
    font-size: 14px;
    color: #00ffff;
    margin-bottom: 30px;
    text-shadow: 0 0 5px #00ffff;
}

button {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 15px 40px;
    font-family: var(--font-primary);
    font-size: 18px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

button:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.6);
}

/* Touch Controls */
#touch-controls {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.touch-active #touch-controls {
    display: block;
}

.joystick-outer {
    position: absolute;
    bottom: 40px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 243, 255, 0.08);
    border: 2px solid rgba(0, 243, 255, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    touch-action: none;
}

#joystick-left {
    left: 30px;
}

#joystick-right {
    right: 30px;
}

.joystick-knob {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 243, 255, 0.3);
    border: 2px solid rgba(0, 243, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    transition: transform 0.05s ease-out;
    pointer-events: none;
    touch-action: none;
}

canvas {
    touch-action: none;
}

/* Mobile instructions toggle */
.mobile-instructions {
    display: none;
}

.touch-active .mobile-instructions {
    display: block;
}

.touch-active .desktop-instructions {
    display: none;
}

/* Mobile HUD adjustments */
@media (max-width: 768px) {
    #score-value, #wave-value {
        font-size: 22px;
    }

    #lives-value {
        font-size: 18px;
    }

    .score-label, .health-label, .wave-label, .lives-label, .ammo-label {
        font-size: 11px;
    }

    #health-board {
        bottom: 170px;
        left: 10px;
        width: 140px;
    }

    #lives-board {
        bottom: 200px;
        left: 10px;
    }

    #ammo-board {
        bottom: 170px;
        right: 10px;
        width: 140px;
    }

    #score-board {
        top: 10px;
        left: 10px;
    }

    #wave-board {
        top: 10px;
        right: 10px;
    }

    h1 {
        font-size: 36px;
    }

    p {
        font-size: 14px;
        padding: 0 20px;
        text-align: center;
    }

    button {
        padding: 12px 30px;
        font-size: 14px;
    }
}
