* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Orbitron', sans-serif;
    background: #0D0D0D;
    color: #E0E0E0;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

#hud {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 3px solid #0f3460;
    flex-wrap: wrap;
    gap: 8px;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.hud-label {
    font-size: 10px;
    color: #8892b0;
    letter-spacing: 2px;
}

#country-display {
    flex-direction: row;
    gap: 8px;
}

#country-flag {
    font-size: 24px;
}

#country-name {
    font-family: 'Black Ops One', cursive;
    font-size: 18px;
    color: #64ffda;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
}

#wave-counter {
    font-size: 20px;
    font-weight: 900;
    color: #e94560;
}

#gold-display {
    font-size: 20px;
    font-weight: 700;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#gold-display::before {
    content: '💰 ';
}

#lives-display {
    font-size: 14px;
    letter-spacing: -2px;
}

#canvas {
    flex: 1;
    display: block;
    cursor: crosshair;
}

#defense-panel {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(180deg, #16213e 0%, #1a1a2e 100%);
    border-top: 3px solid #0f3460;
    flex-wrap: wrap;
}

.defense-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(180deg, #0f3460 0%, #1a1a2e 100%);
    border: 2px solid #1a1a2e;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
}

.defense-btn:hover {
    border-color: #64ffda;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(100, 255, 218, 0.3);
}

.defense-btn.selected {
    border-color: #64ffda;
    background: linear-gradient(180deg, #1a4a5e 0%, #0f3460 100%);
    box-shadow: 0 0 20px rgba(100, 255, 218, 0.4);
}

.defense-btn.unaffordable {
    opacity: 0.4;
    cursor: not-allowed;
}

.defense-btn.unaffordable:hover {
    transform: none;
    border-color: #1a1a2e;
    box-shadow: none;
}

.defense-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.defense-name {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

.defense-cost {
    font-size: 12px;
    color: #FFD700;
    font-weight: 700;
}

.defense-key {
    font-size: 9px;
    color: #8892b0;
    margin-top: 2px;
}

#start-wave-btn {
    display: block;
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    padding: 15px 30px;
    font-family: 'Black Ops One', cursive;
    font-size: 18px;
    color: #fff;
    background: linear-gradient(180deg, #e94560 0%, #b91c3c 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: pulse 2s ease-in-out infinite;
}

#start-wave-btn:hover:not(.disabled) {
    transform: scale(1.02);
    box-shadow: 0 5px 30px rgba(233, 69, 96, 0.5);
}

#start-wave-btn.disabled {
    background: linear-gradient(180deg, #555 0%, #333 100%);
    cursor: not-allowed;
    animation: none;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(233, 69, 96, 0.3); }
    50% { box-shadow: 0 0 40px rgba(233, 69, 96, 0.6); }
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

#overlay.hidden {
    display: none;
}

#overlay-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(180deg, #16213e 0%, #1a1a2e 100%);
    border: 3px solid #0f3460;
    border-radius: 16px;
    max-width: 90%;
}

#overlay-title {
    font-family: 'Black Ops One', cursive;
    font-size: 36px;
    margin-bottom: 20px;
}

#overlay-stats {
    margin-bottom: 30px;
}

#overlay-stats p {
    font-size: 16px;
    margin: 10px 0;
    color: #8892b0;
}

#overlay-stats span {
    color: #64ffda;
    font-weight: 700;
}

#play-again-btn {
    padding: 15px 40px;
    font-family: 'Black Ops One', cursive;
    font-size: 18px;
    color: #fff;
    background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#play-again-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 30px rgba(76, 175, 80, 0.5);
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #0D0D0D;
    font-size: 11px;
    color: #8892b0;
}

footer a {
    color: #64ffda;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.tagline {
    font-family: 'Black Ops One', cursive;
    color: #e94560;
    letter-spacing: 1px;
}

.damage-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(233, 69, 96, 0.3);
    pointer-events: none;
    animation: flash 0.3s ease-out forwards;
    z-index: 50;
}

@keyframes flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@media (max-width: 480px) {
    #hud {
        padding: 8px 10px;
    }
    
    #country-name {
        font-size: 14px;
    }
    
    #wave-counter, #gold-display {
        font-size: 16px;
    }
    
    #lives-display {
        font-size: 12px;
    }
    
    .defense-btn {
        padding: 8px 10px;
        min-width: 60px;
    }
    
    .defense-icon {
        font-size: 22px;
    }
    
    .defense-name {
        font-size: 8px;
    }
    
    .defense-cost {
        font-size: 10px;
    }
    
    .defense-key {
        display: none;
    }
    
    #start-wave-btn {
        font-size: 14px;
        padding: 12px 20px;
    }
    
    #overlay-title {
        font-size: 28px;
    }
}