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

:root {
  --primary-color: #00d4ff;
  --secondary-color: #ff6b6b;
  --accent-color: #ffd700;
  --success-color: #4caf50;
  --danger-color: #f44336;
  --background-dark: #0a0e27;
  --background-light: #1a1f3a;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --card-bg: rgba(26, 31, 58, 0.95);
  --border-color: rgba(0, 212, 255, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.4);
  --border-radius: 16px;
  --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(135deg, #667eea 0%, #764ba2 50%, #f093fb 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: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.3) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ==================== 游戏容器 ==================== */
.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(--border-color);
  margin: 20px 0;
  backdrop-filter: blur(10px);
}

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

/* ==================== 头部 ==================== */
.header {
  text-align: center;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
  margin-bottom: 10px;
  letter-spacing: 2px;
}

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

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

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

.info-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.info-label {
  display: block;
  font-size: 0.85rem;
  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);
}

.highscore-item {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 165, 0, 0.15));
  border-color: var(--accent-color);
}

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

.speed-item {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(139, 195, 74, 0.15));
  border-color: var(--success-color);
}

.speed-item .info-value {
  color: var(--success-color);
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* ==================== 游戏画布 ==================== */
.canvas-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
  background: linear-gradient(to bottom, #87ceeb, #f0e68c);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  box-shadow: 0 0 30px rgba(102, 126, 234, 0.4), inset 0 0 30px rgba(255, 255, 255, 0.1);
/* Made with love by SinceraXY */
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 400px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

#gameCanvas:active {
  transform: scale(0.99);
}

/* 连击显示 */
.combo-display {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 5;
  animation: comboAppear 0.3s ease-out;
}

@keyframes comboAppear {
  from {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  to {
/* QQ: 2952671670 */
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.combo-count {
  font-size: 4rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 
    0 0 20px rgba(255, 215, 0, 0.8),
    0 0 40px rgba(255, 165, 0, 0.6),
    0 4px 0 rgba(0, 0, 0, 0.3);
  animation: comboPulse 0.6s ease-in-out infinite;
  line-height: 1;
}

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

.combo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  margin-top: 5px;
  letter-spacing: 3px;
}

/* 游戏提示 */
.game-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 5;
  animation: hintFadeOut 3.5s ease-out forwards;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

@keyframes hintFadeOut {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(-10px);
  }
  80% {
    opacity: 0.8;
    transform: translate(-50%, -50%) translateY(-25px);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-40px);
  }
}

/* ==================== 覆盖层样式 ==================== */
.start-overlay,
.pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 39, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  backdrop-filter: blur(10px);
}

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

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

.game-logo {
  margin-bottom: 30px;
}

.logo-icon {
  font-size: 5rem;
  display: block;
  margin-bottom: 15px;
  animation: bounce 2s infinite;
}

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

.logo-text {
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
  letter-spacing: 3px;
}

.control-guide {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.guide-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.guide-key {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
  min-width: 80px;
}

.guide-desc {
  font-size: 0.85rem;
  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);
}

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

/* 暂停界面 */
.pause-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

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

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

.pause-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 20px;
}

.pause-control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 30px;
  border: 2px solid var(--primary-color);
  background: rgba(0, 212, 255, 0.1);
  color: white;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.pause-control-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

.pause-control-btn span:first-child {
  font-size: 2rem;
}

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

.pause-tips kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

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

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

.control-btn:hover {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(255, 107, 107, 0.3));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

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

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

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

.instructions-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

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

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

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

.instruction-card:hover {
  background: rgba(0, 212, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

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

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

.instruction-card kbd {
  background: rgba(0, 212, 255, 0.2);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--primary-color);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-color);
}

.score-info {
  background: rgba(255, 215, 0, 0.1);
  padding: 20px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--accent-color);
}

.score-info h4 {
  font-size: 1.2rem;
  color: var(--accent-color);
  margin-bottom: 15px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.score-table {
  display: grid;
  gap: 10px;
}

.score-row {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 10px;
  background: rgba(255, 215, 0, 0.05);
  border-radius: var(--border-radius-sm);
}

.item-preview {
  font-size: 1.5rem;
  text-align: center;
}

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

.score-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-color);
}

/* ==================== 模态框 ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

.modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 40px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  border: 2px solid var(--primary-color);
  animation: scaleIn 0.3s ease-out;
  z-index: 1;
}

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

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.game-over-content {
  text-align: center;
}

.game-over-icon {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: pulse 2s infinite;
}

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

.game-over-content h2 {
  font-size: 2.5rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

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

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

/* 前4个卡片正常2×2排列，第5个高分卡片单独占一行 */

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

.stat-card.highscore-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.2));
  border-color: var(--accent-color);
}

.stat-icon {
  font-size: 2.5rem;
}

.stat-info {
  text-align: left;
  flex: 1;
}

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

.stat-value {
  display: block;

/* Developer: SinceraXY from CUPB */

  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.highscore-card .stat-value {
  color: var(--accent-color);
}

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

.modal-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 30px;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

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

.modal-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

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

.modal-btn.secondary:hover {
  background: linear-gradient(135deg, rgba(100, 100, 100, 0.4), rgba(150, 150, 150, 0.4));
  transform: translateY(-2px);
}

/* ==================== 工具类 ==================== */
.hidden {
  display: none !important;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

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

  .title {
    font-size: 2rem;
  }

  .info-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .combo-count {
    font-size: 3rem;
  }
  
  .combo-text {
    font-size: 1.2rem;
  }

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

  #gameCanvas {
    height: 300px;
  }

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

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

  .control-guide {
    gap: 10px;
  }

  .guide-key {
    padding: 8px 15px;
    min-width: 60px;
    font-size: 0.8rem;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

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

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

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

  .modal-btn {
    width: 100%;
  }

  .pause-controls {
    flex-direction: column;
    gap: 10px;
  }

  .pause-control-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

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

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

  #gameCanvas {
    height: 250px;
  }

  .modal-content {
    padding: 25px;
  }

  .game-over-icon {
    font-size: 4rem;
  }
/* Developer: SinceraXY - CUPB */

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