/* ========================================
   まひろタウン - 共通スタイル
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@500;700;900&display=swap');

/* ---------- Reset & Variables ---------- */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --pink: #ff6b9d;
  --orange: #ff9a56;
  --yellow: #ffd93d;
  --green: #6bcb77;
  --blue: #4d96ff;
  --purple: #9b72cf;
  --bg: #fff8f0;
  --card: #ffffff;
  --text: #5a4a3a;
  --text-light: #b0a090;
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --radius: 20px;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Zen Maru Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: 100%;
  max-width: 500px;
  height: 100dvh;
  max-height: 850px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* ---------- 共通パーツ ---------- */

.coin-badge {
  display: flex; align-items: center; gap: 4px;
  background: var(--card); border-radius: 30px;
  padding: 6px 14px; box-shadow: var(--shadow);
  font-weight: 900; font-size: 18px;
}
.coin-icon { font-size: 20px; }

.btn-back, .btn-close {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 16px; font-weight: 700;
  background: var(--card); color: var(--text-light);
  border: none; border-radius: 30px;
  padding: 8px 18px; cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s;
}
.btn-close {
  width: 44px; height: 44px; padding: 0;
  font-size: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.btn-back:active, .btn-close:active { transform: scale(0.92); }

.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 4px 8px;
}

/* ---------- 紙吹雪 ---------- */

#confetti-container {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100; overflow: hidden;
}
.confetti {
  position: absolute; top: -20px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ========================================
   ホーム画面
   ======================================== */

.home { padding: 16px 16px 32px; }

.home-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px;
}

.greeting-text {
  font-size: clamp(28px, 7vw, 36px); font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--orange));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.greeting-sub {
  font-size: 14px; font-weight: 500; color: var(--text-light); margin-top: 2px;
}

/* ---- スタンプカード ---- */

.stamp-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.stamp-title {
  font-size: 14px; font-weight: 700; color: var(--text-light);
  margin-bottom: 12px; text-align: center;
}
.stamp-week {
  display: flex; justify-content: space-between; gap: 4px;
  margin-bottom: 12px;
}
.stamp-day {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.stamp-label {
  font-size: 11px; font-weight: 700; color: var(--text-light);
}
.stamp-mark {
  font-size: 22px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #f5f0eb;
  transition: transform 0.3s;
}
.stamp-day.stamped .stamp-mark {
  background: #fff8e0; transform: scale(1.1);
}
.stamp-day.is-today .stamp-mark {
  border: 3px solid var(--orange);
  font-weight: 900; color: var(--orange);
}
.stamp-day.is-today.stamped .stamp-mark {
  border-color: var(--yellow);
  animation: stampBounce 0.4s ease;
}

.btn-stamp {
  font-family: 'Zen Maru Gothic', sans-serif;
  width: 100%; padding: 12px;
  font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  border: none; border-radius: 30px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,154,86,0.3);
  transition: transform 0.12s;
}
.btn-stamp:active { transform: scale(0.95); }

.stamp-done {
  text-align: center; font-size: 14px; font-weight: 700;
  color: var(--green); padding: 8px 0;
}

/* ---- ストリーク ---- */

.streak-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border-radius: var(--radius); padding: 10px 16px;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.streak-fire { font-size: 24px; animation: pulse 0.6s ease infinite alternate; }
.streak-text { font-size: 18px; font-weight: 900; color: #e65100; }

/* ---- デイリーチャレンジ ---- */

.daily-card {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-radius: var(--radius); padding: 16px;
  margin-bottom: 16px; box-shadow: var(--shadow); text-align: center;
}
.daily-title { font-size: 18px; font-weight: 900; color: #2e7d32; }
.daily-desc { font-size: 13px; color: #558b2f; margin: 4px 0 12px; }
.daily-done { font-size: 15px; font-weight: 700; color: #2e7d32; padding: 4px 0; }

.daily-question {
  font-size: clamp(28px, 8vw, 44px); font-weight: 900;
  color: var(--text); text-align: center;
  background: var(--card); border-radius: 28px;
  padding: 24px 32px; box-shadow: var(--shadow);
}
.daily-type {
  font-size: 13px; font-weight: 700; color: var(--text-light);
  text-align: center; margin-bottom: 8px;
}
.btn-daily {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--green), #4caf50);
  border: none; border-radius: 30px;
  padding: 12px 32px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(76,175,80,0.3);
  transition: transform 0.12s;
}
.btn-daily:active { transform: scale(0.95); }

/* ---- がんばりグラフ ---- */

.graph-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.graph-title {
  font-size: 14px; font-weight: 700; color: var(--text-light);
  text-align: center; margin-bottom: 12px;
}
.graph-bars {
  display: flex; justify-content: space-between; align-items: flex-end;
  height: 80px; gap: 4px;
}
.graph-col {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; height: 100%;
  justify-content: flex-end;
}
.graph-count {
  font-size: 11px; font-weight: 700; color: var(--text-light);
  margin-bottom: 2px; min-height: 14px;
}
.graph-bar {
  width: 100%; max-width: 28px; min-height: 0;
  background: linear-gradient(180deg, var(--green), #a5d6a7);
  border-radius: 6px 6px 2px 2px;
  transition: height 0.5s ease;
}
.graph-col.is-today .graph-bar {
  background: linear-gradient(180deg, var(--orange), var(--yellow));
}
.graph-label {
  font-size: 11px; font-weight: 700; color: var(--text-light);
  margin-top: 4px;
}

/* ---- セクションラベル ---- */

.section-label {
  font-size: 16px; font-weight: 900; color: var(--text-light);
  margin-bottom: 12px; padding-left: 4px;
}

/* ---- ゲームカード ---- */

.game-list { display: flex; flex-direction: column; gap: 12px; }

.game-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.12s;
}
.game-card:active { transform: scale(0.97); }
.game-card.locked { opacity: 0.5; cursor: default; }
.game-card.locked:active { transform: none; }

.game-card-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.game-card-body { flex: 1; }
.game-card-name { font-size: 18px; font-weight: 900; }
.game-card-meta {
  font-size: 13px; font-weight: 500; color: var(--text-light);
  display: flex; gap: 12px; margin-top: 2px;
}
.game-card-lock {
  font-size: 13px; font-weight: 500; color: var(--text-light);
  margin-top: 2px;
}
.game-card-arrow {
  font-size: 18px; color: var(--text-light); flex-shrink: 0;
}

/* ========================================
   ステージ選択画面
   ======================================== */

.stage-select { padding: 0 16px 32px; }

.stage-header {
  text-align: center; padding: 12px 0 20px;
}
.stage-header-icon { font-size: 40px; }
.stage-header-name {
  font-size: clamp(24px, 6vw, 32px); font-weight: 900;
  margin-top: 4px;
}

.stage-list { display: flex; flex-direction: column; gap: 10px; }

.stage-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.12s;
}
.stage-card:active { transform: scale(0.97); }
.stage-card.locked { opacity: 0.45; cursor: default; }
.stage-card.locked:active { transform: none; }

.stage-num {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; font-size: 20px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stage-card.locked .stage-num {
  background: #e0dcd8; font-size: 18px;
}
.stage-body { flex: 1; }
.stage-name { font-size: 16px; font-weight: 700; }
.stage-stars {
  font-size: 14px; margin-top: 2px; letter-spacing: 2px;
  color: var(--text-light);
}
.stage-arrow {
  font-size: 16px; color: var(--text-light); flex-shrink: 0;
}

/* ========================================
   ゲーム画面（10のおともだち）
   ======================================== */

.game-hosuu,
.game-tashizan,
.game-hikizan,
.game-kuku,
.game-hiragana,
.game-tokei,
.game-zukei,
.game-kanji,
.game-warizan,
.game-katakana,
.game-kagaku,
.game-daily {
  padding: 12px 16px;
  display: flex; flex-direction: column;
  height: 100dvh; max-height: 850px;
}

.game-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.game-stage-label {
  font-size: 13px; font-weight: 700; color: var(--text-light);
  margin-left: auto;
}

/* ---- プログレスドット ---- */

.dots { display: flex; gap: 8px; flex: 1; justify-content: center; }

.dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #e8e2dc; transition: background 0.3s, transform 0.3s;
}
.dot-now { background: var(--blue); transform: scale(1.2); }
.dot-ok  { background: var(--green); }
.dot-ng  { background: var(--pink); }

/* ---- 問題エリア ---- */

.q-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 8px 0; min-height: 0;
}

.q-box {
  display: flex; align-items: center;
  gap: clamp(8px, 3vw, 18px);
  background: var(--card); border-radius: 28px;
  padding: 20px clamp(16px, 5vw, 36px);
  box-shadow: var(--shadow);
}

.q-num {
  font-size: clamp(52px, 14vw, 76px); font-weight: 900;
  color: var(--blue); min-width: 1.2em; text-align: center;
}
.q-op {
  font-size: clamp(22px, 5vw, 30px); font-weight: 900;
  color: var(--text-light);
}
.q-blank {
  display: inline-flex; align-items: center; justify-content: center;
  width: clamp(52px, 14vw, 76px); height: clamp(52px, 14vw, 76px);
  font-size: clamp(36px, 10vw, 52px); font-weight: 900;
  color: var(--pink); background: #fff5f8;
  border: 4px dashed var(--pink); border-radius: 16px;
  transition: all 0.3s;
}
.q-blank.reveal {
  background: #e8ffe8; border-color: var(--green);
  color: var(--green); border-style: solid;
  animation: revealPop 0.3s ease;
}
.q-ten {
  font-size: clamp(36px, 9vw, 52px); font-weight: 900;
  color: var(--orange);
}

/* ---- 選択肢グリッド ---- */

.choices {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: clamp(6px, 2vw, 10px);
  padding: 0 0 4px;
  flex-shrink: 0;
}

.c-btn {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: clamp(26px, 7vw, 38px); font-weight: 900;
  aspect-ratio: 1; border: none; border-radius: 16px;
  cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.1s, opacity 0.2s;
}
.c-btn:active { transform: scale(0.88); }

.c-correct {
  animation: correctPop 0.4s ease;
  box-shadow: 0 0 0 4px var(--green), 0 4px 12px rgba(0,0,0,0.1);
}
.c-wrong {
  animation: wrongShake 0.4s ease;
  opacity: 0.35;
}

/* ---- たしざん 4択グリッド ---- */

.choices-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(10px, 3vw, 16px);
  padding: 0 16px 4px;
  flex-shrink: 0;
}

.choices-4 .c-btn {
  aspect-ratio: 1;
  font-size: clamp(32px, 9vw, 48px);
  border-radius: 20px;
}

.choices-4 .c-btn:nth-child(1) { background: var(--pink); }
.choices-4 .c-btn:nth-child(2) { background: var(--green); }
.choices-4 .c-btn:nth-child(3) { background: var(--blue); }
.choices-4 .c-btn:nth-child(4) { background: var(--orange); }

/* ---- ひらがな / 漢字 共通 ---- */

.q-kanji-box, .q-hiragana-box {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card); border-radius: 28px;
  padding: 20px 40px; box-shadow: var(--shadow);
}
.q-hiragana {
  font-size: clamp(80px, 25vw, 130px); font-weight: 900;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.q-kanji {
  font-size: clamp(72px, 22vw, 110px); font-weight: 900;
  line-height: 1.2;
}
.q-kanji-word {
  font-size: 18px; font-weight: 700; color: var(--green);
  opacity: 0; transition: opacity 0.3s;
}
.q-kanji-word.show { opacity: 1; }
.q-hint {
  font-size: clamp(13px, 3.5vw, 16px); font-weight: 700;
  color: var(--text-light);
}

.choices-word {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 2vw, 12px);
  padding: 0 4px 4px; flex-shrink: 0;
}
.c-btn-word {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: clamp(16px, 4.5vw, 22px); font-weight: 700;
  padding: 14px 10px; border: none; border-radius: 16px;
  cursor: pointer; color: #fff; text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.1s, opacity 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.c-btn-word:active { transform: scale(0.93); }
.c-btn-word:nth-child(1) { background: var(--pink); }
.c-btn-word:nth-child(2) { background: var(--green); }
.c-btn-word:nth-child(3) { background: var(--blue); }
.c-btn-word:nth-child(4) { background: var(--orange); }
.c-btn-word.c-correct {
  animation: correctPop 0.4s ease;
  box-shadow: 0 0 0 4px var(--green), 0 4px 12px rgba(0,0,0,0.1);
}
.c-btn-word.c-wrong {
  animation: wrongShake 0.4s ease;
  opacity: 0.35;
}

/* ---- フィードバック ---- */

.fb {
  height: 48px; display: flex; align-items: center; justify-content: center;
  font-size: clamp(24px, 6vw, 36px); font-weight: 900;
  opacity: 0; transition: opacity 0.2s;
  padding-bottom: env(safe-area-inset-bottom, 8px);
  flex-shrink: 0;
}
.fb.show { opacity: 1; animation: feedbackPop 0.35s ease; }
.fb-ok  { color: var(--green); }
.fb-ng  { color: var(--text-light); font-size: clamp(18px, 4.5vw, 26px); }

/* ========================================
   リザルト画面
   ======================================== */

.result {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100dvh; max-height: 850px;
  padding: 24px;
}

.result-title {
  font-size: clamp(36px, 9vw, 52px); font-weight: 900;
  margin-bottom: 24px; text-align: center;
}
.result-title.cleared {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.result-title.retry { color: var(--blue); }

.result-score {
  background: var(--card); border-radius: var(--radius);
  padding: 20px 40px; box-shadow: var(--shadow);
  text-align: center; margin-bottom: 20px;
}
.result-big {
  font-size: clamp(48px, 12vw, 64px); font-weight: 900;
  color: var(--orange);
}
.result-slash {
  font-size: clamp(20px, 5vw, 28px); font-weight: 700;
  color: var(--text-light);
}
.result-label {
  font-size: 14px; font-weight: 500; color: var(--text-light);
  margin-top: 4px;
}

.result-stars {
  display: flex; gap: 12px; margin-bottom: 20px;
  font-size: 44px;
}
.r-star {
  display: inline-block; opacity: 0.25;
  transform: scale(0.6); transition: all 0.4s;
}
.r-star.earned {
  opacity: 1; transform: scale(1);
  animation: starPop 0.4s ease forwards;
}

.result-coins {
  display: flex; align-items: center; gap: 6px;
  font-size: 24px; font-weight: 900; color: var(--orange);
  margin-bottom: 28px;
  animation: coinSlideIn 0.5s ease 0.6s both;
}

.result-btns { display: flex; gap: 12px; }

.btn-result {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: clamp(18px, 4.5vw, 22px); font-weight: 700;
  border: none; border-radius: 30px;
  padding: 14px 32px; cursor: pointer;
  transition: transform 0.12s;
}
.btn-result:active { transform: scale(0.93); }
.btn-result.retry {
  background: var(--card); color: var(--text);
  box-shadow: var(--shadow);
}
.btn-result.stages {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; box-shadow: 0 4px 16px rgba(77,150,255,0.3);
}

/* ========================================
   おべんきょうガイド
   ======================================== */

.study-guide { padding: 0 16px 32px; }

.guide-header {
  text-align: center; padding: 8px 0 12px;
}
.guide-icon { font-size: 36px; }
.guide-title { font-size: 24px; font-weight: 900; margin-top: 4px; }
.guide-page-num {
  font-size: 13px; font-weight: 700; color: var(--text-light);
}

.guide-content {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

.guide-visual {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 8px 0;
}

.guide-big-text {
  font-size: clamp(64px, 18vw, 96px); font-weight: 900;
  color: var(--orange);
}
.guide-sub {
  font-size: clamp(16px, 4.5vw, 20px); font-weight: 700;
  color: var(--text); text-align: center; line-height: 1.5;
}
.guide-arrow {
  font-size: 18px; font-weight: 700; color: var(--text-light);
  padding: 4px 0;
}

/* 10マス */
.ten-frame {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 4px; width: fit-content;
}
.tf-dot {
  width: clamp(24px, 6vw, 32px); height: clamp(24px, 6vw, 32px);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900; color: #fff;
}

/* ドットグループ */
.dot-group {
  display: inline-flex; gap: 4px; flex-wrap: wrap;
  justify-content: center; max-width: 120px;
}
.dot-circle {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff;
}
.dot-circle.crossed { opacity: 0.4; font-size: 12px; }

.guide-demo-row {
  display: flex; align-items: center; gap: 12px;
  justify-content: center; flex-wrap: wrap;
}
.guide-op {
  font-size: 28px; font-weight: 900; color: var(--text-light);
}
.guide-demo-eq {
  font-size: clamp(22px, 6vw, 30px); font-weight: 900;
  color: var(--text);
}

/* ペア一覧 */
.guide-pairs {
  display: flex; flex-direction: column; gap: 10px;
  align-items: center;
}
.guide-pair-item { text-align: center; }
.guide-pair-label {
  font-size: 16px; font-weight: 900; color: var(--text);
  margin-top: 4px;
}
.guide-insight, .guide-tip {
  font-size: 15px; font-weight: 700; text-align: center;
  line-height: 1.6; padding: 12px 16px;
  background: #fffde7; border-radius: 16px;
  color: #5a4a3a;
}

/* 全ペア一覧 */
.guide-all-pairs {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
}
.guide-mini-pair {
  display: flex; align-items: center; gap: 4px;
  background: var(--card); border-radius: 12px;
  padding: 8px 12px; box-shadow: var(--shadow);
  font-size: 16px; font-weight: 900;
}
.gmp-plus, .gmp-eq { color: var(--text-light); font-size: 14px; }

/* パターン */
.guide-pattern {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border-radius: 16px;
  padding: 16px 24px; box-shadow: var(--shadow);
}
.guide-pattern-row {
  font-size: 20px; font-weight: 900; color: var(--text);
}

/* 指カウント */
.guide-fingers {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.guide-finger-step { text-align: center; }
.guide-finger-emoji { font-size: 36px; }
.guide-finger-text { font-size: 15px; font-weight: 700; }

/* ひきざん逆 */
.guide-reverse {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card); border-radius: 16px;
  padding: 16px 24px; box-shadow: var(--shadow);
}
.guide-reverse-row { font-size: 22px; font-weight: 900; }
.guide-sub-row { text-align: center; }

/* 九九グループ */
.guide-groups { text-align: center; }
.guide-group-row {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-bottom: 8px;
}
.guide-group-gap { width: 8px; }
.guide-group-label { font-size: 18px; font-weight: 900; color: var(--text); }

/* 九九リスト */
.guide-kuku-list {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border-radius: 16px;
  padding: 12px 16px; box-shadow: var(--shadow);
  width: 100%;
}
.guide-kuku-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700;
}
.gkr-eq { min-width: 90px; }
.gkr-ans { font-weight: 900; color: var(--orange); min-width: 24px; }
.gkr-dots { font-size: 10px; color: var(--pink); letter-spacing: 1px; }

/* 九九表 */
.guide-kuku-table {
  font-size: clamp(10px, 2.8vw, 13px); font-weight: 700;
  width: 100%; overflow-x: auto;
}
.gkt-header, .gkt-row { display: flex; }
.gkt-cell {
  flex: 1; min-width: 28px; padding: 4px 2px;
  text-align: center; border: 1px solid #ede8e3;
}
.gkt-cell.head { background: #f5f0eb; font-weight: 900; color: var(--blue); }
.gkt-cell.corner { background: #e8e2dc; }

/* ひらがなデモ */
.guide-char-demo { text-align: center; }
.guide-big-char {
  font-size: clamp(80px, 22vw, 120px); font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1.2;
}
.guide-char-word { font-size: 28px; font-weight: 900; }
.guide-char-list {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%;
}
.guide-char-row {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-radius: 14px;
  padding: 10px 16px; box-shadow: var(--shadow);
}
.gcr-char {
  font-size: 32px; font-weight: 900; min-width: 44px; text-align: center;
  color: var(--purple);
}
.gcr-word { font-size: 18px; font-weight: 700; }

/* 50音表 */
.guide-gojuon {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%;
}
.gojuon-row { display: flex; justify-content: center; gap: 2px; }
.gojuon-cell {
  width: clamp(28px, 7vw, 36px); height: clamp(28px, 7vw, 36px);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(14px, 3.5vw, 18px); font-weight: 900;
  background: var(--card); border-radius: 6px;
  color: var(--purple);
}
.gojuon-cell.empty { background: transparent; }
.gojuon-cell.single { width: clamp(28px, 7vw, 36px); }

/* ナビゲーション */
.guide-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0 16px; flex-shrink: 0;
}
.btn-guide-nav {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 16px; font-weight: 700;
  border: none; border-radius: 30px;
  padding: 12px 24px; cursor: pointer;
  transition: transform 0.12s;
}
.btn-guide-nav:active { transform: scale(0.93); }
.btn-guide-nav.prev { background: var(--card); color: var(--text-light); box-shadow: var(--shadow); }
.btn-guide-nav.next { background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; }
.btn-guide-nav.done { background: linear-gradient(135deg, var(--green), #4caf50); color: #fff; }

/* ステージ選択のおべんきょうボタン */
.btn-study {
  font-family: 'Zen Maru Gothic', sans-serif;
  display: block; width: 100%; margin-top: 16px; padding: 12px;
  font-size: 16px; font-weight: 700;
  background: #fffde7; color: #f9a825;
  border: 3px solid #ffe082; border-radius: 30px;
  cursor: pointer; text-align: center;
  transition: transform 0.12s;
}
.btn-study:active { transform: scale(0.97); }

/* ========================================
   アニメーション
   ======================================== */

.pop-in { animation: popIn 0.3s ease; }

@keyframes popIn {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes correctPop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(5px); }
}

@keyframes feedbackPop {
  0%   { transform: scale(0.5); opacity: 0; }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes revealPop {
  0%   { transform: scale(0.7); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes starPop {
  0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
  60%  { opacity: 1; transform: scale(1.3) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes stampBounce {
  0%   { transform: scale(0.5); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1.1); }
}

@keyframes coinSlideIn {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.2); }
}

/* ---- ショップ画面 ---- */
.shop { padding: 0 16px 32px; }

.shop-title {
  text-align: center; padding: 16px 0;
  font-size: 28px; font-weight: 900;
}

.shop-list { display: flex; flex-direction: column; gap: 12px; }

.shop-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}

.shop-preview {
  width: 48px; height: 48px; border-radius: 12px;
  border: 2px solid rgba(0,0,0,0.1); flex-shrink: 0;
}

.shop-info { flex: 1; }
.shop-name { font-size: 16px; font-weight: 700; }
.shop-price { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.btn-buy {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 14px; font-weight: 700;
  border: none; border-radius: 20px;
  padding: 8px 16px; cursor: pointer;
  transition: transform 0.12s;
}
.btn-buy:active { transform: scale(0.93); }
.btn-buy.buy { background: linear-gradient(135deg, var(--orange), var(--yellow)); color: #fff; }
.btn-buy.use { background: var(--green); color: #fff; }
.btn-buy.current { background: #e8e2dc; color: var(--text-light); cursor: default; }
.btn-buy.cant { background: #e8e2dc; color: var(--text-light); cursor: default; font-size: 12px; }

.btn-shop {
  font-family: 'Zen Maru Gothic', sans-serif;
  width: 100%; margin-top: 20px; padding: 14px;
  font-size: 18px; font-weight: 700;
  background: var(--card); color: var(--text);
  border: 3px solid #e8e2dc; border-radius: 30px;
  cursor: pointer; transition: transform 0.12s;
  box-shadow: var(--shadow);
}
.btn-shop:active { transform: scale(0.97); }

/* ========================================
   レスポンシブ
   ======================================== */

@media (max-width: 380px) {
  .q-box { padding: 14px 12px; border-radius: 20px; }
  .choices { gap: 5px; }
  .c-btn  { border-radius: 12px; }
  .stamp-mark { width: 30px; height: 30px; font-size: 18px; }
  .choices-4 { gap: 8px; padding: 0 10px 4px; }
  .choices-4 .c-btn { border-radius: 16px; }
  .q-materials { padding: 14px 10px; border-radius: 20px; }
  .choices-kagaku { gap: 8px; }
  .choices-kagaku .c-btn-kagaku { min-height: 70px; }
}

@media (min-height: 750px) {
  .q-area { padding: 24px 0; }
}

/* ========================================
   カテゴリタブ（ホーム画面）
   ======================================== */

.category-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.category-tab {
  flex: 1;
  height: 48px;
  padding: 0;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 700;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  background: var(--bg);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-tab.active {
  background: var(--card);
  color: var(--text);
  border-bottom: 3px solid var(--orange);
}

/* ========================================
   ビジュアル教材（不正解時ドット）
   ======================================== */

.visual-hint {
  margin-top: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius);
  text-align: center;
  animation: hint-appear 0.3s ease-out;
}

@keyframes hint-appear {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ドット共通（.visual-hint 内のみ、進捗ドットと競合しない） */
.visual-hint .dot {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin: 2px;
  /* 進捗ドットのスタイルをリセット */
  background: #e0dcd8;
  transition: none;
  transform: none;
}

.visual-hint .dot.filled {
  background: var(--blue);
}

.visual-hint .dot.answer {
  background: var(--orange);
  animation: dot-pop 0.3s ease-out both;
}

.visual-hint .dot.filled-alt {
  background: var(--purple);
}

/* わりざん用グループ色（3色目以降） */
.visual-hint .dot.group-4 { background: var(--green); }
.visual-hint .dot.group-5 { background: var(--pink); }
.visual-hint .dot.group-6 { background: var(--yellow); }
.visual-hint .dot.group-7 { background: #78c4d4; }
.visual-hint .dot.group-8 { background: #e8a87c; }
.visual-hint .dot.group-9 { background: #95afc0; }

@keyframes dot-pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.hint-text {
  margin-top: 8px;
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 700;
  color: var(--text);
}

/* ---- 10のおともだち（hosuu） ---- */

.hint-hosuu .ten-frame {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: fit-content;
  margin: 0 auto;
  padding: 8px;
  border: 2px solid #e8e2dc;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
}

/* ---- たしざん（tashizan） ---- */

.hint-tashizan .hint-groups {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.hint-tashizan .hint-group-a,
.hint-tashizan .hint-group-b {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
}

.hint-tashizan .hint-plus {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-light);
}

.hint-tashizan .hint-merged {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  padding: 8px;
  border: 2px dashed var(--green);
  border-radius: 12px;
  margin-top: 4px;
}

/* ---- ひきざん（hikizan） ---- */

.hint-hikizan .hint-dots-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
}

.hint-hikizan .dot.removed {
  opacity: 0.3;
  position: relative;
}

.hint-hikizan .dot.removed::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -2px;
  right: -2px;
  height: 2px;
  background: var(--pink);
  transform: translateY(-50%);
}

/* ---- 九九のぼうけん（kuku） ---- */

.hint-kuku .hint-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: fit-content;
  margin: 0 auto;
  padding: 8px;
}

.hint-kuku .hint-grid-row {
  display: flex;
  gap: 3px;
  justify-content: center;
}

/* 積 <= 40: 小サイズ */
.hint-kuku.hint-small .dot {
  width: 18px;
  height: 18px;
  margin: 1px;
}

/* 積 <= 81: 最小サイズ */
.hint-kuku.hint-tiny .dot {
  width: 14px;
  height: 14px;
  margin: 1px;
}

/* ---- わりざん（warizan） ---- */

.hint-warizan .hint-wari-groups {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.hint-warizan .hint-wari-group {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  padding: 6px 10px;
}

.hint-warizan .hint-divider {
  font-size: 24px;
  font-weight: 300;
  color: #e8e2dc;
  line-height: 1;
}

/* ========================================
   バッジ共通
   ======================================== */

/* ---- ホーム画面バッジプレビュー ---- */

.badge-section {
  margin-top: 20px;
}

.badge-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 4px;
}

.badge-section-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-light);
}

.badge-section-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
}

.badge-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
  scrollbar-width: none;
}

.badge-preview::-webkit-scrollbar {
  display: none;
}

.badge-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  position: relative;
  transition: transform 0.2s;
}

.badge-icon:active {
  transform: scale(0.93);
}

.badge-icon.earned {
  box-shadow: var(--shadow), 0 0 8px rgba(255, 217, 61, 0.4);
}

.badge-icon.locked {
  filter: grayscale(1);
  opacity: 0.5;
}

.badge-icon.locked::after {
  content: '\1F512';
  position: absolute;
  font-size: 14px;
  bottom: -2px;
  right: -2px;
  filter: none;
}

.btn-badge-all {
  font-family: 'Zen Maru Gothic', sans-serif;
  width: 100%;
  padding: 10px;
  font-size: 14px;
  font-weight: 700;
  background: var(--card);
  color: var(--text-light);
  border: 2px solid #e8e2dc;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.12s;
  text-align: center;
}

.btn-badge-all:active {
  transform: scale(0.97);
}

/* ---- バッジ一覧画面 ---- */

.badge-list-screen {
  padding: 0 16px 32px;
}

.badge-list-title {
  text-align: center;
  padding: 16px 0;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 900;
}

.badge-category {
  margin-bottom: 20px;
}

.badge-category-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 8px;
  padding-left: 4px;
}

.badge-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 8px;
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.12s;
}

.badge-item:active {
  transform: scale(0.97);
}

.badge-item-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff8e0;
}

.badge-item.earned .badge-item-icon {
  box-shadow: 0 0 12px rgba(255, 217, 61, 0.5);
  animation: badge-glow 2s ease-in-out infinite alternate;
}

@keyframes badge-glow {
  from { box-shadow: 0 0 8px rgba(255, 217, 61, 0.3); }
  to { box-shadow: 0 0 16px rgba(255, 217, 61, 0.6); }
}

.badge-item.locked .badge-item-icon {
  filter: grayscale(1);
  opacity: 0.4;
  background: #f0ece8;
}

.badge-item-name {
  font-size: clamp(12px, 3.5vw, 14px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.badge-item.locked .badge-item-name {
  color: var(--text-light);
}

.badge-item-desc {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
  line-height: 1.3;
}

.badge-item-date {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-light);
}

/* ========================================
   バッジ獲得演出
   ======================================== */

.badge-earned-popup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #fff8e0, #ffe0b2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: badge-pop 0.5s ease-out;
}

@keyframes badge-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); }
  80%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

.badge-earned-label {
  font-size: clamp(16px, 4.5vw, 20px);
  font-weight: 900;
  color: #e65100;
}

.badge-earned-icon {
  font-size: 48px;
  animation: badge-icon-bounce 0.6s ease 0.3s both;
}

@keyframes badge-icon-bounce {
  0%   { transform: scale(0) rotate(-20deg); }
  60%  { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.badge-earned-name {
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 700;
  color: var(--text);
}

.badge-earned-coins {
  font-size: 14px;
  font-weight: 700;
  color: var(--orange);
}

/* ========================================
   かがくのじっけん
   ======================================== */

/* ---- かがくゲーム: q-area縦並び ---- */

.game-kagaku .q-area {
  flex-direction: column;
  gap: 8px;
}

/* ---- 問題テキスト ---- */

.q-kagaku-text {
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.5;
}

/* ---- 素材表示エリア ---- */

.q-materials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vw, 16px);
  background: var(--card);
  border-radius: 28px;
  padding: 20px clamp(12px, 4vw, 32px);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.material-a,
.material-b {
  font-size: clamp(36px, 10vw, 48px);
  line-height: 1;
  text-align: center;
  min-width: 1.2em;
}

.material-a {
  animation: slide-from-left 0.3s ease-out;
}

.material-b {
  animation: slide-from-right 0.3s ease-out;
}

.material-plus,
.material-eq {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 900;
  color: var(--text-light);
}

.material-q {
  font-size: clamp(36px, 10vw, 48px);
  font-weight: 900;
  color: var(--pink);
  animation: popIn 0.3s ease;
  min-width: 1.2em;
  text-align: center;
}

@keyframes slide-from-left {
  from { transform: translateX(-60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-from-right {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- 4択ボタン ---- */

.choices-kagaku {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 4px 4px;
  flex-shrink: 0;
}

.choices-kagaku .c-btn-kagaku {
  font-family: 'Zen Maru Gothic', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 80px;
  min-width: 80px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.1s, opacity 0.2s;
  padding: 12px 8px;
}

.choices-kagaku .c-btn-kagaku:active {
  transform: scale(0.93);
}

.c-btn-kagaku .kagaku-emoji {
  font-size: 32px;
  line-height: 1;
}

.c-btn-kagaku .kagaku-label {
  font-size: clamp(12px, 3.5vw, 14px);
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.c-btn-kagaku.c-correct {
  animation: correctPop 0.4s ease;
  box-shadow: 0 0 0 4px var(--green), 0 4px 12px rgba(0,0,0,0.1);
}

.c-btn-kagaku.c-wrong {
  animation: wrongShake 0.4s ease;
  opacity: 0.35;
}

/* ---- 結果ポップイン ---- */

.result-pop {
  animation: result-pop 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes result-pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ---- 解説テキスト ---- */

.hint-box {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 12px;
  animation: hint-appear 0.3s ease-out;
}

.hint-box-inner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.hint-box-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.4;
}

.hint-box-text {
  font-size: clamp(13px, 3.8vw, 16px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
}

/* ========================================
   PC向けドットサイズ調整
   ======================================== */

@media (min-width: 500px) {
  .visual-hint .dot {
    width: 28px;
    height: 28px;
  }

  .hint-kuku.hint-small .dot {
    width: 22px;
    height: 22px;
  }

  .hint-kuku.hint-tiny .dot {
    width: 16px;
    height: 16px;
  }
}
