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

body {
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 900px;
    height: 600px;
    border: 3px solid #4a90d9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(74, 144, 217, 0.3);
}

#gameCanvas {
    display: block;
    background: #e8f4f8;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
}

#ui-overlay.active {
    display: block;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(180deg, rgba(20, 30, 60, 0.9), rgba(20, 30, 60, 0.7));
    pointer-events: auto;
}

#game-title {
    font-size: 20px;
    font-weight: bold;
    color: #7dd3fc;
    text-shadow: 0 0 10px rgba(125, 211, 252, 0.5);
    letter-spacing: 3px;
}

#stats {
    display: flex;
    gap: 20px;
    font-size: 16px;
    color: #e0f2fe;
    font-weight: bold;
}

#stats span {
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 12px;
    border-radius: 8px;
}

#tower-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: linear-gradient(0deg, rgba(20, 30, 60, 0.95), rgba(20, 30, 60, 0.8));
    pointer-events: auto;
}

.tower-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 10px;
    background: rgba(74, 144, 217, 0.2);
    border: 2px solid rgba(74, 144, 217, 0.4);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 85px;
    user-select: none;
}

.tower-btn:hover {
    background: rgba(74, 144, 217, 0.4);
    border-color: #7dd3fc;
    transform: translateY(-2px);
}

.tower-btn.selected {
    background: rgba(74, 144, 217, 0.6);
    border-color: #7dd3fc;
    box-shadow: 0 0 15px rgba(125, 211, 252, 0.4);
}

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

.tower-btn.disabled:hover {
    transform: none;
    background: rgba(74, 144, 217, 0.2);
    border-color: rgba(74, 144, 217, 0.4);
}

.tower-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.tower-name {
    font-size: 11px;
    color: #e0f2fe;
    font-weight: bold;
}

.tower-cost {
    font-size: 11px;
    color: #7dd3fc;
    font-weight: bold;
}

.tower-count {
    font-size: 9px;
    color: #94a3b8;
    margin-top: 1px;
}

#start-wave-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    padding: 12px 24px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    font-size: 16px;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    pointer-events: auto;
    letter-spacing: 2px;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    transition: all 0.2s;
    user-select: none;
}

#start-wave-btn:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.6);
}

#start-wave-btn.hidden {
    display: none;
}

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0c1445, #1a237e, #0d47a1);
    z-index: 10;
}

#start-screen h1 {
    font-size: 48px;
    color: #7dd3fc;
    text-shadow: 0 0 20px rgba(125, 211, 252, 0.6);
    margin-bottom: 16px;
    letter-spacing: 4px;
}

#start-screen p {
    color: #b3e5fc;
    font-size: 18px;
    margin-bottom: 8px;
}

#play-btn, #restart-btn, #victory-restart-btn {
    margin-top: 24px;
    padding: 14px 48px;
    font-size: 22px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    letter-spacing: 3px;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    transition: all 0.2s;
}

#play-btn:hover, #restart-btn:hover, #victory-restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.6);
}

/* Game Over Screen */
#game-over-screen, #victory-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 30, 0.92);
    z-index: 10;
}

#game-over-screen h1 {
    font-size: 48px;
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    margin-bottom: 16px;
}

#victory-screen h1 {
    font-size: 48px;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    margin-bottom: 16px;
}

#game-over-screen p, #victory-screen p {
    color: #b3e5fc;
    font-size: 20px;
}

.hidden {
    display: none !important;
}
