html,
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    background-image: url("./girl.gif");
    background-repeat: repeat;
    background-position: 0 0;
    background-size: auto;
    font: 16px Courier;
}

#cmd {
    width: calc(100% - 20px);
    height: calc(100% - 60px);
    margin: 0;
    padding: 10px;
    color: #eee;
}

.devil {
    color: #0e0;
}

.home-cursor {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 2px;
    background: #eee;
    vertical-align: -0.12em;
    box-shadow: 0 0 4px rgba(255,255,255,0.55);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

#terminal-launcher {
    position: fixed;
    right: 12px;
    bottom: 10px;
    z-index: 20;
    border: 0;
    padding: 5px 7px;
    background: rgba(0,0,0,0.34);
    color: rgba(238,238,238,0.58);
    font: 15px Courier;
    cursor: pointer;
    opacity: 0.58;
    transition: opacity 120ms ease, color 120ms ease, background 120ms ease;
}

#terminal-launcher:hover,
#terminal-launcher:focus-visible {
    opacity: 1;
    color: #0e0;
    background: rgba(0,0,0,0.72);
    outline: 1px solid rgba(0,238,0,0.45);
}

#terminal-overlay[hidden] {
    display: none;
}

#terminal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
    background: rgba(0,0,0,0.74);
}

#terminal-window {
    position: relative;
    width: min(880px, calc(100vw - 36px));
    height: min(620px, calc(100vh - 36px));
    overflow: hidden;
    border: 1px solid rgba(0,238,0,0.42);
    background: rgba(1,5,2,0.97);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.035), 0 0 42px rgba(0,0,0,0.9), 0 0 24px rgba(0,238,0,0.10);
    color: #eee;
}

#terminal-bar {
    position: relative;
    z-index: 8;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    padding-left: 10px;
    border-bottom: 1px solid rgba(0,238,0,0.23);
    background: #070a07;
    color: rgba(238,238,238,0.62);
    font-size: 13px;
}

#terminal-close {
    width: 38px;
    height: 31px;
    border: 0;
    background: transparent;
    color: rgba(238,238,238,0.62);
    font: 20px Courier;
    cursor: pointer;
}

#terminal-close:hover,
#terminal-close:focus-visible {
    color: #ff4444;
    background: rgba(255,0,0,0.10);
    outline: none;
}

#terminal {
    position: relative;
    z-index: 4;
    width: 100%;
    height: calc(100% - 32px);
    box-sizing: border-box;
    padding: 14px;
    overflow: hidden;
    text-shadow: none;
}

#output {
    height: calc(100% - 38px);
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: none;
}

#output::-webkit-scrollbar {
    display: none;
}

.line {
    min-height: 1.45em;
}

.line.dim {
    opacity: 0.62;
}

.line.red {
    color: #ff3232;
    text-shadow: 0 0 7px rgba(255,0,0,0.65);
}

.line.green,
.prompt-mark {
    color: #0e0;
    text-shadow: 0 0 7px rgba(0,255,0,0.55);
}

.line.blue {
    color: #5ea7ff;
}

.line.big {
    font-size: 1.35em;
    letter-spacing: 0.08em;
}

#prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    margin-top: 4px;
    cursor: text;
}

#prompt[hidden] {
    display: none;
}

#command {
    flex: 1;
    min-width: 0;
    height: 30px;
    border: 0;
    outline: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    color: #eee;
    caret-color: #0e0;
    font: inherit;
    text-shadow: 0 0 5px rgba(255,255,255,0.25);
}

.terminal-scanlines {
    position: absolute;
    inset: 32px 0 0;
    z-index: 6;
    pointer-events: none;
    opacity: 0.10;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,0.035) 0,
        rgba(255,255,255,0.035) 1px,
        transparent 1px,
        transparent 4px
    );
}

.terminal-vignette {
    position: absolute;
    inset: 32px 0 0;
    z-index: 5;
    pointer-events: none;
    box-shadow: inset 0 0 100px 24px rgba(0,0,0,0.60);
}

#matrix {
    position: absolute;
    inset: 32px 0 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 220ms ease;
}

#matrix.on {
    opacity: 0.32;
}

.matrix-column {
    position: absolute;
    top: -120vh;
    width: 18px;
    color: #0e0;
    font-size: 14px;
    line-height: 1.05;
    white-space: pre-line;
    text-align: center;
    text-shadow: 0 0 8px rgba(0,255,0,0.7);
    animation: matrixFall linear infinite;
}

@keyframes matrixFall {
    from { transform: translateY(0); }
    to { transform: translateY(240vh); }
}

#secret-hotspot {
    position: absolute;
    top: 0;
    left: 48%;
    z-index: 20;
    width: 34px;
    height: 31px;
    padding: 0;
    border: 0;
    background: transparent;
    opacity: 0;
    cursor: default;
}

#jumpscare,
#crash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #000;
    color: #fff;
}

#jumpscare.show,
#crash.show {
    display: flex;
}

#jumpscare {
    background: radial-gradient(circle at center, #330000 0%, #090000 48%, #000 100%);
}

.face {
    position: relative;
    width: min(64vw, 460px);
    height: min(42vw, 300px);
    filter: drop-shadow(0 0 22px rgba(255,0,0,0.5));
    transform: scale(1.08);
}

.eye {
    position: absolute;
    top: 31%;
    width: 28%;
    height: 11%;
    background: #f4f4f4;
    box-shadow: 0 0 30px rgba(255,255,255,0.85);
    transform: skewY(-8deg);
}

.left-eye { left: 10%; }
.right-eye { right: 10%; transform: skewY(8deg); }

.mouth {
    position: absolute;
    left: 50%;
    bottom: 12%;
    width: 48%;
    height: 28%;
    border: 8px solid #f4f4f4;
    border-top: 0;
    border-radius: 0 0 50% 50%;
    transform: translateX(-50%);
    box-shadow: 0 8px 28px rgba(255,255,255,0.35);
}

.scare-text {
    margin-top: 12px;
    font-size: clamp(18px, 3vw, 42px);
    letter-spacing: 0.35em;
    color: #ff2b2b;
    text-shadow: 0 0 16px rgba(255,0,0,0.9);
}

#crash {
    font-size: clamp(18px, 2.5vw, 34px);
    letter-spacing: 0.16em;
}

#crash-sub {
    margin-top: 22px;
    font-size: 14px;
    letter-spacing: 0.08em;
    opacity: 0.55;
}

body.glitch #terminal-window {
    animation: terminalGlitch 170ms steps(2, end) 3;
}

body.red-flash::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
    background: rgba(255,0,0,0.32);
}

@keyframes terminalGlitch {
    0% { transform: translate(0, 0); filter: none; }
    33% { transform: translate(-3px, 2px); filter: contrast(1.7) hue-rotate(18deg); }
    66% { transform: translate(3px, -1px); filter: contrast(1.4) hue-rotate(-18deg); }
    100% { transform: translate(0, 0); filter: none; }
}

.error-page {
    position: relative;
    z-index: 4;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    box-sizing: border-box;
    padding: 24px;
    text-align: center;
    color: #eee;
}

.error-page .code {
    color: #0e0;
    font-size: clamp(52px, 12vw, 150px);
    line-height: 1;
    text-shadow: 0 0 18px rgba(0,255,0,0.6);
}

.error-page .message {
    margin-top: 18px;
    font-size: clamp(14px, 2vw, 22px);
}

.error-page .returning {
    margin-top: 16px;
    opacity: 0.55;
}

@media (max-width: 600px) {
    #terminal-overlay {
        padding: 8px;
    }

    #terminal-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
    }

    #terminal {
        padding: 10px;
        font-size: 14px;
    }

    .scare-text {
        letter-spacing: 0.14em;
    }
}

@media (prefers-reduced-motion: reduce) {
    #matrix,
    body.glitch #terminal-window {
        animation: none !important;
    }
}

@media (max-width: 600px) {
    html,
    body {
        background-size: 50% auto;
        background-repeat: repeat;
        background-position: 0 26px;
    }
}
