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

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

body {
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    background-color: #0a0a18;
    color: #ffffff;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

#score-container {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 24px;
    text-shadow: 0 0 8px rgba(74, 74, 233, 0.8);
    background: rgba(10, 10, 40, 0.5);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid rgba(74, 74, 233, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 0 15px rgba(74, 74, 233, 0.3);
    transition: all 0.3s ease;
    animation: glow 2s infinite alternate;
}

#music-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(10, 10, 40, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 1px solid rgba(74, 74, 233, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 0 15px rgba(74, 74, 233, 0.3);
    transition: all 0.3s ease;
    color: white;
    font-size: 18px;
    pointer-events: auto;
    z-index: 100;
}

#music-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(74, 74, 233, 0.6);
}

#music-toggle.music-on {
    color: #8d50ff;
}

#music-toggle.music-off {
    color: #666;
}

#score-container:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(74, 74, 233, 0.5);
}

#current-score {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 32px;
    color: #ffffff;
}

#high-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    opacity: 0.9;
    margin-top: 5px;
    color: #a0a0ff;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(74, 74, 233, 0.3);
    }
    to {
        box-shadow: 0 0 15px rgba(74, 74, 233, 0.6);
    }
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 40, 0.8);
    color: white;
    padding: 20px 30px;
    border-radius: 20px;
    text-align: center;
    pointer-events: auto;
    border: 2px solid rgba(74, 74, 233, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 0 30px rgba(74, 74, 233, 0.5);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 30px;
    margin-bottom: 12px;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(74, 74, 233, 0.8);
    letter-spacing: 1px;
    text-transform: uppercase;
}

h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    margin-bottom: 15px;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(74, 74, 233, 0.8);
    letter-spacing: 2px;
}

.game-instructions {
    margin: 15px 0;
    text-align: left;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.game-instructions h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    margin-bottom: 6px;
    color: #8d50ff;
    letter-spacing: 1px;
}

.game-instructions ul {
    list-style-type: none;
    padding: 0;
    margin: 10px 0;
}

.game-instructions li {
    padding: 5px 0 5px 22px;
    position: relative;
    font-size: 13px;
    line-height: 1.3;
}

.game-instructions li:before {
    content: "•";
    color: #4a4ae9;
    font-size: 20px;
    position: absolute;
    left: 10px;
    top: 6px;
}

.game-instructions .tip {
    font-style: italic;
    color: #ffcc00;
    margin-top: 15px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 204, 0, 0.3);
}

.start-button, .restart-button {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #4a4ae9 0%, #8d50ff 100%);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(74, 74, 233, 0.5);
    position: relative;
    overflow: hidden;
    border: none;
}

.start-button:before, .restart-button:before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.5s;
}

.start-button:hover:before, .restart-button:hover:before {
    left: 100%;
}

.start-button:hover, .restart-button:hover {
    background: linear-gradient(135deg, #5a5af9 0%, #9d60ff 100%);
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(74, 74, 233, 0.6);
}

.start-button:active, .restart-button:active {
    transform: translateY(1px);
    box-shadow: 0 3px 10px rgba(74, 74, 233, 0.4);
}

#new-high-score {
    color: #ffcc00;
    font-weight: bold;
    margin: 15px 0;
    font-size: 24px;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
    animation: pulseText 1.5s infinite alternate;
}

@keyframes pulseText {
    from {
        opacity: 0.8;
        transform: scale(1);
        text-shadow: 0 0 5px rgba(255, 204, 0, 0.5);
    }
    to {
        opacity: 1;
        transform: scale(1.1);
        text-shadow: 0 0 15px rgba(255, 204, 0, 0.8);
    }
}

.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.9);
}

/* Animated background pattern for screens */
#start-screen:before, #game-over-screen:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(135deg, rgba(74, 74, 233, 0.2) 25%, transparent 25%) -10px 0,
        linear-gradient(225deg, rgba(74, 74, 233, 0.2) 25%, transparent 25%) -10px 0,
        linear-gradient(315deg, rgba(74, 74, 233, 0.2) 25%, transparent 25%),
        linear-gradient(45deg, rgba(74, 74, 233, 0.2) 25%, transparent 25%);
    background-size: 20px 20px;
    background-color: transparent;
    opacity: 0.3;
    z-index: -1;
    border-radius: 20px;
    animation: patternMove 20s linear infinite;
}

@keyframes patternMove {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 40px 40px;
    }
}

#final-score {
    font-size: 28px;
    margin: 15px 0;
    font-family: 'Orbitron', sans-serif;
    color: #ffffff;
}

.credits {
    margin-top: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.5px;
}

.credits a {
    color: #8d50ff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.credits a:hover {
    color: #4a4ae9;
    text-decoration: underline;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    #start-screen, #game-over-screen {
        padding: 12px 16px;
        max-width: 95vw;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .game-instructions h3 {
        font-size: 12px;
    }
    
    .game-instructions li {
        font-size: 12px;
        padding: 4px 0 4px 18px;
    }
    
    .start-button, .restart-button {
        padding: 10px 25px;
        font-size: 14px;
    }
    
    .credits {
        font-size: 10px;
        margin-top: 15px;
    }
}
