/* 蔬菜拖拽匹配游戏样式 - 儿童卡通风格 */
:root {
  --root-primary-color: #FF4081; /* 鲜艳粉色 */
  --root-secondary-color: #00BCD4; /* 鲜艳青色 */
  --root-accent-color: #FFEB3B; /* 明亮黄色 */
  --root-correct-color: #8BC34A; /* 鲜亮绿色 */
  --root-incorrect-color: #FF5252; /* 鲜亮红色 */
  --root-text-color: #673AB7; /* 紫色文字 */
  --root-white: #ffffff;
  --root-border-radius: 16px;
}

.game-container {
  width: 80%;
  max-width: 800px;
  text-align: center;
  position: relative;
  margin: 20px auto 10px;
}

.game-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: var(--root-border-radius);
  z-index: -1;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 3px dashed var(--root-accent-color);
  margin-bottom: 15px;
  position: relative;
  z-index: 1;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--root-primary-color);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: 1px;
}

.game-header {
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

h1 {
  color: var(--root-primary-color);
  margin: 10px 0;
  font-size: 2.2rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: 1px;
}

.game-info {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  padding-bottom: 10px;
  font-size: 1.5rem;
  position: relative;
  z-index: 1;
}

.score, .group, .timer {
  background-color: var(--root-white);
  padding: 5px 10px;
  border-radius: 20px;
  font-weight: 500;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border: 2px solid var(--root-accent-color);
}

.score {
  color: var(--root-primary-color);
}

.group {
  color: var(--root-secondary-color);
}

.timer {
  background-color: var(--root-white);
  color: var(--root-secondary-color);
}

.timer.warning {
  background-color: #FFEBEE;
  color: var(--root-incorrect-color);
  animation: pulse 1s infinite;
}

.primary-btn {
  background-color: var(--root-secondary-color);
  padding: 12px 20px;
  border-radius: 50px;
  box-shadow: 0 6px 0 #0097A7;
  transform: translateY(-3px);
  transition: all 0.2s ease;
}

.primary-btn:hover {
  background-color: #00ACC1;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #0097A7;
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 0 #0097A7;
}

/* 游戏区域样式 */
.game-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 30px 20px;
  border-radius: var(--root-border-radius);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 1;
  border: 2px dashed var(--root-accent-color);
}

/* 蔬菜容器样式 */
.vegetables-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 30px 20px;
  background-color: rgba(232, 245, 233, 0.5);
  border-radius: var(--root-border-radius);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  min-height: 80px; /* 最小高度确保即使空了也保持大小 */
  position: relative;
  z-index: 1;
}

/* 匹配区域样式 */
.matching-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 拖放区域的容器 */
.drop-zones-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  padding: 30px 0 10px;
}

/* 匹配项容器样式 */
.match-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.vegetable-item {
  width: 100%;
  min-width: 100px;
  max-width: 100px;
  height: 100px;
  background-color: var(--root-white);
  border-radius: var(--root-border-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}

.vegetable-item:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.vegetable-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vegetable-item.dragging {
  opacity: 0.7;
  cursor: grabbing;
  transform: scale(1.1);
}

/* 高亮vegetable-item元素的样式 */
.vegetable-item.highlight {
  transform: scale(1.1);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  border: 2px dashed var(--root-secondary-color);
}

/* 拖放区域的蒙层样式 */
.drop-zone.correct::before,
.drop-zone.incorrect::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 5; /* 确保在图标下面 */
  pointer-events: none; /* 允许点击穿透 */
}

.drop-zone {
  width: 100%;
  min-width: 100px;
  max-width: 100px;
  height: 100px;
  background-color: rgba(225, 245, 254, 0.9);
  border: 3px dashed var(--root-secondary-color);
  border-radius: var(--root-border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  margin: 0 auto;
  position: relative; /* 确保伪元素定位正确 */
  overflow: hidden; /* 确保蒙层不超出框框 */
  touch-action: none;
}

.drop-zone.highlight {
  background-color: rgba(227, 242, 253, 0.9);
  border: 3px dashed #03A9F4;
  box-shadow: 0 0 15px rgba(3, 169, 244, 0.4);
  transform: scale(1.05);
}

.drop-zone.correct {
  background-color: rgba(232, 245, 233, 0.9);
  border: 3px solid var(--root-correct-color);
  animation: correctPulse 1s;
}

.drop-zone.incorrect {
  background-color: rgba(255, 235, 238, 0.9);
  border: 3px solid var(--root-incorrect-color);
}

/* 结果图标样式 */
.result-icon {
  position: absolute;
  font-size: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  z-index: 10; /* 确保在蒙层上面 */
  font-weight: bold;
}

.correct-icon {
  color: var(--root-correct-color);
  text-shadow: 0px 0px 6px rgba(255, 255, 255, 0.9);
}

.incorrect-icon {
  color: var(--root-incorrect-color);
  text-shadow: 0px 0px 6px rgba(255, 255, 255, 0.9);
}

.vegetable-name {
  width: 100%;
  min-width: 80px;
  max-width: 80px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--root-white);
  text-align: center;
  padding: 5px;
  border-radius: 8px;
  background-color: var(--root-secondary-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  margin: 0 auto;
}

.mu-controls {
  margin-top: 30px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  position: relative;
  z-index: 1;
  gap: 20px;
}

/* 按钮的通用样式 */
.mu-btn {
  background-color: var(--root-primary-color);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 1.6rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mu-btn:hover {
  background-color: #E91E63;
  box-shadow: 0 6px 15px rgba(0,0,0,0.3);
  transform: translateY(-2px);
}

.mu-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* 提交按钮禁用状态 */
.mu-btn:disabled, .mu-btn.disabled {
  background-color: #9E9E9E;
  color: #EEEEEE;
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
}

.mu-btn:disabled:hover, .mu-btn.disabled:hover {
  background-color: #9E9E9E;
  box-shadow: none;
  transform: none;
}

/* 提交按钮启用状态 */
.mu-btn.enabled {
  background-color: var(--root-secondary-color);
  animation: bounce 1.5s infinite;
}

.mu-btn.enabled:hover {
  background-color: #0097A7;
}

.sound-toggle {
  background-color: transparent;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: none;
  padding: 8px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--root-accent-color);
}

.sound-toggle:hover {
  background-color: #FFD54F;
  transform: scale(1.15);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.sound-icon {
  width: 28px;
  height: 28px;
  color: var(--root-text-color);
}

.game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.6rem;
  border-radius: var(--root-border-radius);
  z-index: 20;
  display: none;
}

.game-over h2 {
  margin-bottom: 20px;
  color: var(--root-accent-color);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  font-size: 2.5rem;
}

.game-over p {
  padding: 0 10px;
}

.game-over .mu-btn {
  margin-top: 25px;
  background-color: var(--root-accent-color);
  color: #333;
  font-weight: 700;
  padding: 15px 30px;
  font-size: 1.2rem;
  box-shadow: 0 6px 0 #FBC02D;
  transform: translateY(-3px);
}

.game-over .mu-btn:hover {
  background-color: #FDD835;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #FBC02D;
}

.game-over .mu-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 0 #FBC02D;
}

.flying-vegetable {
  position: absolute;
  width: 70px;
  height: 70px;
  animation: fly 2s linear forwards;
  z-index: 15;
  object-fit: contain;
}

@keyframes fly {
  0% {
      transform: translate(0, 0) rotate(0deg) scale(1);
      opacity: 1;
  }
  100% {
      transform: translate(var(--end-x), var(--end-y)) rotate(360deg) scale(0.5);
      opacity: 0;
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
      transform: translateY(0);
  }
  40% {
      transform: translateY(-10px);
  }
  60% {
      transform: translateY(-5px);
  }
}

.bounce {
  animation: bounce 1s;
}

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

/* 添加动画效果 */
@keyframes pulse {
  0% {
      transform: scale(1);
  }
  50% {
      transform: scale(1.05);
  }
  100% {
      transform: scale(1);
  }
}

.pulse {
  animation: pulse 1s infinite;
}

.footer {
  margin-top: 20px;
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  position: relative;
  z-index: 1;
}

@media (max-width: 1024px) {
  .game-container {
    width: 55%;
    padding: 10px;
}
}

/* 响应式设计 */
@media (max-width: 600px) {
  .game-container {
      width: 95%;
      padding: 0 0 10px 0;
      margin-top: 10px;
  }
  
  h1 {
      font-size: 1.6rem;
  }
  
  .game-info {
      flex-direction: row;
      gap: 10px;
  }
  
  .vegetable-item, .drop-zone {
      min-width: 60px;
      max-width: 60px;
      height: 60px;
  }
  
  .vegetable-name {
      min-width: 60px;
      max-width: 60px;
      font-size: 1.2rem;
  }
  
  .drop-zones-container {
      gap: 10px;
      overflow-x: hidden;
      padding: 10px;
  }
  
  .match-item {
      gap: 5px;
  }
  
  .mu-btn {
      padding: 8px 16px;
      font-size: 1.4rem;
  }
  
  .vegetables-container {
      padding: 10px;
      gap: 10px;
  }
  
  .game-area {
      gap: 10px;
      padding: 10px;
  }

  .mu-controls {
    margin-top: 10px;
  }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
  .drop-zones-container {
      grid-template-columns: repeat(2, 1fr);
      padding: 10px;
  }
  
  .vegetable-item, .drop-zone {
      min-width: 60px;
      max-width: 60px;
      height: 60px;
  }
  
  .vegetable-name {
      min-width: 60px;
      max-width: 60px;
      font-size: 0.7rem;
  }
  
  .vegetables-container {
      padding: 10px 5px;
      gap: 8px;
  }
  
  .game-area {
      padding: 10px;
      gap: 10px;
  }

  .mu-controls {
    margin-top: 10px;
  }
}

/* 按钮图标样式 */
.button-icon {
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

/* 开始游戏蒙层样式 */
.game-start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  text-align: center;
  border-radius: var(--root-border-radius);
}

.start-content {
  background-color: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 80%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.start-content h2 {
  margin-top: 0;
  color: #333;
  font-size: 24px;
}

.start-content p {
  margin: 20px 0;
  font-size: 16px;
  line-height: 1.5;
  color: #666;
}

.start-game-btn {
  background-color: #4caf50;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: background-color 0.3s;
}

.start-game-btn:hover {
  background-color: #3d8b40;
}

.start-game-btn .button-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

/* 触摸拖拽克隆元素的样式 */
#touch-drag-clone {
  width: 60px;
  height: 60px;
  border-radius: var(--root-border-radius);
  pointer-events: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  background-color: white;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transform: translate(-50%, -50%); /* 居中显示在触摸点 */
}

#touch-drag-clone img {
  max-width: 85%;
  max-height: 85%;
  width: auto;
  height: auto;
  object-fit: contain;
}