/* snakeGame.css - 贪吃蛇游戏专用样式 */

/* 游戏容器 */
#snake-game {
    display: none;
    margin: 10px auto 0;
    max-width: 500px;
  }
  
  /* 游戏画布 */
  #game-canvas {
    border: 2px solid #333;
    border-radius: 10px;
    background-color: #f0f0f0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
  }
  
  /* 游戏信息区域 */
  .game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
  }
  
  .game-score, .game-high-score {
    font-weight: bold;
    color: #333;
  }
  
  /* 添加血量显示样式 */
  .health-display {
    display: flex;
    justify-content: flex-start;
    padding: 8px 0;
    width: 100%;
  }

  .health-display img {
    width: 30px;
    height: 30px;
    margin: 0 2px;
  }
  
  /* 贪吃蛇专用控制按钮 */
  #snake-game .mobile-controls {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    margin-top: 15px !important;
    width: 100% !important;
    clear: both !important;
  }
  
  /* 贪吃蛇专用排行榜 */
  .snake-leaderboard .leaderboard-header {
    background: linear-gradient(to right, #27ae60, #2ecc71);
  }
  
  /* 贪吃蛇模态框样式 */
  #snake-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    z-index: 9999;
  }
  
  #snake-modal > div {
    position: relative;
    background: linear-gradient(to bottom, #ffffff, #f5f5f7);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    width: 350px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    position: relative;
    z-index: 10000;
    animation: modalFadeIn 0.3s ease-out;
  }
  
  /* 贪吃蛇暂停层样式 */
  #snake-pause-layer {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 120px !important;
    height: 60px !important;
    background-color: rgba(255, 255, 255, 0.7) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 100 !important;
    font-family: Arial, sans-serif !important;
    font-size: 24px !important;
    color: #333 !important;
    pointer-events: none !important;
    border-radius: 10px !important;
    text-align: center !important;
    box-shadow: 0 0 10px rgba(0,0,0,0.1) !important;
  }

  /* 确保排行榜中的所有文字颜色为深色 */
.leaderboard-panel .leaderboard-row,
.leaderboard-panel .player,
.leaderboard-panel .rank,
.leaderboard-panel .date {
  color: #333; /* 深灰色文字，确保在白色背景上清晰可见 */
}
  /* 特别指定玩家名称的样式 */
.leaderboard-panel .player {
  color: #222; /* 更深的灰色，强调玩家名字 */
  font-weight: 500; /* 稍微加粗 */
}

/* styles.css */
#snake-leaderboard-content {
  position: absolute;
  top: 100%; /* 位于 game-info 下方 */
  left: 50%;
  transform: translateX(-50%);
  background-color: #f9f9f9;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 10; /* 确保在其他元素之上 */
  width: 100%;
  text-align: center;
}

#snake-leaderboard-content h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

#snake-leaderboard-content p {
  margin: 4px 0;
  font-size: 14px;
}
/* 修复模态框关闭按钮样式冲突 */
#snake-modal button{
  margin-top: 15px;
  width: 140px;
  padding: 10px 0;
  border-radius: 25px;
  background: linear-gradient(45deg, #4ecdc4, #556270);
  color: white;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
#snake-modal button:hover{
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
#snake-modal button.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 45px;
  height: 45px;
  margin-top: 0; /* 覆盖上面的margin-top */
  padding: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5); /* 半透明背景，与返回按钮一致 */
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06); /* 淡淡的阴影 */
  z-index: 10;
}
#snake-modal button.modal-close-btn:hover{
  background: rgba(255, 255, 255, 0.7); /* 悬停时稍微不透明 */
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

#snake-modal button.modal-close-btn .close-icon{
  width: 24px;
  height: 24px;
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.2s;
}

#snake-modal button.modal-close-btn:hover .close-icon{
  opacity: 1;
  transform: scale(1.1);
}
#snake-player-select {
  margin-top: 15px;
  margin-bottom: 5px;
  width: 200px;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 16px;
}

/* 添加字符计数器的样式 */
.custom-name-container {
  position: relative;
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-name-container span {
  color: #666;
  font-size: 14px;
}

.custom-name-container input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
  background-color: #fff;
  min-width: 0;
  width: 100%;
  transition: border-color 0.2s;
}

.custom-name-container input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
  z-index: 10; /* 确保焦点时在顶层 */
}
/* 当输入过长时的警告样式 */
.custom-name-container input.input-warning {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}
/* 贪吃蛇特有控制按钮样式 */
#snake-game .direction-btn {
  width: 50px !important;
  height: 50px !important;
  padding: 12px !important;
  border-radius: 15px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  border: none !important;
  background: linear-gradient(45deg, #a2c4f5, #d0e1ff) !important;
}

#snake-game .control-btn .control-icon {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto;
  transition: transform 0.2s ease;
}
/* 修改为 */
html body #snake-game:not([style*="display: none"]) ~ .fruit-basket,
body:has(#snake-game:not([style*="display: none"])) .fruit-basket {
  display: none!important; /* 可能更好的方案是隐藏它 */
}