#ch-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  /* iPhoneのホームバー・ノッチを避ける（env未対応ブラウザは上の24pxを使用） */
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s;
}

/* クリック中（メッセンジャー表示中）は隠す */
#ch-launcher.is-hidden {
  opacity: 0;
  transform: scale(0.5);
  visibility: hidden;
  pointer-events: none;
}

#ch-launcher .ch-motion {
  position: relative;
  display: block;
}

#ch-launcher .ch-body {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 56px;
  padding: 0 20px 0 11px;
  border-radius: 999px;
  background: #9500e6;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

#ch-launcher:hover .ch-body {
  transform: scale(1.05);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

#ch-launcher .ch-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
}

#ch-launcher .ch-label {
  color: #ffffff;
  font:
    700 15px/1 "Hiragino Sans",
    "Yu Gothic UI",
    "Meiryo",
    sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
}

/* 狭い画面では短い表記に切り替える */
#ch-launcher .ch-label-short {
  display: none;
}

@media (max-width: 480px) {
  #ch-launcher .ch-body {
    height: 52px;
    padding: 0 16px 0 10px;
  }

  #ch-launcher .ch-label-full {
    display: none;
  }

  #ch-launcher .ch-label-short {
    display: inline;
  }
}

/* 商品ページなどの固定購入バー（.btn-cart-s は高さ62px）と重ならないよう持ち上げる */
@media (max-width: 991px) {
  #ch-launcher.has-bottom-bar {
    bottom: 78px;
  }
}

/* 検索ページの「絞り込み」ボタン（.filter-sp）と重ならないよう左下へ寄せる */
@media (max-width: 767px) {
  #ch-launcher.has-filter-button {
    right: auto;
    left: 24px;
    left: max(24px, env(safe-area-inset-left));
  }
}

#ch-launcher .ch-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ffffff;
  color: #9500e6;
  font: 700 12px/20px sans-serif;
  text-align: center;
  pointer-events: none;
}

/* 波紋 */
#ch-launcher .ch-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #9500e6;
  opacity: 0;
  animation: ch-ripple 2.4s ease-out infinite;
}

#ch-launcher .ch-ring:nth-of-type(2) {
  animation-delay: 1.2s;
}

@keyframes ch-ripple {
  0% {
    transform: scale(1);
    opacity: 0.45;
  }

  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

/* ぼんやり発光 */
#ch-launcher .ch-glow {
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(149, 0, 230, 0.55), rgba(149, 0, 230, 0) 70%);
  filter: blur(6px);
  animation: ch-glow 2s ease-in-out infinite;
}

@keyframes ch-glow {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.95);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.15);
  }
}

/* ドキドキ拡縮 */
#ch-launcher .ch-motion {
  animation: ch-heartbeat 1.8s ease-in-out infinite;
}

@keyframes ch-heartbeat {
  0%,
  100% {
    transform: scale(1);
  }

  14% {
    transform: scale(1.12);
  }

  28% {
    transform: scale(1);
  }

  42% {
    transform: scale(1.09);
  }

  56% {
    transform: scale(1);
  }
}

/* 表示から一定時間が経過したらアニメーションを停止 */
#ch-launcher.is-calm .ch-motion,
#ch-launcher.is-calm .ch-ring,
#ch-launcher.is-calm .ch-glow {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  #ch-launcher .ch-motion,
  #ch-launcher .ch-ring,
  #ch-launcher .ch-glow {
    animation: none;
  }
}

