@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --bg-color: #050505;
    --text-color: #ffffff;
    --accent-color: #00ff9d;
    /* Neon Green */
    --secondary-accent: #ff0055;
    /* Neon Pink */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    cursor: none;
    /* Custom cursor */
    user-select: none;
    /* Prevent text selection globally */
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Space Mono', monospace;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Custom Cursor - Hardware Accelerated */
#cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    /* Use transform for performance, initial off-screen */
    transform: translate3d(-100px, -100px, 0);
    transition: width 0.2s, height 0.2s, background-color 0.2s;
    mix-blend-mode: difference;
    will-change: transform;
}

#cursor.active {
    width: 40px;
    height: 40px;
    background-color: var(--text-color);
}

@media (hover: none) and (pointer: coarse) {
    #cursor {
        display: none;
    }

    * {
        cursor: auto;
    }
}

/* Playground Elements */
#playground {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    /* Increased gap for better spacing */
}

.draggable {
    position: relative;
    cursor: none;
    z-index: 10;
    touch-action: none;
    will-change: transform;
    /* Hint for browser optimization */
}

h1 {
    font-size: clamp(3rem, 12vw, 9rem);
    /* Slightly larger */
    font-weight: 700;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    mix-blend-mode: difference;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    text-align: center;
    line-height: 0.9;
}

/* The Button */
#chaos-btn {
    background: transparent;
    border: 2px solid var(--secondary-accent);
    color: var(--secondary-accent);
    padding: 1rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 50px;
    transition: all 0.2s;
    box-shadow: 0 0 10px var(--secondary-accent);
}

#chaos-btn:hover {
    background: var(--secondary-accent);
    color: #fff;
    box-shadow: 0 0 30px var(--secondary-accent);
    transform: scale(1.1);
}

/* Footer */
footer {
    position: fixed;
    bottom: 2rem;
    display: flex;
    justify-content: center;
    width: 100%;
    opacity: 0.3;
    /* More subtle */
    pointer-events: none;
    /* Let clicks pass through mostly */
}

footer a {
    pointer-events: auto;
    /* Re-enable clicks for the link */
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--accent-color);
}

/* Snake Game Canvas */
#snake-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: rgba(0, 0, 0, 0.9);
}

/* Particles */
.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    animation: fadeOut 0.8s forwards;
    /* Faster fade */
    will-change: transform, opacity;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0);
    }
}

/* Matrix Effect Class */
.matrix-mode {
    color: #0f0 !important;
    font-family: 'Courier New', monospace !important;
    text-shadow: 0 0 5px #0f0;
}

.matrix-bg {
    background-color: #000 !important;
}

/* Letter Rain & Shatter Elements */
.spawned-letter {
    position: absolute;
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
    user-select: none;
    pointer-events: auto;
    cursor: none;
    z-index: 5;
    text-shadow: 0 0 10px currentColor;
}

/* Paint Splatter */
.splatter {
    position: absolute;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
    filter: blur(1px);
    mix-blend-mode: screen;
}

/* Static UI */
#static-ui {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
    /* Let clicks pass through container */
}

#chaos-btn {
    pointer-events: auto;
    /* Re-enable clicks on button */
    /* Keep existing button styles but ensure it's centered */
}

/* Motion Trails */
.motion-trail {
    position: absolute;
    pointer-events: none;
    opacity: 0.4;
    z-index: 1;
    filter: blur(2px);
    transition: opacity 0.2s linear, transform 0.2s linear;
}

/* Drawn Lines */
.drawn-line {
    position: absolute;
    background-color: #fff;
    height: 4px;
    border-radius: 2px;
    box-shadow: 0 0 10px #fff;
    z-index: 5;
    pointer-events: none;
    transition: opacity 1s ease;
}

.drawn-line.fading {
    opacity: 0;
}

/* 3D Parallax Stage (Disabled) */
body {
    overflow: hidden;
}

#playground {
    will-change: transform;
}

/* Button Pulse */
@keyframes pulse {
    0% {
        box-shadow: 0 0 10px var(--secondary-accent);
    }

    50% {
        box-shadow: 0 0 25px var(--secondary-accent);
    }

    100% {
        box-shadow: 0 0 10px var(--secondary-accent);
    }
}

#chaos-btn {
    animation: pulse 2s infinite;
}

/* Glitch Effect */
.glitch-active {
    animation: glitch-anim 0.2s infinite;
    filter: invert(1) hue-rotate(180deg);
}

@keyframes glitch-anim {
    0% {
        transform: translate(0)
    }

    20% {
        transform: translate(-5px, 5px) skewX(10deg)
    }

    40% {
        transform: translate(-5px, -5px) skewY(10deg)
    }

    60% {
        transform: translate(5px, 5px) skewX(-10deg)
    }

    80% {
        transform: translate(5px, -5px) skewY(-10deg)
    }

    100% {
        transform: translate(0)
    }
}