@font-face {
    font-family: 'CustomFont';
    src: url('font.otf') format('opentype');
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
    font-family: 'CustomFont', sans-serif;
}

#container {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
    filter: blur(5px);
}

.ball, .player {
    position: absolute;
    border-radius: 50%;
    border: 2px solid black;
    animation: moveBall 5s linear;
}

.ball {
    background-color: red;
}

.player {
    background-color: #BFECFF;
}

@keyframes moveBall {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(var(--endX), var(--endY));
    }
}

#container.game-over .ball {
    animation-play-state: paused;
}

#container.game-over {
    filter: blur(5px);
    opacity: 0.75;
}

#title-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    font-size: 36px;
    width: 600px;
    height: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

#title-screen h1 {
    margin-bottom: 30px;
}

#title-screen button {
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 24px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 9;
}

#title-screen button:hover {
    background-color: #cc0000;
}

#game-over-screen {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    font-size: 36px;
    width: 450px;
    height: 250px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 8;
}

#restart-button {
    margin-top: 10px;
    padding: 15px 30px;
    font-size: 20px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 7;
}

#restart-button:hover {
    background-color: #cc0000;
}

#timer {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 24px;
    color: black;
    z-index: 11;
}

#win-screen {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    font-size: 36px;
    width: 450px;
    height: 250px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 8;
}

#restart-button-win {
    margin-top: 10px;
    padding: 15px 30px;
    font-size: 20px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 9;
}

#restart-button-win:hover {
    background-color: #cc0000;
}

#return-title-button, #return-title-button-win {
    margin-top: 10px;
    padding: 15px 30px;
    font-size: 20px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 9;
}

#return-title-button:hover, #return-title-button-win:hover {
    background-color: #cc0000;
}
#tutorial-screen {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    font-size: 24px;
    width: 450px;
    height: 250px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    opacity: 0.90;
}

#tutorial-screen h2 {
    margin-bottom: 20px;
}

#tutorial-screen button {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    font-size: 18px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#tutorial-screen button:hover {
    background-color: #cc0000;
}

#leaderboard-screen {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    font-size: 24px;
    width: 450px;
    height: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

#leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
    max-height: 200px; 
    overflow-y: auto;
}

#leaderboard-list li {
    margin: 10px 0;
}

#return-title-button-leaderboard {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 18px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#return-title-button-leaderboard:hover {
    background-color: #cc0000;
}

.modal {
    display: none;
    position: fixed;
    z-index: 20;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8); 
}

.modal-content {
    background-color: #333; 
    color: white;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    text-align: center;
    border-radius: 10px;
}

#name-input {
    width: 80%;
    padding: 10px;
    margin: 10px 0;
    font-size: 18px;
    border: 1px solid #555; 
    border-radius: 5px;
    background-color: #444; 
    color: white;
}

#submit-name-button {
    padding: 10px 20px;
    font-size: 18px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#submit-name-button:hover {
    background-color: #cc0000;
}
