/* author Jacek Byzdra https://www.linkedin.com/in/jacek-byzdra/ */
/* Reset some default margins */
body,
h1,
h2,
div,
button {
    margin: 0;
    padding: 0;
}
body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #efefef;
    user-select: none;
    min-height: 100vh;
    box-sizing: border-box;
    padding: 10px 10px 40px;
}
.top {
    margin-bottom: 10px;
    margin-top: 10px;
}
.title {
    color: dodgerblue;
}

#title {
    font-family: Arial, sans-serif;
    color: blue;
}

h1 {
    margin-bottom: 10px;
    font-size: 1.8rem;
    text-align: center;
}
h2 {
    font-weight: normal;
    font-size: 1.2rem;
    margin-bottom: 12px;
    text-align: center;
    color: #333;
}

#board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-gap: 2px;
    border: 5px solid #5a381e;
    background-color: #5a381e;
    /* max-width to keep aspect ratio */
    max-width: 75vw;
    max-height: 75vw;
    width: 75vw;
    height: 75vw;
    box-sizing: border-box;
}

.square {
    width: 100%; /* full cell width */
    aspect-ratio: 1 / 1; /* keep square */
    position: relative;
    user-select: none;
}

.square.white {
    background-color: #f0d9b5;
}

.square.black {
    background-color: darkslategray;
    cursor: pointer;
}

.square.black.highlight {
    box-shadow: 0 0 4px 3px #bcf5aa inset;
    cursor: pointer;
}

.piece {
    width: 82%;
    height: 82%;
    border-radius: 50%;
    margin: 9% auto;
    position: relative;
    cursor: pointer;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease;
}

.piece.red {
    background-color: #cb0808;
    border: 1.5px solid #23ff02;
}

.piece.white-piece {
    background-color: #fbfbfb;

    border: 1.5px solid black;
}

/* King indicator */
.piece.king::after {
    content: "⊚";
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    color: #00ddff;
    font-weight: bold;
    pointer-events: none;
    user-select: none;
}

#message {
    margin-top: 15px;
    font-size: 1.25rem;
    font-weight: 600;
    min-height: 1.5em;
    color: blue;
    text-align: center;
    width: 100%;
    max-width: 520px;
}

#captured-info {
    color: black;
    text-align: center;
    margin-top: 6px;
    font-size: 1rem;
    min-height: 1.4em;
    width: 100%;
    max-width: 520px;
}

button {
    border-radius: 25px;
    font-family: Helvetica, Arial, sans-serif;
    color: #ffffff;
    font-size: 1rem;
    padding: 8px 16px;
    text-decoration: none;
    border-bottom: 5px solid #19608f;
    border-top: none;
    border-left: none;
    border-right: none;
    background: linear-gradient(#3498db, #217dba);
    box-shadow: 0px 2px 10px grey;
    transition: 150ms ease;
    margin-top: 25px;
    cursor: pointer;
    outline-offset: 2px;
    width: 160px;
    max-width: 90vw;
    user-select: none;
}

button:active,
button:focus-visible {
    border: none;
    border-bottom: 2px solid #19608f;
    box-shadow: 0px 1px 5px grey;
    background: linear-gradient(#2489cc, #2283c3);
    color: #fff;
}

/* Responsive adjustments */
@media (min-width: 1681px) {
    #board {
        max-width: 30vw;
        height: 30vw;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.1rem;
    }

    #captured-info {
        font-size: 0.95rem;
    }

    button {
        width: 140px;
        font-size: 0.95rem;
        padding: 7px 12px;
        margin-top: 22px;
    }
    .piece.king::after {
        top: 5px;
        left: 50%;
        font-size: 30px;
    }
}

@media (max-width: 1680px) {
    #board {
        max-width: 30vw;
        height: 30vw;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.1rem;
    }

    #captured-info {
        font-size: 0.95rem;
    }

    button {
        width: 140px;
        font-size: 0.95rem;
        padding: 7px 12px;
        margin-top: 22px;
    }
    .piece.king::after {
        top: 5px;
        left: 50%;
        font-size: 30px;
    }
}

@media (max-width: 1440px) {
    #board {
        max-width: 30vw;
        height: 30vw;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.1rem;
    }

    #captured-info {
        font-size: 0.95rem;
    }

    button {
        width: 140px;
        font-size: 0.95rem;
        padding: 7px 12px;
        margin-top: 22px;
    }
    .piece.king::after {
        top: 5px;
        left: 50%;
        font-size: 20px;
    }
}

@media (max-width: 1367px) {
    #board {
        max-width: 30vw;
        height: 30vw;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.1rem;
    }

    #captured-info {
        font-size: 0.95rem;
    }

    button {
        width: 140px;
        font-size: 0.95rem;
        padding: 7px 12px;
        margin-top: 22px;
    }
    .piece.king::after {
        top: 5px;
        left: 50%;
        font-size: 20px;
    }
}
@media (max-width: 1280px) {
    #board {
        max-width: 30vw;
        height: 30vw;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.1rem;
    }

    #captured-info {
        font-size: 0.95rem;
    }

    button {
        width: 140px;
        font-size: 0.95rem;
        padding: 7px 12px;
        margin-top: 22px;
    }

    .piece.king::after {
        top: 1px;
        left: 50%;
        font-size: 12px;
    }
}

@media (max-width: 1176px) {
    #board {
        max-width: 30vw;
        height: 30vw;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.5rem;
    }

    #captured-info {
        font-size: 1rem;
    }

    button {
        width: 140px;
        font-size: 1rem;
        padding: 7px 12px;
        margin-top: 22px;
    }
    .piece.king::after {
        top: 5px;
        left: 50%;
        font-size: 11px;
    }
}

@media (max-width: 1023px) {
    #board {
        max-width: 100vw;
        height: 100vw;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.5rem;
    }

    #captured-info {
        font-size: 1rem;
    }

    button {
        width: 140px;
        font-size: 1rem;
        padding: 7px 12px;
        margin-top: 22px;
    }
    .piece.king::after {
        top: 5px;
        left: 50%;
        font-size: 25px;
    }
}

@media (max-width: 820px) {
    #board {
        max-width: 100vw;
        height: 100vw;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.5rem;
    }

    #captured-info {
        font-size: 1rem;
    }

    button {
        width: 140px;
        font-size: 1rem;
        padding: 7px 12px;
        margin-top: 22px;
    }
    .piece.king::after {
        top: 5px;
        left: 50%;
        font-size: 25px;
    }
}

@media (max-width: 650px) {
    #board {
        max-width: 98vw;
        height: 98vw;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    #message {
        font-size: 1.1rem;
    }

    #captured-info {
        font-size: 0.95rem;
    }

    button {
        width: 140px;
        font-size: 0.95rem;
        padding: 7px 12px;
        margin-top: 22px;
    }
    .piece.king::after {
        top: 1px;
        left: 50%;
        font-size: 12px;
    }
}

@media (max-width: 430px) {
    #board {
        max-width: 120vw;
        height: 120vw;
    }

    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 0.9rem;
    }

    #message {
        font-size: 1rem;
    }

    #captured-info {
        font-size: 0.85rem;
    }

    button {
        width: 120px;
        font-size: 0.9rem;
        padding: 6px 10px;
        margin-top: 20px;
    }
    .piece.king::after {
        top: 1px;
        left: 50%;
        font-size: 15px;
    }
}
