:root {
    --bg-color: #0a0a0a;
    --term-green: #ffffff;
    --term-glow: #ffffff80;
    --scan-color: rgba(0, 0, 0, 0.5);
    --font-main: 'VT323', 'Courier New', monospace;
}

@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

html {
    background-color: var(--bg-color);
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--term-green);
    font-family: var(--font-main);
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    min-height: 100dvh;
    /* Mobile viewport fix */
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    font-size: 1.2rem;
    position: relative;
    -webkit-font-smoothing: antialiased;
    /* Crisper text on mobile */
}

/* CRT Effects */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 100%),
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 10;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    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;
    z-index: 11;
    pointer-events: none;
    animation: scroll 10s linear infinite;
}

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

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

.terminal-container {
    width: 80%;
    max-width: 800px;
    margin-top: 50px;
    position: relative;
    z-index: 5;
    text-shadow: 0 0 5px var(--term-glow);
}

#output {
    white-space: pre-wrap;
    margin-bottom: 10px;
}

.input-line {
    display: flex;
    align-items: center;
}

.prompt {
    margin-right: 10px;
}

#command-input {
    background: transparent;
    border: none;
    color: var(--term-green);
    font-family: var(--font-main);
    font-size: inherit;
    width: 100%;
    outline: none;
    text-shadow: 0 0 5px var(--term-glow);
    text-transform: uppercase;
    caret-color: transparent;
    /* Custom cursor used instead */
}

/* Blinking Cursor */
.cursor {
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Flicker Animation for Body */
body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% {
        opacity: 0.027906013306899137;
    }

    5% {
        opacity: 0.04899554030752528;
    }

    10% {
        opacity: 0.04604907142491185;
    }

    15% {
        opacity: 0.07664654522927038;
    }

    20% {
        opacity: 0.04419827083906478;
    }

    25% {
        opacity: 0.027581135249488346;
    }

    30% {
        opacity: 0.02700373038676602;
    }

    35% {
        opacity: 0.07844078174441011;
    }

    40% {
        opacity: 0.0202722080479155;
    }

    45% {
        opacity: 0.02641774880529457;
    }

    50% {
        opacity: 0.08343729961129994;
    }

    55% {
        opacity: 0.05318182559529329;
    }

    60% {
        opacity: 0.042561571285329864;
    }

    65% {
        opacity: 0.08906352938096277;
    }

    70% {
        opacity: 0.043642398606543596;
    }

    75% {
        opacity: 0.057790757209705906;
    }

    80% {
        opacity: 0.07340156934893708;
    }

    85% {
        opacity: 0.038753265541819616;
    }

    90% {
        opacity: 0.07063628286950266;
    }

    95% {
        opacity: 0.026939527586548773;
    }

    100% {
        opacity: 0.055966601267425484;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .terminal-container {
        width: 95%;
        font-size: 1rem;
        margin-top: 20px;
    }

    /* Prevent iOS zoom on focus */
    input[type="text"] {
        font-size: 16px;
    }
}

/* Gallery Link Style */
.gallery-link {
    color: var(--term-green);
    text-decoration: none;
    border: 1px solid var(--term-green);
    padding: 5px 10px;
    display: inline-block;
    margin-top: 10px;
    transition: all 0.3s;
    cursor: pointer;
    font-family: var(--font-main);
}

.gallery-link:hover {
    background: var(--term-green);
    color: var(--bg-color);
    box-shadow: 0 0 15px var(--term-glow);
}

/* Password Box */
.password-box-container {
    display: none;
    margin-top: 20px;
    border: 2px solid var(--term-green);
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 20px var(--term-glow);
    animation: slideIn 0.5s ease-out;
    max-width: 400px;
}

.password-box-label {
    display: block;
    margin-bottom: 15px;
    letter-spacing: 2px;
    text-align: center;
}

#password-box-input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--term-green);
    color: var(--term-green);
    font-family: var(--font-main);
    font-size: 1.5rem;
    padding: 10px;
    outline: none;
    text-align: center;
    box-sizing: border-box;
    text-shadow: 0 0 5px var(--term-glow);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}