* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    overflow: hidden;
    background: #1a1a2e;
    font-family: 'JetBrains Mono', monospace;
    color: #e0e0e0;
}
#canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
}
#ui-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 10;
    pointer-events: none;
}
#ui-overlay > * { pointer-events: auto; }
.hidden { display: none !important; }
.screen {
    display: none;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10,10,30,0.92);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.screen.active { display: flex; }
.start-content, .modal-content {
    text-align: center;
    padding: 3rem;
    border-radius: 16px;
    background: rgba(20,20,50,0.95);
    border: 2px solid #3d5afe;
    box-shadow: 0 0 60px rgba(61,90,254,0.3);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-content.wide { max-width: 800px; width: 90%; }
.title {
    font-family: 'Anybody', sans-serif;
    font-weight: 900;
    font-size: 3rem;
    background: linear-gradient(135deg, #00e676, #3d5afe, #ff6d00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}
.subtitle {
    font-weight: 400;
    font-size: 1.2rem;
    color: #90a4ae;
    margin-bottom: 1rem;
}
.disclaimer {
    font-size: 0.7rem;
    color: #607d8b;
    margin-bottom: 2rem;
}
.start-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: #3d5afe; color: #fff; }
.btn-primary:hover { background: #536dfe; transform: scale(1.05); }
.btn-secondary { background: #263238; color: #b0bec5; border: 1px solid #455a64; }
.btn-secondary:hover { background: #37474f; }
.btn-danger { background: #d32f2f; color: #fff; }
.btn-danger:hover { background: #f44336; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }
.modal-content ul { text-align: left; margin: 1rem 2rem; line-height: 2; }

/* HUD */
#hud { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud-top {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; align-items: center; gap: 0.8rem;
    padding: 8px 12px;
    background: rgba(10,10,30,0.85);
    border-bottom: 1px solid #1a237e;
}
.hud-pill {
    padding: 4px 12px;
    background: rgba(30,30,60,0.9);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}
#hud-hero {
    display: flex; align-items: center; gap: 6px; margin-left: auto;
}
.hero-portrait {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, #ff6d00, #ffab00);
    border-radius: 50%;
    border: 2px solid #ffd600;
}
.hero-info { display: flex; flex-direction: column; gap: 2px; }
#hero-level { font-size: 0.7rem; font-weight: 700; color: #ffd600; }
.xp-bar {
    width: 60px; height: 6px;
    background: #263238;
    border-radius: 3px;
    overflow: hidden;
}
.xp-fill { height: 100%; background: #ffd600; width: 0%; transition: width 0.3s; }
#hud-speed { display: flex; gap: 4px; }
.speed-btn {
    padding: 4px 8px;
    background: #1a237e;
    color: #7986cb;
    border: 1px solid #283593;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
}
.speed-btn.active { background: #3d5afe; color: #fff; }
.hud-gear {
    background: none; border: none; color: #90a4ae;
    font-size: 1.2rem; cursor: pointer;
}

/* Tower Shop */
#tower-shop {
    position: absolute;
    top: 50px; right: 0;
    width: 140px;
    background: rgba(10,10,30,0.9);
    border-left: 1px solid #1a237e;
    padding: 8px;
    height: calc(100% - 50px);
    overflow-y: auto;
}
#tower-shop h3 {
    font-size: 0.65rem;
    color: #7986cb;
    margin-bottom: 8px;
    letter-spacing: 2px;
}
.shop-tower {
    display: flex; align-items: center; gap: 6px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.15s;
    border: 1px solid transparent;
}
.shop-tower:hover { background: rgba(61,90,254,0.2); border-color: #3d5afe; }
.shop-tower.selected { background: rgba(61,90,254,0.3); border-color: #536dfe; }
.shop-tower.disabled { opacity: 0.4; cursor: not-allowed; }
.tower-icon {
    width: 24px; height: 24px;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
}
.shop-tower-info { font-size: 0.6rem; }
.shop-tower-info .name { color: #e0e0e0; }
.shop-tower-info .cost { color: #66bb6a; }

/* Ability Bar */
#ability-bar {
    position: absolute;
    bottom: 12px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 8px;
}
.ability-slot {
    width: 50px; height: 50px;
    background: rgba(20,20,50,0.9);
    border: 2px solid #37474f;
    border-radius: 8px;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.ability-slot.ready { border-color: #00e676; box-shadow: 0 0 12px rgba(0,230,118,0.4); }
.ability-slot.on-cd { opacity: 0.6; }
.ability-key {
    position: absolute; top: 2px; right: 4px;
    font-size: 0.55rem; color: #607d8b;
}
.ability-cd {
    position: absolute; bottom: 2px;
    font-size: 0.55rem; color: #ff6d00;
}

/* Upgrade Panel */
#upgrade-panel {
    position: absolute;
    bottom: 0; left: 0;
    width: calc(100% - 140px);
    background: rgba(10,10,30,0.95);
    border-top: 1px solid #1a237e;
    padding: 12px;
}
#upgrade-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
#upgrade-tower-name { font-weight: 800; font-size: 0.9rem; }
#target-priority {
    background: #1a237e; color: #e0e0e0; border: 1px solid #283593;
    border-radius: 4px; padding: 2px 6px; font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
}
#upgrade-paths { display: flex; gap: 20px; flex-wrap: wrap; }
.upgrade-path {
    display: flex; align-items: center; gap: 6px;
}
.upgrade-node {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid #455a64;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.upgrade-node.purchased { background: #3d5afe; border-color: #536dfe; color: #fff; }
.upgrade-node.available { border-color: #00e676; color: #00e676; }
.upgrade-node.available:hover { background: rgba(0,230,118,0.2); }
.upgrade-node.locked { opacity: 0.3; cursor: not-allowed; }
.upgrade-connector { width: 12px; height: 2px; background: #37474f; }

/* Kill Feed */
#kill-feed {
    position: absolute;
    top: 55px; left: 8px;
    width: 220px;
    pointer-events: none;
    font-size: 0.65rem;
}
.feed-msg {
    padding: 3px 8px;
    background: rgba(10,10,30,0.8);
    border-radius: 4px;
    margin-bottom: 3px;
    animation: feedIn 0.3s ease;
    color: #b0bec5;
}
@keyframes feedIn { from { opacity: 0; transform: translateX(-20px); } }

/* FPS */
#fps-counter {
    position: absolute;
    top: 55px; right: 148px;
    font-size: 0.6rem;
    color: #66bb6a;
    background: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Dev Console */
#dev-console {
    position: absolute;
    bottom: 70px; left: 50%;
    transform: translateX(-50%);
}
#dev-input {
    width: 400px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.9);
    border: 1px solid #3d5afe;
    border-radius: 6px;
    color: #00e676;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

/* Wave Button */
.btn-wave {
    position: absolute;
    bottom: 70px; right: 148px;
}

/* Settings */
.settings-grid { display: flex; gap: 1rem; flex-wrap: wrap; text-align: left; margin: 1rem 0; }
.settings-section { flex: 1; min-width: 200px; }
.settings-section label { display: block; margin: 0.5rem 0; font-size: 0.8rem; }
.settings-section h3 { font-size: 0.8rem; color: #7986cb; margin-bottom: 0.5rem; }
#balance-json {
    width: 100%; font-size: 0.6rem; padding: 8px;
    background: #0a0a1e; color: #00e676; border: 1px solid #1a237e;
    border-radius: 6px; font-family: 'JetBrains Mono', monospace;
    resize: vertical;
}

/* Footer */
#footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    text-align: center; font-size: 0.6rem;
    color: #455a64; padding: 4px;
    background: rgba(10,10,30,0.8);
    z-index: 20;
}
#footer a { color: #7986cb; }

/* Responsive */
@media (max-width: 768px) {
    #tower-shop { width: 100px; }
    .shop-tower-info .name { font-size: 0.5rem; }
    #upgrade-panel { width: 100%; }
    .title { font-size: 2rem; }
    #dev-input { width: 280px; }
}