.board-game {
    --ink: #254c45;
    --cream: #fff6dc;
    color: var(--ink);
}
.bg-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 12px 0;
}
.board-game button:not(.bg-board button) {
    border: 2px solid #527c69;
    border-radius: 12px;
    background: linear-gradient(#fffdf3, #eadbb9);
    color: #254c45;
    padding: 10px 15px;
    min-height: 44px;
    font-weight: 700;
    box-shadow: 0 4px 0 #6f8063;
    cursor: pointer;
    transition:
        transform 0.1s,
        box-shadow 0.1s;
}
.board-game button:not(.bg-board button):active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #6f8063;
}
.board-game button[aria-pressed='true']:not(.bg-board button) {
    background: linear-gradient(#467e66, #27513e);
    color: white;
}
.board-game button:disabled {
    cursor: default;
    opacity: 0.55;
}
.board-game :focus-visible {
    outline: 3px solid #e59d37;
    outline-offset: 3px;
}
.board-game select,
.board-game input {
    border: 2px solid #7b927c;
    border-radius: 8px;
    min-height: 42px;
    padding: 6px;
    max-width: 160px;
    background: #fffdf6;
    color: #254c45;
    margin-left: 8px;
}
.bg-status {
    padding: 12px 16px;
    background: #e7eed7;
    border-radius: 12px;
    font-weight: bold;
}
.bg-feedback {
    color: #a33c28;
}
.bg-layout {
    display: grid;
    grid-template-columns: minmax(0, 540px) minmax(150px, 1fr);
    gap: 20px;
    align-items: start;
}
.bg-board {
    display: grid;
    aspect-ratio: 1;
    grid-template-columns: repeat(8, 1fr);
    border: 8px solid #9b7045;
    border-radius: 12px;
    overflow: hidden;
    background: #497e65;
    box-shadow: 0 6px 12px #23382b33;
}
.bg-board button {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    padding: 0;
    border: 1px solid #244b3a66;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    aspect-ratio: 1;
    cursor: pointer;
    opacity: 1 !important;
}
.bg-piece {
    width: 79%;
    height: 79%;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: clamp(14px, 3vw, 28px);
}
.bg-board .occupied.one .bg-piece {
    background: radial-gradient(circle at 30% 25%, #f3b373, #ac4e2d 70%);
    box-shadow:
        inset 0 -4px 2px #743321,
        0 3px 4px #0005;
    border: 2px solid #8a492b;
    color: #fff2bc;
}
.bg-board .occupied.two .bg-piece {
    background: radial-gradient(circle at 30% 25%, #b6e5e5, #36869d 70%);
    box-shadow:
        inset 0 -4px 2px #285265,
        0 3px 4px #0005;
    border: 2px solid #39788b;
    color: #fff2bc;
}
.bg-board.reversi .one .bg-piece {
    background: radial-gradient(circle at 30% 25%, #777, #171d20 70%);
    border-color: #111;
}
.bg-board.reversi .two .bg-piece {
    background: radial-gradient(circle at 30% 25%, white, #dad8cc 70%);
    border-color: #ccc;
}
.bg-board .legal:not(.occupied):after {
    content: '';
    position: absolute;
    width: 24%;
    height: 24%;
    background: #ffe998;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #314c3250;
}
.bg-board .selected {
    box-shadow: inset 0 0 0 4px #ffe487;
}
.bg-board .last .bg-piece {
    outline: 3px solid #ffe487;
    outline-offset: -3px;
}
.bg-board.checkers button {
    background: #765339;
}
.bg-board.checkers button:nth-child(16n + 1),
.bg-board.checkers button:nth-child(16n + 3),
.bg-board.checkers button:nth-child(16n + 5),
.bg-board.checkers button:nth-child(16n + 7),
.bg-board.checkers button:nth-child(16n + 10),
.bg-board.checkers button:nth-child(16n + 12),
.bg-board.checkers button:nth-child(16n + 14),
.bg-board.checkers button:nth-child(16n + 16) {
    background: #e6cf9e;
}
.bg-board.connect4 {
    grid-template-columns: repeat(7, 1fr);
    aspect-ratio: 7/6;
    background: #416f99;
}
.bg-board.connect4 button:not(.occupied) .bg-piece {
    background: #234966;
    box-shadow: inset 0 4px 6px #163146;
}
.bg-columns {
    display: flex;
    gap: 4px;
    grid-column: 1;
    padding: 0 8px;
}
.bg-columns button {
    flex: 1;
    min-width: 0;
    padding: 4px !important;
}
.bg-columns + .bg-board-viewport {
    grid-column: 1;
    grid-row: 2;
}
.bg-columns ~ .bg-guide {
    grid-column: 2;
    grid-row: 1 / span 2;
}
.bg-board.chinese-checkers {
    position: relative;
    display: block;
    background: radial-gradient(ellipse, #f9edc9, #d8bf87);
    overflow: visible;
}
.bg-board.chinese-checkers .bg-hole {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 5%;
    height: 5%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid #a08c69;
    background: #a3927088;
    box-shadow: inset 0 2px 3px #655c48;
}
.bg-board.chinese-checkers .bg-piece {
    width: 95%;
    height: 95%;
}
.bg-board.chinese-checkers .camp-one {
    background: #d49667aa;
}
.bg-board.chinese-checkers .camp-two {
    background: #74acbdaa;
}
.bg-guide {
    background: #f5edd9;
    padding: 15px;
    border-radius: 12px;
    line-height: 1.6;
}
.board-game [hidden] {
    display: none !important;
}
@media (max-width: 700px) {
    .bg-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .bg-board {
        border-width: 5px;
    }
    .bg-guide {
        font-size: 14px;
    }
    .bg-columns ~ .bg-guide {
        grid-column: 1;
        grid-row: 3;
    }
    .bg-controls {
        gap: 8px;
    }
    .board-game button:not(.bg-board button) {
        padding: 9px 12px;
    }
    .board-game select,
    .board-game input {
        max-width: 120px;
    }
}

.bg-board-viewport {
    min-width: 0;
    overflow: auto;
    padding: 3px 3px 10px;
}
.bg-board-viewport.enlarged .bg-board {
    width: 560px;
}
.bg-board-viewport.enlarged {
    max-height: 65vh;
}
