* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

body {
    background-color: #2c3e50;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: #1a1a1a;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#resource-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    display: flex;
    gap: 20px;
    pointer-events: auto;
}

.resource {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
}

.resource .rate {
    font-size: 12px;
    color: #aaa;
}

#timer-display {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    color: #e74c3c;
    font-size: 24px;
    font-weight: bold;
}

#build-menu {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
    border-radius: 15px;
    color: white;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 300px;
    border: 2px solid #3498db;
}

#build-menu.hidden {
    display: none;
}

.build-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.build-btn {
    padding: 10px;
    background: #34495e;
    border: 1px solid #7f8c8d;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.2s;
}

.build-btn:hover {
    background: #2980b9;
}

.build-btn:active {
    background: #1abc9c;
}

#btn-close-menu {
    margin-top: 10px;
    background: #c0392b;
    border: none;
    padding: 8px;
    color: white;
    cursor: pointer;
    border-radius: 5px;
}

#message-area {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    color: #f1c40f;
    font-size: 20px;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
    text-align: center;
}

/* Global hidden class */
.hidden {
    display: none !important;
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 100;
}

h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #e67e22;
}

.instructions {
    margin-bottom: 40px;
    text-align: center;
    line-height: 1.6;
    color: #bdc3c7;
}

.mode-btn {
    padding: 15px 40px;
    font-size: 24px;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    margin: 0 10px;
}

.mode-btn:hover {
    transform: scale(1.05);
}

#start-btn, #restart-btn {
    background: #27ae60;
}

#start-btn:hover, #restart-btn:hover {
    background: #2ecc71;
}

#start-endless-btn {
    background: #c0392b;
}

#start-endless-btn:hover {
    background: #e74c3c;
}

#start-solo-btn {
    background: #9b59b6;
}

#start-solo-btn:hover {
    background: #8e44ad;
}

/* Cheat Menu Styles */
#cheat-menu {
    position: absolute; 
    bottom: 20px; 
    left: 20px; 
    background: rgba(0,0,0,0.8); 
    padding: 15px; 
    border-radius: 10px; 
    border: 2px solid #e74c3c; 
    z-index: 200; 
    pointer-events: auto; 
    text-align: center; 
    min-width: 200px;
}

#cheat-menu h3 {
    color: #e74c3c; 
    margin-bottom: 10px; 
    font-size: 16px;
}

.cheat-btn {
    padding: 8px; 
    cursor: pointer; 
    border: none; 
    border-radius: 5px; 
    font-weight: bold; 
    font-size: 12px;
    width: 100%;
    margin-bottom: 5px;
}

#cheat-gold { background: #f1c40f; color: black; }
#cheat-elec { background: #3498db; color: white; }
#cheat-upgrade { background: #2ecc71; color: black; }
