/* 按鈕閃光 S (優化版) */
.light {
  width: 100%;
  text-align: center;
  font-size: 2rem;
  overflow: hidden; /* 保持 overflow: hidden 來隱藏移動到外部的閃光 */
  display: block;
  position: relative;
}

.light:after {
  content: "";
  display: block;
  position: absolute;
  /* 移除 left: -150%; 改為固定的 left: 0 */
  left: 0;
  top: 0;
  width: 50%;
  height: 100%;
  background: -webkit-linear-gradient(
    left,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.7) 100% /* 稍微調亮顏色以便觀察 */
  );
  background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.7) 100%);
  /* 將 transform 移至 keyframes 中統一控制 */
  animation: light-transform 3s infinite ease-in-out;
}

/* 將 keyframes 的 left 改為 transform */
@keyframes light-transform {
  0% {
    /* 結合 skewX 和 translateX */
    transform: skewX(-25deg) translateX(-300%);
  }
  70% {
    transform: skewX(-25deg) translateX(300%);
  }
  100% {
    transform: skewX(-25deg) translateX(300%);
  }
}
/* 按鈕閃光 S */
/* 按鈕跳動-果凍 */
.ani-bounce {
  animation: bounce 2s infinite ease-in-out;
}
.ani-scale {
  animation: scale 1s infinite ease-in-out;
}
.ani-scale_2 {
  animation: scale 1s infinite ease-in-out;
  animation-delay: 0.5s;
}
.ani-scale_3 {
  animation: scale 1.2s infinite ease-in-out;
}
.ani-float-horizontal {
  animation: float-horizontal 1.5s ease-in-out infinite;
}
.ani-float-vertical {
  animation: float-vertical 1.5s ease-in-out infinite;
}
.ani-float-vertical-2 {
  animation: float-vertical 2s ease-in-out infinite;
}
.ani-float-vertical-3 {
  animation: float-vertical 1.5s ease-in-out infinite;
  animation-delay: 0.7s;
}
.ani-twinkle {
  animation: twinkle 2s infinite ease-in-out;
}
.ani-fade-in-out{
  animation-name: fade-in-out;
  animation-duration: 3.2s; 
  animation-iteration-count: infinite;
  animation-timing-function: linear; 
  animation-fill-mode: forwards;
  opacity: 0;
}

@keyframes bounce {
  0% {
    transform: scale(1, 1) translate3d(0, 0, 0);
  }
  10% {
    transform: scale(1.05, 0.95) translate3d(0, 0, 0);
  }
  30% {
    transform: scale(0.95, 1.05) translate3d(0, -8%, 0);
  }
  50% {
    transform: scale(1.02, 0.97) translate3d(0, 0, 0);
  }
  57% {
    transform: scale(1, 1) translate3d(0, -2%, 0);
  }
  64% {
    transform: scale(1, 1) translate3d(0, 0, 0);
  }
  100% {
    transform: scale(1, 1) translate3d(0, 0, 0);
  }
}
@keyframes scale {
  0% {
    transform: scale(1, 1);
  }
  50% {
    transform: scale(1.1, 1.1);
  }
  100% {
    transform: scale(1, 1);
  }
}
@keyframes float-horizontal {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(20px);
  }
  100% {
    transform: translateX(0);
  }
}
@keyframes float-vertical {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
  100% {
    transform: translateY(0);
  }
}
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}
.first_Fadein {
  animation-delay: 0s;
}

.second_Fadein {
  animation-delay: .8s;
}

.third_Fadein {
  animation-delay: 1.6s;
}

.fourth_Fadein {
  animation-delay: 2.4s;
}

/* ---------------------------------
   @keyframes 定義：淡入並淡出
   整個週期共 4 秒 (4s)
   --------------------------------- */
@keyframes fade-in-out {
  /* 0% ~ 20% (從 0s 到 0.8s) 淡入並維持可見 */
  0% { opacity: 0; }        /* 0s: 完全透明 */
  15% { opacity: 1; }        /* 0.2s: 快速淡入 */
  30% { opacity: 1; }       /* 0.8s: 維持可見 */
  
  /* 20% ~ 25% (從 0.8s 到 1s) 淡出 */
  37% { opacity: 0; }       /* 1s: 快速淡出 */
  
  /* 25% ~ 100% (從 1s 到 4s) 維持透明，等待下一個週期 */
  100% { opacity: 0; }
}