:root {
    --bg-color: #ffffff;
    --text-color: #4e342e;
    --dim-color: #a1887f;
    --cursor-color: #4e342e;
    --glitch-color: #d84315;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: "Courier New", Courier, monospace;
    font-size: 1rem;
    line-height: 1.4;
    margin: 0;
    padding: 1.25rem;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

#terminal {
    max-width: 50rem;
    margin: 0 auto;
    margin-top: 5vh; /* Added margin to push content down */
    position: relative;
    z-index: 1;
    white-space: pre-wrap;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed var(--dim-color);
    transition: all 0.2s;
}

a:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    text-shadow: none;
}

.cursor {
    display: inline-block;
    width: 0.625rem;
    height: 1em;
    background-color: var(--cursor-color);
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

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

.glitch {
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { text-shadow: -2px 0 var(--glitch-color); }
    2% { text-shadow: 2px 0 red; }
    4% { text-shadow: none; }
    100% { text-shadow: none; }
}

.video-glitch {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: none;
    opacity: 1;
}

@keyframes violent-flash {
    0% { background: #ff0000; transform: translate(5px, -5px); clip-path: inset(10% 0 80% 0); }
    10% { background: #00ff00; transform: translate(-5px, 5px); clip-path: inset(80% 0 5% 0); }
    20% { background: #0000ff; transform: translate(10px, 10px); clip-path: inset(40% 0 40% 0); }
    30% { background: #ffff00; transform: translate(-10px, -10px); clip-path: inset(0 0 0 0); }
    40% { background: #ff00ff; transform: translate(0, 0); clip-path: inset(50% 0 10% 0); }
    50% { background: #00ffff; transform: scale(1.1); clip-path: inset(0 0 0 0); }
    60% { background: #ffffff; filter: invert(1); }
    70% { background: #000000; }
    80% { background: #ff0000; transform: translate(5px, 0); }
    90% { background: #00ff00; transform: translate(0, 5px); }
    100% { background: #0000ff; }
}

@keyframes noise-end {
    0% { background: #fff; clip-path: inset(0 0 0 0); transform: scale(1.05); }
    20% { background: #000; clip-path: inset(20% 0 50% 0); transform: translate(-10px, 0); }
    40% { background: #f0f; clip-path: inset(0 0 0 0); transform: translate(10px, 0); }
    60% { background: #0ff; clip-path: inset(50% 0 10% 0); transform: scale(1.1); }
    80% { background: #fff; clip-path: inset(0 0 0 0); }
    100% { background: #000; clip-path: inset(0 0 0 0); }
}

.video-glitch.active {
    display: block;
    animation: violent-flash 0.15s steps(2) infinite;
}

.video-glitch.final {
    display: block;
    opacity: 1;
    background: #000;
    z-index: 20000;
    animation: noise-end 0.2s steps(4) forwards;
}

#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out;
}

#intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease-in;
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

.hidden {
    display: none;
}

.input-line {
    display: flex;
    margin-top: 1rem;
}

.prompt {
    color: var(--dim-color);
    margin-right: 0.5rem;
}

.lang-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    border: 1px solid var(--text-color);
    padding: 0.3125rem 0.625rem;
    cursor: pointer;
    font-family: inherit;
    background: transparent;
    color: var(--text-color);
    z-index: 10;
    transition: background-color 0.2s, color 0.2s;
}

.lang-toggle:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

.lang-toggle:focus {
    outline: 2px solid var(--glitch-color);
    outline-offset: 2px;
}
