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

body {
  font-family: 'Arial', sans-serif;
  background-color: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.game-container {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 20px;
  max-width: 600px;
  width: 100%;
}

.game-header {
  text-align: center;
  margin-bottom: 20px;
}

.game-title {
  font-size: 2rem;
  color: #333;
  margin-bottom: 10px;
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.score-display {
  font-size: 1.2rem;
  color: #555;
}

.score-value {
  font-weight: bold;
  color: #2d5a27;
}

.difficulty-selector {
  display: flex;
  gap: 10px;
  align-items: center;
}

.difficulty-label {
  font-size: 1rem;
  color: #555;
}

.difficulty-buttons {
  display: flex;
  gap: 5px;
}

.difficulty-btn {
  padding: 5px 10px;
  border: 2px solid #ddd;
  background-color: white;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.difficulty-btn:hover {
  background-color: #f0f0f0;
}

.difficulty-btn.active {
  background-color: #2d5a27;
  color: white;
  border-color: #2d5a27;
}

.game-canvas-container {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

#gameCanvas {
  border: 3px solid #333;
  border-radius: 5px;
  background-color: #fafafa;
  display: block;
}

.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 1.5rem;
  text-align: center;
  border-radius: 5px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.game-overlay.show {
  opacity: 1;
  visibility: visible;
}

.game-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.control-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  min-width: 100px;
}

.start-btn {
  background-color: #2d5a27;
  color: white;
}

.start-btn:hover {
  background-color: #1e3f1a;
}

.pause-btn {
  background-color: #ff9800;
  color: white;
}

.pause-btn:hover {
  background-color: #e68900;
}

.restart-btn {
  background-color: #f44336;
  color: white;
}

.restart-btn:hover {
  background-color: #d32f2f;
}

.control-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.game-instructions {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 15% auto;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-title {
  font-size: 1.5rem;
  color: #333;
  margin-bottom: 15px;
}

.modal-text {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  background-color: #2d5a27;
  color: white;
  transition: all 0.3s ease;
}

.modal-btn:hover {
  background-color: #1e3f1a;
}

/* 移动端样式 */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .game-container {
    padding: 15px;
    border-radius: 0;
    box-shadow: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .game-title {
    font-size: 1.5rem;
  }

  .game-info {
    flex-direction: column;
    align-items: stretch;
  }

  .difficulty-selector {
    justify-content: center;
  }

  .game-canvas-container {
    flex: 1;
    margin-bottom: 15px;
  }

  #gameCanvas {
    width: 100% !important;
    height: auto !important;
    max-height: 60vh;
  }

  .game-controls {
    flex-wrap: wrap;
    gap: 10px;
  }

  .control-btn {
    flex: 1;
    min-width: auto;
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .game-instructions {
    font-size: 0.8rem;
  }
}

/* 动画效果 */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

.pulse {
  animation: pulse 2s infinite;
}
