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

body {
    background: #1a1a2e;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    user-select: none;
}

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

#renderCanvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
}

/* Top HUD */
#hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 10px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    z-index: 10;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.hud-icon {
    font-size: 20px;
}

.hud-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
}

.hud-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Tower Shop */
#tower-shop {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 100%);
    border-radius: 12px 12px 0 0;
    z-index: 10;
}

.shop-title {
    font-size: 14px;
    font-weight: bold;
    color: #aaa;
}

#tower-buttons {
    display: flex;
    gap: 8px;
}

.tower-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
    min-width: 80px;
}

.tower-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.tower-btn.selected {
    border-color: #ffd700;
    background: rgba(255,215,0,0.2);
    box-shadow: 0 0 12px rgba(255,215,0,0.4);
}

.tower-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tower-btn .tower-icon {
    font-size: 24px;
}

.tower-btn .tower-name {
    font-size: 11px;
    font-weight: bold;
}

.tower-btn .tower-cost {
    font-size: 11px;
    color: #ffd700;
}

/* Tower Info Panel */
#tower-info {
    position: absolute;
    right: 10px;
    top: 60px;
    width: 220px;
    padding: 16px;
    background: rgba(0,0,0,0.85);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#tower-info-name {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

#tower-info-stats {
    font-size: 12px;
    color: #ccc;
    line-height: 1.6;
}

#tower-info-upgrade {
    font-size: 12px;
    color: #aaa;
}

.action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s;
    color: #fff;
}

#btn-upgrade {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
}

#btn-upgrade:hover {
    background: linear-gradient(135deg, #66BB6A, #388E3C);
}

#btn-sell {
    background: linear-gradient(135deg, #FF9800, #E65100);
}

#btn-sell:hover {
    background: linear-gradient(135deg, #FFB74D, #F57C00);
}

#btn-close-info {
    background: rgba(255,255,255,0.15);
}

#btn-close-info:hover {
    background: rgba(255,255,255,0.3);
}

/* Wave Announcement */
#wave-announce {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(255,0,0,0.8), 0 4px 8px rgba(0,0,0,0.9);
    z-index: 30;
    text-align: center;
    animation: wavePulse 0.5s ease-out;
}

@keyframes wavePulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Game Over / Victory */
#game-over, #victory-screen, #start-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(0,0,0,0.75);
    z-index: 50;
}

#game-over-title {
    font-size: 56px;
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 30px rgba(255,0,0,0.6);
}

#victory-title {
    font-size: 56px;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255,215,0,0.6);
}

#start-title {
    font-size: 48px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px rgba(100,150,255,0.6);
}

#start-subtitle {
    font-size: 18px;
    color: #aaa;
}

#start-instructions {
    text-align: center;
    color: #888;
    font-size: 14px;
    line-height: 2;
    margin: 10px 0;
}

#game-over-stats, #victory-stats {
    font-size: 20px;
    color: #ccc;
}

.action-btn.large {
    padding: 14px 40px;
    font-size: 20px;
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    border-radius: 10px;
}

.action-btn.large:hover {
    background: linear-gradient(135deg, #66BB6A, #388E3C);
    transform: scale(1.05);
}

.hidden {
    display: none !important;
}

/* Placement indicator */
#placement-preview {
    position: absolute;
    pointer-events: none;
    z-index: 5;
}
