/* 棋盘样式 */
.chess-board {
    /* 尺寸由JavaScript动态设置 */
    background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
    border: 6px solid #8b4513;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    /* padding由JavaScript动态设置 */
    touch-action: none; /* 禁用移动端的默认触摸行为 */
}

@media (max-width: 640px) {
    .chess-board {
        border-width: 4px;
        border-radius: 6px;
    }
}

/* 棋盘网格 */
.board-grid {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 520px;
    height: 580px;
}

.board-line {
    stroke: #8b4513;
    stroke-width: 1.5;
}

.board-line-bold {
    stroke: #654321;
    stroke-width: 2.5;
}

/* 棋盘交叉点 */
.board-point {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #8b4513;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* 棋子样式 */
.chess-piece {
    /* 尺寸由JavaScript动态设置 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

.chess-piece:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.chess-piece.red {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #c92a2a);
    color: #fff;
    border: 3px solid #8b0000;
}

.chess-piece.black {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #1a1a1a);
    color: #fff;
    border: 3px solid #000;
}

.chess-piece.selected {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.5), 0 6px 12px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%) scale(1.15);
}

/* 移除disabled样式，不虚化对方棋子 */
/* .chess-piece.disabled {
    opacity: 0.6;
    cursor: not-allowed;
} */

/* 可移动位置标记 */
.move-hint {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(34, 197, 94, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.2s ease;
    animation: pulse 1.5s ease-in-out infinite;
}

.move-hint:hover {
    background: rgba(34, 197, 94, 0.8);
    transform: translate(-50%, -50%) scale(1.3);
}

.move-hint.capture {
    background: rgba(239, 68, 68, 0.6);
    width: 52px;
    height: 52px;
    border: 3px solid rgba(239, 68, 68, 0.8);
}

.move-hint.capture:hover {
    background: rgba(239, 68, 68, 0.8);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* 最后一步移动高亮 - 增强视觉效果 */
.last-move-from,
.last-move-to {
    position: absolute;
    width: 64px;
    height: 64px;
    border: 5px solid rgba(234, 179, 8, 0.95);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: fadeIn 0.5s ease;
    box-shadow: 0 0 16px rgba(234, 179, 8, 0.7), 0 0 8px rgba(234, 179, 8, 0.5);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 河界标记 */
.river-text {
    position: absolute;
    font-size: 32px;
    font-weight: bold;
    color: #8b4513;
    opacity: 0.3;
    user-select: none;
    pointer-events: none;
}

/* 炮位和兵位标记 */
.position-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
}

.position-marker::before,
.position-marker::after {
    content: '';
    position: absolute;
    background: #8b4513;
}

.position-marker.top-left::before {
    width: 8px;
    height: 2px;
    top: 0;
    left: 0;
}

.position-marker.top-left::after {
    width: 2px;
    height: 8px;
    top: 0;
    left: 0;
}

/* 走法历史项 */
.move-item {
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.move-item:hover {
    background: #e5e7eb;
    transform: translateX(4px);
}

.move-item.active {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 640px) {
    /* 移动端触摸优化 */
    .chess-piece:active {
        transform: translate(-50%, -50%) scale(1.05);
    }
    
    /* 移动端hover效果改为active */
    .chess-piece:hover {
        transform: translate(-50%, -50%);
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}