/* ==========================================================================
   CỜ TƯỚNG ONLINE (XIANGQI) — CHUẨN QUỐC TẾ WXF
   Giao diện Hoàng Gia phương Đông kết hợp hiện đại Dark Mode & Glassmorphism
   ========================================================================== */

:root {
  --bg-primary: #060913;
  --bg-secondary: #0a0f1d;
  --panel-bg: rgba(13, 20, 36, 0.85);
  --panel-border: rgba(245, 158, 11, 0.2);
  --gold: #f59e0b;
  --gold-light: #fef3c7;
  --gold-glow: rgba(245, 158, 11, 0.35);
  --cyan: #00f2fe;
  --cyan-glow: rgba(0, 242, 254, 0.35);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --board-wood: #2a1608;
  --board-surface: #d8a05c;
  --board-line: #5c2c08;
  --board-palace-line: #78350f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Background Mesh */
.background-mesh {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 15% 20%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(239, 68, 68, 0.07) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.6) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 16px 24px;
}

/* ================= TOP NAV HEADER ================= */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--gold-glow);
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #fff 30%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  background: rgba(22, 34, 58, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: rgba(30, 48, 80, 0.95);
  border-color: var(--gold);
  color: var(--gold-light);
}

/* ================= 3-COLUMN MAIN LAYOUT ================= */
.layout-three-cols {
  display: grid;
  grid-template-columns: 310px 1fr 310px;
  gap: 16px;
  align-items: start;
}

.col-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.panel-inner {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sec-title {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Mode Switch Tabs */
.tabs-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(7, 11, 20, 0.8);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.25));
  color: #fff;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Custom Input & Buttons */
.custom-input {
  width: 100%;
  background: rgba(7, 11, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  padding: 9px 12px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.custom-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
}

.code-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #050b14;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--gold-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--gold-glow);
}

.btn-secondary {
  width: 100%;
  background: rgba(22, 34, 58, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(30, 48, 80, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-danger {
  color: #fb7185;
}

.btn-danger:hover {
  background: rgba(225, 29, 72, 0.2);
  border-color: #f43f5e;
}

/* Time presets */
.time-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.time-btn {
  background: rgba(7, 11, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.time-btn.active {
  background: rgba(245, 158, 11, 0.2);
  color: #fff;
  border-color: var(--gold);
}

/* In-game control box */
.room-connected-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.room-code-hero-box {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(217, 119, 6, 0.05));
  border: 1.5px dashed rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
}

.room-code-hero-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--gold);
  margin: 3px 0;
}

.scoreboard-box {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 9px;
  padding: 8px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.score-player {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.score-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}

.in-game-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* ================= CỘT 2: BÀN CỜ TƯỚNG (COL-BOARD) ================= */
.col-board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Player Strip */
.player-strip {
  width: 100%;
  max-width: 558px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  background: rgba(14, 23, 42, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.player-strip.active-turn {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 16px var(--gold-glow);
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.player-avatar.red-side {
  background: radial-gradient(circle, #ef4444 0%, #991b1b 100%);
  color: #fff;
  border: 1.5px solid #fca5a5;
}

.player-avatar.black-side {
  background: radial-gradient(circle, #334155 0%, #0f172a 100%);
  color: #f8fafc;
  border: 1.5px solid #64748b;
}

.player-name-text {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
}

.player-role-tag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Khay quân cờ bị ăn (Captured Tray) */
.captured-tray {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 24px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.captured-mini-item {
  position: relative;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-sizing: border-box;
}

.captured-mini-item.black-piece {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.15);
}

.captured-mini-item.red-piece {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: inset 0 0 4px rgba(239, 68, 68, 0.2);
}

/* Badge số lượng khi ăn từ 2 quân trở lên (+2, +3...) */
.piece-count-badge {
  position: absolute;
  bottom: -3px;
  right: -5px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #031120;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8.5px;
  font-weight: 900;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 5px;
  border: 1px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

/* Digital Clock */
.digital-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(7, 11, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.digital-clock.running {
  color: #fff;
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
}

.digital-clock.low-time {
  color: #fb7185;
  border-color: #f43f5e;
  animation: pulseBeacon 1s infinite;
}

@keyframes pulseBeacon {
  0%, 100% { opacity: 0.8; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* ================= BÀN CỜ TƯỚNG (XIANGQI BOARD FRAME) ================= */
.xiangqi-board-wrapper {
  position: relative;
  width: 100%;
  max-width: 540px;
  /* Tỉ lệ chuẩn 9 cột x 10 hàng là 9 : 10 */
  aspect-ratio: 9 / 10;
  margin: 12px 0; /* Khoảng cách rõ ràng, tách biệt hoàn toàn khỏi dải thông tin người chơi trên và dưới */
  background: radial-gradient(circle at 45% 40%, #e2a665 0%, #cf8e49 55%, #b47432 100%);
  border-radius: 16px;
  border: none;
  box-shadow: 
    0 0 0 8px #5a2e0e,
    0 0 0 9.5px rgba(251, 191, 36, 0.3),
    0 24px 60px rgba(0, 0, 0, 0.9),
    0 8px 24px rgba(0, 0, 0, 0.6),
    inset 0 2px 6px rgba(255, 255, 255, 0.25),
    inset 0 -2px 6px rgba(0, 0, 0, 0.85);
  box-sizing: border-box;
  user-select: none;
  overflow: hidden;
  padding: 0;
}

/* SVG Lớp nền đường kẻ bàn cờ (Grid lines, River, Palace, Cross marks) chuẩn 900x1000 */
.board-grid-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Lớp chứa 90 giao điểm (Intersections) chuẩn 9 cột x 10 hàng căn khớp tuyệt đối từng pixel */
.board-intersections-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(10, 1fr);
}

/* Điểm giao cắt (Point Intersection) */
.board-point {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Gợi ý nước đi (Hint Dot) */
.hint-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle, #00f2fe 0%, #0284c7 100%);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.8);
  pointer-events: none;
  z-index: 8;
  animation: hintPulse 1.2s infinite ease-in-out;
}

@keyframes hintPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* Điểm có thể ăn quân (Capture Target) */
.board-point.capture-target::after {
  content: '';
  position: absolute;
  width: 86%;
  height: 86%;
  border-radius: 50%;
  border: 2.5px solid #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
  pointer-events: none;
  z-index: 8;
  animation: captureRingPulse 1.2s infinite;
}

@keyframes captureRingPulse {
  0%, 100% { transform: scale(0.92); opacity: 0.85; }
  50% { transform: scale(1.05); opacity: 1; }
}

/* Quân cờ trên bàn (Piece Container - đặc hoàn toàn, nổi khối 3D) */
.piece-token-box {
  width: 88%;
  height: 88%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #fffbeb 0%, #fde68a 60%, #d97706 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  z-index: 4;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.piece-token-box:hover {
  transform: scale(1.06);
}

/* Quân đang được chọn (Selected Piece) */
.board-point.selected .piece-token-box {
  transform: scale(1.12);
  filter: drop-shadow(0 0 12px #f59e0b);
}

.board-point.selected::before {
  content: '';
  position: absolute;
  width: 92%;
  height: 92%;
  border-radius: 50%;
  border: 2px dashed #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
  pointer-events: none;
  z-index: 6;
  animation: rotateDashed 6s linear infinite;
}

@keyframes rotateDashed {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Vết nước đi vừa thực hiện (Last Move Highlighting) */
.board-point.last-move-from::before,
.board-point.last-move-to::before {
  content: '';
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  border: 2px solid rgba(0, 242, 254, 0.7);
  background: rgba(0, 242, 254, 0.1);
  pointer-events: none;
  z-index: 2;
}

/* Khi Tướng bị Chiếu (Hiệu ứng phát sáng hào quang & rung trực tiếp trên quân Tướng) */
.board-point.king-in-check {
  z-index: 10;
}

.board-point.king-in-check::after {
  content: '';
  position: absolute;
  width: 96%;
  height: 96%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.45) 0%, rgba(220, 38, 38, 0.2) 60%, transparent 75%);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.85), inset 0 0 10px rgba(239, 68, 68, 0.6);
  pointer-events: none;
  z-index: 3;
  animation: kingCheckPulseRing 1s infinite alternate ease-in-out;
}

.board-point.king-in-check .piece-token-box {
  animation: kingCheckShake 0.6s infinite alternate;
  filter: drop-shadow(0 0 14px #ef4444) drop-shadow(0 0 24px rgba(239, 68, 68, 0.8)) !important;
}

@keyframes kingCheckPulseRing {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}

@keyframes kingCheckShake {
  0% { transform: scale(1.05) translate(-1px, 0); }
  100% { transform: scale(1.1) translate(1px, -1px); }
}

/* ================= THANH TRẠNG THÁI LƯỢT ĐI ================= */
.game-status-banner {
  width: 100%;
  max-width: 558px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  background: rgba(14, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.game-status-banner.your-turn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.5);
  color: var(--gold-light);
  box-shadow: 0 0 16px var(--gold-glow);
}

.game-status-text {
  display: inline-block;
  font-weight: 800;
}

/* ================= CỘT 3: LỊCH SỬ NƯỚC ĐI & CHAT ================= */
.move-history-box {
  background: rgba(7, 11, 20, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.move-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.move-history-table th {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  padding: 6px 8px;
  font-weight: 700;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

.move-history-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.move-history-table tr:hover {
  background: rgba(245, 158, 11, 0.08);
}

.move-num {
  color: var(--text-muted);
  width: 24px;
  font-family: 'JetBrains Mono', monospace;
}

.red-move {
  color: #f87171;
  font-weight: 700;
}

.black-move {
  color: #cbd5e1;
  font-weight: 700;
}

/* Chat container */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages {
  height: 120px;
  background: rgba(7, 11, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-msg {
  font-size: 11.5px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg.system {
  color: var(--gold);
  font-style: italic;
  text-align: center;
}

.chat-msg.mine {
  color: var(--cyan);
}

.chat-msg.opponent {
  color: #fff;
}

.emoji-quick-row {
  display: flex;
  gap: 4px;
  justify-content: space-between;
}

.emoji-btn {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 14px;
  padding: 4px 6px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.emoji-btn:hover {
  transform: scale(1.2);
}

.chat-input-row {
  display: flex;
  gap: 6px;
}

.chat-input {
  flex: 1;
  background: rgba(7, 11, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  outline: none;
}

.chat-send-btn {
  background: var(--gold);
  color: #050b14;
  border: none;
  border-radius: 7px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* ================= MODAL & POPUPS ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #0d1424;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--gold-glow);
  text-align: center;
}

.modal-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* Modal Luật Chơi Chuẩn WXF */
.rules-modal-box {
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
}

.rules-modal-box h3 {
  color: var(--gold);
  text-align: center;
  margin-bottom: 12px;
}

.rules-section {
  margin-bottom: 14px;
}

.rules-section h4 {
  color: var(--gold-light);
  font-size: 13.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rules-section p, .rules-section ul {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
}

.rules-section ul {
  padding-left: 18px;
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  border: 1px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: all 0.25s ease;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1050px) {
  .layout-three-cols {
    grid-template-columns: 280px 1fr 280px;
  }
}

@media (max-width: 900px) {
  .layout-three-cols {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .col-board-container {
    order: 1;
    width: 100%;
  }

  .col-panel {
    width: 100%;
    max-width: 540px;
  }

  .col-left {
    order: 2;
  }

  .col-right {
    order: 3;
  }
}

/* ================= XIANGQI SEO & GUIDE SECTION ================= */
.game-seo-container {
  max-width: 1440px;
  margin: 40px auto 32px;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.game-seo-article {
  background: rgba(13, 20, 38, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 36px 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.game-seo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.game-seo-article h2 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
  line-height: 1.3;
}

.game-seo-intro {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 28px;
}

.game-seo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.game-seo-card {
  background: rgba(18, 28, 54, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 22px;
}

.game-seo-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-seo-card p,
.game-seo-card ul {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.65;
}

.game-seo-card ul {
  padding-left: 18px;
  margin-top: 8px;
}

.game-seo-card li {
  margin-bottom: 6px;
}

.game-seo-faq {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.game-seo-faq h3 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 18px;
}

.game-faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-faq-item {
  background: rgba(18, 28, 54, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.25s ease;
}

.game-faq-item[open] {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(19, 32, 62, 0.7);
}

.game-faq-question {
  padding: 15px 18px;
  font-size: 14.5px;
  font-weight: 700;
  color: #f1f5f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  list-style: none;
}

.game-faq-question::-webkit-details-marker {
  display: none;
}

.game-faq-question::after {
  content: '+';
  font-size: 18px;
  color: var(--gold);
  font-weight: 700;
}

.game-faq-item[open] .game-faq-question::after {
  content: '−';
}

.game-faq-answer {
  padding: 0 18px 16px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.65;
}

.game-seo-footer-nav {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.game-seo-footer-nav a {
  color: var(--cyan);
  text-decoration: none;
}

.game-seo-footer-nav a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .game-seo-grid {
    grid-template-columns: 1fr;
  }
  .game-seo-article {
    padding: 24px 18px;
  }
}
