/* -------------------------------
   页面基础样式：使用图片背景，覆盖整个视口
   100vw/100vh保证在PC和手机上均使用移动版分辨率
------------------------------- */
body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url("../bg/bg1.png") no-repeat center center;
  background-size: cover;
}


/* 当视口宽度大于480px时，背景图片宽度固定为480px，高度自动 */
@media (min-width: 480px) {
  body {
    background-size: 480px auto;
  }
}

/* -------------------------------
   外层容器：整体定位抓娃娃机
   可通过调整top和bottom控制与屏幕的距离
------------------------------- */
#machineWrapper {
  position: absolute;
  top: 100px;             /* 距离屏幕顶部60px，可根据需要自行调整 */
  left: 50%;
  transform: translateX(-50%);

}

/* 机器整体：宽高调整为新尺寸 */
.game-container {
  position: relative;
  width: 380px;      /* 更新后的机器宽度 */
  height: 500px;     /* 更新后的机器高度 */
  background: url("../bg/kj1.png") no-repeat center center;
  background-size: cover;
  z-index: 1;  /* 设为较低层级 */
}

/* 爪子样式：尺寸50×50px，初始位置水平居中，默认背景图片为兔子1.png */
.claw {
  position: absolute;
  top: 127px;
  left: calc(50% - 25px); /* 水平居中：父容器50% - 爪子宽度的一半 */
  width: 61px;
  height: 74px;
  background: url("../bg/KZ.png") no-repeat center center;
  background-size: cover;
  border-radius: 5px;
  z-index: 10; /* 确保爪子层级较高 */
  cursor: pointer;
}

/* 绳子样式：使用线性渐变实现渐变效果，宽2px，初始高度0 */
.rope {
  position: absolute;
  width: 2px;
  background: linear-gradient(to bottom, red, blue); /* 渐变效果 */
  top: 0;
  left: calc(50% + 5px);  /* 初始位置与爪子中心对齐 */
  height: 0;
  z-index: 5;
}

/* 娃娃展示区：透明背景，独立设置宽高 */
.doll-container {
  position: absolute;
  top: 50%;                       /* 垂直居中 */
  left: 50%;                      /* 水平居中 */
  width: 340px;                   /* 设置展示区宽度 */
  height: 350px;                  /* 设置展示区高度 */
  overflow: hidden;               /* 超出部分隐藏 */
  z-index: 2;                     /* 层级设为2，确保展示区显示在机器前面 */
  transform: translate(-50%, -50%) translateY(88px); /* 居中后额外向下偏移 */
}

/* -------------------------------
   控制按钮区域，放在底部图片1之上，但 z-index 不要过高
------------------------------- */
#controlButtons {
  position: absolute;
  top: 520px;               /* 设定按钮区域相对于父容器的位置(正好与 machine-bottom1 同样的 top) */
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;               /* 只需高于底部图片1即可 */
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 300px;
}

/* 新增：彻底清除按钮默认样式 */
#controlButtons button {
  /* 清除默认背景和边框 */
  background: none !important;
  border: none !important;
  /* 清除内边距 */
  padding: 0 !important;
  margin: 0 !important;
  /* 清除Firefox伪元素 */
  &::-moz-focus-inner {
    border: 0;
    padding: 0;
  }
  /* 确保内容不会溢出 */
  overflow: visible;
  /* 使用弹性布局精确控制图片位置 */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 原有按钮图片样式保留 */
#controlButtons img {
	display: block;
  width: 80px;  
  height: 40px; 
  cursor: pointer;
  transition: opacity 0.2s ease;
  vertical-align: bottom;  /* 新增：解决按钮底部间隙问题 */
  image-rendering: -webkit-optimize-contrast;
}

#controlButtons img:active {
  opacity: 0.5;
}



/* 底部图片1 */
.machine-bottom1 {
  position: absolute;
  top: 500px;               /* 紧贴在机器底部 */
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 60px;
  background: url("../bg/按钮底部.png") no-repeat center center;
  background-size: cover;
  z-index: 1;               /* 较低层级 */
}

/* 底部图片2 */
.machine-bottom2 {
  position: absolute;
  top: 560px;              /* 机器高度600px + 底部图1高度60px + 中间空隙等(自己算) */
  left: 50%;
  transform: translateX(-50%);
  width: 399px;
  height: 110px;
  background: url("../bg/立面.png") no-repeat center center;
  background-size: cover;
  z-index: 1;
}

/* -------------------------------
   娃娃图片样式：尺寸50×50px
------------------------------- */
.doll-item {
  width: 55px;
  height: 70px;
  object-fit: cover;
  position: absolute;
}

/* -------------------------------
   弹窗遮罩及内容样式
------------------------------- */

.game-container { z-index: 1; }
.claw { z-index: 10; }
.rope { z-index: 5; }
.modal { z-index: 20; } /* 弹窗层级 */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 20; /* 高于所有 */
}
.modal-content {
  background: url("../bg/DB1.png") no-repeat center center;
  background-size: cover;
  padding: 20px;
  border-radius: 5px;
  text-align: center;
  max-width: 90%;
  width: 450px;
  height: 500px; /* 可根据实际需要调整 */

  display: flex;
  flex-direction: column; /* 让内容从上到下排布 */
  justify-content: space-between; /* 让顶部文字和底部按钮之间有空间 */
  align-items: center;
}


.modal-content img {
  width: 130px;  /* 弹窗娃娃图片宽200px */
  height: 220px; /* 弹窗娃娃图片高200px */
  object-fit: contain;
}
.modal-buttons {
  margin-top: 15px;
}

/*弹窗按钮*/
#modalLink img,
#closeBtn img {
  width: 130px;
  height: 50px;
  cursor: pointer;
  object-fit: cover; /* 保持比例或其他效果 */
}
/*弹窗按钮文本*/
.button-bg {

  font-weight: bold;
  cursor: pointer;
}
.button-bg:active {
  opacity: 0.7; /* 点击时减少透明度 */
}



/* 按钮区域在底部，你可以通过 margin-top: auto 把它往下推 */
.modal-buttons {
  margin-top: auto;  
  margin-bottom: -75px; /* 给它一个与底部留空间 */
  display: flex;
  justify-content: center;
  gap: 90px; /* 两个按钮之间距离 */
}

/* 对弹窗文字整体进行一些基本样式 */
#modalText {
  color: #fff;              /* 整体文字颜色 */
  font-size: 18px;          /* 整体文字大小 */
  text-shadow: 1px 1px 2px #000; /* 文字阴影，可自行调整 */
  margin-top: 10px;         /* 与图片等保持一定距离 */
}

/* 对“恭喜”二字添加特殊类名 highlight，这里只要包含了 highlight 就能闪烁 */
#modalText .highlight {
  font-weight: bold;        
  font-size: 24px;          
  color: #ff0;              
  animation: blink3times 6s infinite;  /* 6秒一个循环 */
}

/* 关键帧动画：前3秒完成3次闪烁，后3秒常亮 */
@keyframes blink3times {
  /* 第1次闪烁 */
  0%, 20% {
    opacity: 1;
  }
  30%, 30% {
    opacity: 0;
  }
  /* 第2次闪烁 */
  40%, 50% {
    opacity: 1;
  }

  /* 剩余时间保持常亮 */
  50%, 100% {
    opacity: 1;
  }
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* -------------------------------
   小屏幕响应式调整
------------------------------- */
@media (max-width: 320px) {
  .game-container {
    width: 100%;
    height: auto;
  }
  .doll-container {
    width: 100%;
    height: auto;
  }
}









