/* ;-; */

:root {
    --light-square: #f3e9d2;
    --dark-square: #795842;
    --highlight: #eeff00;

    --overlay-background: #242424;
}

section {
    display: flex;
    max-width: 1000px;
    justify-content: center;
    margin-top: 4rem;
}

/* Board */
/* #region */
#boardcontainer {
    position: relative;
    margin: auto;
    max-width: 650px;
}

#chessboard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    aspect-ratio: 1 / 1;
    max-width: 800px;
}

.square {
    display: flex;
    width: 100%;
    aspect-ratio: 1 / 1;
    justify-content: center;
    align-items: center;
}

.light {
    background-color: var(--light-square);
}

.dark {
    background-color: var(--dark-square);
}

.highlight.light:not(.selectattack) {
    background-color: color-mix(in srgb, var(--light-square), var(--highlight) 15%);
}

.highlight.dark:not(.selectattack) {
    background-color: color-mix(in srgb, var(--dark-square), var(--highlight) 15%);
}

.square svg {
    border-radius: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#chessboard, .square, .square svg {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.square.lightwin {
    outline: 5px outset white;
    outline-offset: -5px;
}

.square.darkwin {
    outline: 5px outset black;
    outline-offset: -5px;
}
/* #endregion */

/* Overlays and Bars */
/* #region */
#overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1rem;
    background: var(--overlay-background);
    border-radius: 4px;
    z-index: 3;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

#bar_header, #bar_footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--overlay-background);
}

/* Header */
#bar_header {
    border-radius: 6px 6px 0 0;
}

#bar_footer {
    border-radius: 0 0 6px 6px;
}

#bar_header>aside {
    font-size: 1.1em;
    padding: 0.4rem 0.5rem;
}

#bar_header>button {
    height: 100%;
    padding: 0, 0.8rem;
    margin-right: 0.3rem;
}

/* Footer */
#bar_footer {
    display: flex;
    padding: 0.4rem 0.5rem;
    gap: 0.3rem;
}

.piece {
    background: var(--overlay-background);
    border: 1px solid #666;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
}

.piece.selected {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

#bar_footer span {
    font-weight: bold;
    color: white;
    font-size: 3em;
    min-width: 3.5ex;
}

.piece_container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
}

.pregame_buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (max-width: 500px) {

    #bar_footer span {
        font-size: 2em;
    }

    .piece {
        padding: 0.2rem 0.5rem;
    }
}

@media (max-width: 410px) {
    #bar_footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .pregame_buttons {
        flex-direction: row-reverse;
    }
}
/* #endregion */

/* Highlighting */
/* #region */
.move, .hoverattack, .selectattack {
    position: relative;
}

.hoverattack:not(.move)::after, .selectattack:not(.move)::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    border: 4px solid rgba(128, 128, 128, 0.4);
    pointer-events: none;
}

.selectattack:hover::after {
    border-color: var(--accent) !important;
}

.move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    border-radius: 50%;
    border: 4px solid rgba(128, 128, 128, 0.4);
    background-color: color-mix(in srgb, var(--accent), transparent 60%);
    pointer-events: none;
}

.move:hover::after {
    width: 50%;
    height: 50%;
}

.move, .selectattack {
    cursor: pointer;
}

.square:has(svg) {
    cursor: pointer;
}

@media (max-width: 600px) {
    .hoverattack::after {
        border: 2px solid rgba(128, 128, 128, 0.288);
    }
}
/* #endregion */

/* Banner */
/* #region */
.banner {
    flex-direction: column;
    justify-content: center;
    margin-bottom: 0;
}
/* #endregion */
