@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

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

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(45deg, #0a0a0a, #1a0a1a, #0a1a0a);
    background-size: 400% 400%;
    animation: backgroundPulse 8s ease-in-out infinite;
    overflow: hidden;
    color: #00ff88;
}

@keyframes backgroundPulse {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    background: transparent;
    cursor: crosshair;
}

.reticle {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: screen;
    transform: translate(-50%, -50%);
    z-index: 200;
}

.reticle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(255,255,255,0.1));
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(0,255,136,0.6);
}

/* UI Overlay */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.1), rgba(255, 0, 136, 0.1));
    border-bottom: 2px solid #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.health-bar {
    position: relative;
    width: 300px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ff0088;
    border-radius: 15px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff0088, #ff4444);
    transition: width 0.3s ease;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3);
}

.health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-size: 14px;
}

.stats {
    display: flex;
    gap: 30px;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.left-controls, .right-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.small-btn {
    pointer-events: all;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid rgba(0,255,136,0.2);
    background: rgba(0,0,0,0.6);
    color: #00ff88;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.small-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,255,136,0.15);} 

.highscore { color: #ffdd55; }

.small-btn.active {
    background: linear-gradient(45deg, #444, #111);
    color: #ffcc55;
    border-color: rgba(255,204,85,0.25);
}

/* Start Screen */
.start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55); /* allow demo to show behind */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    pointer-events: all;
}

.title h1 {
    font-size: 4rem;
    font-weight: 900;
    text-align: center;
    background: linear-gradient(45deg, #00ff88, #ff0088, #0088ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
    margin-bottom: 10px;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { filter: brightness(1); }
    to { filter: brightness(1.3); }
}

.subtitle {
    font-size: 1.5rem;
    color: #ff0088;
    text-align: center;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.controls {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column; /* stack text above buttons */
    gap: 18px;
    align-items: center;
    justify-content: center;
}

.controls p {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #00ff88;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.control-text { margin-right: 18px; }
.control-buttons { display:flex; gap:18px; }

.start-btn, .restart-btn {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: bold;
    padding: 14px 34px;
    background: linear-gradient(45deg, #00ff88, #0088ff);
    border: none;
    border-radius: 10px;
    color: #000;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    pointer-events: all;
    min-width: 200px;
}

.start-btn:hover, .restart-btn:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0, 255, 136, 0.6);
    background: linear-gradient(45deg, #0088ff, #ff0088);
}

/* Perk tree styles for progression modal */
.perk-trees {
    display: flex;
    gap: 18px;
    justify-content: center;
    align-items: flex-start;
}
.perk-tree {
    width: 260px;
    padding: 12px;
    border: 2px solid #00ff88;
    position: relative;
    background: rgba(0,0,0,0.15);
}
.perk-node {
    background: linear-gradient(90deg, rgba(0,255,136,0.06), rgba(255,0,136,0.02));
    border: 1px solid rgba(0,255,136,0.15);
    padding: 10px 12px;
    margin: 8px 0;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.perk-node.locked { opacity: 0.55; }
.perk-connector {
    height: 18px;
    width: 2px;
    background: rgba(0,255,136,0.35);
    margin: 0 auto;
}
.perk-node .info { margin-left: 8px; font-size: 0.82rem; color: #cfe; }

/* Modals */
.level-up-modal, .game-over-modal {
    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: 1000;
    pointer-events: all;
}

.modal-content {
    background: linear-gradient(135deg, rgba(0, 26, 26, 0.9), rgba(26, 0, 26, 0.9));
    padding: 40px;
    border-radius: 20px;
    border: 3px solid #00ff88;
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.6);
    text-align: center;
    min-width: 400px;
}

.modal-content h2 {
    font-size: 2.5rem;
    font-weight: 900;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
    margin-bottom: 20px;
}

/* Loot modal uses same modal styles */

.player-sprite {
    width: 48px;
    height: 48px;
    display: inline-block;
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(0,255,136,0.2);
}

.player-stage-1 { background: radial-gradient(circle at 30% 30%, #ffffff, #00ff88 40%, #00aa66 100%); }
.player-stage-2 { background: radial-gradient(circle at 30% 30%, #ffffff, #ff0088 40%, #cc0066 100%); transform: scale(1.08); }
.player-stage-3 { background: radial-gradient(circle at 30% 30%, #ffffff, #0088ff 40%, #0066cc 100%); transform: scale(1.14); }
.player-stage-4 { background: conic-gradient(#00ff88, #ff0088, #0088ff); transform: scale(1.22); box-shadow: 0 0 30px rgba(255,0,136,0.4); }

.loot-item { cursor: pointer; }
.loot-item:hover { transform: scale(1.03); box-shadow: 0 0 20px rgba(255,255,255,0.06); }

.upgrade-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.upgrade-option {
    padding: 15px 20px;
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.2), rgba(255, 0, 136, 0.2));
    border: 2px solid #00ff88;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    pointer-events: all;
}

.upgrade-option:hover {
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.4), rgba(255, 0, 136, 0.4));
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    transform: scale(1.05);
}

.upgrade-option h3 {
    color: #ff0088;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.upgrade-option p {
    color: #00ff88;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .title h1 {
        font-size: 2.5rem;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .health-bar {
        width: 250px;
    }
    
    .stats {
        gap: 15px;
        font-size: 14px;
    }
}
