@import url('https://fonts.googleapis.com/css2?family=Anonymous+Pro:wght@400;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    background-color: #000;
    color: #00ff41;
    font-family: 'Anonymous Pro', 'Courier New', monospace;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    position: relative;
}

/* CRT screen effect container */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 10;
}

/* Scanline effect */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 100%;
    }
}

#terminal {
    font-size: 1.2em;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    padding: 20px;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.5);
    position: relative;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% {
        opacity: 0.97;
    }
    5% {
        opacity: 1;
    }
    10% {
        opacity: 0.98;
    }
    15% {
        opacity: 0.99;
    }
    20% {
        opacity: 0.97;
    }
    25% {
        opacity: 1;
    }
    30% {
        opacity: 0.98;
    }
    35% {
        opacity: 0.99;
    }
    40% {
        opacity: 1;
    }
    45% {
        opacity: 0.98;
    }
    50% {
        opacity: 0.97;
    }
    55% {
        opacity: 1;
    }
    60% {
        opacity: 0.99;
    }
    65% {
        opacity: 0.98;
    }
    70% {
        opacity: 1;
    }
    75% {
        opacity: 0.97;
    }
    80% {
        opacity: 0.99;
    }
    85% {
        opacity: 1;
    }
    90% {
        opacity: 0.98;
    }
    95% {
        opacity: 0.99;
    }
    100% {
        opacity: 0.97;
    }
}

.prompt {
    color: #00ff41;
    font-weight: bold;
    margin-right: 5px;
}

.cursor {
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

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

#input-line {
    display: flex;
}

#user-input {
    color: #00ff41;
}

.output {
    color: #00ff41;
    white-space: pre-wrap;
    margin: 5px 0;
}

.error {
    color: #ff0000;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

.warning {
    color: #ffff00;
    text-shadow: 0 0 5px rgba(255, 255, 0, 0.5);
}

.command-line {
    display: flex;
    margin: 5px 0;
}

#keyboard-input {
    position: fixed;
    left: 0;
    top: 0;
    opacity: 0;
    width: 0;
    height: 0;
    border: none;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

/* Glitch effect */
.glitch {
    position: relative;
    animation: glitch 1s linear infinite;
}

@keyframes glitch {
    2%, 64% {
        transform: translate(2px, 0) skew(0deg);
    }
    4%, 60% {
        transform: translate(-2px, 0) skew(0deg);
    }
    62% {
        transform: translate(0, 0) skew(5deg);
    }
}

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

.glitch:before {
    left: 2px;
    text-shadow: -2px 0 #ff00de;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch:after {
    left: -2px;
    text-shadow: -2px 0 #00fff9, 2px 2px #ff00de;
    animation: glitch-anim2 1s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(10px, 9999px, 31px, 0);
    }
    20% {
        clip: rect(70px, 9999px, 71px, 0);
    }
    40% {
        clip: rect(60px, 9999px, 25px, 0);
    }
    60% {
        clip: rect(86px, 9999px, 42px, 0);
    }
    80% {
        clip: rect(45px, 9999px, 98px, 0);
    }
    100% {
        clip: rect(61px, 9999px, 29px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(65px, 9999px, 100px, 0);
    }
    20% {
        clip: rect(52px, 9999px, 74px, 0);
    }
    40% {
        clip: rect(79px, 9999px, 85px, 0);
    }
    60% {
        clip: rect(39px, 9999px, 45px, 0);
    }
    80% {
        clip: rect(28px, 9999px, 60px, 0);
    }
    100% {
        clip: rect(71px, 9999px, 32px, 0);
    }
}
