/* Custom Cursor (Optional - Requires images/creepy_cursor.png) */
/* body {
    cursor: url('images/creepy_cursor.png') 16 16, auto;
} */

/* General Body Styles - Dark, Minimalist Base */
body {
    font-family: 'Times New Roman', serif;
    background-color: #050505;
    color: #e0e0e0;
    max-width: 900px;
    margin: 0 auto;
    padding: 15px; 
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ===== HORROR BACKGROUND EFFECTS ===== */

.horror-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

/* Animated Fog Layers */
.fog {
    position: absolute;
    bottom: -50px;
    left: -50%;
    width: 200%;
    height: 300px;
    background: radial-gradient(ellipse, rgba(100, 100, 100, 0.1) 0%, transparent 70%);
    opacity: 0.3;
    animation: fog-drift 60s linear infinite;
}

.fog-1 {
    animation-duration: 45s;
    animation-delay: 0s;
}

.fog-2 {
    animation-duration: 60s;
    animation-delay: -20s;
    opacity: 0.2;
}

.fog-3 {
    animation-duration: 75s;
    animation-delay: -40s;
    opacity: 0.15;
}

@keyframes fog-drift {
    0% { transform: translateX(0) translateY(0); }
    50% { transform: translateX(15%) translateY(-20px); }
    100% { transform: translateX(0) translateY(0); }
}

/* Shadow Creatures Moving in Background */
.shadow-creature {
    position: absolute;
    width: 150px;
    height: 200px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.4) 0%, transparent 60%);
    filter: blur(20px);
    animation: shadow-move 20s ease-in-out infinite;
}

.shadow-1 {
    top: 10%;
    left: -200px;
    animation-duration: 25s;
}

.shadow-2 {
    top: 40%;
    right: -200px;
    animation-duration: 30s;
    animation-delay: -10s;
}

.shadow-3 {
    bottom: 20%;
    left: -200px;
    animation-duration: 35s;
    animation-delay: -20s;
}

@keyframes shadow-move {
    0%, 100% { transform: translateX(0); opacity: 0; }
    10% { opacity: 0.3; }
    50% { transform: translateX(calc(100vw + 400px)); opacity: 0.2; }
    90% { opacity: 0.3; }
    100% { opacity: 0; }
}

/* Blood Drips */
.blood-drip {
    position: absolute;
    top: -20px;
    width: 2px;
    height: 0;
    background: linear-gradient(to bottom, transparent, rgba(139, 0, 0, 0.8), rgba(80, 0, 0, 0.9));
    animation: blood-fall 3s ease-in infinite;
}

.drip-1 {
    left: 15%;
    animation-delay: 0s;
    animation-duration: 4s;
}

.drip-2 {
    left: 35%;
    animation-delay: 1.5s;
    animation-duration: 3.5s;
}

.drip-3 {
    left: 65%;
    animation-delay: 3s;
    animation-duration: 4.5s;
}

.drip-4 {
    left: 85%;
    animation-delay: 2s;
    animation-duration: 3s;
}

@keyframes blood-fall {
    0% { height: 0; top: -20px; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.6; }
    100% { height: 100vh; top: 100vh; opacity: 0; }
}

/* Watching Eyes Floating in Background */
.watching-eye {
    position: absolute;
    width: 30px;
    height: 18px;
    background: radial-gradient(circle at center, #8b0000 20%, #0a0a0a 60%);
    border-radius: 50%;
    animation: eye-float 8s ease-in-out infinite, eye-glow 3s ease-in-out infinite alternate;
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.6);
}

.watching-eye::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff0000;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    animation: pupil-move 6s ease-in-out infinite;
}

.eye-pos-1 {
    top: 15%;
    left: 5%;
    animation-delay: 0s;
}

.eye-pos-2 {
    top: 25%;
    right: 8%;
    animation-delay: -2s;
}

.eye-pos-3 {
    bottom: 20%;
    left: 10%;
    animation-delay: -4s;
}

.eye-pos-4 {
    bottom: 30%;
    right: 5%;
    animation-delay: -6s;
}

@keyframes eye-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

@keyframes eye-glow {
    0% { box-shadow: 0 0 15px rgba(139, 0, 0, 0.4); }
    100% { box-shadow: 0 0 25px rgba(139, 0, 0, 0.8); }
}

@keyframes pupil-move {
    0%, 100% { transform: translate(-50%, -50%) translateX(-3px); }
    50% { transform: translate(-50%, -50%) translateX(3px); }
}

/* Creepy Vines Crawling */
.creepy-vine {
    position: absolute;
    width: 8px;
    height: 0;
    background: linear-gradient(to bottom, 
        transparent, 
        rgba(30, 50, 30, 0.4) 20%, 
        rgba(20, 40, 20, 0.6) 50%,
        rgba(30, 50, 30, 0.4) 80%,
        transparent);
    border-radius: 4px;
    animation: vine-grow 15s ease-in-out infinite;
    filter: blur(1px);
}

.vine-1 {
    top: 0;
    left: 20%;
    animation-delay: 0s;
}

.vine-2 {
    top: 0;
    right: 25%;
    animation-delay: -5s;
}

.vine-3 {
    top: 0;
    left: 60%;
    animation-delay: -10s;
}

@keyframes vine-grow {
    0%, 100% { height: 0; opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.4; }
    100% { height: 40vh; opacity: 0; }
}

/* Flickering Candle Lights */
.candle-light {
    position: absolute;
    width: 60px;
    height: 80px;
    background: radial-gradient(ellipse at center bottom, 
        rgba(255, 150, 50, 0.4) 0%, 
        rgba(255, 100, 0, 0.2) 40%, 
        transparent 70%);
    filter: blur(8px);
    animation: candle-flicker 2s ease-in-out infinite;
}

.light-1 {
    bottom: 10%;
    left: 5%;
    animation-delay: 0s;
}

.light-2 {
    bottom: 15%;
    right: 5%;
    animation-delay: -1s;
}

@keyframes candle-flicker {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    25% { opacity: 0.7; transform: scale(1.05); }
    50% { opacity: 0.4; transform: scale(0.95); }
    75% { opacity: 0.6; transform: scale(1.02); }
}

/* ===== LOADING SCREEN ENHANCEMENTS ===== */

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: #ff3333;
    overflow: hidden;
}

/* Flicker Overlay Effect */
.flicker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    animation: flicker 4s infinite;
    pointer-events: none;
}

@keyframes flicker {
    0%, 100% { opacity: 0; }
    5%, 95% { opacity: 0.2; }
    10%, 20%, 30%, 70%, 80% { opacity: 0; }
    15%, 25%, 75%, 85% { opacity: 0.4; }
    50% { opacity: 0.1; }
}

/* Glitch Text Effect */
.glitch-text {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    margin-bottom: 40px;
    color: #999;
    position: relative;
    animation: glitch 3s infinite;
}

@keyframes glitch {
    0%, 90%, 100% { transform: translate(0); }
    91% { transform: translate(-2px, 2px); }
    92% { transform: translate(2px, -2px); }
    93% { transform: translate(-2px, -2px); }
    94% { transform: translate(2px, 2px); }
    95% { transform: translate(0); }
}

/* Watching Eyes on Loading Screen */
.loading-eyes {
    position: absolute;
    bottom: 50px;
    display: flex;
    gap: 60px;
}

.eye {
    width: 50px;
    height: 30px;
    background: #1a1a1a;
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.5);
    animation: blink 4s infinite;
}

.eye::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #ff0000 20%, #8b0000 80%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: eye-follow 6s ease-in-out infinite;
}

@keyframes blink {
    0%, 90%, 100% { height: 30px; }
    92%, 96% { height: 2px; }
}

@keyframes eye-follow {
    0%, 100% { transform: translate(-50%, -50%) translateX(-5px); }
    50% { transform: translate(-50%, -50%) translateX(5px); }
}

/* Styling for the title banner on the loading screen */
.title-banner-loading {
    width: 80%;
    max-width: 600px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(255, 51, 51, 0.6));
    animation: title-glow 3s ease-in-out infinite alternate;
}

@keyframes title-glow {
    0% { filter: drop-shadow(0 0 10px rgba(255, 51, 51, 0.6)); }
    100% { filter: drop-shadow(0 0 20px rgba(255, 51, 51, 0.9)); }
}

#begin-game-button {
    font-family: 'Courier New', monospace;
    padding: 15px 30px;
    font-size: 1.5em;
    background-color: #1a1a1a;
    color: #ff3333;
    border: 2px solid #ff3333;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.4);
    animation: pulse 2s infinite alternate;
    position: relative;
    z-index: 10;
}

#begin-game-button:hover {
    background-color: #ff3333;
    color: #0a0a0a;
    border-color: #ff6666;
    box-shadow: 0 0 25px rgba(255, 51, 51, 0.8);
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 15px rgba(255, 51, 51, 0.4); } 
    100% { transform: scale(1.03); box-shadow: 0 0 25px rgba(255, 51, 51, 0.8); }
}

/* ===== GAME WRAPPER EFFECTS ===== */

#game-wrapper {
    position: relative;
}

/* Ghostly Hands Reaching from Edges */
#game-wrapper::before,
#game-wrapper::after {
    content: '';
    position: fixed;
    width: 150px;
    height: 200px;
    background: radial-gradient(ellipse at center, rgba(60, 60, 60, 0.3) 0%, transparent 70%);
    filter: blur(15px);
    pointer-events: none;
    z-index: 50;
    animation: hand-reach 8s ease-in-out infinite;
}

#game-wrapper::before {
    top: 30%;
    left: -100px;
    animation-delay: 0s;
}

#game-wrapper::after {
    top: 50%;
    right: -100px;
    animation-delay: 4s;
}

@keyframes hand-reach {
    0%, 100% { transform: translateX(0) scale(1); opacity: 0; }
    10% { opacity: 0.4; }
    50% { transform: translateX(80px) scale(1.2); opacity: 0.6; }
    90% { opacity: 0.3; }
}

/* Creepy Border that Pulses */
.game-border-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(139, 0, 0, 0.3);
    pointer-events: none;
    z-index: 100;
    animation: border-pulse 4s ease-in-out infinite;
}

@keyframes border-pulse {
    0%, 100% { border-color: rgba(139, 0, 0, 0.2); box-shadow: inset 0 0 30px rgba(139, 0, 0, 0.1); }
    50% { border-color: rgba(139, 0, 0, 0.5); box-shadow: inset 0 0 50px rgba(139, 0, 0, 0.3); }
}

/* Corner Eyes Watching */
.game-border-effect::before,
.game-border-effect::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 25px;
    background: #0a0a0a;
    border-radius: 50%;
    box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.4);
    animation: corner-blink 5s infinite;
}

.game-border-effect::before {
    top: 20px;
    left: 20px;
    background: radial-gradient(circle at 30% 50%, #ff0000 15%, #8b0000 25%, #0a0a0a 40%);
}

.game-border-effect::after {
    top: 20px;
    right: 20px;
    background: radial-gradient(circle at 70% 50%, #ff0000 15%, #8b0000 25%, #0a0a0a 40%);
}

@keyframes corner-blink {
    0%, 90%, 100% { opacity: 0.8; }
    93%, 96% { opacity: 0.1; }
}

/* UI Header */
#ui-header {
    text-align: center;
    border-bottom: 1px dashed #333;
    padding-bottom: 5px;
    margin-bottom: 10px;
    position: relative;
}

/* Styling for the title banner in the game header */
.title-banner {
    width: 90%;
    max-width: 500px;
    height: auto;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 8px rgba(255, 51, 51, 0.4));
}

/* Status Display */
#status-display {
    font-size: 0.8em;
    color: #ff9933;
    margin-top: 5px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.stat {
    padding: 3px 8px;
    border: 1px solid #444;
    border-radius: 3px;
    background-color: #1a1a1a;
    box-shadow: 0 0 5px rgba(255, 153, 51, 0.3);
    transition: all 0.3s;
}

.stat:first-child { color: #cc6666; }
.stat:nth-child(2) { color: #66cc66; }
.stat:last-child { color: #cccc66; }

/* Game Container */
#game-container {
    background-color: #121212;
    padding: 15px;
    border: 1px solid #444;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.9), inset 0 0 50px rgba(0, 0, 0, 0.5);
    min-height: 450px;
    position: relative;
    overflow: hidden;
}

/* Cracks appearing around game container */
#game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(90deg, transparent 0%, rgba(139, 0, 0, 0.1) 50%, transparent 100%),
        linear-gradient(0deg, transparent 0%, rgba(139, 0, 0, 0.1) 50%, transparent 100%);
    background-size: 2px 100%, 100% 2px;
    background-position: 30% 0, 0 60%;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
    animation: crack-spread 10s ease-in-out infinite;
}

@keyframes crack-spread {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.5; }
}

/* Vignette Effect Inside Game Container */
.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Floating Particles in Game Area */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(200, 200, 200, 0.3);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    animation: float 15s infinite ease-in-out;
}

.particle-1 {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 12s;
}

.particle-2 {
    top: 60%;
    left: 80%;
    animation-delay: -3s;
    animation-duration: 18s;
}

.particle-3 {
    top: 40%;
    left: 30%;
    animation-delay: -6s;
    animation-duration: 15s;
}

.particle-4 {
    top: 80%;
    left: 60%;
    animation-delay: -9s;
    animation-duration: 20s;
}

.particle-5 {
    top: 10%;
    left: 90%;
    animation-delay: -12s;
    animation-duration: 14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); opacity: 0.2; }
    25% { transform: translate(20px, -30px); opacity: 0.5; }
    50% { transform: translate(-20px, 30px); opacity: 0.3; }
    75% { transform: translate(30px, 10px); opacity: 0.6; }
}

/* Scene Image Styles */
#scene-image {
    display: block;
    width: 100%;
    height: 180px; 
    object-fit: cover; 
    margin-bottom: 15px;
    border: 2px inset #222;
    filter: saturate(0.9) brightness(0.85);
    position: relative;
    z-index: 3;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
}

/* Story Text */
#story-text {
    line-height: 1.7;
    margin-bottom: 15px; 
    font-size: 1.0em; 
    text-align: justify;
    position: relative;
    min-height: 80px;
    z-index: 3;
}

#story-text p {
    margin: 0; 
    margin-bottom: 0.5em; 
}

/* Typewriter Cursor */
.typewriter-cursor {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    background-color: #ff3333;
    vertical-align: middle;
    margin-left: 3px;
    animation: blink-cursor 0.7s infinite alternate;
}

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

/* Choices Container */
#choices-container {
    position: relative;
    z-index: 3;
}

#choices-container button {
    display: block;
    width: calc(100% - 10px);
    padding: 10px 15px;
    margin: 8px auto;
    background-color: #1a1a1a;
    color: #ff6666;
    border: 1px solid #333;
    border-radius: 0;
    cursor: pointer;
    font-size: 1.1em;
    font-family: 'Courier New', monospace;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

#choices-container button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 51, 51, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#choices-container button:hover::before {
    width: 300px;
    height: 300px;
}

#choices-container button:hover {
    background-color: #2a2a2a;
    color: #ff3333;
    border-color: #ff3333;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.5);
    transform: translateX(3px);
}

#choices-container button:active {
    background-color: #ff3333;
    color: #0a0a0a;
    border-color: #ff6666;
    box-shadow: none;
    transform: translateX(0);
}

/* UI Footer */
#ui-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px dashed #333;
    margin-top: 10px;
    font-size: 0.8em;
    color: #888;
}

#audio-controls label {
    margin-right: 10px;
    font-family: 'Courier New', monospace;
}

#audio-controls input[type="checkbox"] {
    accent-color: #ff3333;
}

#ui-footer button {
    background-color: #1a1a1a;
    color: #888;
    border: 1px solid #333;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    transition: background-color 0.2s, color 0.2s;
    font-family: 'Courier New', monospace;
}

#ui-footer button:hover {
    background-color: #2a2a2a;
    color: #e0e0e0;
}

/* Background static / noise effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent 0px,
        rgba(0,0,0,0.07) 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
    animation: static-drift 0.1s infinite;
}

@keyframes static-drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(2px); }
}
