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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #87CEEB 0%, #E0F7FA 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.game-container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

/* 开始界面 */
#start-screen {
  text-align: center;
  padding: 40px 20px;
}

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

.game-subtitle {
  font-size: 24px;
  color: #7f8c8d;
  margin-bottom: 30px;
}

.start-info {
  margin-bottom: 30px;
  color: #7f8c8d;
  font-size: 14px;
  line-height: 1.8;
}

.start-info p {
  margin-bottom: 8px;
}

.start-btn {
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  color: white;
  border: none;
  padding: 16px 48px;
  font-size: 20px;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(39, 174, 96, 0.5);
}

.start-btn:active {
  transform: translateY(2px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.high-score {
  margin-top: 30px;
  font-size: 18px;
  color: #2c3e50;
}

.high-score .label {
  color: #7f8c8d;
}

.high-score .value {
  font-weight: bold;
  font-size: 24px;
  color: #e74c3c;
}

/* 游戏画布 */
#game-canvas {
  display: block;
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* 游戏结束界面 */
#gameover-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.gameover-card {
  background: white;
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.gameover-title {
  font-size: 32px;
  color: #e74c3c;
  margin-bottom: 20px;
}

.final-score, .best-score {
  font-size: 20px;
  margin-bottom: 10px;
}

.final-score .label, .best-score .label {
  color: #7f8c8d;
}

.final-score .value {
  font-weight: bold;
  font-size: 36px;
  color: #2c3e50;
}

.best-score .value {
  font-weight: bold;
  font-size: 24px;
  color: #f39c12;
}

.restart-btn {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border: none;
  padding: 14px 40px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: 20px;
}

.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(52, 152, 219, 0.5);
}

.restart-btn:active {
  transform: translateY(2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

/* 游戏UI */
#game-ui {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: center;
  z-index: 10;
}

.score-display {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 30px;
  border-radius: 20px;
}

#current-score {
  color: white;
  font-size: 28px;
  font-weight: bold;
}

/* 排行榜 */
.ranking-section {
  margin-top: 30px;
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.ranking-section h3 {
  font-size: 20px;
  color: #2c3e50;
  margin-bottom: 15px;
}

#ranking-content {
  min-height: 100px;
}

#ranking-loading {
  color: #7f8c8d;
  padding: 20px;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.ranking-item .rank {
  font-weight: bold;
  color: #f39c12;
  width: 30px;
}

.ranking-item .player {
  flex: 1;
  text-align: left;
  padding-left: 10px;
  color: #2c3e50;
}

.ranking-item .score {
  font-weight: bold;
  color: #27ae60;
}

.ranking-empty {
  color: #7f8c8d;
  padding: 20px;
}

/* 响应式 */
@media (max-width: 400px) {
  .game-title {
    font-size: 36px;
  }
  
  .game-subtitle {
    font-size: 18px;
  }
  
  .start-btn {
    padding: 14px 36px;
    font-size: 18px;
  }
  
  .gameover-card {
    padding: 30px 20px;
  }
  
  .gameover-title {
    font-size: 28px;
  }
  
  .final-score .value {
    font-size: 32px;
  }
}

/* 返回主页按钮 */
.home-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 32px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.home-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.5);
}

.home-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}