/**
 * 打砖块游戏样式
 * 响应式设计，支持桌面和移动端
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: #fff;
  overflow: hidden;
}

.game-container {
  max-width: 900px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

/* 游戏头部 */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.score-panel {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.score-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 10px;
  text-align: center;
  min-width: 80px;
}

.score-label {
  font-size: 12px;
  color: #a0a0a0;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.score-value {
  font-size: 24px;
  font-weight: bold;
  color: #00d9ff;
}

.high-score .score-value {
  color: #ffd700;
}

.control-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

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

.btn-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 画布容器 */
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  aspect-ratio: 4/3;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 217, 255, 0.2);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #0a0a1a 0%, #1a1a3e 100%);
}

/* 游戏覆盖层 */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: 15px;
}

.game-overlay.hidden {
  display: none;
}

.overlay-title {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #00d9ff 0%, #00ff88 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(0, 217, 255, 0.5);
}

.overlay-subtitle {
  font-size: 24px;
  color: #a0a0a0;
  margin-bottom: 30px;
}

.overlay-stats {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px 40px;
  border-radius: 15px;
  margin-bottom: 30px;
  text-align: center;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 10px;
}

.stat-label {
  color: #a0a0a0;
  font-size: 16px;
}

.stat-value {
  color: #00d9ff;
  font-size: 20px;
  font-weight: bold;
}

.btn-primary {
  background: linear-gradient(135deg, #00d9ff 0%, #00ff88 100%);
  color: #1a1a2e;
  padding: 15px 40px;
  font-size: 20px;
  margin: 10px;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 217, 255, 0.4);
}

.btn-level-select {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 10px 15px;
  font-size: 14px;
}

.btn-level-select:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 暂停指示器 */
.pause-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  padding: 20px 40px;
  border-radius: 15px;
  display: none;
  z-index: 5;
}

.pause-indicator.visible {
  display: block;
}

/* 道具栏 */
.powerup-bar {
  margin-top: 15px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  min-height: 60px;
}

.powerup-item {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.powerup-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 14px;
  animation: pulse 2s infinite;
}

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

/* 移动端控制 */
.mobile-controls {
  margin-top: 15px;
  text-align: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.mobile-hint {
  color: #a0a0a0;
  font-size: 14px;
}

/* 关卡选择网格 */
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-width: 500px;
  margin: 20px 0;
}

.level-btn {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.level-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.level-btn.completed {
  background: linear-gradient(135deg, #00d9ff 0%, #00ff88 100%);
  color: #1a1a2e;
  border-color: transparent;
}

.level-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.05);
}

.level-btn.current {
  border-color: #ffd700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

/* 响应式设计 */
@media (max-width: 850px) {
  .game-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .score-panel {
    justify-content: center;
  }
  
  .control-buttons {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  body {
    padding: 10px;
  }
  
  .game-container {
    padding: 15px;
    border-radius: 15px;
  }
  
  .score-item {
    min-width: 60px;
    padding: 8px 12px;
  }
  
  .score-value {
    font-size: 18px;
  }
  
  .overlay-title {
    font-size: 32px;
  }
  
  .overlay-subtitle {
    font-size: 18px;
  }
  
  .level-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 400px) {
  .level-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .btn {
    padding: 8px 15px;
    font-size: 14px;
  }
}
