* {
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background: #242424;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.board {
    width: 85vh;
    height: 85vh;
    display: flex;
    position: absolute;
    left: 5vh;
    top: 50%;
    transform: translateY(-50%);
    background-color: black;
}

.timer-container {
    position: absolute;
    left: 52%;
    height: 75vh;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.timer {
    background-color: #333;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 2.2rem;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 5px;
    border: 2px solid #555;
    min-width: 140px;
    text-align: center;
}

#timer-black {
    border-top: 4px solid #555;
}

#timer-white {
    background-color: #eee;
    color: #222;
}

.settings {
    width: 28%;
    height: 85vh;
    position: absolute;
    right: 5vh;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgb(111, 111, 111);
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.gamemode, .difficulty, .time, .color, .start {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

h2 {
    width: 100%;
    font-size: 1.2rem;
    margin-bottom: 10px;
    margin-top: 5px;
}

.gamemode-btn, .dif-but, .time-btn, .color-btn, .start-btn {
    color: white;
    background-color: #8a8a8a;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.3s;
    padding: 10px;
}

.gamemode-btn {
    width: 35%;
    height: 5vh;
}

.time-btn {
    width: 28%; 
    padding: 10px 0;
}

.dif-but {
    width: 12vh;
    height: 5vh;
}

.start-btn {
    width: 90%;
    background-color: #4CAF50;
    font-weight: bold;
    padding: 15px;
}

button:hover {
    background-color: #a0a0a0;
    border-color: white;
}



#An, #Bn, #Cn, #Dn, #En, #Fn, #Gn, #Hn {
    display: flex;
    flex-direction: column;
    width: 12.5%;
}

.board-square {
    width: 100%;
    height: 12.5%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-square:hover {
    border: 5px solid rgb(10, 145, 0);
}

.pieces.active {
    transform: translateY(-10px);
}

.pieces {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.white { background-color: rgb(219, 217, 175); }
.black { background-color: rgb(121, 121, 121); }

.black span {
    color: white;
}

.number { position: absolute; top: 2px; left: 4px; font-size: 14px; }
.letter { position: absolute; bottom: 2px; right: 4px; font-size: 14px; }

.pieces.out {
  display: none;
}

.check-warning {
    background-color: rgba(255, 0, 0, 0.3) !important;
}

.active-sq {
    background-color: rgba(125, 255, 125, 0.5) !important;
}

.highlight {
    border: rgba(60, 134, 3, 0.4) 5px solid !important;
    cursor: pointer;
    position: relative;
}

.highlight::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.promotion-menu {
    position: absolute;
    background: rgb(92, 92, 92);
    border: 2px solid black;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.promotion-option {
    width: 50px;
    height: 50px;
    cursor: pointer;
    padding: 5px;
}
.promotion-option:hover {
    background: #a5bb85;
}



@media (max-width: 1100px) {
    body {
        flex-direction: column;
        justify-content: flex-start;
        padding: 15px;
    }

    .board, .timer-container, .settings {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
        margin: 0 auto;
    }

    .timer-container {
        order: 1;
        width: 100%;
        max-width: 500px;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        margin-bottom: 15px;
    }

    .timer {
        font-size: 1.5rem;
        min-width: 100px;
        padding: 6px 12px;
    }

    .board {
        order: 2;
        width: 92vw;
        height: 92vw;
        max-width: 500px;
        max-height: 500px;
        margin-bottom: 20px;
    }

    .settings {
        order: 3;
        width: 100%;
        max-width: 500px;
        height: auto;
        gap: 15px;
        padding: 15px;
    }

    .gamemode-btn, .dif-but, .time-btn, .color-btn {
        flex: 1 1 calc(33% - 10px);
        min-width: 70px;
        font-size: 0.9rem;
    }
}

.flipped {
    transform: translateY(-50%) rotate(180deg);
}

.flipped .number,
.flipped .letter {
    transform: rotate(180deg);
}

.flipped .pieces {
    transform: rotate(180deg);
}