body {
    margin: 0;
    overflow: hidden;
    background-color: #050505;
    font-family: 'Courier New', Courier, monospace;
    user-select: none;
    touch-action: none;
}

/* THE PS1 LOOK */
canvas#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    image-rendering: pixelated;
}

/* UI OVERLAY */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-sizing: border-box;
    color: #ddd;
    text-shadow: 1px 1px 0 #000;
    z-index: 15;
}

/* MINIMAP */
#minimap-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    border: 2px solid #333;
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
}

#minimap {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    opacity: 0.8;
}

/* VHS FILTER EFFECTS */
#vhs-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 3px, 4px 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0.3;
}

/* STATUS BARS */
.stat-bar {
    background: #222;
    width: 150px;
    height: 8px;
    margin-bottom: 8px;
    border: 1px solid #444;
}

.fill {
    height: 100%;
    transition: width 0.2s;
}

#stamina-fill { background: #dcb159; width: 100%; }
#sanity-fill  { background: #59a6dc; width: 100%; }
#battery-fill { background: #59dc6e; width: 100%; }

/* MESSAGES */
#messages {
    text-align: center;
    font-size: 24px;
    color: #b33;
    margin-top: 20vh;
    opacity: 0;
    transition: opacity 0.5s;
    text-shadow: 2px 2px 0 #000;
    font-weight: bold;
    letter-spacing: 2px;
}

/* FULLSCREEN OVERLAY SCREENS */
#start-screen,
#death-screen,
#win-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    pointer-events: auto;
}

#pause-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    pointer-events: auto;
}

#pause-text {
    text-align: center;
    font-size: 48px;
    margin-bottom: 20px;
    color: #eee;
    letter-spacing: 6px;
}

h1 {
    font-size: 40px;
    color: #eee;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 5px;
    text-align: center;
}

p {
    color: #999;
    max-width: 600px;
    text-align: center;
    line-height: 1.6;
    padding: 0 20px;
}

.btn {
    border: 1px solid #666;
    color: #ccc;
    background: #111;
    padding: 15px 40px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 30px;
    text-transform: uppercase;
    transition: all 0.2s;
    font-family: inherit;
}

.btn:hover {
    background: #ccc;
    color: #000;
    border-color: #fff;
}

select {
    background: #111;
    color: #fff;
    border: 1px solid #444;
    padding: 8px;
    font-size: 16px;
    font-family: inherit;
    margin: 10px;
}

.hidden { display: none !important; }

.controls-info {
    font-size: 12px;
    color: #555;
    margin-top: 30px;
}

/* SCANLINES ANIMATION */
@keyframes scanline {
    0%   { transform: translateY(0%); }
    100% { transform: translateY(100%); }
}

.scan-line {
    width: 100%;
    height: 20px;
    background: linear-gradient(
        0deg,
        rgba(0,0,0,0) 0%,
        rgba(255,255,255,0.05) 50%,
        rgba(0,0,0,0) 100%
    );
    position: absolute;
    bottom: 100%;
    animation: scanline 8s linear infinite;
    pointer-events: none;
    z-index: 11;
}

/* MOBILE CONTROLS */
#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none; /* JS will enable */
    z-index: 16;
}

.touch-zone {
    position: absolute;
    bottom: 0;
    width: 50%;
    height: 50%;
    pointer-events: auto;
}

#joystick-zone { left: 0; }
#look-zone     { right: 0; }

/* TOUCH BUTTONS */
.touch-btn-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: auto;
}

.touch-btn {
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    user-select: none;
}

.touch-btn:active,
.touch-btn.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-color: #fff;
}

/* Joystick Visual */
#joystick-nub {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.5);
    transform: translate(-50%, -50%);
    display: none;
    pointer-events: none;
}

/* Enable mobile controls */
body.is-mobile #mobile-controls { display: block; }
body.is-mobile .controls-info   { display: none; }
