:root {
    --primary-color: #ffffff;
    --accent-color: #00ffff;
    --bg-color: #000000;
    --glow-intensity: 2;
    --animation-speed: 1;
    --font-family: 'Tilt Neon', sans-serif;
    --font-family-fallback: 'Courier New', monospace;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-color);
    font-family: var(--font-family);
    color: var(--primary-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.content-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    animation: fadeInOnly 2s ease-out;
    -webkit-user-select: none;
    user-select: none;
    will-change: opacity;
}

@keyframes fadeInOnly {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.site-title {
    font-size: clamp(2rem, 10vw, 6rem);
    font-weight: 700;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.3),
        0 0 20px rgba(255, 255, 255, 0.15),
        0 0 30px rgba(0, 255, 255, 0.1);
    animation: pulse 4s ease-in-out infinite;
    -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.1);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch:hover::before {
    animation: glitch-1 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    opacity: 0.8;
}

.glitch:hover::after {
    animation: glitch-2 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
    opacity: 0.8;
}

@keyframes glitch-1 {
    0% {
        clip-path: inset(40% 0 60% 0);
        transform: translate(-2px, -2px);
        text-shadow: 2px 0 #ff00ff;
    }
    20% {
        clip-path: inset(90% 0 10% 0);
        transform: translate(2px, 2px);
    }
    40% {
        clip-path: inset(10% 0 90% 0);
        transform: translate(-2px, 2px);
        text-shadow: -2px 0 #00ffff;
    }
    60% {
        clip-path: inset(60% 0 40% 0);
        transform: translate(2px, -2px);
    }
    80% {
        clip-path: inset(30% 0 70% 0);
        transform: translate(-2px, -2px);
    }
    100% {
        clip-path: inset(80% 0 20% 0);
        transform: translate(2px, 2px);
    }
}

@keyframes glitch-2 {
    0% {
        clip-path: inset(80% 0 20% 0);
        transform: translate(2px, 2px);
        text-shadow: -2px 0 #00ff00;
    }
    100% {
        clip-path: inset(20% 0 80% 0);
        transform: translate(-2px, -2px);
    }
}


.controls-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    opacity: 0.5;
    text-align: center;
    z-index: 10;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.controls-hint:hover {
    opacity: 0.8;
}

.desktop-hint {
    display: none;
}

.mobile-hint {
    display: block;
}

@media (min-width: 768px) {
    .desktop-hint {
        display: block;
    }
    .mobile-hint {
        display: none;
    }
}


.fps-counter {
    position: fixed;
    top: 20px;
    left: 20px;
    font-size: 0.75rem;
    font-family: var(--font-family-fallback);
    color: rgba(255, 255, 255, 0.5);
    z-index: 100;
    display: none;
}

.fps-counter.visible {
    display: block;
}

.fallback-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 2rem;
}

@media (max-width: 767px) {
    .controls-hint {
        bottom: 10px;
        font-size: 0.65rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .site-title {
        font-size: clamp(1.5rem, 8vw, 4rem);
    }
    
    .content-overlay {
        top: 40%;
    }
}

#gui {
    z-index: 1000 !important;
}

.dg.ac {
    z-index: 1000 !important;
}