@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', 'Courier New', monospace;
    background: #000;
    color: #00ffff;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(rgba(255, 0, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: grid-move 10s linear infinite;
    pointer-events: none;
}

@keyframes grid-move {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

#game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

#gameCanvas {
    border: 2px solid #ff00ff;
    border-radius: 0;
    box-shadow: 
        0 0 30px #ff00ff,
        inset 0 0 30px rgba(255, 0, 255, 0.3);
    cursor: pointer;
    position: relative;
}

#ui-overlay {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

#score {
    font-size: 28px;
    font-weight: 900;
    text-shadow: 
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 30px #00ffff;
    letter-spacing: 2px;
}

#speed {
    display: none;
}

#show-scores-btn {
    margin-top: 15px;
    padding: 10px 20px;
    border: 2px solid #00ffff;
    background: rgba(0, 255, 255, 0.2);
    color: #00ffff;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
}

#show-scores-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 15px #00ffff;
    transform: scale(1.05);
}

#game-over, #high-scores {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border: 2px solid #ff00ff;
    text-align: center;
    box-shadow: 
        0 0 30px #ff00ff,
        inset 0 0 30px rgba(255, 0, 255, 0.2);
    z-index: 1000;
}

#game-over::before, #high-scores::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff00ff, #00ffff, #ff00ff);
    z-index: -1;
    filter: blur(10px);
    opacity: 0.7;
}

#game-over {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 350px;
}

#high-scores {
    top: 80px;
    left: 20px;
    min-width: 300px;
}

#high-scores h3 {
    color: #ff00ff;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 900;
    text-transform: uppercase;
    text-shadow: 
        0 0 10px #ff00ff,
        0 0 20px #ff00ff;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: 2px solid #ff00ff;
    background: rgba(255, 0, 255, 0.2);
    color: #ff00ff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 0, 255, 0.4);
    transform: scale(1.1);
    box-shadow: 0 0 10px #ff00ff;
}

.close-btn:active {
    transform: scale(0.95);
}

#game-over h2 {
    margin-bottom: 20px;
    color: #ff00ff;
    font-size: 36px;
    font-weight: 900;
    text-transform: uppercase;
    text-shadow: 
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        0 0 30px #ff00ff;
    animation: neon-flicker 1.5s ease-in-out infinite alternate;
}

@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

#final-score {
    color: #00ffff;
    font-size: 48px;
    font-weight: 900;
    text-shadow: 
        0 0 10px #00ffff,
        0 0 20px #00ffff;
}

#player-name {
    padding: 15px;
    margin: 20px 0;
    border: 2px solid #00ffff;
    border-radius: 0;
    font-size: 16px;
    font-family: 'Orbitron', monospace;
    background: rgba(0, 255, 255, 0.1);
    color: #00ffff;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
}

#player-name:focus {
    outline: none;
    box-shadow: 
        0 0 20px #00ffff,
        inset 0 0 20px rgba(0, 255, 255, 0.2);
    background: rgba(0, 255, 255, 0.2);
}

#player-name::placeholder {
    color: rgba(0, 255, 255, 0.5);
}

button {
    padding: 15px 30px;
    margin: 10px;
    border: 2px solid #ff00ff;
    border-radius: 0;
    background: linear-gradient(45deg, rgba(255, 0, 255, 0.2), rgba(0, 255, 255, 0.2));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

button:hover {
    box-shadow: 
        0 0 20px #ff00ff,
        inset 0 0 20px rgba(255, 0, 255, 0.3);
    transform: translateY(-2px);
}

button:hover::before {
    left: 100%;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

#scores-list {
    text-align: left;
    margin-top: 20px;
    list-style: none;
}

#scores-list li {
    margin: 10px 0;
    font-size: 14px;
    padding: 10px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

#scores-list li:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#scores-list .rank {
    color: #ff00ff;
    font-weight: 700;
    margin-right: 10px;
}

#scores-list .name {
    flex-grow: 1;
    text-transform: uppercase;
}

#scores-list .score {
    color: #00ffff;
    font-weight: 700;
    text-shadow: 0 0 5px #00ffff;
}

/* Responsive design */
@media (max-width: 768px) {
    #gameCanvas {
        width: 90vw;
        max-width: 400px;
        height: auto;
    }
    
    #game-over {
        width: 90%;
        min-width: auto;
    }
    
    #high-scores {
        position: fixed;
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        max-width: 90%;
    }
    
    #score {
        font-size: 24px;
    }
}

/* Glitch effect */
@keyframes glitch {
    0% {
        text-shadow: 
            0.05em 0 0 #00ffff, 
            -0.05em -0.025em 0 #ff00ff,
            0.025em 0.05em 0 #ffff00;
    }
    15% {
        text-shadow: 
            0.05em 0 0 #00ffff, 
            -0.05em -0.025em 0 #ff00ff,
            0.025em 0.05em 0 #ffff00;
    }
    16% {
        text-shadow: 
            -0.05em -0.025em 0 #00ffff, 
            0.025em 0.025em 0 #ff00ff,
            -0.05em -0.05em 0 #ffff00;
    }
    49% {
        text-shadow: 
            -0.05em -0.025em 0 #00ffff, 
            0.025em 0.025em 0 #ff00ff,
            -0.05em -0.05em 0 #ffff00;
    }
    50% {
        text-shadow: 
            0.025em 0.05em 0 #00ffff, 
            0.05em 0 0 #ff00ff,
            0 -0.05em 0 #ffff00;
    }
    99% {
        text-shadow: 
            0.025em 0.05em 0 #00ffff, 
            0.05em 0 0 #ff00ff,
            0 -0.05em 0 #ffff00;
    }
    100% {
        text-shadow: 
            -0.025em 0 0 #00ffff, 
            -0.025em -0.025em 0 #ff00ff,
            -0.025em -0.05em 0 #ffff00;
    }
}