body {
    margin: 0;
    overflow: hidden;
    background-color: #f0f0f0;
    font-family: Arial, sans-serif;
}

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

#tower {
    position: absolute;
    width: 40px;
    height: 40px;
    background-color: #3498db;
    border-radius: 8px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
    z-index: 10;
}

#attack-range {
    position: absolute;
    width: 300px;
    height: 300px;
    border: 2px dashed rgba(52, 152, 219, 0.5);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    box-sizing: border-box;
}

.enemy {
    position: absolute;
    width: 30px;
    height: 30px;
    background-color: #e74c3c;
    border-radius: 4px;
    z-index: 5;
}

.health-bar {
    position: absolute;
    top: -8px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: #2ecc71;
}

.health-bar-background {
    position: absolute;
    top: -8px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: #7f8c8d;
}

.bullet {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #f1c40f;
    border-radius: 50%;
    box-shadow: 0 0 3px #f39c12;
    z-index: 4;
}

#score {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 20px;
    color: #2c3e50;
    background-color: rgba(255,255,255,0.7);
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 10;
}

#gold {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    color: #2c3e50;
    background-color: rgba(255,255,255,0.7);
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 10;
}

#upgrade-btn {
    position: absolute;
    top: 50px;
    right: 10px;
    font-size: 20px;
    color: white;
    background-color: #27ae60;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 10;
    cursor: pointer;
    border: none;
}

#upgrade-btn:hover {
    background-color: #2ecc71;
}

#upgrade-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 10px;
    z-index: 20;
    display: none;
    width: 300px;
    box-sizing: border-box;
}

.upgrade-option {
    margin: 10px 0;
    padding: 10px;
    background-color: #ecf0f1;
    border-radius: 5px;
    cursor: pointer;
}

.upgrade-option:hover {
    background-color: #bdc3c7;
}

.upgrade-cost {
    float: right;
    color: #f39c12;
    font-weight: bold;
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    color: #c0392b;
    background-color: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 10px;
    display: none;
    text-align: center;
    z-index: 20;
}

#restart-btn {
    margin-top: 20px;
    padding: 8px 16px;
    font-size: 18px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#restart-btn:hover {
    background-color: #2ecc71;
}

@media (max-width: 480px) {
    #attack-range {
        width: min(300px, calc(100vw - 16px));
        height: min(300px, calc(100vw - 16px));
    }

    #upgrade-menu,
    #game-over {
        box-sizing: border-box;
        max-width: calc(100vw - 16px);
    }

    #upgrade-btn,
    #close-upgrades,
    #restart-btn {
        min-height: 44px;
    }
}
