body {
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
    background-color: #222;
    background-size: 200% 200%;
    background-image: url("./img/black1.jpg");
    background-size: contain;
    background-repeat: repeat;
    backdrop-filter: blur(5px);
    color: white;
}

#ui {
    /* display: flex; */
    justify-content: space-between;
    margin-bottom: 79px;
    padding: 17px;
    padding-left: 47px;
    padding-right: 47px;
    margin-top: -5px;
    background-color: #1c1c22;
    border-radius: 5px;
    border: 1px solid #ffb300;
    box-shadow: 0 0 32px 8px #040404;
}

#ui h1 {

    margin: 0;
    font-size: 18px;
}

#game {
    width: 680px;
    height: 600px;
    margin: 0 auto;
    border: 2px solid #555;
    position: relative;
    /* Added for player positioning */
}

#game div {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#pause {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1c1c22;
    color: #fff;
    padding: 32px 48px;
    border-radius: 18px;
    border: 2px solid #ffb300;
    box-shadow: 0 0 32px 8px #040404;
    display: none;
    z-index: 1000;
    text-align: center;
    font-family: 'Bitcount Grid Single', monospace;
    font-size: 2rem;
}

#pause button {
    background: #1c1c22;
    color: #ffb300;
    border: 2px solid #ffb300;
    border-radius: 8px;
    font-size: 1.2rem;
    padding: 10px 24px;
    margin: 12px 8px 0 8px;
    cursor: pointer;
    font-family: 'Bitcount Grid Single', monospace;
    transition: background 0.2s, color 0.2s;
}

#pause button:hover {
    background: #ffb300;
    color: #222;
}

#prestart {
    background-color: #4caf50;
    color: white;
}

#pause button:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

#pause button:active {
    transform: scale(0.98);
}

#player {
    width: 40px;
    height: 40px;
    position: absolute;
    top: 40px;
    left: 40px;
}

#game-over {
    position: fixed;
    top: 34%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 24px;
    text-align: center;
    z-index: 1000;
    /* Ensure it appears above other elements */
    font-family: "Bitcount Grid Single", system-ui;
    display: none;
}


#win {
    position: fixed;
    top: 30%;
    left: 50%;
    display: none;
    transform: translate(-50%, -50%);
    background-color: rgba(211, 191, 11, 0.8);
    color: white;
    padding: 19px 40px;
    border-radius: 10px;
    font-size: 24px;
    text-align: center;
    z-index: 1000000;
    font-family: "Bitcount Grid Single", system-ui;
}


#blur-wrapper {
    filter: blur(35px);
    transition: filter 0.3s ease-in-out;
}

#difficulty-card {
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: 90px;
    transform: translate(-50%, -50%);
    background: #1c1c22;
    color: #fff;
    padding: 36px 56px;
    border-radius: 18px;
    border: 2px solid #ffb300;
    box-shadow: 0 0 32px 8px rgba(0, 0, 0, 0.7);
    z-index: 2000;
    text-align: center;
    font-family: 'Bitcount Grid Single', monospace;
    font-size: 2rem;
}
#startstory {
    display: none;
    position: absolute;
    top: 60%;
    left: 80%;
    transform: translate(-50%, -50%);
    color: #ffffff; 
    padding: 20px 30px; 
    z-index: 1500;
    text-align: center;
    font-family: 'Bitcount Grid Single', monospace;
    font-size: 1.6rem; 
    max-width: 500px;
    width: 80%; 
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px; 
    box-shadow: 0 0 15px rgba(255, 179, 0, 0.5);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.7); 
    line-height: 1.4; 
}
#topstory {
    display: none;
    position: absolute;
    top: 60%;
    left: 50%; 
    transform: translate(-50%, -50%);
    color: #ffffff;
    padding: 20px 30px;
    z-index: 1500;
    text-align: center;
    font-family: 'Bitcount Grid Single', monospace;
    font-size: 1.6rem;
    max-width: 500px;
    width: 80%;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 179, 0, 0.5);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}



@media (max-width: 1100px) {
    body {
        padding: 10px;
    }

    #ui {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        font-size: 14px;
    }

    #game {
        width: 100%;
        max-width: 100%;
        height: auto;
        aspect-ratio: 17 / 15;
        /* 9a3ida sahla l3ard * 17/15 bach t3tina height ghir 3la 9bal dakchi li3tina width o height falawl // 680px * 15 / 17 = 600 lihiya height*/
    }

    #player {
        width: 32px;
        height: 32px;
    }

    #difficulty-card {
        justify-content: space-between; 
        padding: 10px 20px;
        border-radius: 18px;
        border: 2px solid #ffb300;
        box-shadow: 0 0 32px 8px rgba(0, 0, 0, 0.7);
        z-index: 2000;
        text-align: center;
        align-items: center;
        font-family: 'Bitcount Grid Single', monospace;
        font-size: 10px;
    }

    #pause,
    #win,
    #game-over,
    #difficulty-card {
        width: 90%;
        padding: 10px 10px 10px 10px;
        font-size: 15px;
    }

    #pause button {
        width: 90%;
        margin: 10px;
        font-size: 15px;
        align-items: center;
    }

    #startstory {
        font-size: 1rem;
        padding: 15px 20px;
        width: 95%; 
       
    }

    #startstory {
        top: 100%;
        left: 50%;
    }

  

   
}