/* The original snicker-snack CRT one-pager, extracted verbatim from
   the static index.html <style> block, plus the .enter-link addition
   at the bottom. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: "Press Start 2P", monospace;
    overflow: hidden;
    cursor: none;
}

/* ============================================
   BOOT OVERLAY — CRT startup sequence
   ============================================ */
#boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #020202;
    pointer-events: none;
}

/* --- Phase 1: The beam sweeps down --- */
#boot-overlay .beam {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: #33ff33;
    box-shadow:
        0 0 4px #33ff33,
        0 0 12px #0f0,
        0 -20px 30px rgba(51, 255, 51, 0.1);
    top: -2px;
    transition: none;
}

#boot-overlay.warmup .beam {
    animation: beamSweep 1.2s ease-in forwards;
}

@keyframes beamSweep {
    0% {
        top: -2px;
    }
    100% {
        top: 105%;
        opacity: 0;
    }
}

/* Glow that trails behind the beam */
#boot-overlay .beam-glow {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
}

#boot-overlay.warmup .beam-glow {
    animation: beamGlow 1.2s ease-in forwards;
}

@keyframes beamGlow {
    0% {
        background: transparent;
    }
    50% {
        background: radial-gradient(
            ellipse at 50% 50%,
            transparent 50%,
            rgba(51, 255, 51, 0.02) 100%
        );
    }
    100% {
        background: transparent;
    }
}

/* --- Phase 2: scanlines snap on --- */
#boot-overlay .scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.15) 3px,
        rgba(0, 0, 0, 0.15) 6px
    );
    opacity: 0;
    transition: opacity 0.3s;
}

#boot-overlay.scanlines-on .scanlines {
    opacity: 1;
}

/* --- Phase 3: horizontal interference lines --- */
#boot-overlay .interference {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

#boot-overlay.interference-on .interference {
    opacity: 1;
    animation: interference 0.6s ease-out forwards;
}

@keyframes interference {
    0% {
        background: repeating-linear-gradient(
            0deg,
            transparent 0px,
            rgba(51, 255, 51, 0.08) 1px,
            transparent 2px,
            transparent 4px,
            rgba(51, 255, 51, 0.04) 5px,
            transparent 8px
        );
        transform: translateY(20px);
    }
    30% {
        background: repeating-linear-gradient(
            0deg,
            transparent 0px,
            rgba(51, 255, 51, 0.12) 1px,
            transparent 3px,
            transparent 7px,
            rgba(51, 255, 51, 0.06) 8px,
            transparent 14px
        );
        transform: translateY(-15px);
    }
    60% {
        background: repeating-linear-gradient(
            0deg,
            transparent 0px,
            rgba(51, 255, 51, 0.18) 2px,
            transparent 5px
        );
        transform: translateY(5px);
    }
    100% {
        background: repeating-linear-gradient(
            0deg,
            transparent 0px,
            rgba(51, 255, 51, 0.25) 1px,
            transparent 3px
        );
        transform: translateY(0);
    }
}

/* --- Phase 4: horizontal sync roll --- */
#boot-overlay .sync-roll {
    position: absolute;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(51, 255, 51, 0.06) 45%,
        rgba(51, 255, 51, 0.12) 50%,
        rgba(51, 255, 51, 0.06) 55%,
        transparent 100%
    );
    opacity: 0;
}

#boot-overlay.roll-on .sync-roll {
    animation: syncRoll 0.8s ease-out forwards;
}

@keyframes syncRoll {
    0% {
        top: -100%;
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

/* --- Phase 5: overlay fades out --- */
#boot-overlay.fade-out {
    animation: overlayFade 1.2s ease-out forwards;
}

@keyframes overlayFade {
    0% {
        opacity: 1;
    }
    40% {
        opacity: 0.9;
    }
    55% {
        opacity: 0.3;
    }
    70% {
        opacity: 0.6;
    }
    85% {
        opacity: 0.15;
    }
    100% {
        opacity: 0;
    }
}

/* ============================================
   MAIN CONTENT — hidden until boot finishes
   ============================================ */
.text-container {
    visibility: hidden;
}

body.ready .text-container {
    visibility: visible;
}

body.ready {
    cursor: default;
}

/* Permanent CRT scanlines */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.06) 2px,
        rgba(0, 0, 0, 0.06) 4px
    );
    pointer-events: none;
    z-index: 2;
}

/* Vignette */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.5) 100%
    );
    pointer-events: none;
    z-index: 1;
}

.text-container {
    position: relative;
    z-index: 0;
    text-align: center;
    padding: 2rem;
    animation: textFadeIn 2s ease-out 0.5s both;
}

@keyframes textFadeIn {
    0% {
        opacity: 0;
        filter: blur(4px);
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: scale(1);
    }
}

.retro-text {
    color: #33ff33;
    font-size: clamp(1rem, 3.5vw, 2.5rem);
    text-shadow:
        0 0 5px #33ff33,
        0 0 10px #33ff33,
        0 0 20px #33ff33,
        0 0 40px #0f0,
        0 0 80px #0f0;
    animation: flicker 4s infinite alternate;
    letter-spacing: 0.1em;
    line-height: 1.8;
}

@keyframes flicker {
    0%,
    19%,
    21%,
    23%,
    25%,
    54%,
    56%,
    100% {
        opacity: 1;
    }
    20%,
    24%,
    55% {
        opacity: 0.85;
    }
}

/* Blinking cursor */
.cursor {
    display: inline-block;
    width: 0.6em;
    height: 1em;
    background: #33ff33;
    margin-left: 0.2em;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
    box-shadow:
        0 0 5px #33ff33,
        0 0 10px #33ff33;
}

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

/* --- Addition for the portal: the way in --- */
.enter-link {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 3;
    visibility: hidden;
    color: #33ff33;
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-shadow:
        0 0 5px #33ff33,
        0 0 10px #33ff33;
}

body.ready .enter-link {
    visibility: visible;
    animation: textFadeIn 1s ease-out both;
}

.enter-link:hover {
    color: #b8ffb8;
}
