/* SWELL既存のページトップボタンを無効化（UI触らずに併存回避）
   既にUIでOFFなら、この行は消してOK */
.c-pageTop,
.p-fixBtn__totop,
.pagetop,
.l-fixBtn .c-btn--pagetop {
  display: none !important;
}

/* カスタム：フラット四角 */
.tdc-pagetop {
  --tdc-size: 50px;
  /* 変数初期値 */
  --tdc-x: 0px;
  --tdc-y: 0px;
  --tdc-tilt: 0deg;

  position: fixed;
  right: clamp(12px, 2vw, 20px);
  bottom: calc(50px + env(safe-area-inset-bottom));
  /* iOSセーフエリア */
  z-index: 10000;

  inline-size: var(--tdc-size);
  block-size: var(--tdc-size);
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border: none;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .02em;

  /* インタラクション */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backface-visibility: hidden;

  /* ふわっと出現 */
  opacity: 0;
  /* transform は変数で合成（出現TY × クリック時JX/ROT）*/
  transform:
    translate3d(var(--tdc-x), calc(var(--tdc-ty) + var(--tdc-y)), 0) rotate(var(--tdc-tilt));
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}


/* 表示状態はそのまま */
.tdc-pagetop.is-show {
  opacity: 1;
  --tdc-ty: 0px;
  pointer-events: auto;
}


/* 表示状態：変数だけを更新（transformを直接上書きしない） */
.tdc-pagetop.is-show {
  opacity: 1;
  --tdc-ty: 0px;
  pointer-events: auto;
}

/* “ふわふわ”小さめモーション（主張控えめ）*/
@keyframes tdc-floaty {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  25%  { transform: translate3d(6px, -8px, 0) rotate(2deg); }
  50%  { transform: translate3d(0, -12px, 0) rotate(0deg); }
  75%  { transform: translate3d(-6px, -8px, 0) rotate(-2deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}


.tdc-pagetop.is-animating {
  will-change: transform;
  transition: opacity .25s ease, transform 0s linear;
  /* rAFのtransform更新に遅延を入れない */
}

/* スマホ：下部UIを避けて +80px */
@media (max-width: 767px) {
  .tdc-pagetop {
    bottom: calc(60px + 12px + env(safe-area-inset-bottom));
  }
}

/* キーボード操作の可視化 */
.tdc-pagetop:focus-visible {
  outline: 2px solid #000;
  outline-offset: 3px;
}

/* 省モーション対応 */
@media (prefers-reduced-motion: reduce) {
  .tdc-pagetop {
    transition: none;
  }


}

.tdc-pagetop {
  --tdc-size: 75px;
}

.tdc-pagetop__inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.tdc-pagetop__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tdc-pagetop__text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: rgb(240, 106, 0, 0.9);
  text-shadow: 0 0 6px rgba(225, 225, 225, .35);
  pointer-events: none;
}

.tdc-pagetop.is-show .tdc-pagetop__inner {
  animation: tdc-floaty 3.6s ease-in-out infinite;
}


.tdc-pagetop.is-animating .tdc-pagetop__inner {
  animation: none;
}