:root {
    --bg-color: #05050a;
    --neon-cyan: #00f3ff;
    --neon-purple: #b53cff;
    --neon-pink: #ff0055;
    --text-color: #ffffff;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    overflow: hidden;
    overscroll-behavior: none;
    font-family: var(--font-main);
    color: var(--text-color);
    /* Handle safe areas for notches / dynamic islands */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #101018 0%, #05050a 100%);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to canvas when playing */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#score-display {
    position: absolute;
    top: 5%;
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.1);
    letter-spacing: 2px;
    z-index: 5;
    transition: opacity 0.3s;
}

.screen {
    pointer-events: auto; /* Re-enable pointer events for menus */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(15, 15, 25, 0.85) 0%, rgba(5, 5, 10, 0.95) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 4rem 5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 243, 255, 0.02);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(0) scale(1);
    opacity: 1;
}

.screen.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.glow-text {
    font-size: 4rem;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.1;
    background: linear-gradient(135deg, #ffffff 0%, #00f3ff 50%, #b53cff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(0, 243, 255, 0.3));
    margin-bottom: 1.5rem;
}

.glow-text.title .subtitle {
    display: block;
    margin-top: 8px;
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 12px;
    color: #ffffff;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 10px rgba(181, 60, 255, 0.5);
    filter: none;
}

.glow-text.error {
    background: linear-gradient(135deg, #ffffff 0%, #ff0055 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(255, 0, 85, 0.3));
}

.pulse-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 3rem;
    animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.accent-text {
    color: var(--neon-cyan);
    text-shadow: 0 0 5px var(--neon-cyan);
}

.neon-button {
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.05), rgba(181, 60, 255, 0.05));
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 6px;
    padding: 1.2rem 3.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

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

.neon-button:hover::before {
    left: 100%;
}

.neon-button:hover {
    border-color: rgba(0, 243, 255, 0.5);
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.15), rgba(181, 60, 255, 0.15));
    box-shadow: 0 10px 40px rgba(0, 243, 255, 0.3), inset 0 0 15px rgba(0, 243, 255, 0.1);
    transform: translateY(-3px);
}

.neon-button:active {
    transform: translateY(1px);
}

.neon-button.error-btn {
    background: linear-gradient(90deg, rgba(255, 0, 85, 0.05), transparent);
}

.neon-button.error-btn:hover {
    border-color: rgba(255, 0, 85, 0.5);
    background: linear-gradient(90deg, rgba(255, 0, 85, 0.15), transparent);
    box-shadow: 0 10px 40px rgba(255, 0, 85, 0.3), inset 0 0 15px rgba(255, 0, 85, 0.1);
}
