body {
    margin: 0;
    padding: 0;
    font-family: 'Creepster', cursive;
    background-color: #000;
    color: #fff;
    overflow: hidden;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: -2;
}

.moon {
    position: absolute;
    top: 50px;
    right: 50px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #fff9c4, #fdd835);
    border-radius: 50%;
    box-shadow: 0 0 30px 10px rgba(255, 255, 255, 0.5);
}

.graveyard {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 200px;
    background: url('https://png.pngtree.com/png-clipart/20221008/ourmid/pngtree-graveyard-clipart-illustration-png-image_6292394.png') repeat-x bottom;
    background-size: contain;
}

.gravestone {
    position: absolute;
    bottom: 0;
    width: 50px;
    height: 80px;
    background: url('https://cdn-icons-png.flaticon.com/512/4321/4321609.png') no-repeat center center;
    background-size: contain;
    animation: sway 3s infinite alternate;
}

.gravestone:nth-child(1) {
    left: 20%;
    animation-duration: 4s;
}

.gravestone:nth-child(2) {
    left: 50%;
    animation-duration: 3s;
}

.gravestone:nth-child(3) {
    left: 80%;
    animation-duration: 5s;
}

.fog {
    position: absolute;
    bottom: 200px;
    width: 100%;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    animation: moveFog 10s linear infinite;
}

header {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 0;
    text-align: center;
    z-index: 1000; }

h1 {
    font-size: 3em;
    color: #ff6600;
    text-shadow: 2px 2px 10px #ff0000;
    margin: 0;
}

p {
    font-size: 1.2em;
    margin: 10px 0;
}

.scoreboard {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 1.2em;
}

.buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn {
    background-color: #ff6600;
    border: none;
    color: #fff;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.3s;
}

.btn:hover {
    background-color: #e65c00;
    transform: scale(1.05);
}

.main-content {
    padding-top: 150px; }

.game-area {
    position: relative;
    width: 100%;
    height: calc(100vh - 150px); 
    cursor: crosshair;
}

.ghost {
    position: absolute;
    width: 60px;
    height: 60px;
    background: url('https://cdn-icons-png.flaticon.com/512/91/91453.png') no-repeat center center;
    background-size: contain;
    cursor: pointer;
    animation: floatGhost 4s ease-in-out infinite;
}

.end-game-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px; 
    height: auto;
    opacity: 0;
    animation: fadeInOut 3s forwards;
    z-index: 1001;
}

footer {
    position: fixed;
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 0.8em;
    color: gray;
}


@keyframes sway {
    from { transform: rotate(0deg); }
    to { transform: rotate(5deg); }
}

@keyframes moveFog {
    from { background-position: 0 0; }
    to { background-position: -1000px 0; }
}

@keyframes floatGhost {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

@keyframes fly {
    0% { left: -100px; top: 20%; }
    50% { left: 100%; top: 30%; }
    100% { left: -100px; top: 20%; }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    90% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}



@media (max-width: 600px) {
    h1 {
        font-size: 2em;
    }

    .gravestone {
        width: 30px;
        height: 50px;
    }

    .ghost {
        width: 40px;
        height: 40px;
    }

    .scoreboard {
        flex-direction: column;
        gap: 10px;
    }

    .bat {
        width: 60px;
        height: 40px;
    }

    .buttons {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }

    .main-content {
        padding-top: 180px;
    }

    .game-area {
        height: calc(100vh - 180px);     }

    .end-game-image {
        width: 150px; 
    }
}



.end-game-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1001; 
}

.end-game-image {
    width: 200px; 
    height: auto;
    opacity: 0;
    animation: fadeInOut 3s forwards;
}

.end-game-text {
    margin-top: 10px;
    font-size: 1.5em;
    color: #ff6600;
    opacity: 0;
    animation: fadeInOut 3s forwards;
}


@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    90% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}


