* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: #fff;
  /* 移动端优化 */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.game-wrapper {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

header.hud {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo .emoji {
  font-size: 32px;
}

.logo h1 {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.stat .label {
  font-size: 12px;
  opacity: 0.8;
  color: rgba(255, 255, 255, 0.9);
}

.stat span:last-child {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.fruit-badge {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-size: 24px;
}

.stage {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: rgba(14, 20, 33, 0.6);
  /* 移动端优化 */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.top-line {
  position: absolute;
  top: 100px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: rgba(255, 131, 0, 0.6);
  border: 1px dashed rgba(255, 131, 0, 0.4);
  pointer-events: none;
  z-index: 10;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: 20px;
}

.overlay.hidden {
  display: none;
}

.panel {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 32px;
  max-width: 90%;
  width: 400px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  color: #333;
}

.panel h2 {
  font-size: 28px;
  margin-bottom: 16px;
  color: #333;
}

.panel h3 {
  font-size: 20px;
  margin-bottom: 12px;
  color: #333;
}

.panel p {
  font-size: 16px;
  margin-bottom: 24px;
  color: #666;
}

.panel button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  /* 移动端优化 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.panel button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.panel button:active {
  transform: translateY(0);
}

#leaderboard-list,
#leaderboard-list-view {
  text-align: left;
  margin: 16px 0;
  max-height: 300px;
  overflow-y: auto;
}

#leaderboard-list > div,
#leaderboard-list-view > div {
  padding: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#leaderboard-list > div:last-child,
#leaderboard-list-view > div:last-child {
  border-bottom: none;
}

.instructions {
  text-align: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.instructions p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

.instructions strong {
  color: #fff;
  font-weight: 600;
}

/* 滚动条样式 */
#leaderboard-list::-webkit-scrollbar,
#leaderboard-list-view::-webkit-scrollbar {
  width: 6px;
}

#leaderboard-list::-webkit-scrollbar-track,
#leaderboard-list-view::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

#leaderboard-list::-webkit-scrollbar-thumb,
#leaderboard-list-view::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

#leaderboard-list::-webkit-scrollbar-thumb:hover,
#leaderboard-list-view::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* 移动端优化 */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  .game-wrapper {
    gap: 12px;
  }
  
  header.hud {
    padding: 12px 16px;
  }
  
  .logo h1 {
    font-size: 18px;
  }
  
  .stat span:last-child {
    font-size: 20px;
  }
  
  .instructions {
    padding: 12px;
  }
  
  .instructions p {
    font-size: 12px;
  }
  
  .panel {
    padding: 24px;
    width: 90%;
  }
  
  .panel h2 {
    font-size: 24px;
  }
  
  .panel button {
    padding: 10px 24px;
    font-size: 14px;
  }
}

/* 触摸反馈 */
.panel button:active {
  transform: scale(0.95);
}

#leaderboard-btn:active {
  transform: scale(0.95);
  opacity: 0.8;
}

/* 防止移动端双击缩放 */
* {
  -webkit-tap-highlight-color: transparent;
}

