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

body {
    background: linear-gradient(135deg, rgb(5, 5, 15) 0%, rgb(15, 10, 25) 100%);
    color: rgb(245, 245, 255);
    font-family: 'JetBrains Mono', monospace;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

#game-container {
    display: flex;
    gap: 0;
    margin-top: 10px;
    max-width: 1400px;
}

#canvas {
    border: 2px solid rgb(60, 40, 80);
    border-radius: 6px 0 0 6px;
    cursor: crosshair;
    image-rendering: pixelated;
    box-shadow: 0 0 30px rgba(180, 100, 255, 0.2);
}

#ui-panel {
    width: 280px;
    background: linear-gradient(180deg, rgb(18, 15, 28) 0%, rgb(12, 10, 20) 100%);
    border: 2px solid rgb(60, 40, 80);
    border-left: none;
    border-radius: 0 6px 6px 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 640px;
    overflow-y: auto;
}

#ui-panel::-webkit-scrollbar {
    width: 6px;
}

#ui-panel::-webkit-scrollbar-track {
    background: rgb(20, 20, 35);
}

#ui-panel::-webkit-scrollbar-thumb {
    background: rgb(80, 60, 120);
    border-radius: 3px;
}

#resources {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: linear-gradient(90deg, rgba(40, 30, 60, 0.8), rgba(30, 25, 50, 0.8));
    border-radius: 6px;
    border: 1px solid rgb(70, 50, 100);
}

.resource {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-family: 'Orbitron', sans-serif;
}

.resource .icon {
    font-size: 16px;
}

.resource .value {
    font-weight: 700;
}

.resource .gold { color: rgb(255, 215, 0); }
.resource .aether { color: rgb(180, 100, 255); }

#speed-controls {
    display: flex;
    justify-content: center;
}

.speed-buttons {
    display: flex;
    gap: 4px;
}

.speed-buttons button {
    padding: 6px 14px;
    background: rgb(30, 25, 45);
    border: 1px solid rgb(60, 50, 80);
    border-radius: 4px;
    color: rgb(150, 140, 180);
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    transition: all 0.2s;
}

.speed-buttons button:hover {
    background: rgb(50, 40, 70);
    border-color: rgb(100, 80, 140);
}

.speed-buttons button.active {
    background: linear-gradient(180deg, rgb(0, 180, 220), rgb(0, 140, 180));
    border-color: rgb(0, 220, 255);
    color: white;
    box-shadow: 0 0 10px rgba(0, 220, 255, 0.4);
}

#wave-info {
    text-align: center;
    padding: 10px;
    background: linear-gradient(180deg, rgb(35, 25, 50), rgb(25, 20, 40));
    border-radius: 6px;
    border: 1px solid rgb(80, 50, 100);
}

.wave-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    color: rgb(180, 100, 255);
}

#next-wave-btn {
    margin-top: 8px;
    padding: 8px 14px;
    background: linear-gradient(180deg, rgb(60, 40, 100), rgb(40, 25, 70));
    border: 1px solid rgb(100, 60, 150);
    border-radius: 4px;
    color: rgb(200, 150, 255);
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    transition: all 0.2s;
    width: 100%;
}

#next-wave-btn:hover {
    background: linear-gradient(180deg, rgb(80, 50, 130), rgb(50, 30, 90));
    box-shadow: 0 0 15px rgba(180, 100, 255, 0.5);
    transform: translateY(-1px);
}

#wave-preview {
    background: rgb(25, 20, 40);
    border-radius: 6px;
    padding: 10px;
    border: 1px solid rgb(60, 50, 80);
    display: none;
}

#wave-preview h4 {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    color: rgb(150, 140, 180);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preview-enemies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.enemy-preview {
    font-size: 11px;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.difficulty {
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
}

.difficulty.easy { color: rgb(100, 255, 100); background: rgba(100, 255, 100, 0.1); }
.difficulty.medium { color: rgb(255, 200, 50); background: rgba(255, 200, 50, 0.1); }
.difficulty.hard { color: rgb(255, 100, 50); background: rgba(255, 100, 50, 0.1); }
.difficulty.intense { color: rgb(255, 50, 100); background: rgba(255, 50, 100, 0.1); }
.difficulty.boss { color: rgb(255, 50, 50); background: rgba(255, 50, 50, 0.2); text-shadow: 0 0 10px rgba(255, 50, 50, 0.5); }

#build-menu h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    color: rgb(150, 150, 180);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.tower-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.tower-btn {
    position: relative;
    padding: 10px 8px 8px;
    background: linear-gradient(180deg, rgb(30, 28, 45), rgb(22, 20, 35));
    border: 2px solid rgb(50, 45, 70);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.tower-btn:hover:not(.disabled) {
    border-color: var(--tower-color);
    box-shadow: 0 0 15px var(--tower-color);
    transform: translateY(-2px);
}

.tower-btn.selected {
    border-color: var(--tower-color);
    background: rgba(var(--tower-color), 0.15);
    box-shadow: 0 0 20px var(--tower-color), inset 0 0 20px rgba(255, 255, 255, 0.05);
}

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

.tower-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.tower-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    color: rgb(200, 200, 220);
    font-weight: 600;
}

.tower-cost {
    font-size: 11px;
    color: rgb(255, 215, 0);
    font-weight: 700;
}

.tower-dps {
    font-size: 9px;
    color: rgb(150, 150, 180);
}

.hotkey {
    position: absolute;
    top: 3px;
    right: 4px;
    font-size: 9px;
    color: rgb(100, 100, 130);
}

#tower-inspector {
    background: linear-gradient(180deg, rgb(25, 22, 38), rgb(18, 16, 28));
    border-radius: 6px;
    padding: 12px;
    border: 1px solid rgb(60, 50, 80);
    display: none;
}

#tower-inspector h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    margin-bottom: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 4px;
    padding: 2px 0;
}

.stat-row span:first-child {
    color: rgb(140, 140, 170);
}

.stat-row.highlight {
    background: rgba(0, 220, 255, 0.1);
    padding: 4px 6px;
    margin: 4px -6px;
    border-radius: 4px;
}

.stat-row.highlight span:last-child {
    color: rgb(0, 220, 255);
    font-weight: 700;
}

.xp-bar {
    height: 5px;
    background: rgb(30, 28, 50);
    border-radius: 3px;
    margin: 6px 0;
    overflow: hidden;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, rgb(50, 200, 50), rgb(100, 255, 100));
    transition: width 0.3s;
    border-radius: 3px;
}

.targeting {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    font-size: 11px;
}

.targeting button {
    padding: 5px 10px;
    background: rgb(40, 35, 60);
    border: 1px solid rgb(70, 60, 100);
    border-radius: 4px;
    color: rgb(200, 200, 220);
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    transition: all 0.2s;
}

.targeting button:hover {
    background: rgb(55, 45, 80);
    border-color: rgb(100, 80, 140);
}

.inspector-actions {
    margin-top: 10px;
}

.sell-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(180deg, rgb(100, 40, 40), rgb(70, 25, 25));
    border: 1px solid rgb(150, 60, 60);
    border-radius: 5px;
    color: rgb(255, 150, 150);
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    transition: all 0.2s;
}

.sell-btn:hover {
    background: linear-gradient(180deg, rgb(130, 50, 50), rgb(90, 30, 30));
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.3);
}

.sell-btn.undo {
    background: linear-gradient(180deg, rgb(100, 80, 40), rgb(70, 55, 25));
    border-color: rgb(150, 120, 60);
    color: rgb(255, 215, 150);
}

.sell-btn.undo:hover {
    background: linear-gradient(180deg, rgb(130, 100, 50), rgb(90, 70, 30));
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

#hero-status {
    background: linear-gradient(180deg, rgb(30, 28, 20), rgb(22, 20, 15));
    border-radius: 6px;
    padding: 12px;
    border: 1px solid rgb(100, 85, 50);
}

#hero-status h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    color: rgb(255, 215, 0);
    margin-bottom: 8px;
}

.hero-xp .xp-fill {
    background: linear-gradient(90deg, rgb(255, 180, 0), rgb(255, 220, 100));
}

.hero-hp {
    margin: 6px 0;
    font-size: 12px;
    color: rgb(100, 255, 100);
}

.skill-points-indicator {
    background: linear-gradient(90deg, rgba(50, 255, 50, 0.2), rgba(100, 255, 100, 0.1));
    border: 1px solid rgb(50, 255, 50);
    border-radius: 4px;
    padding: 6px;
    text-align: center;
    font-size: 11px;
    color: rgb(50, 255, 50);
    margin: 6px 0;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.cooldowns {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.cooldown {
    flex: 1;
    padding: 6px;
    background: rgb(30, 28, 45);
    border-radius: 5px;
    text-align: center;
    font-size: 9px;
    border: 1px solid rgb(50, 45, 70);
}

.cooldown span {
    display: block;
    margin: 1px 0;
}

.cooldown.ready {
    border-color: rgb(0, 220, 255);
    box-shadow: 0 0 10px rgba(0, 220, 255, 0.3);
}

.cooldown .ready-text {
    color: rgb(0, 220, 255);
    font-weight: 700;
}

#dps-tracker {
    background: linear-gradient(180deg, rgb(20, 25, 35), rgb(15, 18, 28));
    border-radius: 6px;
    padding: 10px;
    border: 1px solid rgb(50, 60, 80);
}

.dps-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0;
}

.dps-label {
    font-size: 10px;
    color: rgb(120, 130, 150);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dps-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: rgb(0, 220, 255);
    font-weight: 700;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 20, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

footer {
    margin-top: 15px;
    padding: 12px 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 11px;
    color: rgb(100, 100, 130);
    background: rgba(20, 20, 35, 0.8);
    border-radius: 20px;
}

footer .separator {
    color: rgb(60, 60, 80);
}

footer a {
    color: rgb(0, 180, 220);
    text-decoration: none;
    transition: all 0.2s;
}

footer a:hover {
    color: rgb(0, 220, 255);
    text-shadow: 0 0 10px rgba(0, 220, 255, 0.5);
}

footer .inspired {
    font-style: italic;
    color: rgb(80, 80, 100);
}

@media (max-width: 1000px) {
    #game-container {
        flex-direction: column;
        align-items: center;
    }
    
    #ui-panel {
        width: 100%;
        max-width: 768px;
        max-height: none;
        border: 2px solid rgb(60, 40, 80);
        border-radius: 6px;
        margin-top: 10px;
    }
    
    #canvas {
        border-radius: 6px;
    }
    
    .tower-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .cooldowns {
        flex-direction: row;
    }
}

@media (max-width: 600px) {
    .tower-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #resources {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    footer {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
}