/* 首页右侧悬浮工具栏：客服二维码、公众号二维码、淘宝购买 */
.floating-tools {
  position: fixed;
  top: 50%;
  right: max(18px, env(safe-area-inset-right));
  z-index: 50;
  transform: translateY(-50%);
}

.floating-tools__rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 7px;
  border: 1px solid rgba(75, 143, 73, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 52px rgba(48, 91, 42, 0.16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.floating-tool {
  position: relative;
}

.floating-tool + .floating-tool::before {
  position: absolute;
  top: 0;
  left: 13px;
  right: 13px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(73, 132, 69, 0.18), transparent);
}

.floating-tool__button {
  position: relative;
  display: flex;
  width: 74px;
  min-height: 76px;
  padding: 9px 6px 8px;
  border: 0;
  border-radius: 16px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: #3f7f45;
  font: inherit;
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.floating-tool__button:hover,
.floating-tool.is-open .floating-tool__button {
  color: #2f743a;
  background: linear-gradient(145deg, rgba(234, 247, 226, 0.92), rgba(255, 255, 255, 0.84));
  transform: translateY(-1px);
}

.floating-tool__button:active {
  transform: translateY(0) scale(0.97);
}

.floating-tool__button:focus-visible {
  outline: 3px solid rgba(62, 143, 72, 0.28);
  outline-offset: 2px;
}

.floating-tool__button--taobao {
  color: #ef6c43;
}

.floating-tool__button--taobao:hover {
  color: #e45c32;
  background: linear-gradient(145deg, rgba(255, 239, 229, 0.94), rgba(255, 255, 255, 0.86));
}

.floating-tool__icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: rgba(79, 151, 76, 0.11);
}

.floating-tool__button--taobao .floating-tool__icon {
  background: rgba(239, 108, 67, 0.11);
}

.floating-tool__icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.floating-tool__label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.floating-qr-card {
  position: absolute;
  top: 50%;
  right: calc(100% + 16px);
  width: 224px;
  padding: 16px 16px 14px;
  border: 1px solid rgba(71, 139, 70, 0.2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 20px 58px rgba(45, 83, 40, 0.2);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translate(12px, -50%) scale(0.96);
  transform-origin: right center;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.floating-qr-card::after {
  position: absolute;
  top: 50%;
  right: -7px;
  width: 14px;
  height: 14px;
  content: "";
  border-top: 1px solid rgba(71, 139, 70, 0.18);
  border-right: 1px solid rgba(71, 139, 70, 0.18);
  background: rgba(255, 255, 255, 0.97);
  transform: translateY(-50%) rotate(45deg);
}

.floating-tool.is-open .floating-qr-card {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%) scale(1);
  pointer-events: auto;
}

.floating-qr-card__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  place-items: center;
  background: rgba(66, 119, 63, 0.08);
  color: #6f806d;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}

.floating-qr-card__close:hover {
  color: #33743b;
  background: rgba(66, 119, 63, 0.14);
}

.floating-qr-card__image {
  width: 172px;
  height: 172px;
  margin: 2px auto 11px;
  padding: 7px;
  border: 1px solid rgba(64, 128, 63, 0.14);
  border-radius: 15px;
  background: #fff;
  object-fit: contain;
}

.floating-qr-card__title {
  margin: 0;
  color: #306f39;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.floating-qr-card__text {
  margin: 4px 0 0;
  color: #7b8278;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 1050px) {
  .floating-tools {
    right: 10px;
  }

  .floating-tools__rail {
    padding: 5px;
    border-radius: 18px;
  }

  .floating-tool__button {
    width: 64px;
    min-height: 66px;
  }

  .floating-tool__icon {
    width: 30px;
    height: 30px;
  }

  .floating-tool__label {
    font-size: 11px;
  }
}

@media (max-width: 760px) {
  .floating-tools {
    top: auto;
    right: 12px;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: none;
  }

  .floating-tools__rail {
    flex-direction: row;
  }

  .floating-tool + .floating-tool::before {
    top: 10px;
    bottom: 10px;
    left: 0;
    right: auto;
    width: 1px;
    height: auto;
    background: linear-gradient(180deg, transparent, rgba(73, 132, 69, 0.18), transparent);
  }

  .floating-tool__button {
    width: 68px;
    min-height: 60px;
    padding-block: 7px;
  }

  .floating-qr-card {
    top: auto;
    right: 0;
    bottom: calc(100% + 14px);
    transform: translateY(10px) scale(0.96);
    transform-origin: right bottom;
  }

  .floating-qr-card::after {
    top: auto;
    right: 26px;
    bottom: -7px;
    transform: rotate(135deg);
  }

  .floating-tool.is-open .floating-qr-card {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-tool__button,
  .floating-qr-card {
    transition: none;
  }
}
