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

body {
    font-family: 'Courier New', monospace;
    background: #000;
    color: #00ff00;
    min-height: 100vh;
    overflow: hidden;
    cursor: none;
}

.game-header {
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid #ff0000;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-content h1 {
    font-size: 2.5rem;
    color: #ff0000;
    text-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000;
    letter-spacing: 3px;
    animation: titleGlitch 5s infinite;
}

@keyframes titleGlitch {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
}

.anycoder-link {
    color: #ff0000;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border: 1px solid #ff0000;
    border-radius: 20px;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px #ff0000;
}

.anycoder-link:hover {
    background: #ff0000;
    color: #000;
    box-shadow: 0 0 20px #ff0000;
}

.game-stats {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.stat {
    text-align: center;
    min-width: 100px;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #ff0000;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 5px #ff0000;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
}

.stat-value-danger {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 0 0 10px #ff0000;
}

.health-bar, .sanity-bar {
    width: 100px;
    height: 10px;
    background: #333;
    border: 1px solid #ff0000;
    margin-bottom: 0.5rem;
    position: relative;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ff4444);
    width: 100%;
    transition: width 0.3s ease;
}

.sanity-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff00, #44ff44);
    width: 100%;
    transition: width 0.3s ease;
}

.game-container {
    display: flex;
    height: calc(100vh - 80px);
    padding: 0;
    position: relative;
}

.viewport-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.flashlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at var(--x, 50%) var(--y, 50%),
        transparent 100px,
        rgba(0, 0, 0, 0.95) 200px
    );
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.static-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 0, 0.05) 2px,
        rgba(0, 255, 0, 0.05) 4px
    );
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    animation: staticFlicker 0.1s infinite;
}

@keyframes staticFlicker {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.3; }
}

.view-finder {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: #ff0000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 15;
    box-shadow: 0 0 10px #ff0000;
}

.viewport {
    width: 100%;
    height: 100%;
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

.scene {
    width: 800px;
    height: 800px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(60deg) rotateZ(45deg);
    transition: transform 0.1s ease;
}

.floor {
    position: absolute;
    width: 800px;
    height: 800px;
    background: 
        repeating-linear-gradient(90deg, 
            transparent, 
            transparent 49px, 
            #111 49px, 
            #111 50px),
        repeating-linear-gradient(0deg, 
            transparent, 
            transparent 49px, 
            #111 49px, 
            #111 50px);
    background-color: #0a0a0a;
    transform: rotateX(90deg) translateZ(-50px);
    border: 1px solid #330000;
}

.walls-container, .game-objects {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.wall {
    position: absolute;
    background: 
        linear-gradient(135deg, #1a0000, #0a0000);
    border: 1px solid #330000;
    transform-style: preserve-3d;
    box-shadow: inset 0 0 20px #000;
}

.wall::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(90deg,
            transparent,
            transparent 9px,
            rgba(255, 0, 0, 0.1) 9px,
            rgba(255, 0, 0, 0.1) 10px);
    animation: wallFlicker 3s infinite;
}

@keyframes wallFlicker {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.3; }
}

.player {
    position: absolute;
    width: 30px;
    height: 30px;
    transform-style: preserve-3d;
    transition: all 0.2s ease;
    z-index: 10;
}

.player-model {
    width: 100%;
    height: 100%;
    position: relative;
}

.player-body {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #660000, #330000);
    border-radius: 50%;
    box-shadow: 0 0 20px #ff0000;
}

.flashlight-beam {
    position: absolute;
    top: -50px;
    left: 50%;
    width: 4px;
    height: 100px;
    background: linear-gradient(to top, 
        rgba(255, 255, 0, 0.8) 0%,
        rgba(255, 165, 0, 0.6) 50%,
        transparent 100%);
    transform: translateX(-50%) rotateZ(180deg);
    transform-origin: bottom center;
}

.key {
    position: absolute;
    width: 20px;
    height: 20px;
    transform-style: preserve-3d;
    animation: keyFloat 2s ease-in-out infinite;
}

.key-model {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    clip-path: polygon(30% 0%, 70% 0%, 70% 40%, 85% 40%, 50% 100%, 15% 40%, 30% 40%);
    box-shadow: 0 0 20px #ffd700;
}

@keyframes keyFloat {
    0%, 100% { transform: translateY(0) rotateY(0deg); }
    50% { transform: translateY(-10px) rotateY(180deg); }
}

.enemy {
    position: absolute;
    width: 40px;
    height: 40px;
    transform-style: preserve-3d;
    transition: all 0.5s ease;
}

.enemy-model {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #000000, #330000);
    border-radius: 50%;
    box-shadow: 
        0 0 30px #ff0000,
        inset 0 0 20px #660000;
    animation: enemyPulse 2s ease-in-out infinite;
    position: relative;
}

.enemy-model::before {
    content: '👁️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    filter: hue-rotate(180deg);
}

@keyframes enemyPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 30px #ff0000;
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 50px #ff0000;
    }
}

.exit {
    position: absolute;
    width: 60px;
    height: 60px;
    transform-style: preserve-3d;
}

.exit-model {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #004400, #00aa00);
    border: 2px solid #00ff00;
    box-shadow: 0 0 50px #00ff00;
    animation: exitPulse 3s ease-in-out infinite;
}

@keyframes exitPulse {
    0%, 100% { 
        opacity: 0.7;
        box-shadow: 0 0 30px #00ff00;
    }
    50% { 
        opacity: 1;
        box-shadow: 0 0 70px #00ff00;
    }
}

.controls-info {
    background: rgba(0, 0, 0, 0.9);
    border-left: 1px solid #ff0000;
    padding: 2rem;
    width: 300px;
    position: relative;
    z-index: 20;
}

.control-group {
    margin-bottom: 2rem;
}

.control-group h3 {
    margin-bottom: 1rem;
    color: #ff0000;
    text-shadow: 0 0 5px #ff0000;
    border-bottom: 1px solid #330000;
    padding-bottom: 0.5rem;
}

.key-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.key-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

kbd {
    background: #111;
    border: 1px solid #ff0000;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: #ff0000;
    text-shadow: 0 0 5px #ff0000;
    box-shadow: 0 2px 5px rgba(255, 0, 0, 0.3);
}

.warning {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #ff0000;
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
    margin-top: 2rem;
}

.warning-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.modal {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
}

.horror-modal {
    background: linear-gradient(135deg, #0a0000, #1a0000);
    border: 2px solid #ff0000;
    box-shadow: 
        0 0 50px #ff0000,
        inset 0 0 50px rgba(255, 0, 0, 0.1);
}

.modal-content h2 {
    color: #ff0000;
    margin-bottom: 1rem;
    font-size: 3rem;
    text-shadow: 0 0 20px #ff0000;
    animation: titleGlitch 2s infinite;
}

.modal-content p {
    margin-bottom: 2rem;
    color: #00ff00;
    line-height: 1.6;
    text-shadow: 0 0 10px #00ff00;
}

.difficulty-select {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.difficulty-btn {
    background: #111;
    border: 1px solid #ff0000;
    color: #ff0000;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px #ff0000;
}

.difficulty-btn:hover {
    background: #ff0000;
    color: #000;
    box-shadow: 0 0 20px #ff0000;
}

.difficulty-btn.active {
    background: #ff0000;
    color: #000;
    box-shadow: 0 0 20px #ff0000;
}

.horror-btn {
    background: linear-gradient(45deg, #ff0000, #660000);
    color: #000;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px #000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

.horror-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
}

.jumpscare {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.jumpscare-content {
    text-align: center;
}

.jumpscare-face {
    font-size: 10rem;
    margin-bottom: 2rem;
    animation: jumpscareShake 0.5s infinite;
}

@keyframes jumpscareShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-5px); }
}

.jumpscare-text {
    font-size: 3rem;
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000;
    animation: textFlash 0.2s infinite;
}

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

.sanity-low {
    filter: hue-rotate(90deg) contrast(150%) brightness(80%);
}

.sanity-critical {
    filter: hue-rotate(180deg) contrast(200%) brightness(70%) blur(1px);
    animation: sanityGlitch 0.1s infinite;
}

@keyframes sanityGlitch {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
}

@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
    }
    
    .controls-info {
        width: 100%;
        border-left: none;
        border-top: 1px solid #ff0000;
    }
    
    .game-stats {
        gap: 1rem;
    }
    
    .scene {
        width: 400px;
        height: 400px;
    }
    
    .floor {
        width: 400px;
        height: 400px;
    }
}