:root {
    --bg: #0D0D1A;
    --green: #39FF14;
    --dim-green: #1A8A0E;
    --pink: #FF6EC7;
    --cyan: #00FFFF;
    --amber: #FFB800;
    --red: #FF3333;
}

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

body {
    background-color: var(--bg);
    color: var(--green);
    font-family: 'VT323', monospace;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* Scan lines */
.scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0,0,0,0.1) 2px,
        rgba(0,0,0,0.1) 4px
    );
}

/* Glitch bars */
.glitch-bar {
    position: fixed;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 998;
    pointer-events: none;
    opacity: 0;
}

.glitch-bar-1 {
    top: 30%;
    background-color: var(--pink);
    animation: glitch-flash-1 12s linear infinite;
}

.glitch-bar-2 {
    top: 70%;
    background-color: var(--cyan);
    animation: glitch-flash-2 15s linear infinite;
}

@keyframes glitch-flash-1 {
    0%, 69%, 71%, 100% { opacity: 0; }
    70% { opacity: 0.3; }
}

@keyframes glitch-flash-2 {
    0%, 44%, 46%, 100% { opacity: 0; }
    45% { opacity: 0.3; }
}

/* HUD */
.hud {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background-color: rgba(13,13,26,0.9);
    border-top: 1px solid var(--dim-green);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 100;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--green);
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.health-bar {
    display: inline-block;
    width: 80px;
    height: 10px;
    border: 1px solid var(--green);
    position: relative;
}

.health-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--green));
}

.blink-cursor {
    display: inline-block;
    width: 10px;
    height: 16px;
    background-color: var(--green);
    animation: blink 1s step-start infinite;
}

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

/* Quest container - horizontal scroll */
.quest-container {
    display: flex;
    flex-wrap: nowrap;
    height: calc(100vh - 64px);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

/* Room panels */
.room {
    min-width: 100vw;
    height: calc(100vh - 64px);
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* Terminal windows */
.terminal {
    max-width: 700px;
    width: 100%;
    max-height: calc(100vh - 144px);
    overflow-y: auto;
    border: 1px solid var(--dim-green);
}

.terminal-bar {
    height: 24px;
    background-color: rgba(26,138,14,0.15);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 6px;
}

.term-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.term-title {
    font-family: 'VT323', monospace;
    font-size: 12px;
    color: var(--dim-green);
    margin-left: auto;
    margin-right: auto;
}

.terminal-body {
    padding: 24px;
}

/* Room titles */
.room-title {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 20px;
    text-shadow: 0 0 8px rgba(57,255,20,0.3);
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--green);
    animation: typewriter 2s steps(40) 0.5s forwards, cursor-blink 0.8s step-end 3 forwards;
    width: 0;
}

@keyframes typewriter {
    to { width: 100%; }
}

@keyframes cursor-blink {
    0%, 100% { border-color: var(--green); }
    50% { border-color: transparent; }
}

/* Phosphor glow on text */
.room-text {
    font-family: 'VT323', monospace;
    font-size: 18px;
    line-height: 1.6;
    color: var(--green);
    text-shadow: 0 0 8px rgba(57,255,20,0.3);
    margin-bottom: 16px;
    animation: phosphor-pulse 3s ease-in-out infinite;
}

@keyframes phosphor-pulse {
    0%, 100% { text-shadow: 0 0 6px rgba(57,255,20,0.25); }
    50% { text-shadow: 0 0 10px rgba(57,255,20,0.4); }
}

.text-cyan {
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(0,255,255,0.3);
    font-size: 22px;
}

/* Choices */
.room-choice {
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: var(--cyan);
    margin-bottom: 8px;
    cursor: default;
}

.final-prompt {
    font-size: 24px;
    margin-top: 20px;
    color: var(--green);
}

/* System messages */
.sys-msg {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--dim-green);
    margin-bottom: 12px;
}

.sys-warn { color: var(--amber); }
.sys-dim { color: var(--dim-green); }
.sys-pink { color: var(--pink); }
.sys-amber { color: var(--amber); }
.sys-red { color: var(--red); }
.sys-green { color: var(--green); }

/* ASCII art */
.ascii-art {
    font-family: 'VT323', monospace;
    font-size: 14px;
    line-height: 1.2;
    margin: 20px 0;
    white-space: pre;
}

.ascii-green { color: var(--green); }
.ascii-amber { color: var(--amber); }
.ascii-red { color: var(--red); }
.ascii-pink { color: var(--pink); }

/* Mobile */
@media (max-width: 768px) {
    .hud {
        font-size: 11px;
        padding: 0 12px;
        height: 48px;
    }

    .health-bar {
        width: 50px;
    }

    .quest-container {
        height: calc(100vh - 48px);
    }

    .room {
        height: calc(100vh - 48px);
        padding: 20px;
    }

    .terminal-body {
        padding: 16px;
    }

    .room-title {
        font-size: clamp(0.6rem, 2.5vw, 0.9rem);
    }

    .ascii-art {
        font-size: 10px;
    }
}
