/* public/assets/css/games/xiangqi.css */

.xq-wrapper { padding: 32px 16px; position: relative; }
.xq-header { text-align: center; margin-bottom: 24px; }
.xq-title { font-size: 2.2rem; font-weight: 800; color: var(--text-main); margin-bottom: 8px; }
.xq-subtitle { font-size: 1.05rem; color: var(--text-muted); max-width: 700px; margin: 0 auto; line-height: 1.6; }

.xq-workspace { width: 100%; display: flex; flex-direction: column; align-items: center; }
.xq-board-area { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 16px; margin: 0 auto; }

.xq-status-bar { background: var(--bg-surface); border: 2px solid var(--border-color); padding: 14px 24px; border-radius: 12px; font-size: 1.2rem; font-weight: 800; color: var(--text-main); text-align: center; box-shadow: 0 10px 20px rgba(0,0,0,0.05); transition: 0.3s; }
.xq-status-bar.turn-r { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; color: #ef4444; }
.xq-status-bar.turn-b { background: rgba(15, 23, 42, 0.1); border-color: #475569; color: var(--text-main); }
.xq-status-bar.is-win { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; border-color: #d97706; animation: winPulse 1.5s infinite; }
@keyframes winPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); } 50% { box-shadow: 0 0 0 10px rgba(245,158,11,0); } }

/* 游戏模式切换 */
.xq-mode-switch { display: flex; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px; padding: 6px; gap: 8px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); margin: 0 auto; width: 100%; max-width: 320px; }
.mode-btn { flex: 1; background: transparent; border: none; padding: 10px 0; font-size: 0.95rem; font-weight: 800; color: var(--text-muted); border-radius: 8px; cursor: pointer; transition: 0.3s; }
.mode-btn:hover { color: var(--text-main); }
.mode-btn.active { background: #3b82f6; color: #fff; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4); }

.xq-status-bar.is-thinking { background: linear-gradient(135deg, #8b5cf6, #6d28d9); color: #fff; border-color: #6d28d9; animation: pulseAI 1.5s infinite; }
@keyframes pulseAI { 0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); } 50% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0); } }

/* 🌟 核心修复：棋盘线颜色独立定义，防止全局变量缺失导致隐形 */
.xq-grid-line { stroke: #64748b; }
.xq-grid-text { fill: #64748b; }
[data-theme="dark"] .xq-grid-line { stroke: #475569; }
[data-theme="dark"] .xq-grid-text { fill: #475569; }

/* 🌟 核心修复：111.11% 占位法彻底解决高度塌陷问题 */
.xq-board-container { 
    width: 100%; 
    padding-bottom: 111.11%; /* 1000/900 * 100% = 111.11%，完美锁定黄金比例 */
    height: 0;
    background: #e2e8f0; 
    border-radius: 12px; 
    position: relative; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.2); 
    overflow: hidden; 
    user-select: none; 
}
[data-theme="dark"] .xq-board-container { background: #1e293b; }

.xq-svg-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; opacity: 0.8; }
.xq-pieces-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; }

/* 实体棋子 */
.xq-piece { 
    position: absolute; 
    width: 9%; 
    aspect-ratio: 1 / 1; 
    transform: translate(-50%, -50%); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-family: 'KaiTi', 'STKaiti', serif; 
    font-size: 1.8rem; 
    font-weight: 800; 
    cursor: pointer; 
    transition: left 0.3s cubic-bezier(0.25, 1, 0.5, 1), top 0.3s cubic-bezier(0.25, 1, 0.5, 1), transform 0.1s, box-shadow 0.1s; 
    box-sizing: border-box; 
    background: radial-gradient(circle at 30% 30%, #fffde7, #d7ccc8); 
    border: 2px solid #a1887f; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 -2px 4px rgba(0,0,0,0.2); 
}
[data-theme="dark"] .xq-piece { background: radial-gradient(circle at 30% 30%, #334155, #0f172a); border-color: #475569; }
.xq-piece:active { transform: translate(-50%, -50%) scale(0.95); box-shadow: 0 2px 4px rgba(0,0,0,0.4); }

.xq-piece.color-r { color: #d32f2f; }
.xq-piece.color-b { color: #1f2937; }
[data-theme="dark"] .xq-piece.color-r { color: #ef4444; }
[data-theme="dark"] .xq-piece.color-b { color: #94a3b8; }

.xq-piece.is-selected { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.6), 0 8px 16px rgba(0,0,0,0.5); transform: translate(-50%, -50%) scale(1.1); z-index: 10; border-color: #3b82f6; }
.xq-piece.last-move { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.4), 0 4px 8px rgba(0,0,0,0.4); }

/* 提示点与瞄准框 */
.xq-hint { position: absolute; width: 4%; aspect-ratio: 1/1; transform: translate(-50%, -50%); background: rgba(16, 185, 129, 0.6); border-radius: 50%; cursor: pointer; z-index: 5; transition: 0.2s; }
.xq-hint:hover { transform: translate(-50%, -50%) scale(1.5); background: rgba(16, 185, 129, 0.9); }
.xq-hint.is-capture { width: 9.5%; background: transparent; border: 3px dashed rgba(239, 68, 68, 0.8); }

.xq-btn-primary { padding: 16px 32px; font-size: 1.1rem; font-weight: 800; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; border: none; border-radius: 12px; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3); text-transform: uppercase; letter-spacing: 1px; }
.xq-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4); }

.xq-info-card { background: var(--bg-surface); padding: 24px; border-radius: 16px; border: 1px solid var(--border-color); box-sizing: border-box; max-width: 800px; margin: 0 auto; }

@media (max-width: 600px) {
    .xq-wrapper { padding: 16px 8px; }
    .xq-piece { font-size: 1.3rem; border-width: 1px; }
}