@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --crt-green: #33ff00;
    --crt-blue: #0088ff;
    --dark-bg: #050505;
}

body {
    margin: 0;
    padding: 0;
    background-color: black;
    color: var(--crt-green);
    font-family: 'VT323', monospace;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    position: relative;
    background-color: #111;
}

/* --- CRT EFFECT --- */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(transparent 50%,
            rgba(0, 0, 0, 0.5) 50%);
    background-size: 100% 4px;
    z-index: 10;
    pointer-events: none;
    animation: scanlines 0.2s linear infinite;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.9);
}

@keyframes scanlines {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(4px);
    }
}

/* --- LOADING SCREEN --- */
#loading-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    font-size: 1.5rem;
    text-shadow: 0 0 5px var(--crt-green);
}

.progress-bar {
    width: 300px;
    height: 20px;
    border: 2px solid var(--crt-green);
    margin-top: 20px;
    padding: 2px;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background-color: var(--crt-green);
    transition: width 0.1s;
}

/* --- MAIN MENU --- */
#main-menu {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #000;
}

.main-title-img {
    width: 80vw;
    max-width: 1000px;
    height: auto;
    margin-top: -5vh;
    /* Moves it higher */
    margin-bottom: 0px;
    filter: none;
    /* Removes neon glow */
    object-fit: contain;
    clip-path: inset(0 0 15% 0);
    /* Crops 15% from the bottom */
}

/* --- NIGHT SPLASH --- */
#night-splash {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #000;
    z-index: 2000;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

#night-splash h2 {
    font-size: 4rem;
    color: #fff;
    margin: 0;
}

#night-splash p {
    font-size: 2rem;
    color: var(--crt-green);
}

/* --- SETTINGS SCREEN --- */
#settings-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #000;
    z-index: 2500;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

#settings-screen h1 {
    font-size: 4rem;
    color: var(--crt-green);
    margin-bottom: 50px;
}

/* --- GAME OVER SCREEN --- */
#game-over-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #000;
    z-index: 3000;
    /* Top of everything */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

#game-over-screen h1 {
    font-size: 6rem;
    color: #a00;
    /* Red Title */
    text-shadow: 2px 2px 0px #fff;
    margin-bottom: 20px;
    animation: glitch 1s infinite;
}

#death-message {
    font-size: 2rem;
    color: #fff;
    /* White standard */
    text-transform: uppercase;
}

.blink-text {
    animation: blink 1s infinite;
}

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

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

/* --- GAME VIEW --- */
/* --- GAME VIEW --- */
#office-view {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    /* Removed perspective for simpler FNAF 1 look */
}

/* Container for the panorama */
#panorama-container {
    width: 115%;
    /* Just enough for scrolling */
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.1s linear;
    /* Linear feels more mechanical/direct like FNAF */
}

#main-view {
    width: 100%;
    height: 100%;
    background-color: #000;
    background-size: cover;
    background-position: center;
    /* Subtle radial gradient vignetting to enhance depth */
    box-shadow: inset 0 0 150px rgba(0, 0, 0, 0.8);
    border-radius: 50px;
    /* Rounded corners for tube TV look */
}

/* CRT Overlay Logic */
.crt-overlay {
    display: block;
    /* Visible by default (for menus/loading) */
}

#office-view .crt-overlay {
    display: none;
    /* Hidden by default in office */
}

#office-view.crt-active .crt-overlay {
    display: block;
    /* Visible when Monitor is Active */
}

#ui-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

/* --- INTERACTIVE MONITOR BUTTON --- */
#monitor-trigger {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 40px;
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid var(--crt-green);
    border-bottom: none;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    clip-path: polygon(10% 0, 90% 0, 100% 100%, 0% 100%);
    overflow: hidden;
}

#monitor-trigger:hover {
    background: var(--crt-green);
    height: 50px;
    /* Pop up effect */
}

#monitor-trigger span {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--crt-green);
    animation: blink 2s infinite;
}

#monitor-trigger:hover span {
    color: black;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

button {
    pointer-events: auto;
    background: black;
    color: var(--crt-green);
    border: 2px solid var(--crt-green);
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    padding: 5px 20px;
    cursor: pointer;
    box-shadow: 0 0 5px var(--crt-green);
}

#hide-btn {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    z-index: 30;
}

button:hover {
    background: var(--crt-green);
    color: black;
}

/* --- MAP UI (Hidden by default, shown when monitor is open) --- */
#map-overlay {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 200px;
    height: 150px;
    border: 2px solid var(--crt-green);
    background: rgba(0, 0, 0, 0.8);
    z-index: 25;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 10px;
    gap: 5px;
}

.map-btn {
    width: 45%;
    height: 30px;
    font-size: 1rem;
    padding: 2px;
}

.map-btn.active {
    background: var(--crt-green);
    color: black;
}

.menu-options li {
    font-size: 2rem;
    cursor: pointer;
    margin: 10px 0;
    text-align: center;
}

.menu-options li:hover {
    color: #fff;
    text-decoration: underline;
}

.disabled {
    color: #555;
    pointer-events: none;
}

/* --- ATMOSPHERE EFFECTS --- */
/* --- ATMOSPHERE EFFECTS --- */
#hiding-view {
    position: absolute;
    /* Relative to panorama container */
    top: 0;
    left: 0;
    width: 100%;
    /* Matches panorama width (115%) */
    height: 100%;
    background-color: black;
    background-image: url('assets/under_desk.png');
    background-size: cover;
    background-position: center bottom;
    opacity: 0;
    pointer-events: none;
    z-index: 15;
    /* Above main view (1) but inside panorama */
    transition: opacity 0.5s ease-in-out;
}

#hiding-view.active {
    opacity: 1;
    pointer-events: auto;
}

/* --- UV LIGHT MECHANIC --- */
#uv-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    /* Opposite to Monitor/Map area */
    width: 150px;
    color: #a0f;
    /* Purple text */
    border-color: #a0f;
    box-shadow: 0 0 5px #a0f;
    z-index: 30;
}

#uv-btn:hover,
#uv-btn:active,
#uv-btn.active {
    background: #a0f;
    color: white;
}

/* UV Overlay Effect (Purple Tint) */
.uv-active #main-view::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(160, 0, 255, 0.3) 10%, rgba(50, 0, 100, 0.6) 90%);
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 6;
    /* Above atmosphere */
}

/* Hidden UV Objects */
#uv-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.uv-mark {
    position: absolute;
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.1s;
    filter: drop-shadow(0 0 5px #f0f);
    /* Glowing effect */
}

/* Placeholder shapes if no image */
.uv-mark.handprint {
    background-image: url('assets/uv_handprint.png');
    /* If exists */
    border: 2px dashed #f0f;
    /* Debug placeholder */
    border-radius: 50%;
}

.uv-active .uv-mark {
    opacity: 0.8;
    /* Visible when UV on */
}

/* CLANG UV SPOT (The clickable eyes) */
#clang-spot {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, red 20%, transparent 70%);
    border: 3px solid red;
    box-shadow: 0 0 20px red;
    cursor: crosshair;
    display: none;
    /* Hidden unless Clang is there AND UV is on */
    z-index: 50;
    /* Top of UV layer */
    pointer-events: auto;
    /* CRITICAL: Override parent's none */
}

/* Show spot only when BOTH UV is on AND Clang is in room */
.uv-active.clang-present #clang-spot {
    display: block;
    animation: jitter-eyes 0.1s infinite;
}

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

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

#lighting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: multiply;
    animation: flicker-light 5s infinite;
}

@keyframes flicker-light {

    0%,
    90% {
        opacity: 0;
    }

    91% {
        opacity: 0.2;
    }

    92% {
        opacity: 0;
    }

    93% {
        opacity: 0.1;
    }

    94% {
        opacity: 0;
    }

    95% {
        opacity: 0.3;
    }

    /* Light dims significantly */
    96% {
        opacity: 0;
    }

    97% {
        opacity: 0.1;
    }

    98%,
    100% {
        opacity: 0;
    }
}

/* Dust Particles Container */
.dust-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.dust-particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float-dust 10s linear infinite;
}

@keyframes float-dust {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }

    20% {
        opacity: 0.5;
    }

    80% {
        opacity: 0.5;
    }

    100% {
        transform: translateY(-100px) translateX(20px);
        opacity: 0;
    }
}

/* --- UTILS --- */
.hidden {
    display: none !important;
}