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

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

/* ==================== 游戏容器 ==================== */
.game-container {
  background: white;
  border-radius: 20px;
  padding: 30px;
  max-width: 800px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ==================== 头部 ==================== */
.header {
  text-align: center;
  margin-bottom: 25px;
}

.title {
  font-size: 2.5rem;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  font-weight: bold;
}

.subtitle {
  color: #666;
  font-size: 1.1rem;
}

/* ==================== 信息栏 ==================== */
.info-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.info-item {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  transition: transform 0.3s ease;
}

.info-item:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  animation: infoShake 0.3s ease;
}

@keyframes infoShake {
  0%, 100% { transform: translateY(-3px) scale(1.02) rotate(0deg); }
  25% { transform: translateY(-3px) scale(1.02) rotate(-1deg); }
  75% { transform: translateY(-3px) scale(1.02) rotate(1deg); }
}

.info-label {
  display: block;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 5px;
}

.info-value {
  display: block;
  font-size: 1.8rem;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

/* ==================== 游戏区域 ==================== */
.game-area {
  position: relative;
  background: linear-gradient(to bottom, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
}

#gameCanvas {
  display: block;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  background: white;
  max-width: 100%;
  height: auto;
}

.game-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
  color: white;
  padding: 15px 30px;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: bold;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: fadeInOut 3s ease infinite, float 2s ease-in-out infinite;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

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

@keyframes fadeInOut {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ==================== 控制按钮 ==================== */
.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.control-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  flex: 0 1 auto;
}

.control-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
  animation: buttonGlow 0.3s ease;
}

@keyframes buttonGlow {
  0%, 100% { box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6); }
  50% { box-shadow: 0 8px 30px rgba(102, 126, 234, 0.8); }
}

.control-btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 1.2rem;
}

.btn-text {
  font-size: 1rem;
}

/* ==================== 移动端控制 ==================== */
.mobile-controls {
  display: none;
  justify-content: center;
  margin-bottom: 25px;
}

.d-pad {
  display: grid;
  grid-template-columns: repeat(3, 70px);
  grid-template-rows: repeat(3, 70px);
  gap: 5px;
}

.d-pad-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 15px;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.d-pad-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.6);
  animation: buttonPress 0.1s ease;
}

@keyframes buttonPress {
  0% { transform: scale(1); }
  50% { transform: scale(0.9); }
  100% { transform: scale(0.95); }
}

.d-pad-btn.up {
  grid-column: 2;
  grid-row: 1;
}

.d-pad-btn.left {
  grid-column: 1;
  grid-row: 2;
}

.d-pad-btn.center {
  grid-column: 2;
  grid-row: 2;
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  cursor: default;
}

.d-pad-btn.center:active {
  transform: scale(1);
}

.d-pad-btn.right {
  grid-column: 3;
  grid-row: 2;
}

.d-pad-btn.down {
  grid-column: 2;
  grid-row: 3;
}

/* ==================== 游戏说明 ==================== */
.instructions {
  background: linear-gradient(to right, #f5f7fa 0%, #c3cfe2 100%);
  padding: 20px;
  border-radius: 12px;
  margin-top: 20px;
}

.instructions h3 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.instructions p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 15px;
}

.instructions p:last-child {
  margin-bottom: 0;
}

/* ==================== 遮罩层 ==================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.overlay.hidden {
  display: none;
}

@keyframes fadeIn {
/* Developer: SinceraXY - CUPB */
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

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

.overlay-title {
  font-size: 2.5rem;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.overlay-subtitle {
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.primary-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 50px;
  border-radius: 30px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  margin-bottom: 30px;
}

.primary-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
  animation: primaryBtnPulse 0.5s ease;
}

@keyframes primaryBtnPulse {
  0%, 100% { transform: translateY(-3px) scale(1.05); }
  50% { transform: translateY(-3px) scale(1.08); }
}

/* ==================== 难度选择 ==================== */
/* Project: GameHub */
.level-select h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.difficulty-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.difficulty-btn {
  background: white;
  border: 3px solid #e0e0e0;
  padding: 15px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
}

.difficulty-btn:hover {
  border-color: #667eea;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  animation: difficultyHover 0.3s ease;
}

@keyframes difficultyHover {
  0%, 100% { transform: translateY(-2px) scale(1.02); }
  50% { transform: translateY(-2px) scale(1.05); }
}

.difficulty-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  color: white;
}

.diff-name {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.diff-desc {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ==================== 弹窗 ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 40px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.modal-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: headerGlow 3s ease-in-out infinite;
}

@keyframes headerGlow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10px, 10px); }
}

.trophy-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  animation: trophyBounce 1s ease infinite;
  display: inline-block;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.1); }
}

.win-title {
  font-size: 2.2rem;
  margin: 0 0 10px 0;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.win-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
  position: relative;
  z-index: 1;
}

.modal-body {
  padding: 30px;
}

.win-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.stat-item {
  text-align: center;
  padding: 20px 15px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
  border-radius: 12px;
  border: 2px solid #e0e0e0;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
  border-color: #667eea;
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 5px;
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: bold;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#newRecordCard.hidden {
  display: none;
}

.modal-buttons {
  display: flex;
  gap: 15px;
}

.modal-btn {
  flex: 1;
  padding: 15px 20px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-btn .btn-icon {
  font-size: 1.3rem;
}

.modal-btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.modal-btn.primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
  animation: modalBtnGlow 0.3s ease;
}

@keyframes modalBtnGlow {
  0%, 100% { box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6); }
  50% { box-shadow: 0 8px 25px rgba(102, 126, 234, 0.8); }
}

.modal-btn.secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

.modal-btn.secondary:hover {
  background: linear-gradient(to bottom, #f5f7fa 0%, #e8ecf1 100%);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
  .game-container {
    padding: 20px;
  }

  .title {
    font-size: 2rem;
  }

  .subtitle {

/* Developer: SinceraXY from CUPB */

    font-size: 1rem;
  }

  .info-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .info-value {
    font-size: 1.5rem;
  }

  #gameCanvas {
    width: 100%;
    height: auto;
  }

  .controls {
    grid-template-columns: repeat(2, 1fr);
  }

  .control-btn {
    width: 100%;
  }

  .mobile-controls {
    display: flex;
  }

  .difficulty-buttons {
    flex-direction: column;
  }

  .win-stats {
    grid-template-columns: 1fr;
  }

  .stat-item:last-child {
    grid-column: span 1;
  }

  .modal-buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .game-container {
    padding: 15px;
  }

  .title {
    font-size: 1.5rem;
  }

  .info-item {
    padding: 10px;
  }

  .info-value {
    font-size: 1.2rem;
  }

  .d-pad {
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
  }

  .d-pad-btn {
    font-size: 1.2rem;
  }
}
