/* ============================================================
   Stamp Feature（汎用版）｜スタイルシート
   ------------------------------------------------------------
   stamp-feature.js とセットで使用してください。
   クラス名はすべて "sf-" 接頭辞（Kids-Phonicsの "kp-" と衝突しないように）。

   【カスタマイズ方法】
   下記のCSS変数を、ホストアプリ側のstyle.cssで定義しておくと、
   ブランドカラー・フォント・角丸の丸みなどが自動的に反映されます。
   何も定義しなくても、フォールバック値（Kids-Phonicsと同系統の
   黄緑・クリーム色）で動作します。

     --sf-main        : ブランドカラー（例: #7CB518）
     --sf-main-light  : ブランドカラーの淡色（例: #E4F3C9）
     --sf-ink         : 本文の文字色（例: #2B2640）
     --sf-radius      : 角丸の大きさ（例: 20px）
     --sf-shadow      : カード等の影（例: 0 6px 16px rgba(43,38,64,0.10)）
     --sf-font-heading: 見出し用フォント（例: 'Baloo 2', sans-serif）
     --sf-font-body   : 本文用フォント（例: 'Zen Maru Gothic', sans-serif）
   ============================================================ */

.sf-profile-bar-wrap {
  background: #fff;
  border-bottom: 2px solid var(--sf-main-light, #E4F3C9);
}
.sf-profile-bar {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  font-family: var(--sf-font-body, 'Zen Maru Gothic', sans-serif);
}
.sf-profile-bar--empty { color: #6b6580; }
.sf-profile-name { font-weight: 700; color: var(--sf-ink, #2B2640); }

.sf-profile-switch-btn,
.sf-profile-add-btn,
.sf-profile-pick-btn,
.sf-profile-close-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--sf-main-light, #E4F3C9);
  color: var(--sf-main, #7CB518);
}
.sf-profile-switch-btn:hover,
.sf-profile-add-btn:hover,
.sf-profile-pick-btn:hover {
  background: var(--sf-main, #7CB518);
  color: #fff;
}

.sf-profile-picker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sf-profile-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sf-profile-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sf-profile-row .sf-profile-pick-btn {
  flex: 1;
  text-align: left;
}
.sf-profile-icon-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px 6px;
  border-radius: 8px;
  line-height: 1;
}
.sf-profile-icon-btn:hover {
  background: var(--sf-main-light, #E4F3C9);
}
.sf-profile-add { display: flex; gap: 6px; }
.sf-profile-input {
  border: 2px solid var(--sf-main-light, #E4F3C9);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  width: 140px;
}

.sf-profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 38, 64, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.sf-profile-modal {
  background: #fff;
  border-radius: var(--sf-radius, 20px);
  padding: 22px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--sf-shadow, 0 6px 16px rgba(43,38,64,0.10));
  text-align: center;
}
.sf-profile-modal h4 {
  margin: 0 0 14px;
  color: var(--sf-main, #7CB518);
  font-family: var(--sf-font-heading, 'Baloo 2', sans-serif);
}
.sf-profile-modal .sf-profile-picker { flex-direction: column; align-items: stretch; }
.sf-profile-close-btn { margin-top: 14px; background: #eee; color: #666; }

/* ---------- スタンプボタン ---------- */
.sf-stamp-row { margin-top: 16px; text-align: center; }
.sf-stamp-btn {
  border: 3px solid currentColor;
  border-radius: 999px;
  background: #fff;
  padding: 10px 22px;
  font-family: var(--sf-font-heading, 'Baloo 2', sans-serif);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.sf-stamp-btn:hover { transform: scale(1.04); }
.sf-stamp-btn.is-earned { background: currentColor; }
.sf-stamp-btn.is-earned .sf-stamp-btn-label { color: #fff; }

/* ---------- 進捗表示（ミニスタンプ） ---------- */
.sf-stamp-progress { max-width: 420px; margin: 0 auto 18px; text-align: center; }
.sf-stamp-progress-text {
  font-weight: 700;
  color: var(--sf-ink, #2B2640);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.sf-stamp-progress-icons { display: flex; justify-content: center; gap: 10px; }
.sf-mini-stamp {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 3px solid currentColor;
  background: #f2f2f2;
  color: #ccc;
  opacity: 0.5;
}
.sf-mini-stamp.is-earned { background: currentColor; opacity: 1; }
.sf-mini-stamp.is-earned .sf-mini-stamp-icon { filter: brightness(0) invert(1); }

/* 小さいお祝い（1ユニット完了） */
.sf-confetti-overlay { position: fixed; inset: 0; z-index: 300; overflow: hidden; pointer-events: none; }
.sf-confetti-piece {
  position: absolute;
  top: -10vh;
  width: 10px;
  height: 16px;
  opacity: 0.95;
  animation-name: sf-confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes sf-confetti-fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.85; }
}
.sf-confetti-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 301;
  background: #fff;
  border-radius: var(--sf-radius, 20px);
  padding: 26px 32px;
  box-shadow: 0 12px 32px rgba(43, 38, 64, 0.28);
  text-align: center;
  max-width: 320px;
  cursor: pointer;
  animation: sf-pop .35s ease;
  font-family: var(--sf-font-body, 'Zen Maru Gothic', sans-serif);
}
@keyframes sf-pop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.sf-confetti-title {
  font-family: var(--sf-font-heading, 'Baloo 2', sans-serif);
  font-size: 1.5rem;
  color: var(--sf-main, #7CB518);
  margin-bottom: 8px;
}
.sf-confetti-sub { font-size: 0.9rem; color: #6b6580; }
.sf-confetti-cta{
  display:inline-flex;align-items:center;gap:6px;margin-top:16px;
  background:var(--sf-main, #7CB518);color:#fff;font-weight:800;
  font-family:var(--sf-font-heading, 'Baloo 2', sans-serif);
  font-size:0.85rem;padding:10px 20px;border-radius:999px;text-decoration:none;
  box-shadow:0 4px 10px -3px rgba(0,0,0,.25);
}
.sf-confetti-cta:hover{filter:brightness(1.06);}

/* 大きいお祝い（全達成・全画面テイクオーバー） */
.sf-takeover {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(124,181,24,0.92) 0%, rgba(43,38,64,0.94) 100%);
  animation: sf-takeover-fade-in .35s ease;
  padding: 20px;
}
.sf-takeover--closing { animation: sf-takeover-fade-out .3s ease forwards; }
@keyframes sf-takeover-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sf-takeover-fade-out { from { opacity: 1; } to { opacity: 0; } }
.sf-takeover-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.sf-takeover-content { position: relative; z-index: 1; text-align: center; max-width: 520px; width: 100%; }
.sf-takeover-trophy {
  width: 260px;
  max-width: 60vw;
  margin: 0 auto 10px;
  display: block;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.35));
  animation: sf-takeover-bounce-in .7s cubic-bezier(.34,1.56,.64,1);
}
@keyframes sf-takeover-bounce-in {
  0% { transform: scale(0) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  80% { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.sf-takeover-title {
  font-family: var(--sf-font-heading, 'Baloo 2', sans-serif);
  font-weight: 800;
  font-size: 3.4rem;
  line-height: 1.15;
  margin: 6px 0 14px;
  background: linear-gradient(90deg, #FFE08A, #FFB627, #FF7A7A, #7EC8E3, #B7D94C, #FFE08A);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sf-takeover-shine 3s linear infinite, sf-takeover-pop .5s ease .2s both;
  text-shadow: 0 4px 18px rgba(0,0,0,0.15);
}
@keyframes sf-takeover-shine { to { background-position: 300% center; } }
@keyframes sf-takeover-pop { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.sf-takeover-sub {
  font-family: var(--sf-font-heading, 'Baloo 2', sans-serif);
  font-weight: 700;
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 18px;
  animation: sf-takeover-pop .5s ease .35s both;
}
.sf-takeover-ja {
  font-size: 1.15rem;
  color: #FFFDF8;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 10px 22px;
  display: inline-block;
  margin-bottom: 26px;
  animation: sf-takeover-pop .5s ease .5s both;
}
.sf-takeover-close {
  display: block;
  margin: 0 auto;
  border: 2px solid rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 28px;
  border-radius: 999px;
  cursor: pointer;
  animation: sf-takeover-pop .5s ease .65s both;
}
.sf-takeover-close:hover { background: rgba(255,255,255,0.3); }

@media (max-width: 480px) {
  .sf-takeover-trophy { width: 190px; }
  .sf-takeover-title { font-size: 2.2rem; }
  .sf-takeover-sub { font-size: 1.2rem; }
  .sf-takeover-ja { font-size: 1rem; padding: 8px 16px; }
}

/* ---------- コレクション（スタンプ帳）ページの一覧表示 ---------- */
.sf-book-total { max-width: 420px; margin: 0 auto 26px; text-align: center; }
.sf-book-total .sf-total-text {
  font-family: var(--sf-font-heading, 'Baloo 2', sans-serif);
  font-size: 1.3rem;
  color: var(--sf-main, #7CB518);
  margin-bottom: 8px;
}
.sf-progress-bar-outer {
  background: var(--sf-main-light, #E4F3C9);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
}
.sf-progress-bar-inner {
  background: var(--sf-main, #7CB518);
  height: 100%;
  border-radius: 999px;
  transition: width .3s ease;
}
.sf-book-unit {
  border-radius: var(--sf-radius, 20px);
  background: #fff;
  border: 3px solid var(--sf-main-light, #E4F3C9);
  padding: 16px 20px;
  margin-bottom: 14px;
}
.sf-book-unit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.sf-book-unit-title {
  font-family: var(--sf-font-heading, 'Baloo 2', sans-serif);
  font-weight: 800;
  color: var(--sf-ink, #2B2640);
  font-size: 1.1rem;
}
.sf-book-unit-sub {
  font-family: var(--sf-font-body, 'Zen Maru Gothic', sans-serif);
  font-weight: 500;
  font-size: 0.8rem;
  color: #6b6580;
  margin-left: 6px;
}
.sf-book-goto-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  background: var(--sf-main, #7CB518);
  color: #fff;
  font-family: var(--sf-font-body, 'Zen Maru Gothic', sans-serif);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  padding: 9px 16px;
  border-radius: 999px;
  text-decoration: none;
}
.sf-book-goto-btn:hover { filter: brightness(0.92); }

.sf-book-stamps { display: flex; gap: 14px; flex-wrap: wrap; }
.sf-book-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: #999;
  font-family: var(--sf-font-body, 'Zen Maru Gothic', sans-serif);
}
.sf-book-stamp.is-earned { color: var(--sf-ink, #2B2640); }

/* 「全カテゴリー達成」インライン・バッジ（丸い見た目で他のスタンプと横並び） */
.sf-book-stamp--complete { color: #92650A; }
.sf-book-stamp--complete span:last-child { font-weight: 700; }
.sf-book-complete-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #FFE07A 0%, #F5A800 100%);
  box-shadow: 0 3px 8px rgba(245, 168, 0, 0.5), inset 0 0 0 2px rgba(255,255,255,0.5);
}

.sf-book-reset { text-align: center; margin: 30px 0 10px; }
.sf-book-reset button {
  background: none;
  border: none;
  color: #b33;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  font-family: var(--sf-font-body, 'Zen Maru Gothic', sans-serif);
}

@media (max-width: 480px) {
  .sf-book-stamps { gap: 10px; }
}
