.floating-book-button {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(16px, 3vw, 28px));
  left: calc(env(safe-area-inset-left, 0px) + clamp(16px, 3vw, 32px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-decoration: none;
  background: var(--accent-color);
  color: var(--light-text);
  border-radius: var(--radius-pill);
  transform: translate3d(0, 0, 0);
  transition: transform 0.35s ease;
  z-index: 1200;
  isolation: isolate;
  touch-action: manipulation;
  will-change: transform;
}

.floating-book-button:focus-visible {
  outline: 3px solid rgba(255, 248, 240, 0.6);
  outline-offset: 4px;
}

.floating-book-button__inner {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.4rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: relative;
  animation: floatingBookButtonWiggle 12s ease-in-out infinite;
  white-space: nowrap;
}

.floating-book-button__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0.4rem;
}

.floating-book-button__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.floating-book-button__label {
  color: var(--light-text);
  font-size: 0.92rem;
}

.floating-book-button:hover .floating-book-button__inner,
.floating-book-button:focus-visible .floating-book-button__inner {
  animation-duration: 7s;
}

.floating-book-button--hidden {
  transform: translate3d(-18px, 160%, 0);
  opacity: 0;
  pointer-events: none;
}

@keyframes floatingBookButtonWiggle {
  0%, 60%, 100% { transform: translate3d(0, 0, 0) rotate(0); }
  4% { transform: translate3d(0, -3px, 0) rotate(-6deg); }
  8% { transform: translate3d(0, -2px, 0) rotate(5deg); }
  12% { transform: translate3d(0, -1px, 0) rotate(-4deg); }
  16% { transform: translate3d(0, 0, 0) rotate(3deg); }
  20% { transform: translate3d(0, 0, 0) rotate(-2.5deg); }
  24% { transform: translate3d(0, 0, 0) rotate(1.8deg); }
  28% { transform: translate3d(0, 0, 0) rotate(-1.2deg); }
  32% { transform: translate3d(0, 0, 0) rotate(0.6deg); }
  36% { transform: translate3d(0, 0, 0) rotate(0); }
}

@media (max-width: 767px) {
  .floating-book-button__inner {
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    letter-spacing: 0.05em;
  }

  .floating-book-button__label {
    font-size: 0.7rem;
  }

  .floating-book-button__icon {
    width: 28px;
    height: 28px;
    padding: 0.35rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .floating-book-button__inner {
    gap: 0.55rem;
    padding: 0.7rem 1.1rem;
    letter-spacing: 0.06em;
  }

  .floating-book-button__label {
    font-size: 0.82rem;
  }

  .floating-book-button__icon {
    width: 30px;
    height: 30px;
    padding: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-book-button__inner {
    animation: none;
  }
}
