/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}


html, body {
    height: 100%;
    overflow: hidden;
}
body {
    font-family: 'Courier New', monospace;
    background: #000;
    color: #fff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
}

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

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111;
    display: block;
}

/* HUD Styles */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.hud-top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-center {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 11;
}

.health-bar-container {
    position: relative;
    width: 200px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #333;
    border-radius: 5px;
    overflow: hidden;
}

.health-bar-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #222;
}

.health-bar-fill {
    position: absolute;
    height: 100%;
    background: linear-gradient(to right, #ff0000, #00ff00);
    transition: width 0.3s ease;
    width: 100%;
}

.health-text {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px #000;
}

.scrap-counter, .wave-counter {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border: 2px solid #333;
    border-radius: 5px;
    font-weight: bold;
    font-size: 16px;
    color: #ffcc00;
}

.wave-counter {
    color: #00ccff;
}

.hud-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hud-bottom {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weapon-display {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border: 2px solid #333;
    border-radius: 5px;
    font-weight: bold;
    font-size: 16px;
    color: #ff66cc;
}

.message-display {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    border: 2px solid #ff0000;
    border-radius: 5px;
    font-weight: bold;
    font-size: 18px;
    color: #ff0000;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Virtual Joystick */
.joystick-container {
    position: absolute;
    bottom: 120px;
    left: 30px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
    z-index: 20;
}

.joystick-base {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

.joystick-handle {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s;
}

/* Shoot Button */
.shoot-button {
    position: absolute;
    bottom: 120px;
    right: 30px;
    width: 100px;
    height: 100px;
    background: rgba(255, 0, 0, 0.3);
    border: 3px solid rgba(255, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: #fff;
    pointer-events: auto;
    z-index: 20;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, transform 0.1s;
}

.shoot-button:active {
    background: rgba(255, 0, 0, 0.6);
    transform: scale(0.95);
}

/* Camp Screen */
.camp-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    pointer-events: auto;
}

.camp-content {
    background: #111;
    border: 3px solid #00ccff;
    border-radius: 10px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.camp-content h2 {
    color: #00ccff;
    text-align: center;
    margin-bottom: 20px;
    font-size: 28px;
}

.camp-scrap {
    background: #222;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    font-size: 24px;
    color: #ffcc00;
    margin-bottom: 20px;
    font-weight: bold;
}

.upgrades-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.upgrade-button {
    background: #333;
    border: 2px solid #555;
    border-radius: 5px;
    padding: 15px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.upgrade-button:hover {
    background: #444;
    border-color: #00ccff;
}

.upgrade-button:disabled {
    background: #222;
    border-color: #444;
    color: #888;
    cursor: not-allowed;
}

.next-run-button, .restart-button {
    background: #00cc44;
    border: none;
    border-radius: 5px;
    padding: 15px 30px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.next-run-button:hover, .restart-button:hover {
    background: #00ee55;
}

.resume-button {
    background: #7733aa;
    border: none;
    border-radius: 5px;
    padding: 15px 30px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
    margin-top: 5px;
}

.resume-button:hover {
    background: #9944cc;
}

/* Game Over Screen */
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    pointer-events: auto;
}

.game-over-content {
    background: #111;
    border: 3px solid #ff0000;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.game-over-content h2 {
    color: #ff0000;
    font-size: 36px;
    margin-bottom: 20px;
}

#game-over-wave, #game-over-scrap {
    font-size: 24px;
    margin: 15px 0;
    color: #fff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hud-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .health-bar-container {
        width: 150px;
    }
    
    .scrap-counter, .wave-counter, .weapon-display {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .joystick-container {
        bottom: 100px;
        left: 20px;
        width: 100px;
        height: 100px;
    }
    
    .shoot-button {
        bottom: 100px;
        right: 20px;
        width: 80px;
        height: 80px;
        font-size: 16px;
    }
    
    .camp-content {
        padding: 20px;
    }
    
    .camp-content h2 {
        font-size: 24px;
    }
    
    .camp-scrap {
        font-size: 20px;
        padding: 12px;
    }
}

.weapon-hint {
    color: #666;
    font-size: 11px;
    text-align: center;
    position: absolute;
    bottom: 45px;
    left: 0;
    right: 0;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Start Screen */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    z-index: 999;
}

.start-content {
    text-align: center;
    padding: 40px;
}

.start-title {
    font-size: 48px;
    color: #00ccff;
    text-shadow: 0 0 20px #00ccff, 0 0 40px #0066ff;
    margin-bottom: 10px;
    letter-spacing: 8px;
}

.start-subtitle {
    font-size: 16px;
    color: #666;
    letter-spacing: 4px;
    margin-bottom: 30px;
    text-transform: uppercase;
}

.start-controls {
    margin: 20px 0 30px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.8;
}

.start-controls p {
    margin: 0;
}

.start-highscore {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #333;
    border-radius: 5px;
    background: #0a0a0a;
}

.hs-line {
    font-size: 14px;
    color: #aaa;
    letter-spacing: 2px;
    line-height: 2;
    text-transform: uppercase;
}

.hs-line span {
    color: #ffcc00;
    font-weight: bold;
}


.start-button {
    padding: 15px 50px;
    font-size: 20px;
    background: #00cc44;
    color: #000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    transition: transform 0.2s, background 0.2s;
}

.start-button:hover {
    background: #00ee55;
    transform: scale(1.05);
}

.start-button:active {
    transform: scale(0.95);
}

/* Camp Actions */
.camp-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.reset-button {
    padding: 12px 25px;
    font-size: 14px;
    background: #cc4400;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    transition: background 0.2s, transform 0.2s;
}

.reset-button:hover {
    background: #ee5500;
    transform: scale(1.05);
}

.reset-button:active {
    transform: scale(0.95);
}

.home-button {
    padding: 12px 25px;
    font-size: 14px;
    background: #444;
    color: #fff;
    border: 2px solid #666;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    transition: background 0.2s, transform 0.2s;
}

.home-button:hover {
    background: #555;
    transform: scale(1.05);
}

.home-button:active {
    transform: scale(0.95);
}


/* Start Buttons */
.start-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.camp-button {
    padding: 15px 30px;
    font-size: 16px;
    background: #444;
    color: #fff;
    border: 2px solid #666;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    transition: transform 0.2s, background 0.2s;
}

.camp-button:hover {
    background: #555;
    transform: scale(1.05);
}

.camp-button:active {
    transform: scale(0.95);
}


.continue-button {
    padding: 15px 30px;
    font-size: 16px;
    background: #222;
    color: #555;
    border: 2px solid #333;
    border-radius: 5px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    cursor: not-allowed;
    opacity: 0.5;
}

.continue-button.enabled {
    background: #1a3a1a;
    color: #66ff66;
    border: 2px solid #33aa33;
    cursor: pointer;
    opacity: 1;
}

.continue-button.enabled:hover {

.btn-desc {
    color: #8888bb;
    font-size: 14px;
    text-align: center;
    margin: 0px 0 16px 0;
    font-family: "Courier New", monospace;
    opacity: 0.85;
}
    background: #224422;
    border-color: #44cc44;
}

.pause-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    color: #00ffff;
    text-shadow: 0 0 8px #00ffff;
    border: 2px solid #00ffff;
    border-radius: 5px;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.pause-button:hover {
    background: rgba(50, 50, 50, 0.7);
    border-color: #888;
}