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

body {
    overflow: hidden;
    background-color: #000;
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
}

#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
}

#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('intro_bg.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 50px;
    text-align: center;
    pointer-events: auto;
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(20, 0, 0, 0.85);
    padding: 40px;
    border: 2px solid #800;
    border-radius: 8px;
    pointer-events: auto;
}

#start-screen h1 {
    font-size: 6rem;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 4px 4px 0 #000, -2px -2px 0 #f00;
    letter-spacing: 10px;
}

#game-over h1 {
    font-size: 4rem;
    color: #f00;
    margin-bottom: 10px;
    text-shadow: 2px 2px 5px #000;
    letter-spacing: 5px;
}

p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #ccc;
}

button {
    background: #500;
    color: #fff;
    border: 2px solid #f00;
    padding: 15px 30px;
    font-size: 1.5rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

button:hover:not(:disabled) {
    background: #f00;
    color: #000;
    box-shadow: 0 0 15px #f00;
}

button:disabled {
    background: #333;
    color: #888;
    border-color: #555;
    cursor: not-allowed;
    box-shadow: none;
}

.char-btn {
    font-size: 1.5rem;
    padding: 10px 20px;
    background: #000;
    border: 3px solid #ffdd00;
    color: #ffdd00;
}
.char-btn:hover:not(:disabled) {
    background: #ffdd00;
    color: #000;
    box-shadow: 0 0 15px #ffdd00;
}

#hud {
    position: absolute;
    top: 20px;
    left: 40px;
    font-size: 2rem;
    font-weight: bold;
    color: #f00;
    text-shadow: 2px 2px 0 #000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hidden {
    display: none !important;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

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

#mute-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #aaa;
    color: #fff;
    font-size: 1.5rem;
    pointer-events: auto;
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

#mobile-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5;
}

#joystick-zone {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    pointer-events: auto;
}

#action-buttons {
    position: absolute;
    bottom: 40px;
    right: 40px;
    display: flex;
    gap: 20px;
    pointer-events: auto;
}

#action-buttons button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(80, 0, 0, 0.6);
    border: 3px solid #f00;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px #f00 inset, 0 0 10px #f00;
    user-select: none;
    -webkit-user-select: none;
}

#action-buttons button:active {
    background: rgba(255, 0, 0, 0.8);
    transform: scale(0.95);
}

/* Jumpscare CSS */
#jumpscare-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    pointer-events: auto;
    z-index: 9999; /* Higher than everything else */
}

#jumpscare-face {
    max-width: 100vw;
    max-height: 100vh;
    object-fit: cover;
    transform: scale(0.01);
    opacity: 0;
}

#jumpscare-face.zoom {
    animation: jumpscare-zoom-effect 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes jumpscare-zoom-effect {
    0% {
        transform: scale(0.01);
        opacity: 0.2;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: scale(2.2);
        opacity: 1;
    }
}

#jumpscare-blood {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    background: radial-gradient(circle, rgba(130, 0, 0, 0.1) 10%, rgba(90, 0, 0, 0.85) 70%, rgba(50, 0, 0, 0.98) 100%);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 1), inset 0 0 200px rgba(180, 0, 0, 0.6);
}

#jumpscare-blood::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Add a blood splattered look using a CSS gradient */
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(150, 0, 0, 0.7) 0%, transparent 8%),
        radial-gradient(circle at 80% 20%, rgba(120, 0, 0, 0.8) 0%, transparent 12%),
        radial-gradient(circle at 40% 75%, rgba(160, 0, 0, 0.75) 0%, transparent 10%),
        radial-gradient(circle at 85% 70%, rgba(140, 0, 0, 0.8) 0%, transparent 15%),
        radial-gradient(circle at 10% 85%, rgba(130, 0, 0, 0.9) 0%, transparent 6%);
}

#jumpscare-blood.show {
    opacity: 1;
    transition: opacity 0.05s ease-in;
}

/* Boss 3 (the Drummer): HP bar, player hearts, hurt flash */
#boss-bar {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: min(46vw, 520px);
    text-align: center;
}

#boss-name {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 4px;
    color: #d4af37;
    text-shadow: 0 0 8px #7a0019, 2px 2px 0 #000;
    margin-bottom: 4px;
}

#boss-hint {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: #d4af37;
    text-shadow: 0 0 8px #7a0019, 2px 2px 0 #000;
    margin-top: 6px;
}

#boss-bar-frame {
    height: 20px;
    background: #0d0004;
    border: 3px double #d4af37;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.5), inset 0 0 8px #000;
    padding: 2px;
}

#boss-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(180deg, #a3001f 0%, #5c0011 60%, #3a000b 100%);
    box-shadow: 0 0 6px #ff2a55;
    transition: width 0.15s ease-out;
}

#hearts {
    position: absolute;
    top: 82px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    letter-spacing: 6px;
    color: #ff2a55;
    text-shadow: 2px 2px 0 #000;
}

#hurt-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 0, 40, 0.45);
    opacity: 0;
    pointer-events: none;
}

#hurt-flash.flash {
    animation: hurt-flash-fade 0.4s ease-out;
}

@keyframes hurt-flash-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}
