.fb-container {
  position: fixed;
  right: 24px;
  bottom: 120px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fb-group {
  background: var(--fb-bg, #111827);
  color: #fff;
  border-radius: 999px;
  padding: 12px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  width: 78px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.fb-item {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  color: var(--fb-text-color, #fff) !important;
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  position: relative;
  font-family: inherit;
  transition: background 0.2s ease;
}

.fb-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.fb-item .fb-icon {
  font-size: 20px;
  width: 24px;
  height: 24px;
  line-height: 24px;
  color: var(--fb-icon-color, #fff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fb-item .fb-text {
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.fb-item.type-qrcode .fb-qrcode-popup {
  position: absolute;
  right: 84px;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  background: #fff;
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fb-item.type-qrcode .fb-qrcode-popup img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  display: block;
}

.fb-item.type-qrcode.show-qr .fb-qrcode-popup {
  display: block;
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.fb-item.type-phone .fb-phone-popup,
.fb-item.type-qq .fb-qq-popup,
.fb-item.type-wechat .fb-wechat-popup {
  position: absolute;
  right: 84px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  display: none;
  white-space: nowrap;
  color: #333;
  font-size: 14px;
}

.fb-item.type-phone .fb-phone-popup::before,
.fb-item.type-qq .fb-qq-popup::before,
.fb-item.type-wechat .fb-wechat-popup::before,
.fb-item.type-qrcode .fb-qrcode-popup::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-left-color: #fff;
  border-right: none;
}

.fb-item.type-phone.show-popup .fb-phone-popup,
.fb-item.type-qq.show-popup .fb-qq-popup,
.fb-item.type-wechat.show-popup .fb-wechat-popup {
  display: block;
}

.fb-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--fb-bg, #111827);
  color: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  margin-top: 8px;
  font-size: 14px;
  transition: transform 0.3s ease, background 0.2s ease;
  border: none;
}

.fb-toggle:hover {
  background: var(--fb-bg, #374151);
}

.fb-container.expanded .fb-toggle {
  transform: rotate(180deg);
}

.fb-toggle:active {
  transform: scale(0.95);
}

.fb-container.expanded .fb-toggle:active {
  transform: rotate(180deg) scale(0.95);
}

@media (max-width: 768px) {
  .fb-container {
    right: 8px;
    bottom: 80px;
    transition: all 0.3s ease;
  }

  .fb-container[data-position="left"] {
    left: 8px;
    right: auto;
  }

  .fb-group {
    width: 52px;
    padding: 6px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: none;
  }

  .fb-container.expanded .fb-group {
    display: flex;
  }

  .fb-item {
    padding: 8px 6px;
    gap: 3px;
  }

  .fb-item .fb-icon {
    font-size: 16px;
    width: 20px;
    height: 20px;
    line-height: 20px;
  }

  .fb-item .fb-text {
    font-size: 10px;
  }

  .fb-item.type-qrcode .fb-qrcode-popup {
    right: 60px;
  }

  .fb-item.type-phone .fb-phone-popup,
  .fb-item.type-qq .fb-qq-popup,
  .fb-item.type-wechat .fb-wechat-popup {
    right: 60px;
    font-size: 12px;
    padding: 8px 12px;
  }

  .fb-toggle {
    display: flex;
  }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .fb-container {
      bottom: calc(80px + env(safe-area-inset-bottom));
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .fb-item,
  .fb-toggle,
  .fb-group,
  .fb-container {
    transition: none;
  }
}

.fb-item.type-back_to_top {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, background 0.2s ease;
}

.fb-item.type-back_to_top.visible {
  opacity: 1;
  visibility: visible;
}

@media print {
  .fb-container {
    display: none !important;
  }
}
