/* 堆叠塔游戏样式 */
* {
  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 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
  transition: background 0.5s ease;
}

.game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

/* 头部信息栏 */
.game-header {
  position: relative;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 800px;
  padding: 15px 25px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

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

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

.score-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-value {
  font-size: 28px;
  font-weight: bold;
  color: #6c5ce7;
  transition: all 0.3s ease;
}

.score-item.combo .score-value {
  color: #fd79a8;
}

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

/* 控制按钮 */
.control-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-theme {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
}

.btn-theme:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(108, 92, 231, 0.4);
}

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

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

.btn-home {
  background: #e74c3c;
  color: #fff;
}

.btn-home:hover {
  background: #c0392b;
}

/* 游戏画布容器 */
.canvas-wrapper {
  position: relative;
  border-radius: 12px;
  overflow: visible;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  min-height: 600px;
}

#gameCanvas {
  display: block;
  border-radius: 12px;
}

/* 游戏覆盖层（开始/结束/暂停界面） */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 26, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 1000;
  pointer-events: auto;
  padding: 20px;
  overflow-y: auto;
  max-height: 100%;
}

.game-overlay * {
  position: relative;
  z-index: 1001;
}

.game-overlay .overlay-btn {
  min-width: 200px;
}

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

.overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 450px;
  gap: 15px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 10px;
}

.overlay-title {
  font-size: 42px;
  font-weight: bold;
  margin-bottom: 5px;
  text-shadow: 0 0 20px rgba(108, 92, 231, 0.5);
  text-align: center;
  line-height: 1.2;
  flex-shrink: 0;
  transition: color 0.5s ease;
}

.overlay-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 15px;
  text-align: left;
  line-height: 1.6;
  flex-shrink: 0;
  width: 100%;
}

.overlay-subtitle ul {
  margin: 10px 0 0 20px;
  padding: 0;
}

.overlay-subtitle li {
  margin: 5px 0;
  font-size: 13px;
}

.overlay-score {
  font-size: 24px;
  color: #ffd700;
  margin-bottom: 30px;
  text-align: center;
}

.overlay-btn {
  padding: 15px 40px;
  font-size: 18px;
  background: #6c5ce7;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  margin: 10px;
  min-width: 200px;
  text-align: center;
}

.overlay-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(108, 92, 231, 0.5);
}

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

.overlay-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 控制说明 */
.controls-info {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 450px;
}

.control-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.control-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.control-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
  line-height: 1.3;
  max-width: 120px;
  word-wrap: break-word;
}

/* 移动端控制提示 */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.mobile-hint {
  background: rgba(255, 255, 255, 0.2);
  padding: 15px 30px;
  border-radius: 30px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 连击提示 */
.combo-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 36px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 500;
}

/* 暂停指示器 */
.pause-indicator {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 14px;
  color: #ffd700;
  display: none;
  z-index: 300;
}

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

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

  .game-header {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }

  .score-panel {
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .score-value {
    font-size: 24px;
  }

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

  .overlay-title {
    font-size: 36px;
  }

  .controls-info {
    flex-direction: column;
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .mobile-controls {
    display: block;
  }

  .control-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }

  .btn {
    padding: 8px 15px;
    font-size: 12px;
  }
}

/* 动画效果 */
@keyframes scorePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.score-pop {
  animation: scorePop 0.3s ease;
}
