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

body {
    font-family: system-ui, sans-serif;
    background: #0f0f1a;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

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

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    pointer-events: auto;
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease;
}

.screen.active {
    opacity: 1;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Start Screen */
#start-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f1a 100%);
    text-align: center;
}

.game-title {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 900;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff, #06ffa5);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
    text-shadow: 0 0 30px rgba(138, 43, 226, 0.5);
}

.game-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #b8b8d1;
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Buttons */
.btn {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    margin: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #ff006e 0%, #8338ec 100%);
    color: white;
    box-shadow: 0 10px 30px rgba(131, 56, 236, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(131, 56, 236, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-primary:hover::before {
    left: 100%;
}

/* Instructions */
.instructions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 2rem;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    color: #b8b8d1;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.icon {
    font-size: 1.5rem;
}

/* Game Over Screen */
#gameover-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f1a 100%);
    text-align: center;
}

.game-over-title {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 900;
    color: #ff006e;
    text-shadow: 0 0 30px rgba(255, 0, 110, 0.5);
    margin-bottom: 1.5rem;
}

.score-display {
    margin-bottom: 1.5rem;
}

.score-label {
    font-size: 0.9rem;
    color: #b8b8d1;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.score-value {
    font-size: clamp(3rem, 12vw, 6rem);
    font-weight: 900;
    background: linear-gradient(45deg, #06ffa5, #3a86ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.high-score-display {
    margin-bottom: 1rem;
}

.high-score-label {
    font-size: 0.9rem;
    color: #b8b8d1;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.high-score-value {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 700;
    color: #ffcc00;
}

.bonus-info {
    margin-bottom: 1.5rem;
}

.bonus-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #06ffa5;
    text-shadow: 0 0 20px rgba(6, 255, 165, 0.5);
    animation: pulse 1s ease-in-out infinite;
}

/* HUD */
.hud {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.hud-label {
    font-size: 0.7rem;
    color: #b8b8d1;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hud-value {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

/* Animations */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hud {
        width: 90%;
        justify-content: space-around;
        padding: 0.5rem 1rem;
    }

    .hud-label {
        font-size: 0.6rem;
    }

    .hud-value {
        font-size: 1.2rem;
    }

    .instructions {
        max-width: 80%;
    }
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-text {
    font-size: 1.5rem;
    color: #8338ec;
    animation: pulse 1s ease-in-out infinite;
}

/* Touch optimizations */
@media (max-width: 768px) {
    .btn {
        padding: 1rem 2.5rem;
        font-size: 1rem;
    }
}
