/* public/assets/css/games/online-chess.css */

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

.chess-workspace { max-width: 1000px; margin: 0 auto; display: flex; gap: 32px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }

/* 🌟 左侧棋盘区 */
.chess-board-area { flex: 1; min-width: 320px; max-width: 600px; display: flex; flex-direction: column; gap: 16px; }

.chess-status-bar { background: var(--bg-surface); border: 2px solid var(--border-color); padding: 16px 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; }
.chess-status-bar.is-check { background: rgba(245, 158, 11, 0.1); border-color: #f59e0b; color: #d97706; }
.chess-status-bar.is-mate { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; color: #ef4444; }

/* 棋盘大外框 (含坐标) */
.chess-board-container { background: #1e293b; padding: 4px; border-radius: 8px; box-shadow: 0 20px 40px rgba(0,0,0,0.4); display: flex; flex-direction: column; user-select: none; }

.board-body-wrapper { display: flex; align-items: stretch; }

/* 坐标指示器 */
.coord-row { display: flex; margin: 0 20px; }
.coord-row span { flex: 1; text-align: center; font-size: 0.75rem; font-weight: 700; color: #94a3b8; padding: 4px 0; text-transform: uppercase; }
.coord-col { display: flex; flex-direction: column; width: 20px; }
.coord-col span { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #94a3b8; }

/* 8x8 棋盘网格 */
.chess-grid { flex: 1; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); aspect-ratio: 1 / 1; border: 2px solid #0f172a; }

/* 单个格子 */
.chess-sq { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; }
.chess-sq.light { background-color: #cbd5e1; } /* 亮色格 */
.chess-sq.dark { background-color: #475569; }  /* 暗色格 */

/* 交互高亮与选中特效 */
.chess-sq::before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; transition: 0.2s; }
.chess-sq.is-selected::before { background: rgba(59, 130, 246, 0.5); box-shadow: inset 0 0 0 4px #3b82f6; }
.chess-sq.is-hint::after { content: ""; position: absolute; width: 25%; height: 25%; border-radius: 50%; background: rgba(0, 0, 0, 0.2); pointer-events: none; }
.chess-sq.is-hint.has-piece::after { width: 80%; height: 80%; background: transparent; border: 4px solid rgba(0, 0, 0, 0.2); }
.chess-sq.last-move::before { background: rgba(245, 158, 11, 0.4); }

/* 棋子渲染 (利用 Unicode + 高级阴影) */
.chess-piece { font-size: 3.5vw; line-height: 1; cursor: pointer; z-index: 2; transition: transform 0.1s; }
@media (min-width: 600px) { .chess-piece { font-size: 42px; } }

.chess-piece:hover { transform: scale(1.15); }
.piece-w { color: #f8fafc; text-shadow: 0 3px 6px rgba(0,0,0,0.6), 0 1px 2px rgba(0,0,0,0.8); }
.piece-b { color: #0f172a; text-shadow: 0 1px 1px rgba(255,255,255,0.4), 0 3px 6px rgba(0,0,0,0.8); }

/* 🌟 右侧侧边栏 */
.chess-sidebar { flex: 1; min-width: 300px; max-width: 350px; display: flex; flex-direction: column; gap: 20px; }

.chess-btn-primary { padding: 16px 24px; 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); width: 100%; text-transform: uppercase; letter-spacing: 1px; }
.chess-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4); }

.chess-history-panel { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; display: flex; flex-direction: column; height: 100%; max-height: 520px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); overflow: hidden; }
.hist-header { padding: 16px 20px; background: rgba(0,0,0,0.02); border-bottom: 1px solid var(--border-color); }
.hist-header h4 { margin: 0; font-size: 1.1rem; color: var(--text-main); font-weight: 800; }

.hist-content { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.hist-content::-webkit-scrollbar { width: 6px; }
.hist-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* 棋谱行样式 */
.pgn-row { display: flex; background: var(--bg-body); border-radius: 6px; overflow: hidden; font-family: 'Courier New', Courier, monospace; font-size: 0.95rem; font-weight: 700; border: 1px solid var(--border-color); }
.pgn-row:nth-child(even) { background: transparent; border-color: transparent; }
.pgn-num { width: 40px; background: rgba(0,0,0,0.05); color: var(--text-muted); display: flex; align-items: center; justify-content: center; }
.pgn-w, .pgn-b { flex: 1; padding: 6px 12px; color: var(--text-main); }
.pgn-b { color: #64748b; }

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

@media (max-width: 768px) {
    .chess-workspace { flex-direction: column; align-items: center; }
    .chess-board-area, .chess-sidebar { width: 100%; max-width: 100%; }
    .chess-history-panel { max-height: 300px; }
}