body {
    margin: 0;
    font-family: 'Bangers', cursive; /* Apply new font to the entire page */
    /* Gradient background as a fallback if the video doesn't load */
    background: linear-gradient(45deg, #a8c0ff, #3f2b96, #a8c0ff);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite alternate; /* Gradient shift animation */
    overflow: hidden; /* Prevent scrolling */
    user-select: none; /* Prevent text selection */
    position: relative; /* For absolute positioning of particles */
    /* *** تغییرات اضافه شده: اطمینان از پوشش کامل صفحه *** */
    height: 100vh;
    width: 100vw;
}

/* Animation for gradient background position shift */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Style for the game character GIF */
#gifme {
    width: 100px; /* Adjust as needed */
    height: 100px; /* Adjust as needed */
    position: absolute;
    top: 15.4rem; /* Initial position for the GIF */
    margin-left: 20vh;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    /* transition: top 0.3s ease-out, transform 0.3s ease-out; */ /* Smooth transition for jump */
}

/* The line at the bottom of the screen (game ground) */
#line {
    position: relative;
    width: 100%;
    height: 0.1%;
    top: 21.1rem; /* Position of the ground line */
    border: 1px solid black;
    background-color: black;
}

/* Base style for blocks */
.block {
    position: absolute;
    width: 3rem; /* Standard block width */
    height: 3rem; /* Standard block height */
    background-color: #4CAF50; /* Base appealing green color */
    border: none;
    border-radius: 8px; /* Rounded corners */
    /* Add a subtle glow for standard blocks */
    box-shadow: 0 0 10px 5px rgba(76, 175, 80, 0.5), 5px 5px 15px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s ease, box-shadow 0.2s ease; /* Smooth transition for color changes */
}

/* New CSS for Challenging Blocks */
.block.challenging {
    background-color: #ffe600; /* Aggressive orange/red for challenging blocks */
    /* More intense, flickering glow */
    box-shadow: 0 0 10px 5px rgb(255, 196, 0), 5px 5px 15px rgba(0, 0, 0, 0.3);
    /* Optional: Slight visual distortion/glitch effect */
    animation: blockGlitch 0.5s infinite alternate;
}
.block.challenginger{
    background-color: #ff8800; /* Aggressive orange/red for challenging blocks */
    /* More intense, flickering glow */
    box-shadow: 0 0 10px 5px rgb(255, 153, 0), 5px 5px 15px rgba(0, 0, 0, 0.3);
    /* Optional: Slight visual distortion/glitch effect */
    animation: blockGlitch 0.5s infinite alternate;
}
.block.challengingeryt{
    background-color: #81008d; /* Aggressive orange/red for challenging blocks */
    /* More intense, flickering glow */
    box-shadow: 0 0 20px 8px rgb(212, 0, 255), 0 0 30px 10px rgb(212, 0, 255), 5px 5px 20px rgba(0, 0, 0, 0.5);
    /* Optional: Slight visual distortion/glitch effect */
    animation: blockGlitch 0.5s infinite alternate;
}
.block.challengingerpoyan{
    background-color: #ff0000; /* Aggressive orange/red for challenging blocks */
    /* More intense, flickering glow */
    box-shadow: 0 0 20px 8px rgb(238, 62, 62), 0 0 30px 10px rgb(238, 62, 62), 5px 5px 20px rgba(0, 0, 0, 0.5);
    /* Optional: Slight visual distortion/glitch effect */
    animation: blockGlitch 0.5s infinite alternate;
}

@keyframes blockGlitch {
    0% { transform: translate(0, 0); }
    25% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, 1px); }
    75% { transform: translate(1px, 1px); }
    100% { transform: translate(-1px, -1px); }
}

/* Style for overlay screens (start and game over) */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-size: 3rem;
}

/* Style for video background in overlay */
.overlay video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -1; /* Place behind main content */
    transform: translate(-50%, -50%);
    object-fit: cover; /* Cover the entire available space */
}

/* Dark overlay layer on video for better text readability */
.video-overlay-dark {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Black with 50% opacity */
    z-index: 0;
}

/* Wrapper for main content to sit on top of video and dark layer */
.content-wrapper {
    position: relative;
    z-index: 1; /* Above video and dark layer */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.overlay h1 {
    margin-bottom: 3rem;
    font-family: 'Bangers', cursive; /* Apply Bangers font */
    font-size: 5rem; /* Larger title size */
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4); /* Text shadow for 3D effect */
    letter-spacing: 5px; /* Spacing between letters for readability */
    opacity: 0; /* Initially invisible */
    animation: fadeInSlideUp 0.8s ease-out forwards; /* Entry animation */
    animation-delay: 0.5s; /* Delay for title animation */
}

.overlay p {
    margin: 0.5rem 0;
    font-size: 2.2rem; /* Slightly larger score text */
    opacity: 0; /* Initially invisible */
    animation: fadeInSlideUp 0.8s ease-out forwards; /* Entry animation */
}

/* Delay for score paragraphs */
.overlay p:nth-of-type(1) { animation-delay: 0.8s; } /* Delay for 'Your Score' */
.overlay p:nth-of-type(2) { animation-delay: 1.1s; } /* Delay for 'Your Record' */

/* --- New Entry Animations for Elements --- */
@keyframes fadeInSlideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceIn {
    0%, 20%, 40%, 60%, 80%, 100% {
        transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    }
    0% {
        opacity: 0;
        transform: scale3d(.3, .3, .3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(.9, .9, .9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(.97, .97, .97);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

/* Style and animation for buttons */
.btn {
    padding: 1rem 3rem;
    font-size: 1.8rem;
    font-family: 'Bangers', cursive;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6a11cb, #2575fc); /* Attractive gradient for button */
    color: white;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease; /* Smooth hover animation */
    box-shadow: 0 4px 10px rgba(101, 105, 255, 0.6);

    opacity: 0; /* Initially invisible */
    animation: bounceIn 0.8s forwards; /* BounceIn animation for entry */
    animation-delay: 1.5s; /* Delay after text elements */
}

.btn:hover {
    background: linear-gradient(135deg, #ff5e62, #ff9966); /* Change gradient on hover */
    transform: scale(1.05); /* Slightly enlarge on hover */
}

/* In-game score display in the corner */
#inGameScore {
    position: fixed;
    top: 10px;
    left: 10px; /* Position to the left */
    font-size: 1.8rem;
    color: black;
    font-weight: bold;
    z-index: 1001;
}

/* --- Particle animation styles --- */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4); /* White color with transparency */
    animation: float 6s linear infinite; /* Floating animation */
    pointer-events: none; /* Do not interfere with other elements */
}

@keyframes float {
    0% { transform: translateY(0); opacity: 0; }
    50% { transform: translateY(-50vh); opacity: 1; } /* Move upwards */
    100% { transform: translateY(-100vh); opacity: 0; } /* Fade out at the top */
}