/* ===== 迷你游戏样式（像素风暖色修复版）===== */

/* 游戏模态框 */
.game-modal .modal {
  border: 2px solid var(--card-border);
  border-radius: 4px;
  box-shadow: 6px 6px 0 rgba(180,140,100,0.2);
  background: var(--card);
}

/* 游戏头部 */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  border-bottom: 3px solid var(--primary-dark);
}
.game-score {
  display: flex;
  gap: 16px;
}
.game-score-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-family: 'zpix', 'Noto Sans SC', sans-serif;
  font-size: 0.9rem;
}
.game-score-value {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--accent);
}
.game-timer {
  font-family: 'zpix', 'Noto Sans SC', sans-serif;
  font-size: 1rem;
  color: #fff;
  background: rgba(0,0,0,0.2);
  padding: 4px 10px;
  border-radius: 0;
}
.game-timer.warning {
  color: #ff6b6b;
  animation: timerBlink 0.5s steps(2) infinite;
}
@keyframes timerBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 游戏容器 */
.game-container {
  position: relative;
  height: 350px;
  overflow: hidden;
  background: linear-gradient(180deg, #f5ead6 0%, #fdf6ec 100%);
  border-bottom: 2px solid var(--card-border);
}

/* 游戏画布 */
.game-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* 游戏控制按钮 */
.game-controls {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg);
  border-top: 2px solid var(--card-border);
}
.game-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 0;
  font-family: 'zpix', 'Noto Sans SC', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  border: 2px solid;
  transition: all 0.1s steps(2);
}
.game-btn-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #fff;
  box-shadow: 3px 3px 0 var(--primary-dark);
}
.game-btn-primary:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--primary-dark);
}
.game-btn-primary:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}
.game-btn-secondary {
  background: var(--bg);
  border-color: var(--card-border);
  color: var(--text-secondary);
  box-shadow: 3px 3px 0 rgba(180,140,100,0.12);
}
.game-btn-secondary:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(180,140,100,0.15);
}

/* 游戏结束覆盖层 */
.game-over-content {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(253,246,236,0.92);
  backdrop-filter: blur(4px);
  z-index: 10;
  border: 2px solid var(--card-border);
  border-radius: 0;
}
.game-over-title {
  font-family: 'zpix', 'Noto Sans SC', sans-serif;
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 12px;
  text-shadow: 2px 2px 0 rgba(180,140,100,0.15);
}
.game-over-score {
  font-family: 'zpix', 'Noto Sans SC', sans-serif;
  font-size: 3rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 16px;
  text-shadow: 2px 2px 0 rgba(200,150,50,0.2);
}
.game-over-stats {
  display: flex;
  gap: 24px;
}
.game-over-stat {
  text-align: center;
}
.game-over-stat-value {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.game-over-stat-label {
  font-family: 'zpix', 'Noto Sans SC', sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== 接金币游戏 ===== */
.catch-player {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  z-index: 5;
  transition: left 0.05s linear;
}
.coin-item {
  position: absolute;
  font-size: 1.5rem;
  z-index: 3;
  animation: coinFall linear forwards;
  pointer-events: none;
}
.obstacle-item {
  position: absolute;
  font-size: 1.5rem;
  z-index: 3;
  animation: coinFall linear forwards;
  pointer-events: none;
}
@keyframes coinFall {
  0% { top: -20px; opacity: 1; }
  100% { top: 100%; opacity: 1; }
}

/* ===== 记忆翻牌游戏 ===== */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px;
  height: 100%;
  align-content: center;
}
.memory-card {
  aspect-ratio: 1;
  cursor: pointer;
  perspective: 600px;
}
.memory-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.4s steps(4);
  transform-style: preserve-3d;
}
.memory-card.flipped .memory-card-inner {
  transform: rotateY(180deg);
}
.memory-card-front {
  position: absolute;
  inset: 0;
  background: var(--primary);
  border: 2px solid var(--primary-dark);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: rgba(255,255,255,0.3);
  backface-visibility: hidden;
  box-shadow: 2px 2px 0 var(--primary-dark);
}
.memory-card-front::after {
  content: '?';
  font-family: 'zpix', 'Noto Sans SC', sans-serif;
  font-size: 1.2rem;
}
.memory-card-back {
  position: absolute;
  inset: 0;
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  backface-visibility: hidden;
  transform: rotateY(180deg);
  box-shadow: 2px 2px 0 rgba(180,140,100,0.1);
}
.memory-card.matched .memory-card-back {
  background: rgba(125,184,125,0.1);
  border-color: var(--green);
}
.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

/* ===== 点击反应游戏 ===== */
.reaction-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-secondary);
  font-family: 'zpix', 'Noto Sans SC', sans-serif;
}
.reaction-hint > div {
  font-size: 1rem;
}
.reaction-hint-sub {
  font-size: 0.8rem !important;
  color: var(--text-muted);
  margin-top: 6px;
}
.reaction-target {
  position: absolute;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  background: rgba(212,132,90,0.1);
  border: 2px solid var(--primary);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--primary-dark);
  transition: all 0.1s steps(2);
  animation: targetPopIn 0.15s steps(2);
  z-index: 5;
}
.reaction-target:hover {
  transform: scale(1.05);
  box-shadow: 4px 4px 0 var(--primary-dark);
}
.reaction-target.caught {
  background: rgba(125,184,125,0.15);
  border-color: var(--green);
  box-shadow: none;
  font-size: 1.2rem;
}
@keyframes targetPopIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== 垂直跳跃游戏 ===== */
.jump-game-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(212,132,90,0.03) 100%);
}
.jump-player {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  z-index: 5;
  transition: bottom 0.15s steps(3);
}
.jump-player.jumping {
  animation: jumpAnim 0.5s steps(6);
}
@keyframes jumpAnim {
  0% { bottom: 10px; }
  30% { bottom: 80px; }
  60% { bottom: 80px; }
  100% { bottom: 10px; }
}
.jump-platform {
  position: absolute;
  height: 12px;
  background: var(--primary);
  border: 2px solid var(--primary-dark);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--primary-dark);
  z-index: 3;
}

/* ===== 游戏内粒子效果 ===== */
.game-particle {
  position: absolute !important;
  z-index: 20;
  font-size: 1.2rem;
  animation: particleFly 1.2s steps(4) forwards;
  pointer-events: none;
}
@keyframes particleFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx, 0), var(--ty, -30px)) scale(0.4); }
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .game-container {
    height: 300px;
  }
  .memory-grid {
    gap: 6px;
    padding: 10px;
  }
  .memory-card-back {
    font-size: 1.4rem;
  }
  .game-over-title {
    font-size: 1.2rem;
  }
  .game-over-score {
    font-size: 2.5rem;
  }
  .jump-player {
    font-size: 1.6rem;
  }
}
