/* Container: 基本は画面の下に隠し、透明にする */
#web-mascot-container {
  position: fixed;
  bottom: 0;
  /* left は JS から動的に設定されます */
  transform: translate(-50%, 120%);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;

  /* 【重要】退場時の滑らかさを定義。transition: none は絶対に書かないこと */
  transition: transform 1.5s cubic-bezier(0.45, 0.05, 0.55, 0.95),
    opacity 1s ease;

  /* 【高画質】ブラウザに対し、キャンバスの拡大・縮小を最高品質で行うよう指示 */
  /* image-rendering: auto; */
}

/* 【修正点】表示状態：このクラスがつくと画面内に浮上し、その場に留まる */
#web-mascot-container.active {
  /* ここに最終的な位置を指定することで、バウンド終了後も消えずに留まります */
  transform: translate(-50%, 0%);
  opacity: 1;
  pointer-events: auto;
  /* 入場時のみバウンドアニメーションを適用（forwardsは使わないのが正解） */
  animation: slideBoundIn 0.8s ease-out;
}

@media (max-width: 768px) {
  #web-mascot-container {
    display: none !important;
  }
}

#mascot-avatar-wrapper canvas {
  display: block;
  max-height: 100%;
  width: auto;
  image-rendering: auto;
  /* image-rendering: crisp-edges; */
}

#mascot-bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  background: #fff;
  border-radius: 10px;
  padding: 15px;
  font-size: 14px;
  line-height: 1.4;
  display: none;
  border: 1px solid #ccc;
  z-index: 10000;
  margin-bottom: 15px;
}

#mascot-bubble:after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  margin-left: -10px;
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: #fff transparent;
  display: block;
  width: 0;
}

/* 入場アニメーション */
@keyframes slideBoundIn {
  0% {
    transform: translate(-50%, 120%);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -20px);
    opacity: 1;
  }
  80% {
    transform: translate(-50%, 10px);
  }
  100% {
    transform: translate(-50%, 0%);
    opacity: 1;
  }
}
