:root {
    --primary-color: #00D4FF;
    --accent-color: #FF0055;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --text-color: #ffffff;
    --font-main: 'Outfit', sans-serif;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-gradient);
    font-family: var(--font-main);
    color: var(--text-color);
    user-select: none;
}

#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: 9999;
    /* Ensure strictly on top */
    pointer-events: none;
    /* Let clicks pass through to canvas when playing */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Enable pointer events for buttons */
button {
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* Start Screen */
#start-screen,
#game-over-screen {
    text-align: center;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    font-size: 4rem;
    margin: 0;
    letter-spacing: -2px;
    line-height: 1;
}

h2 {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
}

.highlight {
    color: var(--primary-color);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.7;
    margin: 0.5rem 0 2rem 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.instructions {
    margin-bottom: 2rem;
    font-size: 1rem;
    opacity: 0.8;
}

.key-hint {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    color: var(--primary-color);
}

button {
    background: var(--primary-color);
    color: #0f172a;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.6);
    background: #ffffff;
}

/* In-Game UI */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#score-display {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 5rem;
    font-weight: 800;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    opacity: 0.8;
}

.final-score {
    font-size: 2rem;
    margin-bottom: 2rem;
}

#final-score-val {
    color: var(--primary-color);
    font-weight: 800;
}

/* Speed Lines Effect */
.speed-lines-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle, transparent 40%, rgba(255, 255, 255, 0.1) 90%),
        repeating-conic-gradient(from 0deg, transparent 0deg, transparent 10deg, rgba(255, 255, 255, 0.05) 10.5deg, transparent 11deg);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.5s ease;
    mix-blend-mode: overlay;
}

.speed-lines-overlay.active {
    opacity: 1;
    animation: zoomPulse 0.1s infinite;
}

@keyframes zoomPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

.website-link {
    display: block;
    margin-top: 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
    opacity: 0.6;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    pointer-events: auto;
}

.website-link:hover {
    opacity: 1;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Mobile Optimization */
@media (max-width: 768px) {
    h1 {
        font-size: 3rem;
    }

    .subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    #start-screen,
    #game-over-screen {
        padding: 2rem;
        width: 80%;
    }

    button {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }

    #score-display {
        font-size: 3rem;
        top: 15%;
    }

    .instructions {
        font-size: 0.9rem;
    }
}