@keyframes shake {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-50%) rotate(-3deg); }
  20%, 40%, 60%, 80% { transform: translateX(-50%) rotate(3deg); }
}

@keyframes shake-mobile {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(calc(-50% - 2px)) rotate(-2deg); }
  20%, 40%, 60%, 80% { transform: translateX(calc(-50% + 2px)) rotate(2deg); }
}

.qiuzhi-jianli-btn {
  position: fixed;
  top: 40px;
  right: 10%;
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  animation: shake 0.6s ease-in-out infinite;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.qiuzhi-jianli-btn:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  animation: none;
}

.qiuzhi-jianli-btn:active {
  transform: translateX(-50%) scale(0.96);
  animation: none;
}

/* ============================================
   移动端浮动按钮适配
   ============================================ */

/* 平板设备 */
@media screen and (min-width: 481px) and (max-width: 768px) {
  .qiuzhi-jianli-btn {
    top: 50px;
    right: 5%;
    padding: 10px 18px;
    font-size: 13px;
    border-radius: 20px;
  }
}

/* 手机设备 - 底部固定，更易拇指触及 */
@media screen and (max-width: 480px) {
  .qiuzhi-jianli-btn {
    top: auto !important;
    bottom: 70px;
    right: 20% !important;
    transform: translateX(50%);
    padding: 12px 22px;
    font-size: 13px;
    border-radius: 30px;
    white-space: nowrap;
    animation: shake-mobile 0.6s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
  }

  .qiuzhi-jianli-btn:hover {
    animation: shake-mobile 0.6s ease-in-out infinite;
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
  }
}

/* 小屏手机 */
@media screen and (max-width: 374px) {
  .qiuzhi-jianli-btn {
    padding: 10px 18px;
    font-size: 12px;
    bottom: 60px;
  }
}

/* 横屏模式 */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .qiuzhi-jianli-btn {
    top: 10px;
    bottom: auto;
    right: 5%;
    padding: 8px 16px;
    font-size: 12px;
    animation: none;
    transform: none;
  }
}

/* iOS 安全区域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media screen and (max-width: 480px) {
    .qiuzhi-jianli-btn {
      bottom: calc(70px + env(safe-area-inset-bottom));
    }
  }
}
