/* 颜色分类游戏样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow-x: hidden;
}

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

/* 头部信息栏 */
.game-header {
  position: relative;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1000px;
  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: #f39c12;
}

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

.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-undo {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

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

.btn-undo:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-hint {
  background: #f39c12;
  color: #fff;
}

.btn-hint:hover {
  background: #e67e22;
  transform: translateY(-2px);
}

.btn-restart {
  background: #3498db;
  color: #fff;
}

.btn-restart:hover {
  background: #2980b9;
  transform: translateY(-2px);
}

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

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

/* 游戏区域 */
.game-area {
  position: relative;
  width: 100%;
  max-width: 1000px;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-board {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
  align-items: flex-end;
  padding: 40px 20px;
  position: relative;
  z-index: 10;
}

/* 试管样式 */
.test-tube {
  width: 60px;
  height: 200px;
  border: 4px solid rgba(255, 255, 255, 0.6);
  border-top: none;
  border-radius: 0 0 30px 30px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.test-tube:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.test-tube.selected {
  transform: translateY(-20px) rotate(-5deg);
  border-color: #f39c12;
  box-shadow: 0 20px 50px rgba(243, 156, 18, 0.5);
}

.test-tube.hint {
  animation: hintPulse 1.5s infinite;
  border-color: #2ecc71;
  box-shadow: 0 0 30px rgba(46, 204, 113, 0.6);
}

@keyframes hintPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.6);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 50px rgba(46, 204, 113, 0.8);
  }
}

/* 试管中的液体 */
.liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  transition: height 0.5s ease, background-color 0.3s ease;
  border-radius: 0 0 26px 26px;
}

.liquid-layer {
  position: absolute;
  left: 0;
  width: 100%;
  transition: all 0.5s ease;
}

/* 液体流动动画 */
.liquid-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.liquid-flow {
  position: absolute;
  width: 20px;
  height: 60px;
  border-radius: 10px;
  opacity: 0.9;
  animation: flowAnimation 0.8s ease-in-out forwards;
}

@keyframes flowAnimation {
  0% {
    opacity: 0.9;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100px) rotate(180deg);
  }
}

/* 游戏覆盖层 */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(44, 62, 80, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 1000;
  pointer-events: auto;
  padding: 20px;
}

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

.overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  gap: 20px;
  padding: 20px;
}

.overlay-title {
  font-size: 48px;
  font-weight: bold;
  color: #f39c12;
  text-shadow: 0 0 30px rgba(243, 156, 18, 0.6);
  text-align: center;
}

.overlay-subtitle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  line-height: 1.6;
}

.overlay-message {
  font-size: 24px;
  color: #2ecc71;
  text-align: center;
  margin: 20px 0;
}

.overlay-btn {
  padding: 15px 40px;
  font-size: 18px;
  background: #f39c12;
  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 {
  background: #e67e22;
  transform: scale(1.05);
}

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

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

.overlay-btn.next-level {
  background: #2ecc71;
}

.overlay-btn.next-level:hover {
  background: #27ae60;
}

/* 关卡选择面板 */
.level-selector {
  width: 100%;
  max-width: 1000px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
}

.level-btn {
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.level-btn.completed {
  background: #2ecc71;
  border-color: #27ae60;
}

.level-btn.current {
  background: #f39c12;
  border-color: #e67e22;
  transform: scale(1.15);
}

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

/* 移动端控制提示 */
.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; }
}

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

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

  .score-panel {
    gap: 20px;
  }

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

  .control-buttons {
    justify-content: center;
    width: 100%;
  }

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

  .test-tube {
    width: 50px;
    height: 170px;
  }

  .game-board {
    gap: 20px;
  }

  .mobile-controls {
    display: block;
  }

  .level-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  }
}

@media (max-width: 480px) {
  .test-tube {
    width: 40px;
    height: 140px;
  }

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

  .overlay-btn {
    padding: 12px 30px;
    font-size: 16px;
    min-width: 160px;
  }
}

/* 胜利特效 */
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f39c12;
  animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(500px) rotate(720deg);
  }
}

/* 提示高亮 */
.highlight-source {
  animation: sourcePulse 1s infinite;
}

@keyframes sourcePulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.8);
  }
  50% {
    box-shadow: 0 0 40px rgba(243, 156, 18, 1);
  }
}

.highlight-target {
  animation: targetPulse 1s infinite;
}

@keyframes targetPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.8);
  }
  50% {
    box-shadow: 0 0 40px rgba(46, 204, 113, 1);
  }
}
