/* ==========================================================================
   龙猫云 - "穿过森林去找龙猫" 森林过河迷你游戏样式 (game.css)
   ========================================================================== */

.game-section {
  padding: 90px 0;
  background: linear-gradient(180deg, #F5FBF6 0%, #E8F4E5 100%);
  position: relative;
  overflow: hidden;
}

.game-container-card {
  max-width: 840px;
  margin: 0 auto;
  background-color: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-card);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  position: relative;
}

/* Game Header & HUD */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 2px dashed var(--border-subtle);
  margin-bottom: 20px;
}

.game-status-group {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--bg-canvas);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.hud-lives {
  display: flex;
  gap: 4px;
}

.heart-icon {
  color: #D9534F;
  font-size: 1.25rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.heart-icon.lost {
  opacity: 0.25;
  filter: grayscale(100%);
}

.game-controls-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-btn {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
}

.game-btn-start {
  background-color: var(--btn-primary);
  color: #FFFFFF;
}

.game-btn-start:hover {
  background-color: var(--btn-primary-hover);
}

.game-btn-pause {
  background-color: #FFFFFF;
  color: var(--text-main);
  border-color: var(--border-card);
}

.game-btn-pause:hover {
  background-color: var(--bg-cream-soft);
}

.game-btn-restart {
  background-color: #FFFFFF;
  color: #9C5135;
  border-color: var(--bg-peach);
}

.game-btn-restart:hover {
  background-color: var(--bg-peach-soft);
}

.game-btn-rules {
  background-color: var(--bg-sky);
  color: #2F617E;
}

.game-btn-rules:hover {
  background-color: #C6E0EE;
}

/* Canvas Stage Wrapper */
.game-stage-wrapper {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 3px solid #758A6A;
  background-color: #A8C98B;
  aspect-ratio: 640 / 560;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background-color: #A8C98B;
  image-rendering: auto;
}

/* Game Overlay Screen (Start, Pause, Victory, Game Over) */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(47, 56, 46, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  color: #FFFFFF;
  z-index: 20;
  transition: opacity 0.25s ease;
}

.game-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.game-overlay-icon {
  margin-bottom: 14px;
}

.game-overlay-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: #FFFDF5;
}

.game-overlay-desc {
  font-size: 1rem;
  max-width: 440px;
  line-height: 1.6;
  margin-bottom: 24px;
  color: #DDE6DB;
}

.game-overlay-btn {
  padding: 12px 32px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background-color: #F5E8B9;
  color: #4A5140;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.game-overlay-btn:hover {
  background-color: #FFFFFF;
  transform: scale(1.05);
}

/* Virtual D-Pad for Mobile Controls */
.mobile-dpad-container {
  display: none;
  margin-top: 24px;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.dpad-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dpad-btn {
  width: 60px;
  height: 54px;
  background-color: #FFFFFF;
  border: 2px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 8px rgba(74, 81, 64, 0.15);
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.dpad-btn:active {
  background-color: var(--bg-grass);
  transform: scale(0.92);
  box-shadow: 0 1px 3px rgba(74, 81, 64, 0.2);
}

/* Game Rules Modal */
.rules-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(30, 36, 28, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.rules-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.rules-card {
  background-color: var(--bg-canvas);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 32px;
  border: 2px solid var(--border-card);
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.rules-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1.5px dashed var(--border-subtle);
  padding-bottom: 14px;
}

.rules-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--text-main);
}

.rules-close-btn {
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.rules-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-main);
}

.rules-content ol {
  margin: 14px 0 20px 20px;
  list-style: decimal;
}

.rules-content li {
  margin-bottom: 10px;
}

.rules-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
  background-color: #FFFFFF;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.legend-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive Show Mobile D-pad */
@media (max-width: 768px) {
  .game-container-card {
    padding: 20px 16px;
  }
  .game-hud {
    justify-content: center;
  }
  .mobile-dpad-container {
    display: flex;
  }
}
