:root {
    --wallpaper: #d1c181;
    --carpet: #85794f;
    --trim: #5d5438;
    --ceiling: #e5e0c5;
    --fog: #221f14;
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: monospace;
}

#canvas-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #000;
    /* Cinematic color grading — sickly VHS purgatory */
    filter:
        contrast(120%) brightness(85%) sepia(25%) saturate(80%) blur(0.3px);
    box-shadow: inset 0 0 200px rgba(0, 0, 0, 0.9);
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* VHS scanline overlay */
#vhs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    background: repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.05) 0px,
            rgba(0, 0, 0, 0.05) 1px,
            transparent 1px,
            transparent 2px);
    opacity: 0.3;
    animation: jitter 0.1s infinite;
}

@keyframes jitter {
    0% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-1px, 1px);
    }

    100% {
        transform: translate(1px, -1px);
    }
}

/* Grain noise animation */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 11;
    opacity: 0.12;
    mix-blend-mode: overlay;
    animation: grain 0.15s steps(4) infinite;
}

@keyframes grain {
    0% {
        background-position: 0 0;
    }

    25% {
        background-position: -5px -8px;
    }

    50% {
        background-position: 3px 5px;
    }

    75% {
        background-position: -3px 3px;
    }

    100% {
        background-position: 6px -6px;
    }
}

/* Glitch flash overlay */
#glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 12;
    opacity: 0;
    transition: none;
}

/* HUD */
#hud {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(200, 190, 140, 0.4);
    font-size: 11px;
    z-index: 15;
    text-align: center;
    pointer-events: none;
    letter-spacing: 1px;
    text-shadow: 0 0 6px rgba(200, 190, 140, 0.2);
}

/* Score HUD */
#score-hud {
    position: fixed;
    bottom: 16px;
    right: 20px;
    color: #ffd83d;
    font-size: 16px;
    font-family: monospace;
    z-index: 15;
    pointer-events: none;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(255, 216, 61, 0.5), 0 0 20px rgba(255, 216, 61, 0.2);
}

/* Minimap */
#minimap-canvas {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 140px;
    height: 140px;
    z-index: 16;
    pointer-events: none;
    border: 1px solid rgba(200, 190, 140, 0.3);
    border-radius: 4px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    opacity: 0.85;
}

/* Start overlay */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #c8be8c;
    cursor: pointer;
}

#start-screen h1 {
    font-size: 28px;
    letter-spacing: 6px;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(200, 190, 140, 0.4);
    animation: flicker-title 4s infinite;
}

#start-screen p {
    font-size: 12px;
    opacity: 0.4;
    margin-top: 16px;
}

#start-screen .subtitle {
    font-size: 13px;
    opacity: 0.6;
    margin-bottom: 30px;
}

@keyframes flicker-title {

    0%,
    92%,
    94%,
    100% {
        opacity: 1;
    }

    93% {
        opacity: 0.6;
    }

    93.5% {
        opacity: 1;
    }
}

/* Mobile controls */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 15;
    padding: 10px;
    pointer-events: none;
}

#mobile-controls .ctrl-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#mobile-controls button {
    pointer-events: auto;
    width: 60px;
    height: 60px;
    background: rgba(200, 190, 140, 0.15);
    border: 1px solid rgba(200, 190, 140, 0.25);
    border-radius: 8px;
    color: rgba(200, 190, 140, 0.6);
    font-size: 22px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

#mobile-controls button:active {
    background: rgba(200, 190, 140, 0.3);
}

@media (pointer: coarse),
(max-width: 850px) {
    #mobile-controls {
        display: block;
    }

    #hud {
        bottom: 140px;
    }
}