* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Courier New', monospace;
  background-image: url('../img/taff头像.png');
  background-size: 100px;
  background-repeat: repeat;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* 主界面样式 */
.main-menu {
  text-align: center;
  background-color: #fff;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.main-menu h1 {
  font-size: 32px;
  margin-bottom: 20px;
  color: #333;
}

.author-info {
  margin-bottom: 30px;
}

#author-name {
  font-size: 16px;
  color: #666;
  cursor: pointer;
  transition: color 0.3s;
}

#author-name:hover {
  color: #ff6b6b;
  text-decoration: underline;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.menu-buttons button {
  padding: 15px 30px;
  font-size: 18px;
  width: 200px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#start-btn {
  background-color: #4CAF50;
  color: white;
}

#start-btn:hover {
  background-color: #45a049;
}

#exit-btn {
  background-color: #f44336;
  color: white;
}

#exit-btn:hover {
  background-color: #da190b;
}

/* 游戏界面样式 */
.game-container {
  text-align: center;
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.top-controls {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 15px;
}

.top-controls button {
  padding: 8px 16px;
  font-size: 14px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#restart-btn {
  background-color: #4CAF50;
  color: white;
}

#restart-btn:hover {
  background-color: #45a049;
}

#back-btn {
  background-color: #ff9800;
  color: white;
}

#back-btn:hover {
  background-color: #f57c00;
}

.game-container h1 {
  font-size: 24px;
  margin-bottom: 20px;
  color: #333;
}

.game-info {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: bold;
}

#gameCanvas {
  border: 2px solid #333;
  background-color: #e0e0e0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.game-controls {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.game-controls p {
  margin-bottom: 10px;
  font-size: 14px;
}

.game-controls p {
  margin-bottom: 10px;
  font-size: 14px;
}

.game-message {
  margin-top: 20px;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  min-height: 30px;
}

.nightmare-text {
  margin-top: 10px;
  padding: 15px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 5px;
  color: #ff4444;
  font-size: 16px;
  text-align: center;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 1s ease;
}

/* 游戏结束全屏界面 */
.game-over-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.game-over-screen h2 {
  font-size: 64px;
  color: #ff6b6b;
  margin-bottom: 20px;
  text-shadow: 3px 3px 0 #000;
  animation: pulse 1.5s infinite;
}

.game-over-screen p {
  font-size: 32px;
  color: #fff;
  margin-bottom: 40px;
  text-shadow: 2px 2px 0 #000;
}

/* 游戏胜利全屏界面 */
.game-win-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.game-win-screen h2 {
  font-size: 64px;
  color: #4CAF50;
  margin-bottom: 20px;
  text-shadow: 3px 3px 0 #000;
  animation: pulse 1.5s infinite;
}

.game-win-screen p {
  font-size: 32px;
  color: #fff;
  margin-bottom: 40px;
  text-shadow: 2px 2px 0 #000;
}

.game-over-buttons {
  display: flex;
  gap: 20px;
}

.game-over-buttons button {
  padding: 15px 30px;
  font-size: 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
  min-width: 150px;
}

#restart-btn-game-over, #restart-btn-game-win {
  background-color: #4CAF50;
  color: white;
}

#restart-btn-game-over:hover, #restart-btn-game-win:hover {
  background-color: #45a049;
}

#back-btn-game-over, #back-btn-game-win {
  background-color: #ff9800;
  color: white;
}

#back-btn-game-over:hover, #back-btn-game-win:hover {
  background-color: #f57c00;
}

/* 动画效果 */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* 难度选择界面样式 */
.difficulty-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: white;
  text-align: center;
  padding: 20px;
}

/* 教程界面样式 */
.tutorial-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: white;
  text-align: center;
  padding: 20px;
  overflow-y: auto;
}

.tutorial-screen h2 {
  font-size: 48px;
  color: #ff6b6b;
  margin-bottom: 40px;
  text-shadow: 3px 3px 0 #000;
  animation: pulse 1.5s infinite;
}

.tutorial-content {
  max-width: 800px;
  text-align: left;
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
}

.tutorial-section {
  margin-bottom: 30px;
}

.tutorial-section h3 {
  font-size: 24px;
  color: #4ecdc4;
  margin-bottom: 10px;
  text-shadow: 1px 1px 0 #000;
}

.tutorial-section p, .tutorial-section li {
  font-size: 18px;
  margin-bottom: 10px;
  line-height: 1.5;
}

#back-to-menu-btn {
  margin-top: 30px;
  padding: 15px 30px;
  font-size: 18px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
  background-color: #ff9800;
  color: white;
}

#back-to-menu-btn:hover {
  background-color: #f57c00;
}

.difficulty-screen h2 {
  font-size: 48px;
  color: #ff6b6b;
  margin-bottom: 40px;
  text-shadow: 3px 3px 0 #000;
  animation: pulse 1.5s infinite;
}

.difficulty-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.difficulty-buttons button {
  padding: 15px 30px;
  font-size: 20px;
  width: 200px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
  color: white;
}

#normal-btn {
  background-color: #4CAF50;
}

#normal-btn:hover {
  background-color: #45a049;
}

#stealth-btn {
  background-color: #2196F3;
}

#stealth-btn:hover {
  background-color: #0b7dda;
}

/* 恶梦难度按钮样式 */
#nightmare-btn {
  background-color: #2c2c2c;
  color: #ff4444;
  border: 2px solid #ff4444;
}



#nightmare-btn:hover {
  background-color: #3c3c3c;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

#back-from-difficulty-btn {
  background-color: #ff9800;
}

#back-from-difficulty-btn:hover {
  background-color: #f57c00;
}

/* 手机控制按钮 */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.mobile-controls button {
  width: 60px;
  height: 60px;
  font-size: 24px;
  border: none;
  border-radius: 50%;
  background-image: url('../img/taff头像.png');
  background-size: cover;
  background-position: center;
  color: white;
  cursor: pointer;
  margin: 5px;
  transition: transform 0.3s;
  position: relative;
  overflow: hidden;
}

.mobile-controls button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
}

.mobile-controls button:hover {
  transform: scale(1.1);
}

.mobile-controls .control-row {
  display: flex;
  justify-content: center;
}

#up-btn::after {
  content: '↑';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#down-btn::after {
  content: '↓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#left-btn::after {
  content: '←';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#right-btn::after {
  content: '→';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 响应式布局 */
@media (max-width: 768px) {
  /* 主菜单 */
  .main-menu {
    padding: 30px;
    width: 90%;
    max-width: 300px;
  }
  
  .main-menu h1 {
    font-size: 24px;
    margin-bottom: 30px;
  }
  
  .menu-buttons button {
    padding: 12px 24px;
    font-size: 16px;
    width: 180px;
  }
  
  /* 游戏界面 */
  .game-container {
    padding: 15px;
    width: 95%;
    max-width: 420px;
  }
  
  .game-container h1 {
    font-size: 20px;
    margin-bottom: 15px;
  }
  
  .game-info {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  #gameCanvas {
    width: 100%;
    height: auto;
    max-width: 400px;
  }
  
  .game-controls button {
    padding: 8px 16px;
    font-size: 14px;
  }
  
  /* 游戏结束和胜利界面 */
  .game-over-screen h2,
  .game-win-screen h2 {
    font-size: 48px;
  }
  
  .game-over-screen p,
  .game-win-screen p {
    font-size: 24px;
  }
  
  .game-over-buttons {
    flex-direction: column;
    gap: 15px;
  }
  
  .game-over-buttons button {
    padding: 12px 24px;
    font-size: 16px;
  }
  
  /* 教程界面 */
  .tutorial-screen {
    padding: 15px;
  }
  
  .tutorial-screen h2 {
    font-size: 36px;
    margin-bottom: 20px;
  }
  
  .tutorial-content {
    max-width: 90%;
    padding: 15px;
  }
  
  .tutorial-section h3 {
    font-size: 20px;
  }
  
  .tutorial-section p,
  .tutorial-section li {
    font-size: 16px;
  }
  
  #back-to-menu-btn {
    padding: 12px 24px;
    font-size: 16px;
    width: 180px;
  }
}