
/* 棋盘样式 */
#board-container {
    width: min(90vw, 450px);
    height: min(100vw, 500px); /* 保持 9:10 比例 */
    transition: transform 0.5s ease;
}

#board-container.rotate-180 {
    transform: rotate(180deg);
}

/* 棋子通用样式 */
.chess-piece {
    position: absolute;
    width: 11.11%;  /* 1/9 */
    height: 10%;    /* 1/10 */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease-out;
    z-index: 10;
}

.chess-piece-inner {
    width: 85%;
    height: 85%;
    border-radius: 50%;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3), inset -2px -2px 4px rgba(0,0,0,0.2), inset 2px 2px 4px rgba(255,255,255,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: "KaiTi", "楷体", serif;
    font-weight: bold;
    user-select: none;
    position: relative;
    border: 2px solid;
    transition: transform 0.5s ease;
}

/* 翻转棋盘时，保持棋子文字正向 */
#board-container.rotate-180 .chess-piece-inner {
    transform: rotate(-180deg);
    box-shadow: -2px -2px 4px rgba(0,0,0,0.3), inset 2px 2px 4px rgba(0,0,0,0.2), inset -2px -2px 4px rgba(255,255,255,0.5);
}

/* 棋子环形纹理 */
.chess-piece-inner::before {
    content: '';
    position: absolute;
    top: 5%;
    left: 5%;
    right: 5%;
    bottom: 5%;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
}

/* 红方棋子 */
.piece-red .chess-piece-inner {
    background: #fdf2e9;
    color: #c0392b;
    border-color: #d35400;
}

/* 黑方棋子 */
.piece-black .chess-piece-inner {
    background: #fdf2e9;
    color: #2c3e50;
    border-color: #34495e;
}

/* 选中状态 */
.chess-piece.selected .chess-piece-inner {
    box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.6), 4px 4px 8px rgba(0,0,0,0.4);
    transform: scale(1.1);
    z-index: 20;
    background-color: #fff;
}
/* 翻转时的选中状态修正 */
#board-container.rotate-180 .chess-piece.selected .chess-piece-inner {
    transform: rotate(-180deg) scale(1.1);
}

/* 上一步移动标记 */
.chess-piece.last-move::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(39, 174, 96, 0.6);
    border-radius: 50%;
    animation: spin 10s linear infinite;
}

/* 可移动位置提示 */
.move-hint {
    position: absolute;
    width: 11.11%;
    height: 10%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 5;
}

.move-hint::after {
    content: '';
    width: 20%;
    height: 20%;
    background-color: rgba(39, 174, 96, 0.6);
    border-radius: 50%;
}

.move-hint.capture::after {
    background-color: transparent;
    border: 4px solid rgba(231, 76, 60, 0.6);
    width: 90%;
    height: 90%;
    border-radius: 50%;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 将军动画 */
@keyframes check-pulse {
    0% { transform: scale(1); opacity: 0; }
    50% { transform: scale(1.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.check-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(231,76,60,0.8) 0%, rgba(231,76,60,0) 70%);
    animation: check-pulse 1s infinite;
    pointer-events: none;
    z-index: 15;
}

/* Toast 动画 */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fade-in-up 0.3s ease-out forwards;
}

/* 响应式调整字体大小 */
@media (max-width: 400px) {
    .chess-piece-inner {
        font-size: 1.2rem;
    }
}
@media (min-width: 401px) {
    .chess-piece-inner {
        font-size: 1.6rem;
    }
}