* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #000;
    overflow: hidden;
    font-family: 'VT323', monospace;
    color: #fff;
    width: 100vw;
    height: 100vh;
    cursor: default;
}

#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

#controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 20;
    pointer-events: none;
}

#controls > * {
    pointer-events: auto;
}

.title-text {
    font-family: 'Creepster', cursive;
    font-size: clamp(2rem, 8vw, 5rem);
    color: #fff;
    text-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000, 0 0 40px #880000;
    text-align: center;
    animation: flicker 3s infinite;
}

@keyframes flicker {
    0%, 95%, 100% { opacity: 1; }
    96% { opacity: 0.4; }
    97% { opacity: 0.9; }
    98% { opacity: 0.3; }
    99% { opacity: 0.8; }
}

.menu-btn {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    padding: 12px 32px;
    background: transparent;
    border: 2px solid #666;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
    margin: 8px;
    min-width: 120px;
}

.menu-btn:hover, .menu-btn:active {
    border-color: #ff4444;
    color: #fff;
    text-shadow: 0 0 8px #ff4444;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}

.menu-btn.selected {
    border-color: #ff0000;
    color: #ff4444;
    text-shadow: 0 0 8px #ff0000;
}

.hud-element {
    position: absolute;
    font-family: 'VT323', monospace;
    color: #fff;
    text-shadow: 0 0 4px rgba(255,255,255,0.5);
}

.time-display {
    top: 10px;
    right: 20px;
    font-size: 2rem;
}

.night-display {
    top: 10px;
    left: 20px;
    font-size: 1.5rem;
}

.power-display {
    bottom: 60px;
    left: 20px;
    font-size: 1.2rem;
}

.power-bar {
    width: 150px;
    height: 12px;
    border: 1px solid #555;
    margin-top: 4px;
    background: #111;
}

.power-bar-fill {
    height: 100%;
    transition: width 0.5s, background-color 0.5s;
}

.game-btn {
    position: absolute;
    font-family: 'VT323', monospace;
    font-size: 1rem;
    padding: 8px 16px;
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid #555;
    color: #ccc;
    cursor: pointer;
    transition: all 0.15s;
}

.game-btn:hover, .game-btn:active {
    background: rgba(60, 60, 60, 0.9);
    border-color: #aaa;
    color: #fff;
}

.game-btn.active {
    background: rgba(80, 20, 20, 0.9);
    border-color: #ff4444;
    color: #ff4444;
}

.camera-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 15;
    display: none;
}

.camera-overlay.active {
    display: block;
}

.cam-btn {
    position: absolute;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    padding: 6px 12px;
    background: rgba(20, 40, 20, 0.8);
    border: 1px solid #2a5a2a;
    color: #4a8;
    cursor: pointer;
}

.cam-btn:hover, .cam-btn.active {
    background: rgba(40, 80, 40, 0.9);
    border-color: #4a8;
    color: #8f8;
}

.static-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    opacity: 0.03;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255,255,255,0.03) 2px,
        rgba(255,255,255,0.03) 4px
    );
}

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

.jumpscare-overlay.active {
    display: flex;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-10px, -5px); }
    20% { transform: translate(10px, 5px); }
    30% { transform: translate(-5px, 10px); }
    40% { transform: translate(5px, -10px); }
    50% { transform: translate(-10px, 5px); }
    60% { transform: translate(10px, -5px); }
    70% { transform: translate(-5px, -10px); }
    80% { transform: translate(5px, 10px); }
    90% { transform: translate(-10px, -5px); }
}

.game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 110;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #000;
}

.game-over-screen.active {
    display: flex;
}

.win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 110;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #000;
}

.win-screen.active {
    display: flex;
}

.footer {
    position: fixed;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    font-size: 0.7rem;
    color: #444;
    text-align: center;
}

.footer a {
    color: #666;
    text-decoration: none;
}

.footer a:hover {
    color: #999;
}

.sound-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 200;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
}

.sound-toggle:hover {
    color: #fff;
}