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

:root {
  --primary-color: #00d4ff;
  --secondary-color: #ff00ff;
/* Author: SinceraXY */
  --success-color: #00ff88;
  --error-color: #ff3366;
  --warning-color: #ffaa00;
  --bg-color: #0a0e27;
  --card-bg: #1a1f3a;
  --text-primary: #ffffff;
  --text-secondary: #b8c5d6;
  --border-color: #2a3f5f;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

/* 星空背景动画 */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 60% 70%, white, transparent),
    radial-gradient(1px 1px at 50% 50%, white, transparent),
    radial-gradient(1px 1px at 80% 10%, white, transparent),
    radial-gradient(2px 2px at 90% 60%, white, transparent),
    radial-gradient(1px 1px at 33% 80%, white, transparent);
  background-size: 200% 200%;
  background-position: 0% 0%;
  animation: stars 120s linear infinite;
  opacity: 0.5;
  z-index: 0;
}

@keyframes stars {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 200% 200%;
  }
}

/* ==================== 游戏容器 ==================== */
.game-container {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  max-width: 800px;
  width: 100%;
  padding: 30px;
  animation: fadeInUp 0.5s ease-out;
  position: relative;
  z-index: 1;
  border: 2px solid var(--primary-color);
  margin: 20px 0;
}

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

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

.title {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 5px;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ==================== 信息栏 ==================== */
.info-bar {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 25px;
}

.info-item {
  flex: 1;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 0, 255, 0.1));
  padding: 12px;
  border-radius: var(--border-radius-sm);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.info-label {
  display: block;
  font-size: 0.85rem;
/* Developer: SinceraXY - CUPB */
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.info-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* ==================== 游戏画布 ==================== */
.canvas-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
  background: #000000;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3), inset 0 0 50px rgba(0, 212, 255, 0.1);
}
/* Dedicated to my girlfriend */

#gameCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: crisp-edges;
}

/* ==================== 覆盖层 ==================== */
.start-overlay,
.pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  animation: fadeIn 0.3s ease-out;
}

.start-overlay.hidden,
.pause-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.start-content,
.pause-content {
  text-align: center;
  color: white;
  animation: slideUp 0.5s ease-out;
}

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

.start-content h2,
.pause-content h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
}

.start-content p {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px auto 0 auto;
  padding: 15px 40px;
  border: none;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: var(--border-radius-sm);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.6);
}

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

/* ==================== 控制按钮 ==================== */
.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.control-btn {
  padding: 12px 20px;
  border: 2px solid var(--primary-color);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 0, 255, 0.1));
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.control-btn:hover {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(255, 0, 255, 0.2));
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

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

.control-btn.muted {
  opacity: 0.5;
}

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

/* ==================== 游戏说明 ==================== */
.instructions {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(255, 0, 255, 0.05));
  padding: 20px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.instructions h3 {
  color: var(--primary-color);
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.instructions ul {
  list-style: none;
  padding: 0;
}

.instructions li {
  color: var(--text-secondary);
  padding: 6px 0;
  padding-left: 25px;
  position: relative;
  font-size: 0.9rem;
}

.instructions li::before {
  content: "▸";
  position: absolute;
  left: 10px;
  color: var(--primary-color);
  font-weight: bold;
}

/* ==================== 模态框 ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 90%;
  animation: slideUp 0.3s ease-out;
  text-align: center;
  border: 2px solid var(--primary-color);
}

/* ==================== 游戏结束 ==================== */
.game-over-content {
  text-align: center;
}

.game-over-icon {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

#gameOverTitle {
  color: var(--text-primary);
  margin-bottom: 25px;
  font-size: 2rem;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.game-over-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 30px;
}

.stat-item {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  text-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

.modal-btn {
  padding: 12px 40px;
  border: none;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: var(--border-radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.6);
}

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

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

  .title {
    font-size: 2rem;
  }

  .info-bar {
    gap: 10px;
  }

  .info-item {
    padding: 10px 8px;
  }

  .info-label {
    font-size: 0.75rem;
  }

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

  .controls {
    gap: 8px;
  }

  .control-btn {
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .btn-text {
    display: none;
  }

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

  .start-content h2 {
    font-size: 2rem;
  }

  .start-content p {
    font-size: 1rem;
  }

  .modal-content {
    padding: 30px 20px;
  }

  .game-over-stats {
    gap: 30px;
  }
}

@media (max-width: 400px) {
  .info-value {
    font-size: 1rem;
  }

  .game-over-icon {
    font-size: 4rem;
  }

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

/* ==================== 新增样式 ==================== */

/* 生命值显示 */
.lives-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.hearts-container {
  display: flex;
  gap: 3px;
  font-size: 1rem;
}

.heart-icon {
  display: inline-block;
  opacity: 1;
  transform: scale(1);
  transition: all 0.3s ease;
  will-change: transform;
}

/* 最高分特殊样式 */
.highscore-item {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
  border-color: #ffd700;
}

.highscore-item .info-value {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* 游戏Logo */
.game-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
}

.logo-alien {
  font-size: 6rem;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.6));
}

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

.logo-text {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 3px;
  text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

/* 控制指南 */
.control-guide {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.guide-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.guide-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 8px 15px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 3px 10px rgba(0, 212, 255, 0.4);
  letter-spacing: 2px;
}

.guide-desc {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* 开始按钮增强 */
.btn-icon-large {
  font-size: 1.5rem;
  margin-right: 8px;
}

/* 暂停界面增强 */
.pause-icon {
  font-size: 6rem;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.pause-hint {
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.pause-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.pause-control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 30px;
  border: 2px solid var(--primary-color);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 0, 255, 0.1));
  color: white;
  border-radius: var(--border-radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.pause-control-btn:hover {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(255, 0, 255, 0.2));
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.pause-tips {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(0, 212, 255, 0.3);
}

/* 游戏说明增强 */
.instructions-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.title-icon {
  font-size: 1.5rem;
}

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

.instruction-card {
  background: rgba(0, 212, 255, 0.05);
  padding: 15px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(0, 212, 255, 0.2);
  transition: var(--transition);
}

.instruction-card:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
}

.card-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 10px;
}

.instruction-card h4 {
  color: var(--primary-color);
  margin-bottom: 8px;
  font-size: 1rem;
}

.instruction-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* 得分信息 */
.score-info {
  background: rgba(255, 215, 0, 0.05);
  padding: 15px;
  border-radius: var(--border-radius-sm);

/* GitHub: https://github.com/nilgpt2024/web-game */

  border: 1px solid rgba(255, 215, 0, 0.3);
}

.score-info h4 {
  color: #ffd700;
  margin-bottom: 12px;
  text-align: center;
  font-size: 1.1rem;
}

.score-table {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
}

.alien-preview {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 1.2rem;
}

.score-value {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

/* 游戏结束对话框增强 */
.game-over-subtitle {
  color: var(--text-secondary);
  margin-bottom: 25px;
  font-size: 1rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 0, 255, 0.1));
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  flex: 1;
}

.stat-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
}

.stat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.highscore-card {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.2));
  border-color: #ffd700;
  grid-column: 1 / -1;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
  }
}

.highscore-card .stat-value {
  color: #ffd700;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

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

.modal-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 30px;
  font-size: 1rem;
}

.modal-btn.primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.modal-btn.secondary {
  background: linear-gradient(135deg, rgba(100, 100, 100, 0.8), rgba(150, 150, 150, 0.8));
  border: 2px solid var(--border-color);
}

/* 响应式补充 */
@media (max-width: 600px) {
  body {
    padding: 10px;
    align-items: flex-start;
  }

  .game-container {
    margin: 10px 0;
    padding: 20px 15px;
  }

  .logo-alien {
    font-size: 4rem;
  }

  .logo-text {
    font-size: 2rem;
  }

  .instructions-grid {
    grid-template-columns: 1fr;
  }

  .score-table {
    grid-template-columns: 1fr;
  }

  .game-over-stats {
    flex-direction: column;
  }

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

  .modal-btn {
    width: 100%;
  }
}
