/* ===== WP Cờ Vua – Styles =====
   Chỉ phần riêng của Cờ Vua (bàn chessboard.js, gợi ý nước đi, phong cấp, báo chiếu).
   Token + component dùng chung nằm ở wp-choico-core/assets/css/choico-games.css */

/* Biểu tượng quân trong thẻ người chơi */
.chess-icon { flex-shrink: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
              border-radius: 50%; font-size: var(--cc-fs-base); line-height: 1;
              background: var(--cc-fill-2); border: 1px solid var(--cc-line-strong); }
.chess-icon.side-w { color: #fff; }
.chess-icon.side-b { color: #d8d8ea; background: rgba(0,0,0,.35); }

/* ── Bàn cờ: chessboard.js tự co theo khung, khung lấy theo cạnh chung --board-max ── */
#vua-board-wrap { position: relative; width: var(--board-max); min-width: 200px; }
#vua-board-wrap .board-b72b1 { border-radius: var(--cc-r-sm); box-shadow: var(--cc-shadow-lg); }
#vua-board-wrap img {
    filter: drop-shadow(0 4px 7px rgba(0,0,0,.55)) drop-shadow(0 2px 3px rgba(0,0,0,.35));
    transition: transform .12s ease, filter .12s ease;
}
#vua-board-wrap [class*="square-"]:hover img {
    transform: translateY(-3px) scale(1.07);
    filter: drop-shadow(0 9px 14px rgba(0,0,0,.65)) drop-shadow(0 3px 6px rgba(0,0,0,.40));
}
/* Ô cờ hai tông gỗ (cùng chất liệu với cờ tướng, cờ vây của ChoiCo) */
#vua-board-wrap .white-1e1d7 { background-color: #ecd5b0 !important; color: #a8794f; }
#vua-board-wrap .black-3c85d { background-color: #a8794f !important; color: #ecd5b0; }
#vua-board-wrap .board-b72b1 { border: 0; box-shadow: 0 0 0 6px #5a3a1e, 0 0 0 7px rgba(0,0,0,.4), var(--cc-shadow-lg); }
#vua-board-wrap [class*="square-"] { position: relative; }
/* Nước vừa đi — cần specificity cao hơn .white-1e1d7 / .black-3c85d */
#vua-board-wrap .highlight-from { background-color: rgba(255,210,0,.5) !important; box-shadow: inset 0 0 0 2px rgba(200,150,0,.6) !important; }
#vua-board-wrap .highlight-to   { background-color: rgba(255,200,0,.8) !important; box-shadow: inset 0 0 0 3px rgba(180,120,0,.9) !important; }
/* Bấm chọn quân + gợi ý nước đi */
.click-selected { background-color: rgba(255,196,70,.7) !important; box-shadow: inset 0 0 0 3px rgba(214,140,20,.95) !important; }
.hint-src { background-color: rgba(255,196,70,.45) !important; }
.hint-dot { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
            width: 30%; height: 30%; border-radius: 50%; background: rgba(20,20,20,.25); pointer-events: none; z-index: 50; }
.hint-dot-src { width: 22%; height: 22%; background: rgba(214,140,20,.55); }
.hint-ring { position: absolute; inset: 0; border-radius: 50%; border: 5px solid rgba(20,20,20,.25); pointer-events: none; z-index: 50; }

/* ── Phong cấp ── */
.promotion-overlay { position: fixed; inset: 0; z-index: var(--cc-z-modal); background: var(--cc-scrim);
                     display: flex; align-items: center; justify-content: center; }
.promotion-card { background: var(--cc-surface-solid); border: 1px solid var(--cc-line); border-radius: var(--cc-r-lg);
                  padding: var(--cc-sp-6); text-align: center; }
.promotion-card h4 { margin: 0 0 var(--cc-sp-4); color: var(--game-accent-text); }
.promotion-pieces { display: flex; gap: var(--cc-sp-3); justify-content: center; }
.promo-piece { font-size: 2.5rem; cursor: pointer; padding: var(--cc-sp-2); border-radius: var(--cc-r);
               border: 2px solid transparent; transition: border-color var(--cc-dur-fast) var(--cc-ease); }
.promo-piece:hover { border-color: var(--cc-wood); background: rgba(var(--cc-wood-rgb),.15); }

/* ── Lịch sử nước đi dạng chip, panel tự cuộn ── */
#vua-app .move-history { max-height: none; overflow-y: visible; }
.moves-list { display: flex; flex-wrap: wrap; gap: var(--cc-sp-1); }
.moves-list:empty::before { content: "Chưa có nước đi nào"; flex: 1; color: var(--cc-text-faint); font-size: var(--cc-fs-sm); text-align: center; padding: var(--cc-sp-2) 0; }
#vua-app .move-item:last-child { color: var(--cc-wood-hi); font-weight: 600; }
#vua-app .vua-sidebar .sb-body { overflow-y: auto; max-height: calc(100vh - 320px); }

/* ── Báo chiếu ── */
#vua-board-wrap .check-overlay {
    position: absolute; inset: 0; pointer-events: none; z-index: 40;
    background: rgba(231,76,60,.5); animation: checkFlash .65s ease-in-out infinite alternate;
}
@keyframes checkFlash { from { opacity: .4; } to { opacity: 1; } }
#vua-board-wrap .check-toast {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.5);
    z-index: 200; pointer-events: none; white-space: nowrap;
    padding: var(--cc-sp-3) var(--cc-sp-8); border-radius: var(--cc-r-lg);
    background: linear-gradient(135deg, rgba(155,89,182,.95), rgba(120,50,160,.95));
    color: #fff; font-size: var(--cc-fs-xl); font-weight: 800; letter-spacing: 3px; text-shadow: 0 2px 8px rgba(0,0,0,.5);
    box-shadow: 0 0 0 3px rgba(180,120,220,.6), 0 0 36px rgba(155,89,182,.7), 0 8px 24px rgba(0,0,0,.5);
    animation: checkToastAnim 2.3s cubic-bezier(.22,1,.36,1) forwards;
}
#vua-board-wrap .check-toast.check-toast-me {
    background: linear-gradient(135deg, rgba(180,80,0,.95), rgba(230,120,0,.95));
    box-shadow: 0 0 0 3px rgba(255,180,60,.6), 0 0 36px rgba(230,120,0,.7), 0 8px 24px rgba(0,0,0,.5);
}
@keyframes checkToastAnim {
    0%   { transform: translate(-50%,-50%) scale(.4);  opacity: 0; }
    12%  { transform: translate(-50%,-50%) scale(1.12); opacity: 1; }
    22%  { transform: translate(-50%,-50%) scale(.97); opacity: 1; }
    35%  { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
    72%  { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(.88); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    #vua-board-wrap .check-overlay { animation: none; }
}
