:root {
    --bg-dark: #050000;
    --text-main: #d0f0d0;
    --accent: #ff0000;
    --secondary: #00ff00;
    --success: #33ff33;
    --error: #ff3333;
    --hud-bg: rgba(20, 0, 0, 0.9);
    --font-headers: 'Press Start 2P', cursive;
    --font-body: 'VT323', monospace;
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: #000;
    font-family: var(--font-body);
    color: var(--text-main);
    /* HIDE CURSOR for Flashlight Effect */
    cursor: none;
}

/* Force cursor to appear only on buttons */
button,
.pnlm-hotspot {
    cursor: pointer !important;
}

/* --- FULLSCREEN OVERLAYS (Intro, Title, Transitions) --- */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* 1. INTRO TEXT ANIMATION */
#intro-dialogue p {
    font-size: 2.5rem;
    color: #fff;
    opacity: 0;
    animation: fadeInOut 5s forwards;
    /* 5 second duration */
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* 2. TITLE SCREEN STYLES */
#title-screen {
    background: radial-gradient(circle, #1a0505 0%, #000000 90%);
    z-index: 1900;
    /* Below intro, above game */
}

.main-title {
    font-family: var(--font-headers);
    font-size: 4rem;
    color: var(--accent);
    text-shadow: 4px 4px 0 #330000, 0 0 20px var(--accent);
    margin-bottom: 10px;
    letter-spacing: -2px;
}

.sub-title {
    font-size: 1.5rem;
    letter-spacing: 5px;
    color: #888;
    margin-bottom: 60px;
}

.credits {
    position: absolute;
    bottom: 30px;
    width: 100%;
    text-align: center;
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: #444;
    left: 0;
}

/* BOUNCING BUTTON */
.pulse-btn {
    background: transparent;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    font-family: var(--font-headers);
    font-size: 1.2rem;
    padding: 20px 40px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    animation: bounce 2s infinite;
}

.pulse-btn:hover {
    background: var(--text-main);
    color: #000;
    box-shadow: 0 0 20px var(--text-main);
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-15px);
    }

    60% {
        transform: translateY(-7px);
    }
}

/* 3. TRANSITION OVERLAY (Mission Briefing between scenes) */
#transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1500;
    /* Above game, below intro/title */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.mission-box {
    border: 6px solid var(--accent);
    padding: 40px;
    max-width: 800px;
    width: 90%;
    background: rgba(0, 0, 0, 0.95);
    box-shadow: 0 0 30px var(--accent);
    text-align: center;
}

#transition-title {
    font-family: var(--font-headers);
    color: var(--accent);
    font-size: 2.5rem;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    text-shadow: 4px 4px 0 #330000;
    min-height: 60px;
}

#transition-text {
    font-family: var(--font-body);
    font-size: 1.8rem;
    color: var(--text-main);
    line-height: 1.4;
    min-height: 60px;
}

.blinking-cursor {
    display: inline-block;
    width: 15px;
    height: 1.5rem;
    background: var(--text-main);
    margin-left: 5px;
    animation: blink 0.8s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

#start-btn {
    margin-top: 30px;
    background: transparent;
    border: 3px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-headers);
    padding: 15px 30px;
    cursor: pointer;
    font-size: 1rem;
}

#start-btn:hover {
    background: var(--accent);
    color: #000;
}

/* --- FLASHLIGHT & GAME UI --- */
#pano {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    filter: contrast(1.2) brightness(0.6) sepia(0.3);
    cursor: inherit;
    /* inherit from body */
}

#flashlight-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
    /* The gradient is updated in JS */
    background: radial-gradient(circle 200px at 50% 50%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.98) 40%, black 100%);
}

#hud {
    position: absolute;
    bottom: 0;
    width: 100%;
    z-index: 20;
    padding: 20px;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

#status-bar {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #333;
    padding: 10px 20px;
    display: flex;
    gap: 20px;
    align-items: center;
}

#fragment-count {
    font-family: var(--font-headers);
    color: var(--secondary);
    font-size: 0.8rem;
}

/* MODALS (Simplified for brevity - keep your existing styles for content) */
.modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.modal-inner,
.code-modal-inner {
    position: relative;
    background: #000;
    border: 4px solid var(--accent);
    padding: 30px;
    width: 90%;
    max-width: 600px;
    color: var(--text-main);
    text-align: center;
    box-shadow: 0 0 20px var(--accent);
}

.code-buttons,
.branch-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.primary-btn,
.secondary-btn,
.choice-btn {
    padding: 10px;
    border: 1px solid var(--accent);
    background: #000;
    color: var(--accent);
    font-family: var(--font-headers);
    cursor: pointer;
}


.primary-btn:hover {
    background: var(--accent);
    color: #000;
}

/* MODAL CONTAINERS - Ensure proper display */
#code-modal,
#branch-modal,
#intel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Additional modal elements */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-family: var(--font-headers);
    color: var(--accent);
    font-size: 1.2rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

#lcd-display {
    background: #111;
    border: 3px solid #333;
    padding: 15px;
    margin: 20px 0;
}

#code-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--accent);
    font-family: var(--font-headers);
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 8px;
    outline: none;
}

#code-feedback {
    margin-top: 10px;
    font-family: var(--font-body);
    font-size: 1.2rem;
    min-height: 20px;
}

#collected-fragments {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

.frag-btn {
    width: 60px;
    height: 60px;
    background: #222;
    border: 2px solid #555;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
}

.frag-btn:hover {
    border-color: var(--accent);
    background: #330;
    transform: scale(1.1);
}

.frag-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.btn-title {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.btn-desc {
    display: block;
    font-family: var(--font-body);
    font-size: 1rem;
    opacity: 0.7;
}


/* HOTSPOT STYLES */
.pnlm-hotspot {
    z-index: 25 !important;
    cursor: pointer !important;
}

.pnlm-hotspot.fragment-hotspot {
    /* Ensure it has size if image fails */
    min-width: 50px;
    min-height: 50px;
    background: transparent;
    animation: hotspot-pulse 2s infinite;
}

.pnlm-hotspot.fragment-hotspot img {
    /* Ensure image is visible */
    display: block;
    filter: drop-shadow(0 0 5px red) contrast(1.5);
    pointer-events: none;
    /* Let clicks pass to parent div */
}

.pnlm-hotspot.fragment-hotspot:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px var(--accent));
    z-index: 30 !important;
    /* Pop over everything */
}

@keyframes hotspot-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 600px) {
    .mission-box {
        padding: 20px;
        width: 95%;
        border-width: 3px;
    }

    #transition-title {
        font-size: 1.5rem;
        /* Significantly reduced from 2.5rem */
        word-wrap: break-word;
        /* Ensure long words break if necessary */
        overflow-wrap: break-word;
    }

    #transition-text {
        font-size: 1.2rem;
    }

    .main-title {
        font-size: 2.5rem;
    }
}
