﻿/* Xiangqi board (Pages/Xiangqi/_XiangqiBoard.cshtml + wwwroot/js/xiangqi.js) */

.xiangqi-whole-board {
    position: relative;
    width: fit-content;
    max-width: 100%;
}

.xiangqi-outer-board {
    padding: 50px;
    background: #eb5;
}

.xiangqi-inner-board {
    padding: 10px;
    border: 1px solid black;
}

/* Sized in px by setBoardSize(); the svg and the pieces layer fill it exactly. */
.xiangqi-board-container {
    position: relative;
    width: 400px;
    height: 450px;
}

.xiangqi-board-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.xiangqi-pieces-layer {
    position: absolute;
    inset: 0;
}

/* Pieces, move circles and highlights are positioned with left/top percentages by xiangqi.js. */
.xiangqi-image {
    position: absolute;
    width: 10%;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
}

.xiangqi-static .xiangqi-image {
    cursor: default;
    touch-action: auto;
}

.xiangqi-selected {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9));
}

.xiangqi-circle {
    position: absolute;
    width: 5%;
    opacity: 0.5;
    cursor: pointer;
    z-index: 500;
    user-select: none;
    -webkit-user-drag: none;
}

.xiangqi-highlight {
    position: absolute;
    width: 11%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    pointer-events: none;
}

.xiangqi-clue {
    background-color: var(--green-blue, #3fa7a0);
    box-shadow: 0 0 12px 4px var(--green-blue, #3fa7a0);
    opacity: 0.85;
}

.daily-header {
    background-color: var(--bs-gray-900);
}

/* Refresh and Next are boxes with a cut-out icon. Match them to the royal Clue / Skip / Share icons in the footer. */
.xiangqi-footer .refresh-box,
.xiangqi-footer .next-svg-container {
    background: var(--royal) !important;
}

    .xiangqi-footer .refresh-box path,
    .xiangqi-footer .next-svg-container path {
        fill: var(--bs-gray-900);
    }

.xiangqi-header {
    min-height: 0;
    padding: 8px 20px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

    .xiangqi-header p {
        font-size: 1.3rem;
    }

.xiangqi-no-puzzles {
    max-width: 600px;
    margin: 80px auto;
    border-radius: 5px;
}

.xiangqi-win {
    background-color: var(--bs-gray-900);
    z-index: 10000;
}

/* Footer under the puzzle board: the page sets an inline height of 98px, but on phones the status text and the
   buttons wrap onto two rows and overflowed it (iPhone SE). Let it grow, keep the text on one line, and give it room. */
.xiangqi-footer {
    height: auto !important;
    min-height: 98px;
}

@media screen and (max-width: 800px) {
    .xiangqi-footer {
        padding: 18px 10px 22px;
    }

        .xiangqi-footer .button-spacing {
            gap: 14px 35px;
        }

        .xiangqi-footer .colour {
            flex-basis: 100%;
            white-space: nowrap;
            font-size: clamp(19px, 6vw, 25px) !important;
        }

        .xiangqi-footer .share-row-container {
            width: 40px;
            flex-shrink: 0;
        }
}

/* Piece style picker (Puzzles page) - sits above the board header, right-aligned to the board width */
.xiangqi-piece-style {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.xiangqi-piece-style-label {
    margin: 0;
    font-family: Hamlin;
    font-size: 14px;
    color: white;
}

.xiangqi-piece-style-select {
    font-family: Hamlin;
    font-size: 14px;
    color: white;
    background-color: var(--dark-green);
    border: none;
    border-radius: 5px;
    padding: 3px 8px;
    cursor: pointer;
}

    .xiangqi-piece-style-select:hover,
    .xiangqi-piece-style-select:focus-visible {
        background-color: var(--luxury-green);
    }
