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

body {
    background-color: #000;
    color: #fff;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* Intro overlay */
#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.5s ease;
    overflow-y: auto;
}

#intro-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#code-display {
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
}

#code-display::after {
    content: '▮';
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Clickable human link */
.clickable-human {
    text-decoration: underline;
    cursor: pointer;
    color: #fff;
}

/* Black screen */
#black-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    z-index: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#black-screen.active {
    opacity: 1;
    pointer-events: all;
}

/* Matchstick video container */
#matchstick-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

#matchstick-container.active {
    opacity: 1;
    pointer-events: all;
}

#matchstick-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}

/* Intense glitch overlay */
#glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: 1100;
    pointer-events: none;
    opacity: 0;
}

#glitch-overlay.active {
    opacity: 1;
    animation: intenseGlitch 0.1s infinite;
}

@keyframes intenseGlitch {
    0% {
        background: linear-gradient(90deg, 
            rgba(255, 0, 0, 0.3) 0%, 
            transparent 10%, 
            transparent 90%, 
            rgba(0, 255, 0, 0.3) 100%);
        transform: translateX(0);
    }
    20% {
        background: linear-gradient(180deg, 
            rgba(0, 0, 255, 0.4) 0%, 
            transparent 20%, 
            transparent 80%, 
            rgba(255, 0, 255, 0.4) 100%);
        transform: translateX(-10px);
    }
    40% {
        background: linear-gradient(270deg, 
            rgba(0, 255, 255, 0.3) 0%, 
            transparent 30%, 
            transparent 70%, 
            rgba(255, 255, 0, 0.3) 100%);
        transform: translateX(10px);
    }
    60% {
        background: radial-gradient(circle, 
            rgba(255, 255, 255, 0.5) 0%, 
            transparent 50%);
        transform: translateY(-10px);
    }
    80% {
        background: linear-gradient(45deg, 
            rgba(255, 0, 0, 0.4) 0%, 
            rgba(0, 255, 0, 0.4) 50%, 
            rgba(0, 0, 255, 0.4) 100%);
        transform: translateY(10px);
    }
    100% {
        background: linear-gradient(315deg, 
            rgba(200, 200, 200, 0.5) 0%, 
            transparent 50%);
        transform: translateX(0);
    }
}

/* RGB Separation effect for glitch */
.rgb-glitch {
    animation: rgbSplit 0.05s infinite;
}

@keyframes rgbSplit {
    0% {
        filter: none;
    }
    33% {
        filter: drop-shadow(-5px 0 0 red) drop-shadow(5px 0 0 cyan);
    }
    66% {
        filter: drop-shadow(-3px 0 0 magenta) drop-shadow(3px 0 0 lime);
    }
    100% {
        filter: drop-shadow(2px 0 0 yellow) drop-shadow(-2px 0 0 blue);
    }
}

/* Screen flicker for glitch */
.screen-flicker {
    animation: flicker 0.05s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    25% { opacity: 0.3; }
    50% { opacity: 0.8; }
    75% { opacity: 0.5; }
}

/* Digital distortion */
.digital-distortion {
    animation: distort 0.1s infinite;
}

@keyframes distort {
    0%, 100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    10% {
        clip-path: inset(10% 0 85% 0);
        transform: translate(-8px, 5px);
    }
    20% {
        clip-path: inset(80% 0 0 0);
        transform: translate(8px, -5px);
    }
    30% {
        clip-path: inset(50% 0 30% 0);
        transform: translate(-6px, 8px);
    }
    40% {
        clip-path: inset(20% 0 60% 0);
        transform: translate(6px, -8px);
    }
    50% {
        clip-path: inset(60% 0 20% 0);
        transform: translate(10px, 3px);
    }
    60% {
        clip-path: inset(30% 0 50% 0);
        transform: translate(-10px, -3px);
    }
    70% {
        clip-path: inset(70% 0 10% 0);
        transform: translate(5px, 10px);
    }
    80% {
        clip-path: inset(15% 0 70% 0);
        transform: translate(-5px, -10px);
    }
    90% {
        clip-path: inset(40% 0 40% 0);
        transform: translate(7px, 7px);
    }
}

/* ASCII canvas */
#ascii-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease;
}

#ascii-canvas.active {
    display: block;
    opacity: 1;
}

/* Rewind button */
#rewind-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: transparent;
    border: none;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    text-decoration: underline;
}

#rewind-btn.visible {
    opacity: 1;
    pointer-events: all;
}

#rewind-btn:hover {
    opacity: 0.7;
}
