/* Block Chess styles: dirt background, stone buttons and inventory panels, block-game style. */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "VT323", "Courier New", monospace;
    font-size: 20px;
    color: #ffffff;
    background-color: #3b2a1d;
    background-image: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), url("../images/ui/dirt.svg");
    background-size: auto, 64px 64px;
    image-rendering: pixelated;
}

.title-bar {
    padding: 20px 16px 4px;
    text-align: center;
}

.title-bar h1 {
    margin: 0;
    font-family: "Press Start 2P", monospace;
    font-size: 40px;
    color: #ffffff;
    text-shadow: 4px 4px 0 #3f3f3f;
}

.title-bar p {
    margin: 10px 0 0;
    color: #ffff55;
    text-shadow: 2px 2px 0 #3f3f15;
}

.game {
    display: flex;
    gap: 24px;
    justify-content: center;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* Board */

.board-area {
    flex: 1 1 760px;
    min-width: 0;
}

.turn-banner {
    margin-bottom: 10px;
    padding: 10px 14px;
    font-family: "Press Start 2P", monospace;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    text-shadow: 2px 2px 0 #000000;
}

.turn-white {
    color: #ffffff;
}

.turn-black {
    color: #e079fa;
}

.turn-game-over {
    color: #55ff55;
}

.board {
    width: 100%;
    border: 4px solid #000000;
    background: #87b5ff;
    cursor: pointer;
    touch-action: none;
}

.board canvas {
    display: block;
}

/* Side panel: grey inventory panels with raised edges. */

.side-panel {
    display: flex;
    flex: 0 1 300px;
    flex-direction: column;
    gap: 16px;
}

.panel-block {
    padding: 12px;
    border: 4px solid;
    border-color: #ffffff #555555 #555555 #ffffff;
    color: #3f3f3f;
    background: #c6c6c6;
    box-shadow: 0 0 0 3px #000000;
}

.panel-block h2 {
    margin: 0 0 8px;
    font-family: "Press Start 2P", monospace;
    font-size: 13px;
    color: #3f3f3f;
}

.captured-label {
    margin: 8px 0 4px;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    min-height: 40px;
}

/* A sunken inventory slot. */
.inventory-slot {
    display: inline-flex;
    width: 40px;
    height: 40px;
    border: 3px solid;
    border-color: #373737 #ffffff #ffffff #373737;
    background: #8b8b8b;
}

.inventory-slot img {
    width: 100%;
    height: 100%;
}

.move-list {
    max-height: 220px;
    margin: 0;
    padding: 6px 6px 6px 40px;
    overflow-y: auto;
    border: 3px solid;
    border-color: #373737 #ffffff #ffffff #373737;
    color: #ffffff;
    background: #8b8b8b;
    text-shadow: 2px 2px 0 #3f3f3f;
    line-height: 1.2;
    white-space: pre;
}

.panel-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Stone buttons with a light top edge and dark bottom edge. */
.block-button {
    flex: 1 1 120px;
    padding: 12px 10px;
    border: 3px solid #000000;
    font-family: "Press Start 2P", monospace;
    font-size: 11px;
    color: #ffffff;
    background-color: #7f7f7f;
    background-image: url("../images/ui/stone.svg");
    background-size: 64px 64px;
    box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.35), inset -3px -3px 0 rgba(0, 0, 0, 0.4);
    text-shadow: 2px 2px 0 #3f3f3f;
    cursor: pointer;
}

.block-button:hover {
    border-color: #ffffff;
    color: #ffffa0;
    background-image: url("../images/ui/stone-hover.svg");
}

.block-button:disabled {
    color: #a0a0a0;
    background-image: none;
    background-color: #2c2c2c;
    box-shadow: none;
    cursor: default;
}

.flip-option {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    margin-top: 4px;
    cursor: pointer;
}

.flip-option input {
    width: 18px;
    height: 18px;
    accent-color: #55aa55;
}

/* Pawn promotion */

.promotion-dialog {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
}

.promotion-dialog[hidden] {
    display: none;
}

.promotion-panel {
    max-width: 90vw;
    padding: 24px;
    border: 4px solid;
    border-color: #ffffff #555555 #555555 #ffffff;
    color: #3f3f3f;
    text-align: center;
    background: #c6c6c6;
    box-shadow: 0 0 0 3px #000000;
}

.promotion-panel h2 {
    margin-top: 0;
    font-family: "Press Start 2P", monospace;
    font-size: 15px;
    line-height: 1.5;
}

.promotion-choices {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.promotion-choice {
    width: 84px;
    height: 84px;
    padding: 4px;
    border: 3px solid;
    border-color: #373737 #ffffff #ffffff #373737;
    background: #8b8b8b;
    cursor: pointer;
}

.promotion-choice:hover {
    background: #c5c5ff;
}

.promotion-choice img {
    width: 100%;
    height: 100%;
}

/* Phones and narrow windows: stack the panel under the board. */
@media (max-width: 900px) {
    .game {
        flex-direction: column;
        align-items: stretch;
    }

    .board-area,
    .side-panel {
        flex-basis: auto;
    }

    .title-bar h1 {
        font-size: 26px;
    }
}
