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

#game-ui {
    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;
    text-shadow: 2px 2px 0 #000;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background-color: #00ff00;
    /* Green dot */
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 0 4px #00ff00;
}

#blood-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    filter: blur(0.8px) opacity(0.95);
}

/* HUD */
#hud {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

#score {
    font-size: 32px;
    color: #ffaa00;
    font-weight: bold;
}

#round {
    font-size: 32px;
    color: #ae0000;
    /* Red */
    font-weight: bold;
    /* Bottom Left */
    position: absolute;
    bottom: 20px;
    left: 20px;
    transition: transform 0.5s, color 0.5s;
}

.round-flash {
    animation: flashRound 3s ease-out forwards;
    color: #fff !important;
    /* Force white start */
    text-shadow: 0 0 20px #fff;
}

.record-blink {
    animation: blinkRecord 1s infinite alternate;
}

@keyframes blinkRecord {
    from {
        color: #ff0000;
        transform: scale(1.0);
    }

    to {
        color: #ffff00;
        transform: scale(1.1);
        text-shadow: 0 0 20px #ff0000;
    }
}

@keyframes flashRound {
    0% {
        opacity: 1;
        color: #fff;
        transform: scale(1.5);
    }

    15% {
        opacity: 0.5;
        color: #fff;
    }

    30% {
        opacity: 1;
        color: #ff0000;
    }

    45% {
        opacity: 0.5;
        color: #fff;
    }

    60% {
        opacity: 1;
        color: #ff0000;
    }

    75% {
        opacity: 0.5;
        color: #fff;
    }

    100% {
        opacity: 1;
        color: #ae0000;
        transform: scale(1.0);
    }
}

#ammo {
    font-size: 48px;
    color: #fff;
    position: absolute;
    bottom: 20px;
    right: 20px;
}

#interaction-msg {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #fff;
    text-align: center;
    display: none;
    text-shadow: 1px 1px 4px #000;
}

#health-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 50%, rgba(255, 0, 0, 0.6) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 5;
}

#intro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    opacity: 0;
    /* Hidden by default, toggled via JS */
    pointer-events: none;
    z-index: 200;
    /* Above everything including menus */
    transition: opacity 3s ease-in-out;
}

/* WEAPON SELECTOR */
#weapon-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.weapon-slot {
    display: flex;
    align-items: center;
    color: #555;
    font-size: 18px;
    transition: color 0.2s, transform 0.2s;
}

.weapon-slot.active {
    color: #fff;
    transform: scale(1.1);
    font-weight: bold;
    text-shadow: 0 0 10px #fff;
}

.weapon-slot .key {
    background: #333;
    color: #fff;
    padding: 2px 6px;
    margin-right: 8px;
    font-size: 14px;
    border-radius: 4px;
}

/* MENUS */
#start-screen,
#pause-menu,
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    /* Flex to center */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ae0000;
    pointer-events: auto;
    /* Enable clicks */
    z-index: 100;
}

#pause-menu {
    display: none;
    /* Hidden by default */
}

#game-over-screen {
    display: none;
}

h1 {
    font-size: 80px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 10px;
    text-align: center;
    color: #ae0000;
    text-shadow: 0 0 20px #550000;
    margin-bottom: 20px;
}

p {
    color: #fff;
    font-size: 24px;
    margin-top: 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 24px;
    background: #ae0000;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    border: 1px solid #ff0000;
}

button:hover {
    background: #ff3333;
    box-shadow: 0 0 15px #ff0000;
}

#wipe-msg {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    color: #ff3333;
    font-weight: bold;
    text-shadow: 2px 2px 4px #000;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 5px;
    border: 1px solid #550000;
}

.blink-urgent {
    animation: blinkUrgent 1s infinite alternate;
}

@keyframes blinkUrgent {
    from {
        opacity: 1;
        transform: translateX(-50%) scale(1);
        text-shadow: 0 0 10px #ff0000;
    }

    to {
        opacity: 0.5;
        transform: translateX(-50%) scale(1.1);
        text-shadow: 0 0 20px #ff0000;
    }
}

/* CONTROLS MODAL */
#controls-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
    pointer-events: auto;
    /* FIX: Enable clicks */
}

.modal-content {
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid #555;
    padding: 40px;
    width: 600px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 95% 100%, 0 100%);
}

.modal-content h2 {
    color: #d4af37;
    /* Gold/Brass */
    font-size: 2rem;
    margin-bottom: 30px;
    letter-spacing: 3px;
    text-transform: uppercase;
    border-bottom: 1px solid #444;
    padding-bottom: 15px;
}

.control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    text-align: left;
    margin-bottom: 30px;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
    font-family: 'Courier New', monospace;
    color: #ccc;
    font-size: 1.1rem;
}

.key {
    background: #333;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid #555;
    box-shadow: 0 2px 0 #111;
    font-size: 0.9rem;
    margin-right: 5px;
}

#close-controls {
    background: #444;
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 1.2rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s;
}

#close-controls:hover {
    background: #d4af37;
    color: black;
}

#controls-btn {
    background: transparent;
    color: #aaa;
    border: 1px solid #555;
    padding: 10px 30px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Oswald', sans-serif;
}

#controls-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #fff;
}