/* =========================================
   ENIGMA // CRT TERMINAL
   ========================================= */

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}

body {
    color: #00ff66;
    font-family: "Courier New", Courier, monospace;
    font-size: 15px;
}


/* =========================================
   CRT CONTAINER
   ========================================= */

#crt {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;

    box-shadow:
        inset 0 0 120px rgba(0, 0, 0, 0.95);
}


/* =========================================
   TERMINAL
   ========================================= */

#terminal {
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    box-sizing: border-box;

    padding: 28px 34px 80px;

    overflow-y: auto;
    overflow-x: hidden;

    background: #000;
    color: #00ff66;

    font-family: "Courier New", Courier, monospace;
    line-height: 1.5;

    scrollbar-width: thin;
    scrollbar-color: #00ff66 #000;
}


/* =========================================
   TERMINAL OUTPUT
   ========================================= */

#terminal-output {
    width: 100%;
    box-sizing: border-box;

    white-space: pre-wrap;
    word-wrap: break-word;
}


/* =========================================
   LINES
   ========================================= */

.line {
    width: 100%;
    min-height: 1.5em;

    white-space: pre-wrap;
    word-break: break-word;
}

.system,
.warning,
.edward {
    color: #00ff66;
}


/* =========================================
   COMMAND INPUT
   ========================================= */

#command-form {
    position: sticky;
    bottom: 0;

    z-index: 20;

    display: flex;
    align-items: center;

    width: 100%;
    box-sizing: border-box;

    padding-top: 10px;

    background: #000;
    color: #00ff66;

    font-family: "Courier New", Courier, monospace;
}

.prompt {
    flex: 0 0 auto;

    color: #00ff66;
    white-space: nowrap;
    user-select: none;
}

#command-input {
    flex: 1 1 auto;

    min-width: 0;
    width: 100%;

    margin: 0;
    padding: 0;

    border: 0;
    outline: 0;

    background: transparent;

    color: #00ff66;

    font-family: "Courier New", Courier, monospace;
    font-size: 15px;
    line-height: 1.5;

    caret-color: #00ff66;
}

#command-input::selection {
    background: #00ff66;
    color: #000;
}

#command-input:focus {
    outline: none;
}


/* =========================================
   COMMAND CURSOR
   ========================================= */

#command-cursor {
    display: inline-block;

    width: 8px;
    height: 1.15em;

    margin-left: 2px;

    background: #00ff66;

    animation: cursorBlink 0.8s steps(1) infinite;
}

.typing-cursor {
    display: inline-block;

    margin-left: 2px;

    color: #00ff66;

    animation: cursorBlink 0.8s steps(1) infinite;
}

@keyframes cursorBlink {
    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}


/* =========================================
   CRT SCANLINES
   ========================================= */

#crt::after {
    content: "";

    position: fixed;
    inset: 0;

    pointer-events: none;

    z-index: 100;

    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0, 255, 102, 0.025) 0px,
            rgba(0, 255, 102, 0.025) 1px,
            transparent 1px,
            transparent 4px
        );
}


/* =========================================
   CRT NOISE
   ========================================= */

#crt::before {
    content: "";

    position: fixed;
    inset: 0;

    pointer-events: none;

    z-index: 101;

    opacity: 0.035;

    background:
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.08) 0px,
            rgba(255, 255, 255, 0.02) 1px,
            transparent 1px,
            transparent 3px
        );

    animation: noiseFlicker 0.12s steps(2) infinite;
}


/* =========================================
   NOISE FLICKER
   ========================================= */

@keyframes noiseFlicker {
    0% {
        opacity: 0.025;
        transform: translate(0, 0);
    }

    25% {
        opacity: 0.04;
        transform: translate(-1px, 1px);
    }

    50% {
        opacity: 0.03;
        transform: translate(1px, -1px);
    }

    75% {
        opacity: 0.045;
        transform: translate(-1px, 0);
    }

    100% {
        opacity: 0.025;
        transform: translate(0, 1px);
    }
}


/* =========================================
   GLITCH
   ========================================= */

.glitch {
    animation: glitchShake 0.08s infinite;
}

@keyframes glitchShake {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(1px, -1px);
    }

    50% {
        transform: translate(-1px, 1px);
    }

    75% {
        transform: translate(1px, 1px);
    }

    100% {
        transform: translate(0, 0);
    }
}


/* =========================================
   SCROLLBAR
   ========================================= */

#terminal::-webkit-scrollbar {
    width: 8px;
}

#terminal::-webkit-scrollbar-track {
    background: #000;
}

#terminal::-webkit-scrollbar-thumb {
    background: #00ff66;
}

#terminal::-webkit-scrollbar-thumb:hover {
    background: #33ff88;
}


/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 600px) {
    #terminal {
        padding: 20px 18px 70px;
    }

    body {
        font-size: 13px;
    }

    #command-input {
        font-size: 13px;
    }
}