/* =======================================
   モリのん感謝ポップアップ（初回表示限定）
   ---------------------------------------
   ・トップページで初回アクセス時に表示
   ・段ボール＋モリのん＋「ありがとう」演出
   ・JS（localStorage）で一度だけ表示
   ======================================= */

/* === 全体のポップアップ背景 === */
#thanks-popup {
  position: fixed;                  /* 画面に固定 */
  top: 0;
  left: 0;
  width: 100vw;                     /* 画面全体を覆う */
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.85); /* 半透明の白背景 */
  z-index: 9999;                    /* 最前面に表示 */
  display: flex;                    /* 中央寄せのためのFlex */
  align-items: center;
  justify-content: center;
  opacity: 0;                       /* 初期状態：非表示 */
  pointer-events: none;            /* 非アクティブ状態にする */
  transition: opacity 0.5s ease;   /* フェードアニメーション */
}

/* === 表示時にクラス .show が付く === */
#thanks-popup.show {
  opacity: 1;
  pointer-events: auto;            /* クリック可能に */
}

/* === 中身のラッパー（中央に集める） === */
.popup-content {
  position: relative;
  display: inline-block;
  text-align: center;
  animation: popupFadeIn 0.6s ease-out;
}

/* === 段ボール画像 === */
.popup-box {
  width: 160px;
  height: auto;
  animation: boxPop 0.8s ease-out;
}

/* === モリのん画像（段ボールから飛び出す） === */
.popup-character {
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%) translateY(20px); /* 中央寄せ＋下から出る感じ */
  width: 100px;
  opacity: 0;                                     /* 初期非表示 */
  animation: morinonPop 0.8s 0.5s ease-out forwards; /* 遅れて表示 */
}

/* === メッセージテキスト（ありがとう） === */
.popup-message {
  margin-top: 1rem;
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
  opacity: 0;
  animation: messageFadeIn 1s 1s ease-out forwards;
}

/* ========== アニメーション定義群 ========== */

/* ポップアップ全体のフェードイン */
@keyframes popupFadeIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* 段ボールの出現演出 */
@keyframes boxPop {
  0% {
    transform: scale(0.8) rotate(-3deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* モリのんが段ボールから“ぴょこん”と出る */
@keyframes morinonPop {
  0% {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) translateY(-30px);
    opacity: 1;
  }
}

/* 「ありがとう」テキストがふんわり表示 */
@keyframes messageFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* === 非表示用（任意：JSで使用可） === */
#thanks-popup.hide {
  animation: fadeOut 0.6s ease-in forwards;
}

/* フェードアウト（上に浮かぶように） */
@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}
