/* ========== 游戏中心 ========== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.game-card {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border: 2px solid rgba(255, 182, 217, 0.3);
  transition: all 0.3s ease;
}

.game-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-large);
}

.game-thumb {
  width: 100%;
  height: 100px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 14px;
}

.game-card h3 {
  font-size: 17px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.game-card p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* 游戏弹窗 */
.game-modal {
  max-width: 560px;
}

.game-area {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 380px;
  margin: 10px 0;
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 2px dashed var(--pink-100);
}

#gameScore {
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: 18px;
  color: var(--pink-600);
}

/* === 消消乐 === */
.match3-board {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: var(--pink-100);
  border-radius: var(--radius-md);
}

.match3-cell {
  width: 42px;
  height: 42px;
  background: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.match3-cell:hover {
  transform: scale(1.1);
}

.match3-cell.selected {
  background: var(--pink-200);
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--pink-400);
}

.match3-cell.removing {
  animation: popOut 0.3s ease forwards;
}

@keyframes popOut {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); }
  100% { transform: scale(0); opacity: 0; }
}

/* === 贪吃蛇 === */
.snake-board {
  background: var(--mint-100);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.snake-cell {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  transition: all 0.08s linear;
}

.snake-head {
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  box-shadow: 0 0 8px rgba(255,126,176,0.5);
  z-index: 2;
}

.snake-body {
  background: linear-gradient(135deg, var(--pink-300), var(--purple-300));
}

.snake-food {
  background: radial-gradient(circle, #ffb347, #ff8c42);
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

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

.snake-gameover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--pink-600);
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: 24px;
}

/* === 2048 === */
.game2048-board {
  background: var(--peach-100);
  border-radius: var(--radius-md);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.game2048-cell {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: 22px;
  font-weight: bold;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.tile-2 { background: #ffe4e1; color: #8b4513; }
.tile-4 { background: #ffdab9; color: #8b4513; }
.tile-8 { background: #ffb6c1; color: white; }
.tile-16 { background: #ff9ec2; color: white; }
.tile-32 { background: #ff7eb0; color: white; }
.tile-64 { background: #e85a94; color: white; }
.tile-128 { background: #dda0dd; color: white; font-size: 18px; }
.tile-256 { background: #da70d6; color: white; font-size: 18px; }
.tile-512 { background: #ba55d3; color: white; font-size: 18px; }
.tile-1024 { background: #9932cc; color: white; font-size: 15px; }
.tile-2048 { background: linear-gradient(135deg, #ffd700, #ff69b4); color: white; font-size: 15px; }

.game2048-over {
  text-align: center;
  color: var(--pink-600);
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: 22px;
  margin-top: 15px;
}

/* === 记忆翻牌 === */
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 8px;
}

.memory-card {
  width: 64px;
  height: 64px;
  perspective: 800px;
  cursor: pointer;
}

.memory-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.memory-card.flipped .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card-front, .memory-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.memory-card-front {
  background: linear-gradient(135deg, var(--pink-300), var(--purple-300));
}

.memory-card-front::after {
  content: '♡';
  color: rgba(255,255,255,0.7);
  font-size: 28px;
}

.memory-card-back {
  background: white;
  transform: rotateY(180deg);
  box-shadow: inset 0 0 0 2px var(--pink-200);
}

.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card-back {
  background: var(--mint-100);
  animation: matchedPulse 0.5s ease;
}

@keyframes matchedPulse {
  0%, 100% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.15); }
}

/* === 接水果 === */
.catch-game {
  position: relative;
  width: 340px;
  height: 380px;
  background: linear-gradient(180deg, var(--blue-100), var(--pink-100));
  border-radius: var(--radius-md);
  overflow: hidden;
}

.catch-basket {
  position: absolute;
  bottom: 10px;
  width: 60px;
  height: 40px;
  font-size: 36px;
  text-align: center;
  transition: left 0.05s linear;
  z-index: 2;
}

.catch-item {
  position: absolute;
  font-size: 28px;
  z-index: 1;
}

.catch-score-float {
  position: absolute;
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: 18px;
  color: var(--pink-600);
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); }
}

/* === 井字棋 === */
.tic-board {
  display: grid;
  grid-template-columns: repeat(3, 80px);
  gap: 8px;
}

.tic-cell {
  width: 80px;
  height: 80px;
  background: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.tic-cell:hover {
  background: var(--pink-50);
  transform: scale(1.05);
}

.tic-cell.x { color: var(--pink-500); }
.tic-cell.o { color: var(--purple-400); }

.tic-result {
  margin-top: 15px;
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: 18px;
  color: var(--pink-600);
  text-align: center;
}

/* === 打地鼠 === */
.mole-game {
  display: grid;
  grid-template-columns: repeat(3, 90px);
  grid-template-rows: repeat(3, 90px);
  gap: 10px;
}

.mole-hole {
  background: radial-gradient(ellipse, #8b6f5c 0%, #6b5344 100%);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.mole-hole::before {
  content: '';
  position: absolute;
  top: 60%;
  left: 0;
  right: 0;
  height: 40%;
  background: #5a4434;
  border-radius: 50%;
}

.mole {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 48px;
  transition: top 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.mole-hole.up .mole {
  top: 10%;
}

.mole-hole.hit .mole {
  animation: moleHit 0.3s ease;
}

@keyframes moleHit {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(0.8) rotate(10deg); }
}

.mole-timer {
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: 18px;
  color: var(--pink-600);
  margin-left: 20px;
}

@media (max-width: 500px) {
  .match3-cell { width: 34px; height: 34px; font-size: 22px; }
  .game2048-cell { width: 52px; height: 52px; font-size: 18px; }
  .memory-board { grid-template-columns: repeat(4, 52px); }
  .memory-card { width: 52px; height: 52px; }
  .memory-card-front, .memory-card-back { font-size: 24px; }
  .tic-board { grid-template-columns: repeat(3, 70px); }
  .tic-cell { width: 70px; height: 70px; font-size: 32px; }
  .mole-game { grid-template-columns: repeat(3, 75px); grid-template-rows: repeat(3, 75px); }
  .mole { font-size: 38px; }
  .catch-game { width: 300px; height: 340px; }
}
