/* 中国象棋 */

.game-root--chess { padding: 2px; }

.ch-wrap {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 14px;
    padding: 4px;
}

.ch-board-wrap {
    position: relative;
    flex: 0 1 auto;
    width: min(100%, 372px);
}

#ch-board {
    display: block;
    width: 100%;
    aspect-ratio: 9 / 10;
    height: auto;
    border-radius: 6px;
    border: 2px solid #4a3a23;
    box-shadow:
        0 0 0 1px #0a0806,
        0 0 34px rgba(233, 185, 73, .08),
        inset 0 0 28px rgba(0, 0, 0, .5);
    cursor: pointer;
    touch-action: manipulation;
}

.ch-flash {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    font-family: var(--font-hei);
    font-size: 30px;
    font-weight: 900;
    letter-spacing: .3em;
    color: #ff6a58;
    text-shadow: 0 0 24px rgba(255, 90, 68, .6);
    opacity: 0;
}

.ch-flash.is-on { animation: ch-flash 1s ease; }

@keyframes ch-flash {
    0% { opacity: 0; transform: scale(.8); }
    20% { opacity: 1; transform: scale(1.04); }
    75% { opacity: .9; }
    100% { opacity: 0; transform: scale(1); }
}

.ch-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 196px;
    flex: 0 0 auto;
}

.ch-statusbox {
    padding: 9px 11px;
    border: 1px solid #2c4633;
    border-radius: 5px;
    background: rgba(8, 18, 12, .8);
}

.ch-statusbox__label {
    display: block;
    font-size: 7.5px;
    letter-spacing: .22em;
    color: #4d6b55;
}

.ch-statusbox b {
    display: block;
    margin-top: 2px;
    font-family: var(--font-hei);
    font-size: 15px;
    letter-spacing: .1em;
    color: var(--gold);
}

.ch-statusbox b.is-check { color: #ff7b68; }

.ch-statusbox em {
    display: block;
    margin-top: 2px;
    font-family: var(--font-ui);
    font-size: 10px;
    font-style: normal;
    color: #8aa994;
}

.ch-actions { display: flex; flex-direction: column; gap: 5px; }

.ch-btn {
    padding: 7px 8px;
    font-family: var(--font-ui);
    font-size: 10.5px;
    letter-spacing: .06em;
    color: #c8f5d0;
    background: linear-gradient(180deg, #16261b, #0b1610);
    border: 1px solid #2f4d38;
    border-radius: 4px;
    cursor: pointer;
    transition: .14s ease;
}

.ch-btn:hover {
    border-color: var(--phosphor-dim);
    color: #e8ffe9;
    box-shadow: 0 0 16px rgba(141, 240, 161, .1);
}

.ch-btn:disabled { opacity: .35; cursor: default; box-shadow: none; }

.ch-history {
    flex: 1;
    min-height: 120px;
    max-height: 210px;
    display: flex;
    flex-direction: column;
    border: 1px solid #223a2a;
    border-radius: 5px;
    background: rgba(4, 10, 7, .7);
    overflow: hidden;
}

.ch-history__head {
    display: flex;
    justify-content: space-between;
    padding: 5px 9px;
    font-size: 8.5px;
    letter-spacing: .12em;
    color: #6f9a7d;
    border-bottom: 1px solid #223a2a;
}

.ch-history__head em { font-style: normal; color: #4d6b55; }

.ch-history__list {
    flex: 1;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    overflow-y: auto;
    counter-reset: ply;
}

.ch-history__list li {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 3px 9px;
    font-size: 10.5px;
    color: #a9c6b2;
    counter-increment: ply;
}

.ch-history__list li::before {
    content: counter(ply, decimal-leading-zero);
    font-family: var(--font-pixel);
    font-size: 8px;
    color: #43614b;
}

.ch-history__list li.is-r b { color: #ff8a78; }
.ch-history__list li.is-b b { color: #c8f5d0; }

.ch-history__list b { font-weight: 400; font-family: var(--font-kai); font-size: 12px; }

.ch-note {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 9px;
    line-height: 1.6;
    color: #557a62;
}

.ch-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(3, 8, 5, .85);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: .2s ease;
}

.ch-overlay.is-on { opacity: 1; visibility: visible; }

.ch-overlay__box {
    padding: 20px 28px;
    text-align: center;
    border: 2px solid var(--gold);
    border-radius: 8px;
    background: linear-gradient(180deg, #122016, #08110b);
    box-shadow: 0 0 0 4px rgba(233, 185, 73, .06);
}

.ch-overlay h2 {
    margin: 0 0 4px;
    font-family: var(--font-hei);
    font-size: 24px;
    letter-spacing: .12em;
    color: var(--gold);
}

.ch-overlay p { margin: 0; font-family: var(--font-ui); font-size: 11px; color: #8fae97; }

@media (max-width: 880px) {
    .ch-wrap { flex-direction: column; align-items: center; }
    .ch-side {
        width: 100%;
        max-width: 372px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .ch-history { grid-column: 1 / -1; max-height: 130px; min-height: 90px; }
    .ch-note { grid-column: 1 / -1; }
    .ch-actions { flex-direction: row; flex-wrap: wrap; }
    .ch-actions .ch-btn { flex: 1; }
}

@media (max-width: 480px) {
    .ch-side { max-width: 100%; }
    .ch-statusbox b { font-size: 13px; }
    .ch-board-wrap { width: 100%; }
}
