:root {
    --bg-color: #050510;
    --primary-color: #00f3ff;
    /* Cyan */
    --secondary-color: #bc13fe;
    /* Purple */
    --accent-color: #ff0055;
    /* Red/Pink */
    --text-color: #e0e0e0;
    --ui-bg: rgba(5, 5, 16, 0.92);
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Noto Sans SC', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
    font-family: var(--font-body);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* CRT Scanline Effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0),
            rgba(255, 255, 255, 0) 50%,
            rgba(0, 0, 0, 0.2) 50%,
            rgba(0, 0, 0, 0.2));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 100;
    animation: scrollScanlines 10s linear infinite;
}

@keyframes scrollScanlines {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100%;
    }
}

#game-container {
    position: relative;
    width: 900px;
    height: 650px;
    background-color: var(--bg-color);
    box-shadow:
        0 0 20px var(--primary-color),
        0 0 50px rgba(0, 243, 255, 0.2);
    border: 1px solid var(--primary-color);
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(10, 10, 20, 0.9) 0%, rgba(0, 0, 0, 0.98) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    pointer-events: auto;
    transition: opacity 0.5s ease, filter 0.5s ease;
    backdrop-filter: blur(5px);
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    filter: blur(20px);
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    filter: blur(0);
}

/* Typography & Glitch */
.glitch-wrapper {
    position: relative;
    margin-bottom: 40px;
}

.glitch {
    font-family: var(--font-heading);
    font-size: 64px;
    font-weight: 900;
    color: var(--text-color);
    position: relative;
    text-shadow: 2px 2px var(--accent-color), -2px -2px var(--primary-color);
}

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

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 var(--accent-color);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--primary-color);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(10px, 9999px, 30px, 0);
    }

    20% {
        clip: rect(80px, 9999px, 100px, 0);
    }

    40% {
        clip: rect(10px, 9999px, 110px, 0);
    }

    60% {
        clip: rect(60px, 9999px, 40px, 0);
    }

    80% {
        clip: rect(100px, 9999px, 60px, 0);
    }

    100% {
        clip: rect(30px, 9999px, 80px, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(40px, 9999px, 10px, 0);
    }

    20% {
        clip: rect(10px, 9999px, 50px, 0);
    }

    40% {
        clip: rect(80px, 9999px, 30px, 0);
    }

    60% {
        clip: rect(30px, 9999px, 80px, 0);
    }

    80% {
        clip: rect(50px, 9999px, 100px, 0);
    }

    100% {
        clip: rect(10px, 9999px, 40px, 0);
    }
}

.mission-brief {
    font-size: 18px;
    color: var(--primary-color);
    letter-spacing: 2px;
    margin-bottom: 50px;
    border-left: 3px solid var(--primary-color);
    padding-left: 15px;
}

/* Cyber Button */
.cyber-btn {
    position: relative;
    padding: 20px 40px;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-size: 20px;
    letter-spacing: 2px;
    cursor: pointer;
    overflow: hidden;
    transition: 0.3s;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.cyber-btn:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 30px var(--primary-color);
}

.cyber-btn.secondary {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.2);
}

.cyber-btn.secondary:hover {
    background: var(--accent-color);
    color: #000;
    box-shadow: 0 0 30px var(--accent-color);
}

/* Controls */
.controls {
    margin-top: 60px;
    text-align: center;
    color: #888;
}

.key-group {
    margin-bottom: 10px;
}

.key {
    display: inline-block;
    border: 1px solid #888;
    padding: 5px 10px;
    margin: 0 2px;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 14px;
    color: var(--text-color);
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    font-family: var(--font-heading);
}

#hud.hidden {
    display: none;
}

.shards-counter {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 20px;
    text-shadow: 0 0 10px var(--primary-color);
}

.progress-bar {
    width: 200px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--primary-color);
    position: relative;
}

.progress-bar .fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 10px var(--primary-color);
}

/* Reveal Screen */
.cyber-frame {
    position: relative;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    display: inline-block;
}

.frame-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--secondary-color);
    transition: 0.3s;
}

.frame-corner.top-left {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.frame-corner.top-right {
    top: -2px;
    right: -2px;
    border-left: none;
    border-bottom: none;
}

.frame-corner.bottom-left {
    bottom: -2px;
    left: -2px;
    border-right: none;
    border-top: none;
}

.frame-corner.bottom-right {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.cyber-frame:hover .frame-corner {
    width: 30px;
    height: 30px;
    border-color: var(--primary-color);
}

#artifact-image {
    max-width: 100%;
    max-height: 350px;
    display: block;
    filter: sepia(20%) hue-rotate(180deg) saturate(150%);
    transition: 1s;
}

#artifact-image:hover {
    filter: none;
}

.neon-text {
    color: var(--secondary-color);
    text-shadow: 0 0 10px var(--secondary-color), 0 0 20px var(--secondary-color);
    font-family: var(--font-heading);
    margin-bottom: 20px;
    font-size: 32px;
}

.typing-effect {
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 30px;
    text-align: left;
    display: inline-block;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-left: 2px solid var(--secondary-color);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        border: none;
    }
}