/* ==================== 字体导入 ==================== */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ==================== CSS变量 ==================== */
:root {
  --primary-green: #4CAF50;
  --primary-dark: #2E7D32;
  --accent-yellow: #FFC107;
  --accent-red: #F44336;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ==================== 基础样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Press Start 2P', cursive, monospace;
  color: white;
  overflow: hidden;
  background: #1a1a1a;
}

/* ==================== 游戏容器 ==================== */
.game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

/* ==================== 3D渲染区域 ==================== */
.game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.game-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ==================== 游戏头部 ==================== */
.game-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 100%);
  pointer-events: none;
}

.game-header > * {
  pointer-events: auto;
}

/* ==================== 标题组 ==================== */
.title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-title {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
  animation: pulse 2s ease-in-out infinite;
}

.game-title .icon {
  font-size: 2rem;
  display: inline-block;
  animation: bounce 1s ease-in-out infinite;
}

/* ==================== 帮助按钮 ==================== */
.help-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 215, 0, 0.2);
  border: 2px solid var(--accent-yellow);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.help-btn:hover {
  background: rgba(255, 215, 0, 0.4);
  transform: scale(1.1) rotate(15deg);
  box-shadow: var(--shadow-lg);
}

.help-btn:active {
  transform: scale(0.95);
}

/* ==================== 分数容器 ==================== */
.score-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-display,
.highscore-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 15px;
  border-radius: var(--radius-md);
  border: 2px solid var(--accent-yellow);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.highscore-display {
  border-color: #FFD700;
}

.score-label {
  font-size: 0.75rem;
  color: var(--accent-yellow);
}

.highscore-display .score-label {
  color: #FFD700;
}

.score-value {
  font-size: 1rem;
  color: #fff;
  min-width: 50px;
  text-align: right;
}

/* ==================== 游戏控制 ==================== */
.game-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 30px;
  z-index: 10;
  pointer-events: none;
}

.control-grid {
  display: grid;
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: auto auto;
  gap: 12px;
  pointer-events: all;
}

.control-btn {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid #333;
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  box-shadow: 0 4px 0 #666, var(--shadow-md);
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #666, var(--shadow-lg);
}

.control-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #666, var(--shadow-md);
}

.control-btn svg {
  fill: #333;
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

.control-btn:first-of-type {
  grid-column: 1 / -1;
  width: 100%;
}

/* ==================== 游戏结束界面 ==================== */
.game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 20;
}

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

.game-over-content {
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 40px 60px;
  border-radius: var(--radius-lg);
  border: 3px solid var(--accent-red);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.5s ease;
}

.game-over-title {
  font-size: 2rem;
  margin-bottom: 30px;
  color: var(--accent-red);
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

.final-score {
  font-size: 1.2rem;
  margin-bottom: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.score-highlight {
  font-size: 2.5rem;
  color: var(--accent-yellow);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.retry-btn {
  background: var(--accent-red);
  color: white;
  border: none;
  padding: 20px 50px;
  font-family: 'Press Start 2P', cursive;
  font-size: 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 6px 0 #b71c1c, var(--shadow-md);
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0 auto;
}

.retry-btn:hover {
  background: #e53935;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #b71c1c, var(--shadow-lg);
}

.retry-btn:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 #b71c1c, var(--shadow-md);
}

/* ==================== 帮助弹窗 ==================== */
.help-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
/* Dedicated to my girlfriend */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.help-modal.show {
  display: flex;
  opacity: 1;
}

.help-modal-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(255, 215, 0, 0.3);
  animation: slideIn 0.5s ease;
  border: 3px solid var(--accent-yellow);
}

.help-header {
/* Made with love by SinceraXY */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.help-header h2 {
  font-size: 1.5rem;
  margin: 0;
/* Author: SinceraXY */
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.close-help {
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  line-height: 1;
}

.close-help:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.help-body {
  padding: 25px;
  max-height: 50vh;
  overflow-y: auto;
}

.help-body::-webkit-scrollbar {
  width: 8px;
}

.help-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.help-body::-webkit-scrollbar-thumb {
  background: var(--accent-yellow);
  border-radius: 10px;
}

.help-section {
  margin-bottom: 25px;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--accent-yellow);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.help-section p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
}

.help-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-section li {
  font-size: 0.85rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.95);
  padding-left: 20px;
  position: relative;
}

.help-section li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-yellow);
  font-size: 1.2rem;
}

.help-section strong {
  color: var(--accent-yellow);
}

.help-footer {
  padding: 20px 25px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 2px solid rgba(255, 215, 0, 0.3);
  text-align: center;
}

.start-game-btn {
  background: var(--primary-green);
  color: white;
  border: none;
  padding: 15px 40px;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 6px 0 #2E7D32, var(--shadow-md);
  transition: all 0.1s ease;
}

.start-game-btn:hover {
  background: #66BB6A;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #2E7D32, var(--shadow-lg);
}

.start-game-btn:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 #2E7D32, var(--shadow-md);
}

/* ==================== 动画效果 ==================== */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
  .game-title {
    font-size: 1.2rem;
  }
  
  .game-title .icon {
    font-size: 1.5rem;
  }
  
  .help-btn {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
  }
  
  .score-label {
    font-size: 0.65rem;
  }
  
  .score-value {
    font-size: 0.9rem;
    min-width: 40px;
  }
  
  .score-container {
    gap: 6px;
  }
  
  .control-btn {
    width: 50px;
    height: 50px;
  }
  
  .control-grid {
    grid-template-columns: 50px 50px 50px;
  }
  
  .game-over-title {
    font-size: 1.5rem;
  }
  
  .retry-btn {
    font-size: 0.8rem;
    padding: 15px 35px;
  }
  
  .info-text {
    font-size: 0.6rem;
  }
  
  /* 帮助弹窗响应式 */
  .help-modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .help-header h2 {
    font-size: 1.2rem;
  }
  
  .help-section h3 {
    font-size: 1rem;
  }
  
  .help-section p,
  .help-section li {
    font-size: 0.8rem;
  }
  
  .start-game-btn {
    font-size: 0.8rem;
    padding: 12px 30px;
  }
}

@media (max-width: 480px) {
  .game-header {
    padding: 15px;
  }
  
  .game-title {
    font-size: 1rem;
  }
  
  .title-group {
    gap: 6px;
  }
  
  .help-btn {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }
  
  .game-over-content {
    padding: 30px 40px;
  }
  
  .game-over-title {
    font-size: 1.2rem;
  }
  
  .final-score {
    font-size: 1rem;
  }
  
  .score-highlight {
    font-size: 2rem;
  }
  
  /* 帮助弹窗小屏幕优化 */
  .help-header {
    padding: 15px 20px;
  }
  
  .help-header h2 {
    font-size: 1rem;
  }
  
  .close-help {
    font-size: 2rem;
    width: 35px;
    height: 35px;
  }
  
  .help-body {
    padding: 20px;
    max-height: 55vh;
  }
  
  .help-section {
    margin-bottom: 20px;
  }

/* Developer: SinceraXY from CUPB */

  
  .help-section h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }
  
  .help-section p,
  .help-section li {
    font-size: 0.75rem;
    line-height: 1.6;
  }
  
  .help-footer {
    padding: 15px 20px;
  }
  
  .start-game-btn {
    font-size: 0.7rem;
    padding: 12px 25px;
  }
}
