/* Global Variables and Reset */
:root {
    --primary-red: #ff0040;
    --terminal-green: #00ff41;
    --corruption-purple: #8a2be2;
    --warning-orange: #ff8c00;
    --void-black: #000000;
    --static-white: #ffffff;
    --error-red: #dc143c;
    --glitch-cyan: #00ffff;
    
    --font-mono: 'Courier New', monospace;
    --font-display: 'Arial Black', sans-serif;
}

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

body {
    font-family: var(--font-mono);
    background: var(--void-black);
    color: var(--terminal-green);
    overflow-x: hidden;
    overflow-y: auto;
    cursor: crosshair;
}

/* Game Container */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #001100 0%, #000000 100%);
}

/* Scanlines Effect */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.03) 2px,
        rgba(0, 255, 65, 0.03) 4px
    );
    z-index: 1000;
    animation: scanlines 0.1s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Glitch Overlay */
#glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    background: var(--primary-red);
    mix-blend-mode: multiply;
}

.glitch-active #glitch-overlay {
    animation: glitch-flash 0.1s ease-in-out;
}

@keyframes glitch-flash {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.3; }
}

/* Screen System */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.screen.active {
    display: flex;
}

/* Loading Screen */
#loading-screen {
    background: var(--void-black);
}

.terminal-text {
    text-align: center;
    font-size: 1.2rem;
}

.loading-bar {
    width: 300px;
    height: 20px;
    border: 2px solid var(--terminal-green);
    margin: 20px auto;
    position: relative;
    overflow: hidden;
}

#loading-progress {
    height: 100%;
    background: var(--terminal-green);
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 20px var(--terminal-green);
}

/* Title Screen */
#title-screen {
    text-align: center;
}

.title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 6rem);
    margin-bottom: 2rem;
    text-shadow: 0 0 20px var(--primary-red);
}

.subtitle {
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.warning {
    color: var(--warning-orange);
    font-weight: bold;
    margin-top: 1rem;
    animation: pulse 2s infinite;
}

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

/* Glitch Text Effect */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    color: var(--glitch-cyan);
    animation: glitch-1 0.5s infinite linear alternate-reverse;
}

.glitch::after {
    color: var(--primary-red);
    animation: glitch-2 0.5s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
    0% { clip: rect(42px, 9999px, 44px, 0); }
    5% { clip: rect(12px, 9999px, 59px, 0); }
    10% { clip: rect(48px, 9999px, 29px, 0); }
    15% { clip: rect(42px, 9999px, 73px, 0); }
    20% { clip: rect(63px, 9999px, 27px, 0); }
    25% { clip: rect(34px, 9999px, 55px, 0); }
    30% { clip: rect(86px, 9999px, 73px, 0); }
    35% { clip: rect(20px, 9999px, 20px, 0); }
    40% { clip: rect(26px, 9999px, 60px, 0); }
    45% { clip: rect(25px, 9999px, 66px, 0); }
    50% { clip: rect(57px, 9999px, 98px, 0); }
    55% { clip: rect(5px, 9999px, 46px, 0); }
    60% { clip: rect(82px, 9999px, 31px, 0); }
    65% { clip: rect(54px, 9999px, 27px, 0); }
    70% { clip: rect(28px, 9999px, 99px, 0); }
    75% { clip: rect(45px, 9999px, 69px, 0); }
    80% { clip: rect(23px, 9999px, 85px, 0); }
    85% { clip: rect(54px, 9999px, 84px, 0); }
    90% { clip: rect(45px, 9999px, 47px, 0); }
    95% { clip: rect(37px, 9999px, 20px, 0); }
    100% { clip: rect(4px, 9999px, 91px, 0); }
}

@keyframes glitch-2 {
    0% { clip: rect(65px, 9999px, 100px, 0); }
    5% { clip: rect(52px, 9999px, 74px, 0); }
    10% { clip: rect(79px, 9999px, 85px, 0); }
    15% { clip: rect(75px, 9999px, 5px, 0); }
    20% { clip: rect(67px, 9999px, 61px, 0); }
    25% { clip: rect(14px, 9999px, 79px, 0); }
    30% { clip: rect(1px, 9999px, 66px, 0); }
    35% { clip: rect(86px, 9999px, 30px, 0); }
    40% { clip: rect(23px, 9999px, 98px, 0); }
    45% { clip: rect(85px, 9999px, 39px, 0); }
    50% { clip: rect(15px, 9999px, 82px, 0); }
    55% { clip: rect(37px, 9999px, 88px, 0); }
    60% { clip: rect(61px, 9999px, 35px, 0); }
    65% { clip: rect(14px, 9999px, 21px, 0); }
    70% { clip: rect(59px, 9999px, 52px, 0); }
    75% { clip: rect(37px, 9999px, 31px, 0); }
    80% { clip: rect(23px, 9999px, 95px, 0); }
    85% { clip: rect(27px, 9999px, 97px, 0); }
    90% { clip: rect(38px, 9999px, 49px, 0); }
    95% { clip: rect(83px, 9999px, 84px, 0); }
    100% { clip: rect(50px, 9999px, 25px, 0); }
}

/* Buttons */
.terminal-btn {
    background: transparent;
    color: var(--terminal-green);
    border: 2px solid var(--terminal-green);
    padding: 15px 30px;
    font-family: var(--font-mono);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.terminal-btn:hover {
    background: var(--terminal-green);
    color: var(--void-black);
    box-shadow: 0 0 20px var(--terminal-green);
    transform: scale(1.05);
}

.terminal-btn:active {
    transform: scale(0.95);
}

/* Game Screen */
#game-screen {
    height: 100vh;
    overflow-y: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 20px 20px 60px 20px;
    box-sizing: border-box;
}

#game-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--terminal-green);
    margin-bottom: 20px;
}

#location-name {
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#system-status {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
}

#corruption-level {
    color: var(--primary-red);
}

#memory-fragments {
    color: var(--glitch-cyan);
}

#game-world {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    max-height: none;
}

#environment {
    width: 100%;
    height: 100%;
    position: relative;
    background: radial-gradient(circle at center, rgba(0, 255, 65, 0.1) 0%, transparent 50%);
    border: 1px solid var(--terminal-green);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 20px;
    text-align: center;
}

#interactive-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.interactive-element {
    position: absolute;
    pointer-events: auto;
    background: rgba(255, 0, 64, 0.2);
    border: 1px solid var(--primary-red);
    cursor: pointer;
    transition: all 0.3s ease;
}

.interactive-element:hover {
    background: rgba(255, 0, 64, 0.4);
    box-shadow: 0 0 15px var(--primary-red);
    animation: flicker 0.5s infinite;
}

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

#narrative-panel {
    margin-top: 20px;
    min-height: 120px;
    border-top: 1px solid var(--terminal-green);
    padding-top: 20px;
    flex-shrink: 0;
}

#text-display {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 20px;
    min-height: 60px;
}

#choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-btn {
    background: transparent;
    color: var(--terminal-green);
    border: 1px solid var(--terminal-green);
    padding: 10px 15px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.choice-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    border-color: var(--glitch-cyan);
    color: var(--glitch-cyan);
}

.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Terminal Overlay */
#terminal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#terminal-overlay.hidden {
    display: none;
}

.terminal-window {
    background: var(--void-black);
    border: 2px solid var(--terminal-green);
    width: 80%;
    max-width: 600px;
    height: 60%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px var(--terminal-green);
}

.terminal-header {
    background: var(--terminal-green);
    color: var(--void-black);
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

#terminal-close {
    background: none;
    border: none;
    color: var(--void-black);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
}

#terminal-content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

#terminal-history {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 5px;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--terminal-green);
    font-family: var(--font-mono);
    font-size: 1rem;
    outline: none;
}

/* Ending Screen */
#ending-screen {
    text-align: center;
    padding: 40px;
}

#ending-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--primary-red);
    text-shadow: 0 0 20px var(--primary-red);
}

#ending-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

#ending-stats {
    margin-bottom: 3rem;
    font-size: 0.9rem;
    color: var(--glitch-cyan);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        overflow-y: auto;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    #game-screen {
        padding: 10px;
        height: 100vh;
        overflow-y: auto;
    }
    
    #game-world {
        min-height: 250px;
    }
    
    #game-ui {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #system-status {
        justify-content: center;
    }
    
    .terminal-window {
        width: 95%;
        height: 70%;
    }
    
    #choices {
        gap: 8px;
    }
    
    .choice-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    body {
        overflow-y: auto;
    }
    
    .title {
        font-size: 2rem;
    }
    
    #game-screen {
        height: 100vh;
        overflow-y: auto;
        padding: 8px;
    }
    
    #game-world {
        min-height: 200px;
    }
    
    #environment {
        font-size: 1rem;
        padding: 12px;
    }
    
    #narrative-panel {
        min-height: 100px;
    }
    
    #text-display {
        font-size: 0.9rem;
    }
    
    .terminal-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--void-black);
}

::-webkit-scrollbar-thumb {
    background: var(--terminal-green);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--glitch-cyan);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-red: #ff0000;
        --terminal-green: #00ff00;
        --glitch-cyan: #00ffff;
    }
}

/* Footer Styles */
#game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid var(--terminal-green);
    padding: 8px 20px;
    font-size: 0.8rem;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.version {
    color: var(--glitch-cyan);
    font-family: var(--font-mono);
    opacity: 0.7;
}

.footer-links {
    display: flex;
    gap: 15px;
}

.footer-link {
    color: var(--terminal-green);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    padding: 2px 6px;
    border-radius: 2px;
}

.footer-link:hover {
    opacity: 1;
    border-color: var(--terminal-green);
    box-shadow: 0 0 8px var(--terminal-green);
    transform: scale(1.05);
}

/* Info Page Styles */
.info-page {
    background: var(--void-black);
    color: var(--terminal-green);
    line-height: 1.6;
    overflow-y: auto;
}

.info-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    position: relative;
    z-index: 10;
}

.back-link {
    margin-bottom: 30px;
}

.back-link.bottom {
    margin-top: 40px;
    margin-bottom: 0;
    text-align: center;
}

.page-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-red);
}

.subtitle {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--glitch-cyan);
}

.tagline {
    text-align: center;
    font-style: italic;
    margin-bottom: 40px;
    color: var(--terminal-green);
    opacity: 0.8;
}

.game-info {
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--terminal-green);
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 4px;
}

.game-info p {
    margin: 5px 0;
}

.faq-content h2,
.readme-content h2 {
    color: var(--primary-red);
    font-size: 1.5rem;
    margin: 30px 0 15px;
    border-bottom: 1px solid var(--primary-red);
    padding-bottom: 5px;
}

.faq-content h3,
.readme-content h3 {
    color: var(--glitch-cyan);
    font-size: 1.2rem;
    margin: 20px 0 10px;
}

.faq-content p,
.readme-content p {
    margin: 10px 0;
}

.faq-content ul,
.readme-content ul,
.faq-content ol,
.readme-content ol {
    margin: 10px 0 10px 20px;
}

.faq-content li,
.readme-content li {
    margin: 5px 0;
}

.faq-content code,
.readme-content code {
    background: rgba(255, 0, 64, 0.2);
    color: var(--glitch-cyan);
    padding: 2px 4px;
    border-radius: 2px;
    font-family: var(--font-mono);
}

.warning {
    color: var(--warning-orange);
    font-weight: bold;
}

.warning-list li {
    color: var(--warning-orange);
}

.contact {
    text-align: center;
    margin-top: 30px;
    color: var(--glitch-cyan);
    opacity: 0.8;
}

.version-info {
    text-align: center;
    color: var(--glitch-cyan);
    opacity: 0.6;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Mobile adjustments for info pages */
@media (max-width: 768px) {
    .info-content {
        padding: 20px 15px 60px;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .footer-links {
        gap: 10px;
    }
    
    #game-footer {
        padding: 10px 15px;
    }