/* 游戏专用样式 */

/* 游戏画布 */
.game-canvas {
  border: 2px solid var(--game-grid-color);
  border-radius: var(--border-radius);
  background: var(--game-board-bg);
  max-width: 100%;
  height: auto;
}

/* 游戏棋盘样式 */
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 1px;
  background: var(--game-grid-color);
  border: 2px solid var(--game-grid-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.chess-cell {
  aspect-ratio: 1;
  background: var(--game-board-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.chess-cell:hover {
  background: var(--primary-light);
}

.chess-piece {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.player1 .chess-piece {
  background: var(--game-player1);
}

.player2 .chess-piece {
  background: var(--game-player2);
}

/* 2048游戏样式 */
.game-2048-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
  padding: 8px;
  width: 320px;
  height: 320px;
}

.game-2048-cell {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

/* 数字 2, 4, 8, 16... 的不同颜色 */
.cell-2 { background: #eee4da; color: #776e65; }
.cell-4 { background: #ede0c8; color: #776e65; }
.cell-8 { background: #f2b179; color: #f9f6f2; }
.cell-16 { background: #f59563; color: #f9f6f2; }
.cell-32 { background: #f67c5f; color: #f9f6f2; }
.cell-64 { background: #f65e3b; color: #f9f6f2; }
.cell-128 { background: #edcf72; color: #f9f6f2; font-size: var(--font-size-base); }
.cell-256 { background: #edcc61; color: #f9f6f2; font-size: var(--font-size-base); }
.cell-512 { background: #edc850; color: #f9f6f2; font-size: var(--font-size-base); }
.cell-1024 { background: #edc53f; color: #f9f6f2; font-size: var(--font-size-sm); }
.cell-2048 { background: #edc22e; color: #f9f6f2; font-size: var(--font-size-sm); }

/* 华容道游戏样式 */
.game-huarongdao-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 2px;
  background: var(--game-grid-color);
  border-radius: var(--border-radius);
  padding: 2px;
  width: 320px;
  height: 400px;
}

.game-huarongdao-block {
  background: var(--primary-color);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  cursor: move;
  user-select: none;
}

.game-huarongdao-block.cao-cao {
  background: var(--danger-color);
  grid-row: span 2;
  grid-column: span 2;
}

.game-huarongdao-block.vertical {
  grid-row: span 2;
}

.game-huarongdao-block.horizontal {
  grid-column: span 2;
}

/* 游戏信息显示 */
.game-info {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  box-shadow: var(--box-shadow);
}

.game-info-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

.game-info-item {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border-color);
}

.game-info-item:last-child {
  border-bottom: none;
}

.game-info-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.game-info-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* 排行榜样式 */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.ranking-item {
  display: flex;
  align-items: center;
  padding: var(--spacing-md);
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: var(--transition);
}

.ranking-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ranking-rank {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  font-size: var(--font-size-xs);
  font-weight: 600;
  margin-right: var(--spacing-md);
}

.ranking-rank.gold {
  background: #FFD700;
  color: var(--text-primary);
}

.ranking-rank.silver {
  background: #C0C0C0;
  color: var(--text-primary);
}

.ranking-rank.bronze {
  background: #CD7F32;
  color: white;
}

.ranking-user {
  flex: 1;
  font-weight: 500;
}

.ranking-score {
  font-weight: 600;
  color: var(--primary-color);
}

/* 游戏对话框 */
.game-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.game-modal-content {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.game-modal-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

.game-modal-message {
  font-size: var(--font-size-base);
  margin-bottom: var(--spacing-lg);
  color: var(--text-secondary);
}

.game-modal-buttons {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
}

/* 游戏计时器 */
.game-timer {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--primary-color);
  text-align: center;
  margin: var(--spacing-md) 0;
}

/* 游戏按钮组 */
.game-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.game-button {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  background: var(--primary-color);
  color: white;
}

.game-button:hover {
  background: var(--primary-hover);
}

.game-button.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.game-button.secondary:hover {
  background: var(--border-color);
}