/* author Jacek Byzdra https://www.linkedin.com/in/jacek-byzdra/ */

:root {
    --light-square: #ebd1a7;
    --dark-square: #b27b4f;
    --highlight-color: #ffeb3b;
    --check-color: #ff4136;
    --button-bg: #006991;
    --button-hover-bg: #1d4b77;
    --button-disabled-bg: #208f8a;
    --font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}
body {
    font-family: var(--font-family);
    margin: 0;
    background-color: #333;
    color: #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    user-select: none;
    padding: 0;
}
.top {
    margin-bottom: 5px;
    margin-top: 10px;
}
.top a{
     color: #eee;
}
h1 {
    margin: 12px 0 10px;
    font-weight: 700;
    font-size: 2rem;
    text-align: center;
}
#game-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 1100px;
    margin-bottom: 16px;
}
#chessboard-container {
    position: relative;
    flex-shrink: 0;
    width: fit-content;
    max-width: 100%;
    user-select: none;
}

.row-label-left {
    grid-column: 1;
    font-size: 20px;
    line-height: 60px;
    text-align: center;
    font-weight: 700;
    color: #c7c7c7;
}
.row-label-right {
    grid-column: 10;
    font-size: 20px;
    line-height: 60px;
    text-align: center;
    font-weight: 700;
    color: #c7c7c7;
}
.col-label-top {
    grid-row: 1;
    font-size: 20px;
    text-align: center;
    font-weight: 700;
    color: #c7c7c7;
    line-height: 30px;
}
.col-label-bottom {
    grid-row: 10;
    font-size: 20px;
    text-align: center;
    font-weight: 700;
    color: #c7c7c7;
    line-height: 30px;
}

#board {
    display: grid;
    grid-template-columns: 30px repeat(8, 60px) 30px;
    grid-template-rows: 30px repeat(8, 60px) 30px;
    background-color: #222;
    border: 3px solid #f0a500;
    border-radius: 10px;
}
.square {
    width: 7.5vw;
    max-width: 60px;
    height: 7.5vw;
    max-height: 60px;
    line-height: 7.5vw;
    font-size: 7vw;
    text-align: center;
    vertical-align: middle;
    cursor: default;
    transition: background-color 0.3s ease;
    user-select: none;
    touch-action: manipulation;
    box-sizing: border-box;
}
.light {
    background-color: var(--light-square);
}
.dark {
    background-color: var(--dark-square);
}
.square.highlight {
    background-color: var(--highlight-color);
}
.square.check {
    background-color: var(--check-color);
    color: white;
    font-weight: 700;
}


#controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #222;
    padding: 12px;
    border-radius: 8px;
    width: 300px;
    box-shadow: 3px 3px 8px #000a;
}

#game-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;

}



button {
    flex: 1 1 120px;
    padding: 8px 12px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--button-bg);
    color: var(--button-color);
    transition: background-color 0.3s;
    user-select: none;
}
button:hover:not(:disabled) {
    background-color: var(--button-hover-bg);
}
button:disabled {
    background-color: var(--button-disabled-bg);
    cursor: not-allowed;
}


#info-panel {

    padding: 0 12px;
    background-color: var(--info-bg);
    border-radius: 5px;
    min-height: 2.5em;
    font-size: 14px;
    line-height: 1.3em;
}
#info-panel p {
    margin: 2px 0;
    word-break: break-word;
}


#captured-container {

    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 12px;
}
.captured-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.captured-label {
    font-weight:500;
    font-size: 14px;
    color: white;
    margin-bottom: 2px;
}


#captured-info span {
    display: inline-block;
    font-size: 1.2rem;
    margin-right: 10px;
    vertical-align: middle;
}
#status {
    margin-top: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    min-height: 24px;
    word-wrap: break-word;
}

#history-container {
    max-width: 600px;
    max-height: 320px;
    overflow-y: auto;
    background-color: #222;
    padding: 10px;
    border-radius: 6px;
    margin-top: 15px;
    word-break: break-word;
}
#history-container h2 {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    text-align: center;
}
#history-list {
    font-family: monospace;
    font-size: 0.875rem;
    line-height: 1.4em;
    color: #ccc;
    outline-offset: 0;
    outline: none;
    max-height: 280px;
    overflow-y: auto;
}
#history-list p {
    margin: 2px 0;
    user-select: text;
}


@media (min-width: 901px) {
    #game-container {
        display: flex;
        width: 100%;
        max-width: 100vw;
        margin-bottom: 16px;
        padding: 12px;
        justify-content: 0;
    }

    #chessboard-container {
        float: left;
    }

    #board {
        display: grid;
        grid-template-columns: 1.5vw repeat(8, 3vw) 1.5vw;
        grid-template-rows: 1.5vw repeat(8, 3vw) 1.5vw;
        background-color: #222;
        border: 3px solid #f0a500;
        border-radius: 10px;
    }
    .square {
        width: 3vw;
        height: 3vw;
        line-height: 3vw;
        font-size: 2.2vw;
        max-width: 5vw;
        max-height: 5vw;
    }
    
   .square img {
	width: 2vw;
	height: 2vw;
}
    .label-square {
        font-size: 1.7vw;
        height: 3vw;
        width: 3vw;
        min-width: none;
    }

    #history-container {
        max-width: 90vw;
    }

    button {
        font-size: 0.8rem;
    }

    .row-label-left,
    .row-label-right,
    .col-label-top,
    .col-label-bottom {
        font-size: 1.5vw;
        line-height: 1.5vw;
    }
}
@media (max-width: 900px) {
    #game-container {
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 100vw;
        margin-bottom: 16px;
    }
    #board {
        display: grid;
        grid-template-columns: 5vw repeat(8, 10vw) 5vw;
        grid-template-rows: 5vw repeat(8, 10vw) 5vw;
        background-color: #222;
        border: 3px solid #f0a500;
        border-radius: 10px;
    }
    .square {
        width: 10vw;
        height: 10vw;
        line-height: 10vw;
        font-size: 9vw;
        max-width: 15vw;
        max-height: 15vw;
    }
    .square img {
	width: 8vw;
	height: 8vw;
}
    .label-square {
        font-size: 6vw;
        height: 10vw;
        width: 10vw;
        min-width: none;
    }

    #history-container {
        max-width: 90vw;
    }

    .row-label-left,
    .row-label-right,
    .col-label-top,
    .col-label-bottom {
        font-size: 4vw;
        line-height: 4vw;
    }
}
@media (max-width: 600px) {
    #game-container {
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 100vw;
        margin-bottom: 16px;
    }
    #board {
        display: grid;
        grid-template-columns: 5vw repeat(8, 10vw) 5vw;
        grid-template-rows: 5vw repeat(8, 10vw) 5vw;
        background-color: #222;
        border: 3px solid #f0a500;
        border-radius: 10px;
    }
    .square {
        width: 10vw;
        height: 10vw;
        line-height: 10vw;
        font-size: 9vw;
        max-width: 15vw;
        max-height: 15vw;
    }
   .square img {
	width: 8vw;
	height: 8vw;
}
    .label-square {
        font-size: 6vw;
        height: 10vw;
        width: 10vw;
        min-width: none;
    }

    #history-container {
        max-width: 90vw;
    }

    .row-label-left,
    .row-label-right,
    .col-label-top,
    .col-label-bottom {
        font-size: 4vw;
        line-height: 4vw;
    }
}
@media (max-width: 430px) {
    #game-container {
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 100vw;
        margin-bottom: 16px;
    }
    #board {
        display: grid;
        grid-template-columns: 5vw repeat(8, 10vw) 5vw;
        grid-template-rows: 5vw repeat(8, 10vw) 5vw;
        background-color: #222;
        border: 3px solid #f0a500;
        border-radius: 10px;
    }
    .square {
        width: 10vw;
        height: 10vw;
        line-height: 10vw;
        font-size: 9vw;
        max-width: 15vw;
        max-height: 15vw;
    }
    .square img {
	width: 8vw;
	height: 8vw;
}
    .label-square {
        font-size: 6vw;
        height: 10vw;
        width: 10vw;
        min-width: none;
    }

    #history-container {
        max-width: 90vw;
    }

    .row-label-left,
    .row-label-right,
    .col-label-top,
    .col-label-bottom {
        font-size: 4vw;
        line-height: 4vw;
    }
}