/* ===== カラーパレット & フォント（Phase 5：プリキュア風 / きらきらパステル） ===== */
:root {
  /* メインカラー：ピンク〜マゼンタ */
  --color-primary:        #ff4a99;
  --color-primary-light:  #ffb3d1;
  --color-primary-dark:   #c8267a;

  /* サブカラー：パステル */
  --color-lavender: #c8a4ff;
  --color-skyblue:  #a0d8ff;
  --color-mint:     #b8f2d8;
  --color-lemon:    #fff5a0;

  /* アクセント */
  --color-gold:   #ffd700;
  --color-silver: #e0e0f0;

  /* テキスト */
  --color-text:        #4a3568;  /* 深い紫 */
  --color-text-light:  #8a7aa8;
  --color-text-on-primary: #ffffff;

  /* グラデーション */
  --gradient-bg:        linear-gradient(180deg, #ffe4f1 0%, #f3d9ff 50%, #d4f1ff 100%);
  --gradient-primary:   linear-gradient(135deg, #ff8ec7 0%, #c8a4ff 100%);
  --gradient-button:    linear-gradient(180deg, #ff6fb5 0%, #ff4a99 100%);
  --gradient-magic:     linear-gradient(135deg, #ffd700 0%, #ff8ec7 50%, #c8a4ff 100%);

  /* フォント */
  --font-display: 'Mochiy Pop One', 'M PLUS Rounded 1c', "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --font-body:    'M PLUS Rounded 1c', "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
}

/* ===== Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
  background: var(--gradient-bg);
  background-attachment: fixed;
}

/* ===== 背景キラキラ装飾 ===== */
.bg-sparkles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
/* スパークル基本（位置・サイズ・delay/durationは JS でインライン設定） */
.sparkle {
  position: absolute;
  pointer-events: none;
  line-height: 1;
  animation: twinkle 4s ease-in-out infinite;
  will-change: transform, opacity;
}
/* 丸タイプ：背景色 + glow */
.sparkle.circle { border-radius: 50%; }
.sparkle.circle.white { background: #ffffff; box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.85); }
.sparkle.circle.gold  { background: #fff2a8; box-shadow: 0 0 8px 2px rgba(255, 215, 100, 0.8); }
.sparkle.circle.pink  { background: #ffd6e8; box-shadow: 0 0 8px 2px rgba(255, 180, 220, 0.8); }
/* 星タイプ：Unicode文字 + text-shadow で発光 */
.sparkle.star {
  display: inline-block;
  font-weight: normal;
  text-align: center;
}
.sparkle.star.white { color: #ffffff; text-shadow: 0 0 6px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.6); }
.sparkle.star.gold  { color: #ffe680; text-shadow: 0 0 6px rgba(255, 215, 100, 0.95), 0 0 10px rgba(255, 215, 100, 0.6); }
.sparkle.star.pink  { color: #ffc6dc; text-shadow: 0 0 6px rgba(255, 180, 220, 0.95), 0 0 10px rgba(255, 180, 220, 0.6); }

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .sparkle { animation: none; opacity: 0.7; }
}

/* #app の z-index は既存ブロックで設定済み（下記） */

#app {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Screen ===== */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  padding: 20px;
  flex-direction: column;
}
.screen.active {
  display: flex;
  animation: screen-in 0.25s ease-out;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .screen.active { animation: none; }
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.screen-header h2 {
  font-family: var(--font-display);
  font-weight: normal; /* Mochiy Pop One はウェイト固定 */
  font-size: 1.5rem;
  flex: 1;
  text-align: center;
  padding-right: 74px; /* 戻るボタン分のオフセット */
  color: var(--color-primary-dark);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 2px 4px rgba(200, 80, 160, 0.15);
}

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  padding: 16px 18px;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.3rem;
  border: none;
  border-radius: 22px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: translateY(3px); }

/* プライマリ：濃いピンクグラデ + 上部グロス */
.btn-primary {
  background: linear-gradient(180deg, #ff7ab6 0%, #ff4a99 60%, #e6338a 100%);
  color: #fff;
  padding: 20px 18px;
  font-size: 1.5rem;
  box-shadow:
    0 5px 0 #b01f6b,
    0 10px 22px rgba(200, 40, 120, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
  text-shadow: 0 2px 3px rgba(150, 30, 90, 0.45);
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 12%;
  width: 45%;
  height: 36%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
}
.btn-primary:active {
  box-shadow:
    0 1px 0 #b01f6b,
    0 4px 10px rgba(200, 40, 120, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}

/* サブ：白〜淡ピンクのグラデ + ピンク縁取り */
.btn-sub {
  background: linear-gradient(180deg, #ffffff 0%, #ffeaf3 100%);
  color: var(--color-primary-dark);
  border: 3px solid var(--color-primary-light);
  padding: 14px 18px;
  font-size: 1.15rem;
  box-shadow:
    0 3px 0 rgba(255, 74, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.btn-sub:active {
  box-shadow:
    0 1px 0 rgba(255, 74, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* 戻るボタン：ピル型 */
.btn-back {
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid var(--color-primary-light);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-primary-dark);
  font-weight: 700;
  cursor: pointer;
  padding: 6px 12px;
}
.btn-back:active { transform: scale(0.95); background: rgba(255, 234, 243, 0.9); }

/* ===== ホーム画面 ===== */
#screen-home {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.title {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 3.2rem;
  line-height: 1.05;
  margin-bottom: 44px;
  background: linear-gradient(180deg, #ffb3d9 0%, #ff4a99 45%, #c8267a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(255, 255, 255, 0.95)) drop-shadow(0 6px 14px rgba(200, 38, 122, 0.35));
  position: relative;
  animation: title-bob 3.8s ease-in-out infinite;
}
@keyframes title-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.title::before,
.title::after {
  position: absolute;
  font-size: 1.8rem;
  color: var(--color-gold);
  -webkit-text-fill-color: var(--color-gold);
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.85));
  animation: sparkle-spin 4s linear infinite;
}
.title::before { content: '✨'; top: -6px; left: -22px; }
.title::after  { content: '✨'; bottom: -4px; right: -22px; animation-delay: -2s; animation-direction: reverse; }
@keyframes sparkle-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

.menu {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== モード選択 ===== */
.mode-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 4px 2px 8px;
}
.mode-card {
  position: relative;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  padding: 14px 16px 14px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  color: var(--color-text);
  box-shadow:
    0 6px 16px rgba(200, 80, 160, 0.18),
    inset 0 0 24px rgba(255, 255, 255, 0.28);
  transition: transform 0.1s, box-shadow 0.15s;
}
.mode-card:active {
  transform: scale(0.98);
  box-shadow: 0 3px 8px rgba(200, 80, 160, 0.2);
}
/* 上部の光沢ハイライト */
.mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  border-radius: 19px 19px 0 0;
}
/* レベルごとのジュエルカラー */
.mode-card[data-level="1"] { background: linear-gradient(135deg, #ffc6dc 0%, #ff9dc3 100%); }
.mode-card[data-level="2"] { background: linear-gradient(135deg, #dcc7ff 0%, #b39bff 100%); }
.mode-card[data-level="3"] { background: linear-gradient(135deg, #b7e2ff 0%, #82c3f0 100%); }
.mode-card[data-level="4"] { background: linear-gradient(135deg, #c6f3df 0%, #8adfba 100%); }
.mode-card[data-level="5"] { background: linear-gradient(135deg, #ffe98f 0%, #ffc94a 100%); }

.mode-card-title {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.45rem;
  color: var(--color-primary-dark);
  margin-bottom: 2px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}
.mode-card-desc {
  font-size: 0.88rem;
  color: rgba(74, 53, 104, 0.85);
  margin-bottom: 8px;
  font-weight: 700;
  line-height: 1.3;
}
.mode-card-best {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 3px 12px;
  color: var(--color-text);
  white-space: nowrap;
  max-width: 100%;
}
.mode-card-best .best-star {
  display: inline-block;
  margin-right: 4px;
  color: var(--color-gold);
  text-shadow: 0 0 4px rgba(255, 215, 0, 0.7);
}
.mode-card-best strong {
  color: var(--color-primary-dark);
  font-weight: normal;
  font-family: var(--font-display);
  margin-left: 2px;
  font-size: 1.05em;
}

/* ===== プレイ画面 ===== */
#screen-play {
  padding: 14px;
}
/* ヘッダー：ガラス風、ピンク枠 */
.play-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid var(--color-primary-light);
  border-radius: 18px;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(200, 80, 160, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.play-progress {
  color: var(--color-text-light);
  font-size: 1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.play-timer {
  font-family: var(--font-display);
  font-weight: normal;
  color: var(--color-primary);
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

/* やめるボタン：控えめな警告色 */
.btn-quit {
  background: linear-gradient(180deg, #fff 0%, #ffe6e6 100%);
  border: 2px solid #ff9bb0;
  color: #e03a6f;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 900;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(224, 58, 111, 0.18);
}
.btn-quit:active { transform: translateY(1px); box-shadow: 0 0 0 rgba(224, 58, 111, 0.18); }

/* 問題エリア */
.question-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 22px;
  padding: 16px 0;
}
.question {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 3rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #6e4f9e 0%, #4a3568 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.9)) drop-shadow(0 4px 10px rgba(74, 53, 104, 0.2));
}

/* 回答表示：パステル枠＋内側グロー */
.answer-display {
  min-height: 72px;
  min-width: 220px;
  padding: 10px 24px;
  background: linear-gradient(180deg, #fff 0%, #fff0f6 100%);
  border: 3px solid var(--color-primary-light);
  border-radius: 18px;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 2.4rem;
  text-align: center;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  box-shadow:
    0 4px 14px rgba(255, 74, 153, 0.2),
    inset 0 0 18px rgba(255, 179, 209, 0.25);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.answer-display.wrong {
  background: linear-gradient(180deg, #ffe0e0 0%, #ffc0c0 100%);
  border-color: #ff5a5a;
  color: #d63030;
  animation: shake 0.4s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}

/* ===== 数字パッド ===== */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.numpad-btn {
  padding: 18px 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.7rem;
  color: var(--color-primary-dark);
  background: linear-gradient(180deg, #ffffff 0%, #ffeaf3 100%);
  border: 2px solid var(--color-primary-light);
  border-radius: 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 3px 0 rgba(255, 74, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.06s, box-shadow 0.06s, background 0.1s;
}
/* 上部の光沢 */
.numpad-btn::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 12%;
  right: 12%;
  height: 30%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 40% 40% 60% 60% / 100% 100% 0 0;
  pointer-events: none;
}
.numpad-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 rgba(255, 74, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  background: linear-gradient(180deg, #fff0f6 0%, #ffd6e8 100%);
}
/* C（クリア）：赤系 */
.numpad-clear {
  background: linear-gradient(180deg, #fff0f0 0%, #ffd4d4 100%);
  border-color: #ff9bb0;
  color: #d63030;
  box-shadow:
    0 3px 0 rgba(214, 48, 48, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.numpad-clear:active {
  box-shadow:
    0 1px 0 rgba(214, 48, 48, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  background: linear-gradient(180deg, #ffdada 0%, #ffb8b8 100%);
}
/* けってい：ミントグリーン */
.numpad-enter {
  background: linear-gradient(180deg, #b8f2d8 0%, #6fd4a5 55%, #4abf8b 100%);
  border-color: #6fd4a5;
  color: #fff;
  font-size: 1.25rem;
  text-shadow: 0 1px 2px rgba(30, 110, 70, 0.35);
  box-shadow:
    0 3px 0 #3a9a6e,
    0 6px 14px rgba(74, 191, 139, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.numpad-enter:active {
  box-shadow:
    0 1px 0 #3a9a6e,
    0 3px 8px rgba(74, 191, 139, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ===== コレクション画面 ===== */
/* 統計表示：あつめた数 */
.collection-stats {
  text-align: center;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.3rem;
  color: var(--color-primary-dark);
  margin-bottom: 14px;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}
.collection-stats strong {
  color: var(--color-primary);
  font-family: var(--font-display);
  font-weight: normal;
  margin: 0 4px;
}
.collection-stats .stats-sep {
  color: var(--color-text-light);
  margin: 0 2px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  align-content: start;
  padding: 4px 2px 8px;
}

/* コレクションケース：獲得済みは金色、未獲得は淡いグレー */
.collection-cell {
  position: relative;
  border-radius: 18px;
  padding: 10px 8px 8px;
  text-align: center;
  transition: transform 0.15s;
}
.collection-cell::before {
  /* 上部光沢 */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 15px 15px 0 0;
  pointer-events: none;
}
.collection-cell.owned {
  background: linear-gradient(180deg, #fff9dc 0%, #ffe896 60%, #ffd855 100%);
  border: 3px solid #ffd700;
  box-shadow:
    0 4px 14px rgba(255, 184, 77, 0.45),
    0 0 18px rgba(255, 215, 0, 0.35),
    inset 0 0 20px rgba(255, 255, 255, 0.3);
}
.collection-cell.owned::after {
  /* 獲得済みマーク（右上に✨） */
  content: '✨';
  position: absolute;
  top: -6px;
  right: -4px;
  font-size: 1.1rem;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.9));
  animation: sparkle-spin 5s linear infinite;
}
.collection-cell.locked {
  background: linear-gradient(180deg, #efeaf0 0%, #d9d2dc 100%);
  border: 3px solid #c8bfd0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 画像エリア：全レア度で固定サイズ（正方形）。内部の画像サイズだけレア度で変える */
.collection-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.collection-img {
  object-fit: contain;
  display: block;
}
/* レア度別：画像エリア内での描画サイズを変えて余白で階層感を出す
   （セル枠・名前サイズ・名前位置は全レア度で同一） */
.collection-cell.rarity-1 .collection-img { width: 65%; height: 65%; }
.collection-cell.rarity-2 .collection-img { width: 82%; height: 82%; }
.collection-cell.rarity-3 .collection-img { width: 100%; height: 100%; }

/* ===== 獲得回数オーラ（3以上=銀、9以上=金） ===== */
/* オーラは「中心から外へ広がる放射波」で表現。::before と ::after の2本を
   半周期ズラして連続波紋にする。キャラ本体の明滅は控えめ。 */

/* キャラ画像をオーラより手前に重ねる（オーラ z:0、画像 z:1、星 z:2） */
.collection-img-wrap {
  position: relative;
  z-index: 1;
}

/* ===== 背景マトリクス：レア度 × 獲得回数ステージ =====
   - ベース背景は .owned.rarity-X で決定（銅・銀ステージ共通）
   - 金ステージ（count>=9）は全レア度で虹色グラデに上書き */

/* ベース背景：獲得済みの銅・銀ステージ（未獲得 .locked は従来のグレーを維持） */
.collection-cell.owned.rarity-1 { background: #ffffff; }
.collection-cell.owned.rarity-2 { background: #fff8e0; }
.collection-cell.owned.rarity-3 { background: #fff0b0; }

/* ===== 銀ステージ：控えめな演出（背景色はベースのまま） ===== */
/* セル全体に軽い銀のグローと影 */
.collection-cell.stage-silver {
  box-shadow:
    0 0 0 2px rgba(200, 220, 255, 0.6),
    0 4px 20px rgba(180, 200, 255, 0.4),
    inset 0 0 20px rgba(220, 235, 255, 0.3);
  border-color: rgba(200, 220, 255, 0.7);
}

/* キャラ本体：控えめに浮遊（金より弱め、2pxだけ） */
.collection-cell.stage-silver .collection-img {
  animation: float-silver-soft 3.5s ease-in-out infinite;
}
@keyframes float-silver-soft {
  0%, 100% {
    transform: translateY(0);
    filter: brightness(1);
  }
  50% {
    transform: translateY(-2px);
    filter: brightness(1.05) drop-shadow(0 4px 8px rgba(180, 200, 255, 0.5));
  }
}

/* 粒子：銀白色の星 8個、14px、text-shadowでグロー（配置とkeyframeは下の粒子セクションで定義） */
.collection-cell.stage-silver .sparkle-dot {
  font-size: 14px;
  color: #a0c5ff;
  text-shadow:
    0 0 4px #fff,
    0 0 8px rgba(200, 220, 255, 0.8);
  animation: sparkle-blink-silver 2.5s ease-in-out infinite;
}

/* 金ステージ：虹色グラデが流動（!important でレア度ベース背景を上書き） */
.collection-cell.stage-gold {
  background: linear-gradient(135deg,
    #ffccee 0%,
    #fff2c0 20%,
    #d4f0d4 40%,
    #c8e0ff 60%,
    #e0c8ff 80%,
    #ffccee 100%
  ) !important;
  background-size: 200% 200%;
  animation: rainbow-flow 6s ease-in-out infinite;
  border-color: #ffd700;
}
@keyframes rainbow-flow {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* 金ステージだけキャラが浮遊（6px） */
.collection-cell.stage-gold .collection-img {
  animation: float-gold 2.5s ease-in-out infinite;
}
@keyframes float-gold {
  0%, 100% {
    transform: translateY(0);
    filter: brightness(1) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.10));
  }
  50% {
    transform: translateY(-6px);
    filter: brightness(1.1) drop-shadow(0 10px 8px rgba(0, 0, 0, 0.12));
  }
}

/* ===== キラキラ粒子（銀ステージ:8個 / 金ステージ:14個） ===== */
.aura-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.sparkle-dot {
  position: absolute;
  display: inline-block;
  line-height: 1;
  opacity: 0;
  text-align: center;
  /* サイズ（font-size）・色・アニメは stage-silver / stage-gold で個別指定 */
}
/* 星型の文字を ::before で挿入。デフォルト ★ に加えて 3個ごとに ✦ / ✧ を混在 */
.sparkle-dot::before            { content: '★'; display: inline-block; }
.sparkle-dot:nth-child(3n+1)::before { content: '✦'; }
.sparkle-dot:nth-child(3n+2)::before { content: '✧'; }

/* --- 銀ステージ：8個の位置と delay、強めの明滅 --- */
.collection-cell.stage-silver .sparkle-dot:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s;   }
.collection-cell.stage-silver .sparkle-dot:nth-child(2) { top: 15%; left: 80%; animation-delay: 0.3s; }
.collection-cell.stage-silver .sparkle-dot:nth-child(3) { top: 40%; left: 10%; animation-delay: 0.6s; }
.collection-cell.stage-silver .sparkle-dot:nth-child(4) { top: 45%; left: 90%; animation-delay: 0.9s; }
.collection-cell.stage-silver .sparkle-dot:nth-child(5) { top: 70%; left: 25%; animation-delay: 1.2s; }
.collection-cell.stage-silver .sparkle-dot:nth-child(6) { top: 75%; left: 75%; animation-delay: 1.5s; }
.collection-cell.stage-silver .sparkle-dot:nth-child(7) { top: 55%; left: 50%; animation-delay: 1.8s; }
.collection-cell.stage-silver .sparkle-dot:nth-child(8) { top: 30%; left: 50%; animation-delay: 2.1s; }
@keyframes sparkle-blink-silver {
  0%, 100% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.5) rotate(180deg);
  }
}

/* --- 金ステージ：14個の星、18px、虹色サイクル、回転付き超派手な明滅 --- */
.collection-cell.stage-gold .sparkle-dot {
  font-size: 18px;
  text-shadow:
    0 0 6px #fff,
    0 0 12px currentColor,
    0 0 20px rgba(255, 215, 0, 0.5);
  animation: sparkle-blink-gold 2s ease-in-out infinite;
}
.collection-cell.stage-gold .sparkle-dot:nth-child(1)  { top: 8%;  left: 15%; animation-delay: 0s;   }
.collection-cell.stage-gold .sparkle-dot:nth-child(2)  { top: 12%; left: 50%; animation-delay: 0.2s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(3)  { top: 10%; left: 85%; animation-delay: 0.4s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(4)  { top: 30%; left: 8%;  animation-delay: 0.6s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(5)  { top: 35%; left: 92%; animation-delay: 0.8s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(6)  { top: 50%; left: 5%;  animation-delay: 1.0s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(7)  { top: 55%; left: 95%; animation-delay: 1.2s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(8)  { top: 65%; left: 20%; animation-delay: 1.4s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(9)  { top: 70%; left: 80%; animation-delay: 1.6s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(10) { top: 85%; left: 30%; animation-delay: 1.8s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(11) { top: 88%; left: 60%; animation-delay: 2.0s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(12) { top: 90%; left: 85%; animation-delay: 2.2s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(13) { top: 45%; left: 50%; animation-delay: 2.4s; }
.collection-cell.stage-gold .sparkle-dot:nth-child(14) { top: 25%; left: 65%; animation-delay: 1.1s; }
/* 虹7色サイクル（星の塗り色のみ） */
.collection-cell.stage-gold .sparkle-dot:nth-child(7n+1) { color: #ff6bb5; }
.collection-cell.stage-gold .sparkle-dot:nth-child(7n+2) { color: #ffc84d; }
.collection-cell.stage-gold .sparkle-dot:nth-child(7n+3) { color: #ffd700; }
.collection-cell.stage-gold .sparkle-dot:nth-child(7n+4) { color: #6bc56b; }
.collection-cell.stage-gold .sparkle-dot:nth-child(7n+5) { color: #6bb5ff; }
.collection-cell.stage-gold .sparkle-dot:nth-child(7n+6) { color: #b56bff; }
.collection-cell.stage-gold .sparkle-dot:nth-child(7n)   { color: #ff9b6b; }
@keyframes sparkle-blink-gold {
  0%, 100% {
    opacity: 0;
    transform: scale(0.3) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.8) rotate(180deg);
  }
}

/* 動きを減らす設定：背景流動・浮遊・粒子すべて停止 */
@media (prefers-reduced-motion: reduce) {
  .collection-cell.stage-gold { animation: none; background-position: 0% 50%; }
  .collection-cell.stage-gold .collection-img,
  .collection-cell.stage-silver .collection-img { animation: none; transform: none; }
  .sparkle-dot { animation: none; opacity: 0.5; transform: scale(1); }
}
.collection-cell.owned .collection-img {
  filter: drop-shadow(0 3px 6px rgba(180, 120, 30, 0.35));
}
/* 未獲得シルエット：明るくぼかして「光のかたまり」風に */
.collection-cell.locked .collection-img {
  filter: brightness(1.3) contrast(0.3) blur(4px) opacity(0.5);
}

.collection-name {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 0.95rem;
  margin-top: 4px;
  color: var(--color-primary-dark);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}
.collection-cell.locked .collection-name {
  color: #8a7e92;
  font-family: var(--font-body);
  font-weight: 900;
  text-shadow: none;
}

/* ===== 獲得回数の星マーク（コレクション左上＋結果画面） ===== */
/* レアリティごとにサイズを変える：金 > 銀 > 銅 の順に大きく */
.star {
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}
/* コレクション画面のデフォルトサイズ */
.star.bronze {
  font-size: 14px;
  color: #CD7F32;
  text-shadow: 0 0 2px #fff, 0 1px 1px rgba(0, 0, 0, 0.3);
}
.star.silver {
  font-size: 18px;
  color: #C0C0C0;
  text-shadow: 0 0 2px #fff, 0 0 4px rgba(192, 192, 192, 0.6), 0 1px 1px rgba(0, 0, 0, 0.3);
}
.star.gold {
  font-size: 22px;
  color: #FFD700;
  text-shadow: 0 0 2px #fff, 0 0 5px rgba(255, 215, 0, 0.9), 0 1px 1px rgba(0, 0, 0, 0.3);
  animation: star-gold-glow 2.2s ease-in-out infinite;
}
@keyframes star-gold-glow {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.25); }
}

/* コレクションセル下部：キャラのレア度表示（結果画面の配色を流用、サイズ小さめ） */
.collection-rarity {
  text-align: center;
  line-height: 1;
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.collection-rarity.rarity-1 {
  font-size: 0.9rem;
  color: #CD7F32;
  text-shadow: 0 0 2px #fff, 0 2px 3px rgba(0, 0, 0, 0.3);
}
.collection-rarity.rarity-2 {
  font-size: 1.0rem;
  background: linear-gradient(135deg,
    #e0e0f0 0%, #ffffff 30%, #c0c8ff 60%, #b8a8ff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter:
    drop-shadow(0 0 3px rgba(192, 200, 255, 0.9))
    drop-shadow(0 0 6px rgba(180, 168, 255, 0.5))
    drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
  animation: silver-shimmer 2.5s ease-in-out infinite;
}
.collection-rarity.rarity-3 {
  font-size: 1.1rem;
  background: linear-gradient(90deg,
    #ff4a99 0%,
    #ffb84d 20%,
    #ffd700 40%,
    #7fc55a 60%,
    #a0d8ff 80%,
    #c8a4ff 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter:
    drop-shadow(0 0 4px rgba(255, 215, 0, 0.8))
    drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
  animation:
    rainbow-flow 3s linear infinite,
    star-glow-pulse 1.5s ease-in-out infinite;
}
/* 未獲得は装飾を落ち着かせる */
.collection-cell.locked .collection-rarity {
  opacity: 0.5;
  animation: none;
}

/* コレクションセル左上：横並び折返し＋ベースライン揃え */
.collection-stars {
  position: absolute;
  top: 2px;
  left: 4px;
  right: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center; /* サイズ違いでも縦位置を揃える */
  gap: 1px;
  z-index: 2;
  line-height: 1;
  pointer-events: none;
}

/* ===== ご褒美エリア（結果画面内） ===== */
.reward-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #fffce6 0%, #fff3a8 100%);
  border: 3px solid var(--color-gold);
  border-radius: 24px;
  padding: 18px 28px;
  margin-bottom: 16px;
  box-shadow:
    0 8px 26px rgba(255, 184, 77, 0.4),
    0 0 40px rgba(255, 215, 0, 0.25),
    inset 0 2px 0 rgba(255, 255, 255, 0.7);
  animation: pop-in 0.5s ease-out, reward-glow 2.4s ease-in-out infinite 0.5s;
  overflow: visible;
}
.reward-area.hidden { display: none; }
/* 周囲のキラキラ（疑似要素） */
.reward-area::before, .reward-area::after {
  content: '✨';
  position: absolute;
  font-size: 1.6rem;
  color: var(--color-gold);
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
  animation: sparkle-spin 3s linear infinite;
}
.reward-area::before { top: -12px; left: -10px; }
.reward-area::after  { bottom: -6px; right: -8px; animation-delay: -1.5s; animation-direction: reverse; }
@keyframes reward-glow {
  0%, 100% { box-shadow: 0 8px 26px rgba(255, 184, 77, 0.4), 0 0 40px rgba(255, 215, 0, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.7); }
  50%      { box-shadow: 0 8px 26px rgba(255, 184, 77, 0.55), 0 0 60px rgba(255, 215, 0, 0.5),  inset 0 2px 0 rgba(255, 255, 255, 0.7); }
}
.reward-label {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.15rem;
  color: var(--color-primary-dark);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}
.reward-image {
  width: 140px;
  height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(200, 150, 40, 0.35));
}
.reward-image.hidden { display: none; }
.reward-name {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.5rem;
  color: var(--color-primary-dark);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

/* レア度星（結果画面の名前下）。レア度ごとに色・演出を切り替えて差別化 */
.reward-stars {
  line-height: 1;
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.1em;
}
.reward-stars.hidden { display: none; }

/* ☆1：ブロンズ、シンプル */
.reward-stars.rarity-1 {
  font-size: 1.8rem;
  color: #CD7F32;
  text-shadow:
    0 0 2px #fff,
    0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ☆2：シルバー〜水色〜紫の微グラデ、強めの発光＋シマーで上品な特別感 */
.reward-stars.rarity-2 {
  font-size: 2.2rem;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg,
    #e0e0f0 0%,
    #ffffff 30%,
    #c0c8ff 60%,
    #b8a8ff 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter:
    drop-shadow(0 0 4px rgba(192, 200, 255, 0.9))
    drop-shadow(0 0 10px rgba(180, 168, 255, 0.5))
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  animation: silver-shimmer 2.5s ease-in-out infinite;
}

@keyframes silver-shimmer {
  0%, 100% {
    background-position: 0% center;
    transform: scale(1);
  }
  50% {
    background-position: 100% center;
    transform: scale(1.06);
  }
}

/* ☆3：レインボーグラデ、流れるアニメ＋脈動で特別感を演出 */
.reward-stars.rarity-3 {
  font-size: 2.5rem;
  letter-spacing: 0.15em;
  background: linear-gradient(90deg,
    #ff4a99 0%,    /* ピンク */
    #ffb84d 20%,   /* オレンジ */
    #ffd700 40%,   /* ゴールド */
    #7fc55a 60%,   /* グリーン */
    #a0d8ff 80%,   /* スカイブルー */
    #c8a4ff 100%   /* ラベンダー */
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter:
    drop-shadow(0 0 6px rgba(255, 215, 0, 0.8))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation:
    rainbow-flow 3s linear infinite,
    star-glow-pulse 1.5s ease-in-out infinite;
}

@keyframes rainbow-flow {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* 結果画面：重複獲得時のお星様カウント表示 */
.reward-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.reward-stats.hidden { display: none; }
.reward-stats-label {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1rem;
  color: var(--color-primary-dark);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
  text-align: center;
}
.reward-stats-stars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: 260px;
}
/* 結果画面ではコレクションより一段大きく表示 */
.reward-stats-stars .star.bronze { font-size: 18px; }
.reward-stats-stars .star.silver { font-size: 22px; }
.reward-stats-stars .star.gold   { font-size: 26px; }

@keyframes star-sparkle {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.07); }
}
@keyframes star-glow-pulse {
  0%, 100% {
    transform: scale(1);
    filter:
      drop-shadow(0 0 6px rgba(255, 215, 0, 1))
      drop-shadow(0 0 12px rgba(255, 184, 77, 0.7));
  }
  50% {
    transform: scale(1.1);
    filter:
      drop-shadow(0 0 10px rgba(255, 215, 0, 1))
      drop-shadow(0 0 20px rgba(255, 184, 77, 1));
  }
}

/* ===== 結果画面 ===== */
#screen-result {
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.result-title {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 2.6rem;
  margin-bottom: 14px;
  background: linear-gradient(180deg, #ff8ec7 0%, #ff4a99 50%, #c8267a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(255, 255, 255, 0.95)) drop-shadow(0 5px 10px rgba(200, 38, 122, 0.3));
  animation: pop-in 0.5s ease-out;
}
.result-badge {
  background: linear-gradient(135deg, #ffd700 0%, #ff8ec7 50%, #c8a4ff 100%);
  color: #fff;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.2rem;
  padding: 12px 26px;
  border-radius: 999px;
  margin-bottom: 16px;
  box-shadow:
    0 4px 14px rgba(255, 107, 157, 0.4),
    0 0 24px rgba(255, 215, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  text-shadow: 0 2px 3px rgba(150, 30, 90, 0.4);
  animation: pop-in 0.4s ease-out, badge-pulse 1.8s ease-in-out infinite 0.5s;
}
.result-badge.hidden { display: none; }
@keyframes pop-in {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
/* 結果カード：ガラス風パステル */
.result-card {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 240, 248, 0.85) 100%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow:
    0 8px 26px rgba(200, 80, 160, 0.18),
    inset 0 2px 0 rgba(255, 255, 255, 0.8);
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 2px dashed rgba(255, 179, 209, 0.7);
}
.result-row:last-child { border-bottom: none; }
.result-label {
  font-size: 1rem;
  color: var(--color-text-light);
  font-weight: 900;
}
.result-value {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.7rem;
  color: var(--color-primary-dark);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}
.result-actions {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== きろく画面（グラフ） ===== */
#screen-history { padding: 16px; }

.history-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}
/* ピル型タブ：非アクティブは淡く、アクティブは濃ピンクで浮き上がる */
.history-tab {
  flex-shrink: 0;
  padding: 7px 14px;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 0.92rem;
  background: linear-gradient(180deg, #ffffff 0%, #ffeaf3 100%);
  border: 2px solid var(--color-primary-light);
  border-radius: 999px;
  color: var(--color-primary-dark);
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(255, 74, 153, 0.15);
  transition: transform 0.08s, box-shadow 0.1s;
}
.history-tab:active { transform: translateY(1px); }
.history-tab.active {
  background: linear-gradient(180deg, #ff7ab6 0%, #ff4a99 100%);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow:
    0 3px 0 #b01f6b,
    0 5px 12px rgba(255, 74, 153, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 2px rgba(150, 30, 90, 0.3);
}

.history-note {
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-light);
  font-weight: 900;
  margin-bottom: 8px;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* グラフカード：ガラス風パステル。グラフ本体は視認性最優先で装飾を抑える */
.history-graph-wrap {
  flex: 1;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  overflow: auto;
  box-shadow:
    0 6px 18px rgba(200, 80, 160, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.history-graph {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* SVG は viewBox = 実コンテナ幅 にして 1:1 描画。height は JS でインライン指定 */
.history-svg {
  display: block;
  width: 100%;
}
.history-svg .grid-line  { stroke: #f3dae8; stroke-width: 1; }
.history-svg .axis-line  { stroke: #a89cb8; stroke-width: 1.5; }
.history-svg .axis-label { fill: #6e5a82; font-family: inherit; }
.history-svg .axis-date  { fill: #8a7aa8; font-family: inherit; }
.history-svg .data-line  { stroke: var(--color-primary); stroke-width: 2.5; fill: none; }
.history-svg .data-point { cursor: pointer; }

.history-empty {
  text-align: center;
  color: var(--color-text-light);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 900;
  padding: 30px 0;
}

.history-delete { margin-top: 10px; }
.history-delete.hidden { display: none; }

/* ===== 設定画面 ===== */
.settings-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 2px 12px;
}

/* 見出し：ピンクで分類を示す */
.settings-section {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1rem;
  color: var(--color-primary-dark);
  margin: 14px 4px 4px;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}
.settings-section-danger { color: #d63a5e; }

/* 設定項目カード：ガラス風パステル */
.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 240, 248, 0.85) 100%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow:
    0 3px 10px rgba(200, 80, 160, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.settings-label {
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 900;
  color: var(--color-text);
}

/* ステッパー：ピンク系ボタン */
.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stepper-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--color-primary-light);
  background: linear-gradient(180deg, #fff 0%, #ffeaf3 100%);
  color: var(--color-primary-dark);
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow:
    0 2px 0 rgba(255, 74, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.08s, box-shadow 0.08s;
}
.stepper-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 0 0 rgba(255, 74, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  background: linear-gradient(180deg, #ffeaf3 0%, #ffd6e8 100%);
}
.stepper-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.stepper-value {
  min-width: 70px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.25rem;
  color: var(--color-primary-dark);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* 危険ゾーン */
.settings-danger {
  border-color: #ffb3c0;
  background: linear-gradient(180deg, rgba(255, 240, 240, 0.9) 0%, rgba(255, 220, 228, 0.85) 100%);
  justify-content: center;
  padding: 8px 14px;
}

/* 危険ボタン（履歴画面でも使用） */
.btn-danger {
  background: linear-gradient(180deg, #fff 0%, #ffe0e6 100%);
  color: #d63a5e;
  border: 3px solid #ffa0b3;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.05rem;
  padding: 12px;
  margin: 0;
  border-radius: 18px;
  cursor: pointer;
  box-shadow:
    0 3px 0 rgba(214, 58, 94, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.btn-danger:active {
  transform: translateY(2px);
  box-shadow:
    0 0 0 rgba(214, 58, 94, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  background: linear-gradient(180deg, #ffe6ec 0%, #ffc8d3 100%);
}

/* ===== Responsive ===== */
@media (min-height: 700px) {
  .question { font-size: 3.5rem; }
  .numpad-btn { padding: 22px 0; font-size: 1.8rem; }
}

/* 狭い画面（〜375px：一般的なスマホの下限帯） */
@media (max-width: 375px) {
  .screen            { padding: 12px; }
  #screen-play       { padding: 10px; }
  #screen-history    { padding: 12px; }
  #screen-result     { padding: 12px; }

  /* ヘッダー：戻るボタンとタイトルを両方コンパクト化 */
  .screen-header { gap: 6px; }
  .screen-header h2 {
    font-size: 1.2rem;
    padding-right: 58px;
  }
  .btn-back {
    font-size: 0.82rem;
    padding: 5px 10px;
  }

  /* ホームタイトル */
  .title { font-size: 2.8rem; margin-bottom: 36px; }
  .title::before, .title::after { font-size: 1.5rem; }

  /* モードカード */
  .mode-card { padding: 12px 12px 12px; }
  .mode-card-title { font-size: 1.3rem; }
  .mode-card-desc  { font-size: 0.82rem; }
  .mode-card-best  { font-size: 0.88rem; padding: 2px 10px; }

  /* 問題・回答 */
  .question        { font-size: 2.6rem; }
  .answer-display  { font-size: 2rem; min-width: 180px; min-height: 64px; padding: 8px 18px; }

  /* 数字パッド */
  .numpad          { gap: 8px; }
  .numpad-btn      { font-size: 1.55rem; padding: 16px 0; }
  .numpad-enter    { font-size: 1rem; white-space: nowrap; letter-spacing: -0.02em; }

  /* 結果画面 */
  .result-title    { font-size: 2.2rem; }
  .result-badge    { font-size: 1.05rem; padding: 10px 20px; }
  .result-card     { padding: 16px 20px; }
  .result-value    { font-size: 1.5rem; }
  .reward-area     { padding: 14px 20px; }
  .reward-image    { width: 120px; height: 120px; }
  .reward-name     { font-size: 1.3rem; }

  /* 設定画面 */
  .settings-section { font-size: 0.9rem; }
  .settings-item    { padding: 8px 12px; }
  .settings-label   { font-size: 0.9rem; }
  .stepper          { gap: 8px; }
  .stepper-btn      { width: 34px; height: 34px; font-size: 1.3rem; }
  .stepper-value    { min-width: 60px; font-size: 1.1rem; }
  .btn-danger       { font-size: 0.98rem; padding: 11px; }
}

/* 極端に狭い画面（〜340px：iPhone SE 第1世代・古いAndroid等） */
@media (max-width: 340px) {
  .screen         { padding: 8px; }
  #screen-play    { padding: 8px; }
  #screen-history { padding: 8px; }
  #screen-result  { padding: 8px; }

  .screen-header h2 {
    font-size: 1.05rem;
    padding-right: 48px;
  }
  .btn-back {
    font-size: 0.76rem;
    padding: 4px 8px;
  }

  .title { font-size: 2.4rem; margin-bottom: 28px; }

  .mode-list { gap: 10px; }
  .mode-card { padding: 10px 10px 10px; }
  .mode-card-title { font-size: 1.15rem; }
  .mode-card-desc  { font-size: 0.76rem; margin-bottom: 6px; }
  .mode-card-best  { font-size: 0.82rem; padding: 2px 8px; }

  .question       { font-size: 2.2rem; }
  .answer-display { font-size: 1.8rem; min-width: 150px; min-height: 58px; }

  .numpad         { gap: 6px; }
  .numpad-btn     { font-size: 1.35rem; padding: 13px 0; border-radius: 14px; }
  .numpad-enter   { font-size: 0.9rem; }

  .result-title   { font-size: 2rem; }
  .result-badge   { font-size: 0.95rem; padding: 8px 16px; }
  .result-card    { padding: 14px 16px; }
  .result-value   { font-size: 1.35rem; }
  .reward-area    { padding: 12px 16px; }
  .reward-image   { width: 100px; height: 100px; }
  .reward-name    { font-size: 1.15rem; }

  /* 設定画面 */
  .settings-section { font-size: 0.85rem; margin: 10px 2px 2px; }
  .settings-item    { padding: 7px 10px; border-radius: 14px; }
  .settings-label   { font-size: 0.84rem; }
  .stepper          { gap: 6px; }
  .stepper-btn      { width: 30px; height: 30px; font-size: 1.15rem; }
  .stepper-value    { min-width: 52px; font-size: 1rem; }
  .btn-danger       { font-size: 0.92rem; padding: 10px; }
}
