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

body {
    font-family: 'Courier New', monospace;
    background: #0a0a0a;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

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

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
}

.hidden {
    display: none !important;
}

/* Loading Screen */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a472a 0%, #0a0a0a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#loading-screen h1 {
    font-size: 4em;
    margin-bottom: 20px;
    text-shadow: 0 0 20px #00ff00;
}

.loading-bar {
    width: 300px;
    height: 20px;
    background: #333;
    border: 2px solid #00ff00;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 20px;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #00ff00, #00aa00);
    width: 0%;
    animation: loading 2s ease-in-out forwards;
}

@keyframes loading {
    to { width: 100%; }
}

/* Main Menu */
#main-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 900;
}

.menu-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a3a1a 0%, #0a1a0a 100%);
}

.menu-content {
    position: relative;
    text-align: center;
    padding-top: 10vh;
}

.title {
    font-size: 4em;
    text-shadow: 0 0 30px #00ff00, 0 0 10px #000;
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 30px #00ff00, 0 0 10px #000; }
    50% { text-shadow: 0 0 50px #00ff00, 0 0 20px #00ff00; }
}

.subtitle {
    font-size: 1.3em;
    color: #aaa;
    margin-bottom: 40px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.menu-btn {
    width: 280px;
    padding: 18px;
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #2a5a2a 0%, #1a3a1a 100%);
    color: #fff;
    border: 3px solid #00ff00;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.menu-btn:hover {
    background: linear-gradient(135deg, #3a7a3a 0%, #2a4a2a 100%);
    transform: scale(1.05);
    box-shadow: 0 0 20px #00ff00;
}

.version-info {
    margin-top: 40px;
    color: #666;
    font-size: 0.9em;
}

/* Multiplayer Lobby */
#multiplayer-lobby {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 850;
}

.lobby-panel {
    background: linear-gradient(135deg, #1a3a1a 0%, #0a1a0a 100%);
    border: 3px solid #00ff00;
    padding: 30px;
    border-radius: 10px;
    width: 500px;
    max-width: 90vw;
}

.lobby-panel h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #00ff00;
}

.lobby-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: #2a2a2a;
    border: 2px solid #444;
    color: #aaa;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Courier New', monospace;
}

.tab-btn.active {
    background: #2a5a2a;
    border-color: #00ff00;
    color: #fff;
}

.tab-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#room-name, #map-select {
    padding: 15px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    background: #1a1a1a;
    border: 2px solid #00ff00;
    color: #fff;
}

.action-btn {
    padding: 15px;
    font-size: 1.1em;
    font-family: 'Courier New', monospace;
    background: #2a5a2a;
    border: 2px solid #00ff00;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.action-btn:hover {
    background: #3a7a3a;
    box-shadow: 0 0 15px #00ff00;
}

.back-btn {
    margin-top: 20px;
    padding: 10px;
    background: #3a3a3a;
    border: 2px solid #666;
    color: #aaa;
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

.back-btn:hover {
    background: #4a4a4a;
    color: #fff;
}

#room-list {
    min-height: 200px;
    background: #0a0a0a;
    border: 2px solid #333;
    padding: 15px;
}

.no-rooms {
    color: #666;
    text-align: center;
    padding: 50px;
}

/* Tutorial & Settings Overlays */
#tutorial-overlay, #settings-overlay {
    position: absolute;
    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: 950;
}

.tutorial-panel, .settings-panel {
    background: linear-gradient(135deg, #1a3a1a 0%, #0a1a0a 100%);
    border: 3px solid #00ff00;
    padding: 25px;
    border-radius: 10px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.tutorial-panel h2, .settings-panel h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #00ff00;
}

.tutorial-content {
    margin-bottom: 20px;
}

.tutorial-section {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #00ff00;
}

.tutorial-section h3 {
    color: #00ff00;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.tutorial-section p {
    line-height: 1.5;
    color: #ccc;
    font-size: 0.95em;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.setting-row label {
    flex: 1;
    color: #00ff00;
}

.setting-row input[type="range"] {
    flex: 2;
}

.setting-row span {
    width: 50px;
    text-align: center;
}

/* Game HUD */
#game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hud-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 10px;
}

.resource-display {
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.85);
    padding: 8px 16px;
    border: 2px solid #00ff00;
    border-radius: 5px;
    pointer-events: auto;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1em;
}

.resource-icon {
    font-size: 1.3em;
}

#minimap-container {
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #00ff00;
    padding: 5px;
    pointer-events: auto;
    cursor: pointer;
}

#minimap {
    display: block;
}

.hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 10px;
    gap: 10px;
}

#command-panel {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00ff00;
    padding: 12px;
    width: 280px;
    pointer-events: auto;
}

#selection-portrait {
    width: 60px;
    height: 60px;
    background: #1a1a1a;
    border: 2px solid #333;
    margin-bottom: 8px;
}

#unit-name {
    font-size: 1em;
    color: #00ff00;
    margin-bottom: 5px;
}

#unit-health-bar {
    height: 8px;
    background: #333;
    border: 1px solid #00ff00;
    margin-bottom: 8px;
}

#action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 8px;
}

.action-btn-small {
    padding: 8px 4px;
    background: #2a5a2a;
    border: 2px solid #00ff00;
    color: #fff;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.2s;
    font-family: inherit;
}

.action-btn-small:hover:not(:disabled) {
    background: #3a7a3a;
}

.action-btn-small:disabled {
    background: #1a1a1a;
    border-color: #333;
    color: #666;
    cursor: not-allowed;
}

#build-queue {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00ff00;
    padding: 8px;
    min-width: 180px;
    max-width: 200px;
    pointer-events: auto;
}

#control-groups {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00ff00;
    padding: 8px;
    min-width: 140px;
    pointer-events: auto;
}

.control-group-hint {
    font-size: 0.75em;
    color: #666;
    text-align: center;
}

#fps-counter {
    position: absolute;
    top: 10px;
    right: 170px;
    background: rgba(0, 0, 0, 0.85);
    padding: 5px 10px;
    border: 1px solid #00ff00;
    font-size: 0.9em;
}

#game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #00ff00;
    padding: 30px 50px;
    font-size: 2em;
    text-align: center;
    display: none;
    z-index: 1000;
}

footer {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    opacity: 0.6;
}

footer a {
    color: #00ff00;
    text-decoration: none;
    font-size: 0.85em;
}

footer a:hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2.5em;
    }
    .menu-btn {
        width: 220px;
        font-size: 1em;
        padding: 14px;
    }
    #command-panel {
        width: 200px;
        padding: 8px;
    }
    .resource-display {
        font-size: 0.9em;
        gap: 10px;
    }
    #build-queue {
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .hud-bottom {
        flex-wrap: wrap;
    }
    #command-panel {
        width: 100%;
    }
}