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

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Arial', sans-serif;
    background-image: url(background_cavalier.png);
    background-size: 100% 100%;
    height: 100vh;
    justify-content: center;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.575);

}

h1,
h2 {
    color: #333;
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
}

h1 {
    top: 57px;
    position: absolute;
    font-size: 7em;
    text-shadow: 0 10px 2px rgba(3, 3, 3, 0.5);
    z-index: 2;
    color: #45a049;
    -webkit-text-stroke-width: 3px;
    -webkit-text-stroke-color: black;

}

h2 {
    margin: 20px 0;
    font-size: 1.5em;
    z-index: 2;
    color: greenyellow;

}

h3 {
    font-size: 1.3em;
    margin: 5%;
    color: #45a049;
}

h4 {
    color: #45a049;
    display: flex;
    width: 100%;
    top: 57px;
    position: absolute;
    font-size: 7em;
    text-shadow: 0 19px 9px rgba(0, 0, 0, 0.3);
    justify-content: space-around;
    z-index: 2;
    -webkit-text-stroke-width: 3px;
    -webkit-text-stroke-color: black;
}

label {
    color: #45a049;
}

#end-screen {
    width: 100%;
    text-align: center;
    z-index: 2;

}

#name-entry {
    margin-top: 3%;
    display: flex;
    font-size: 2em;
    flex-direction: column;
    align-items: center;
    z-index: 2;

}

#end-screen p {
    font-size: 4em;
    z-index: 2;
    color: #45a049;

}

#player-name-end {
    z-index: 2;
    width: 440px;
    height: 40px;
    font-size: 1.2em;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);

}

#rules {
    z-index: 2;
    position: static;
    width: 60%;
    font-size: 1.1em;
    padding: 2%;
    color: #020202;
    text-align: center;
    background-color: rgba(255, 0, 0, 0.39);
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    border: 2px solid #333;

}

#start-screen {
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
}

#start-button {
    z-index: 2;
    padding: 12px 25px;
    font-size: 1.5em;
    color: white;
    background: linear-gradient(90deg, #4CAF50, #3C9E40);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
    transition: background 0.3s, transform 0.2s;
}

#start-button:hover {
    background: linear-gradient(90deg, #45a049, #3C9E40);
}

#mode {
    z-index: 2;
    margin: 10px 0;
    padding: 5px 10px;
    font-size: 0.9em;
    background: linear-gradient(90deg, #4CAF50, #3C9E40);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
    transition: background 0.3s, transform 0.2s;
}

#mode-container {
    z-index: 2;
    font-size: 1.9em;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
}

#player-name {
    z-index: 2;
    margin: 10px 0;
    padding: 5px 10px;
    font-size: 1.9em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
    transition: background 0.3s, transform 0.2s;
}

#name-container {
    z-index: 2;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
}

#game {
    width: 100%;
    z-index: 2;
    justify-content: space-between;
    align-content: center;
    flex-direction: row;
    flex-wrap: nowrap;
}

#all {
    margin-right: 30%;
    position: relative;
    display: flex;
    width: 44%;
    /* background-color: #ffcc00; */
    flex-direction: column;
    align-items: center;
    flex-wrap: nowrap;
}

#test {
    position: relative;
    display: flex;
    width: 100%;
    justify-content: center;
}

#board {
    z-index: 2;
    width: 484px;
    display: grid;
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(8, 60px);
    overflow: hidden;
    margin: 1%;
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
    border: 2px solid #000000;

}

.cell {
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    border: 2px solid #000000;
    background-color: #505050a1;
}

.cell:hover {
    z-index: 2;
    transform: scale(1.05);
    background-color: rgba(200, 200, 200, 0.5);
    border: 2px solid black;
}

.knight {
    z-index: 2;
    text-align: center;
    font-size: 3.5em;
    color: #ffcc00;
    text-shadow: 5px 1px 2px rgba(0, 0, 0, 0.5);
}

/* .possible-move {
    background-color: rgba(144, 238, 144, 0.8);
} */

#reset {
    position: relative;
    display: flex;
    justify-content: center;
    width: 50%;
    z-index: 2;
    padding: 12px 25px;
    font-size: 1.2em;
    color: white;
    background: linear-gradient(90deg, #4CAF50, #3C9E40);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
    transition: background 0.3s, transform 0.2s;
    margin: 1%;
}

#reset:hover {
    z-index: 2;
    background: linear-gradient(90deg, #45a049, #3C9E40);
    transform: scale(1.05);
}

#reset:active {
    z-index: 2;
    transform: scale(0.95);
}

#score-container {
    z-index: 2;
    margin: 20px 0;
    font-size: 1.5em;
    color: #333;
    color: greenyellow;
    display: flex;
    justify-content: center;

}

#scoreboard {
    width: 20%;
    border: 2px solid #333;
    border-radius: 10px;
    overflow: hidden;
    margin: 1%;
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
    z-index: 2;
    margin-left: 20px;
    text-align: center;
    color: greenyellow;

}

#score-list {
    z-index: 2;
    list-style-type: none;
    padding: 0;
    color: greenyellow;

}

#score-list li {
    z-index: 2;
    font-size: 1.2em;
    color: #333;
    margin: 5px 0;
    color: greenyellow;

}

button {
    z-index: 2;
    margin-top: 5%;
    padding: 10px 10px;
    font-size: 1em;
    color: white;
    background: linear-gradient(90deg, #4CAF50, #3C9E40);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 19px 9px rgba(0, 0, 0, 0.5);
    transition: background 0.3s, transform 0.2s;
}

button:hover {
    z-index: 2;
    background: linear-gradient(90deg, #45a049, #3C9E40);
}

footer {
    z-index: 2;
    margin-top: 20px;
    padding: 10px;
    text-align: center;
    background-color: #333;
    color: white;
    width: 100%;
    position: fixed;
    bottom: 0;
    font-size: 0.9em;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

footer p {
    z-index: 2;
    margin: 0;
}

@media screen and (max-width: 767px) {
    h1, h4 {
        font-size: 2.5em;
        position: static;
        text-align: center;
    }

    h2, h3 {
        font-size: 1.2em;
        text-align: center;
    }

    #rules {
        width: 95%;
        font-size: 1em;
        padding: 10px;
    }

    #board {
        width: auto;
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }

    .cell {
        font-size: 1.2em;
        padding: 2px;
    }

    .knight {
        font-size: 2em;
    }

    #player-name-end,
    #player-name {
        width: 90%;
        font-size: 1em;
    }

    #start-button,
    #reset,
    button {
        width: 90%;
        font-size: 1em;
    }

    #scoreboard {
        width: 95%;
        font-size: 1em;
        margin: 10px auto;
    }

    #score-list li {
        font-size: 1em;
    }

    #name-container,
    #mode-container {
        width: 95%;
    }

    footer {
        font-size: 0.8em;
        padding: 5px;
    }

    body {
        padding: 10px;
        justify-content: flex-start;
        background-size: cover;
    }

    #game, #all, #test {
        flex-direction: column;
        align-items: center;
        width: 100%;
        margin: 0;
    }
}
