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

body {
    overflow: hidden;
    background: #0a0a0f;
    font-family: 'JetBrains Mono', monospace;
    color: #fff;
}

#canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* Menu Screen */
#menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.95) 0%, rgba(20, 10, 30, 0.9) 100%);
    padding: 20px;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(255, 0, 255, 0.5);
}

.game-title .accent {
    color: #ff00ff;
}

.subtitle {
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    color: #888;
    margin-bottom: 3rem;
    letter-spacing: 0.2em;
}

#mode-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-card {
    width: 200px;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.8) 0%, rgba(20, 20, 35, 0.9) 100%);
    border: 2px solid #333;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mode-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: #ff00ff;
    box-shadow: 0 10px 40px rgba(255, 0, 255, 0.3);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mode-card h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.mode-card p {
    font-size: 0.75rem;
    color: #aaa;
}

#settings-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: rgba(20, 20, 30, 0.8);
    border-radius: 10px;
    border: 1px solid #333;
    margin-bottom: 2rem;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.setting-row label {
    font-size: 0.8rem;
    color: #888;
    width: 100px;
    letter-spacing: 0.1em;
}

.setting-row input[type="range"] {
    width: 100px;
    accent-color: #ff00ff;
}

.setting-row select {
    background: #1a1a2a;
    color: #fff;
    border: 1px solid #444;
    padding: 5px 10px;
    border-radius: 5px;
    font-family: inherit;
}

.setting-row input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.menu-footer {
    position: absolute;
    bottom: 20px;
    font-size: 0.75rem;
    color: #666;
}

.menu-footer a {
    color: #ff00ff;
    text-decoration: none;
}

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

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

#hud-top-left {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#mode-badge {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    padding: 5px 12px;
    background: rgba(255, 0, 255, 0.2);
    border: 1px solid #ff00ff;
    border-radius: 20px;
    letter-spacing: 0.1em;
}

#mode-badge.mode-combat { border-color: #ff0044; background: rgba(255, 0, 68, 0.2); }
#mode-badge.mode-territory { border-color: #00ff88; background: rgba(0, 255, 136, 0.2); }
#mode-badge.mode-coop { border-color: #0088ff; background: rgba(0, 136, 255, 0.2); }

#timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#round-info {
    font-size: 0.8rem;
    color: #888;
}

#hud-top-right {
    position: absolute;
    top: 15px;
    right: 15px;
    min-width: 150px;
}

#scoreboard {
    background: rgba(10, 10, 20, 0.8);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.8rem;
}

.sync-bar {
    position: relative;
    height: 30px;
    background: rgba(20, 20, 40, 0.8);
    border: 2px solid #0088ff;
    border-radius: 15px;
    overflow: hidden;
}

.sync-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #0088ff, #00ffff);
    transition: width 0.3s ease;
}

.sync-bar span {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
}

#hud-bottom {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#powerup-indicator {
    font-size: 1.2rem;
}

.powerup-active {
    background: rgba(255, 255, 0, 0.2);
    border: 1px solid #ffff00;
    padding: 5px 15px;
    border-radius: 20px;
}

#ability-cooldown {
    width: 150px;
    height: 8px;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 4px;
    overflow: hidden;
}

.cooldown-bar {
    height: 100%;
    background: #ff00ff;
    transition: width 0.1s linear;
}

.cooldown-bar.ready {
    width: 100% !important;
    background: #00ff00;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #000;
    font-weight: bold;
}

#minimap {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 100px;
    height: 100px;
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
}

#minimap-canvas {
    display: block;
}

/* Countdown */
#countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #ff00ff;
    box-shadow: 0 0 50px rgba(255, 0, 255, 0.5);
}

#countdown-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 5rem;
    font-weight: 900;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Results Screen */
#results-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(20, 20, 35, 0.95) 0%, rgba(10, 10, 20, 0.98) 100%);
    border: 2px solid #333;
    border-radius: 20px;
    padding: 40px 60px;
    text-align: center;
    min-width: 300px;
}

#result-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

#result-title.victory {
    color: #00ff00;
    text-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
}

#result-title.defeat {
    color: #ff0044;
    text-shadow: 0 0 30px rgba(255, 0, 68, 0.5);
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 2rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(30, 30, 50, 0.5);
    border-radius: 8px;
    border-left: 4px solid;
}

.result-row.winner {
    background: rgba(0, 255, 0, 0.1);
}

#results-screen button {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    padding: 12px 30px;
    margin: 5px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#play-again {
    background: linear-gradient(135deg, #ff00ff, #aa00ff);
    color: #fff;
}

#play-again:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(255, 0, 255, 0.4);
}

#back-to-menu {
    background: transparent;
    color: #888;
    border: 1px solid #444;
}

#back-to-menu:hover {
    border-color: #888;
    color: #fff;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    #mode-selector {
        flex-direction: column;
    }
    
    .mode-card {
        width: 100%;
        max-width: 280px;
        padding: 20px;
    }
    
    #settings-panel {
        width: 100%;
        max-width: 280px;
    }
    
    #hud-top-right {
        top: auto;
        bottom: 130px;
        right: 10px;
    }
    
    #scoreboard {
        font-size: 0.7rem;
        padding: 8px;
        min-width: 120px;
    }
    
    #minimap {
        width: 80px;
        height: 80px;
    }
    
    #results-screen {
        padding: 30px;
        width: 90%;
        max-width: 350px;
    }
    
    #result-title {
        font-size: 2rem;
    }
}

/* Touch indicator for mobile */
@media (hover: none) {
    .mode-card:active {
        transform: scale(0.98);
        border-color: #ff00ff;
    }
}