/*
 * materials-common.css
 * さんすうひろば 教材共通スタイル
 *
 * ━━ 使い方 ━━
 * 各教材HTMLの <head> 内に以下を記述し、
 * その後の <style> でテーマカラーをオーバーライドする。
 *
 *   <link rel="stylesheet" href="/css/materials-common.css">
 *   （れんしゅうの ある 教材など、新しい 部品を 使う 教材は ?v=<共通の 版>。版は 共通JS の COMMON_VERSION。
 *    この ファイルを かえたら 共通JS の COMMON_VERSION を 1 上げる）
 *   <style>
 *     :root {
 *       --theme-primary: #1a8cd8;
 *       --theme-bg: linear-gradient(...);
 *       ...
 *     }
 *     （この教材固有のスタイルをここに書く）
 *   </style>
 */

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CSS変数（テーマカラーのデフォルト値）
   各教材の <style> 内で :root を使ってオーバーライドする
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
:root {
  --theme-primary: #ff6b9d;           /* メインカラー（タイトル・レッスン見出し等） */
  --theme-bg: linear-gradient(135deg, #ffe0ec 0%, #fff5cc 50%, #d4f5ee 100%); /* 背景 */
  --theme-card-shadow: rgba(255,107,157,0.2); /* タイトルカードの影 */
  --theme-speech-bg: #fff5cc;         /* 吹き出しの背景色 */
  --theme-speech-border: #ffd93d;     /* 吹き出しの枠色 */
  --theme-score-grad: linear-gradient(90deg, #ffd93d, #ff9eb5); /* スコアバーのグラデーション */
  --theme-ctrl-bg: #4ecdc4;           /* コントロールボタンのデフォルト色 */
  --theme-ctrl-shadow: #2c9a92;       /* コントロールボタンの影 */
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   カテゴリバッジ（教材のホーム画面の タイトル上に表示）
   4カテゴリ：計算 / 図形 / データの活用 / 変化と関係
   配色は lib/materials.ts の categories と一致させる
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.category-badge {
  display: inline-block;
  font-size: clamp(13px, 1.8vw, 16px);
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
  line-height: 1.4;
  border: 2px solid currentColor;
  background: #fff;
}
.category-badge.cat-keisan { color: #e65100; background: #fff3e0; }
.category-badge.cat-zukei  { color: #1565c0; background: #e3f2fd; }
.category-badge.cat-data   { color: #2e7d32; background: #e8f5e9; }
.category-badge.cat-henka  { color: #6a1b9a; background: #f3e5f5; }
.category-badge.cat-program { color: #00695c; background: #e0f7fa; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   リセット・基本
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ふりがな（<ruby>）の見え方
   ボタンや見出し内で 行送りが大きく崩れないように調整
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
ruby {
  ruby-align: center;
}
ruby rt {
  font-size: 0.5em;       /* ふりがなを 親の半分の大きさに */
  font-weight: 500;       /* 親が900でもふりがなは標準寄り */
  letter-spacing: 0;
  line-height: 1;         /* ふりがな自身は行送りを増やさない */
  user-select: none;
}

html, body {
  height: 100%;
  overflow: hidden;
  /* UD フォント（CLAUDE.md ルール準拠）。iPad・Mac は UD の 字体が ない ので ヒラギノ角ゴ（太さが ちゃんと ある。
     丸ゴは 太さが 1つ だけ で、太字が にじむ。ユーザー 2026-11-09「文字が ださい」） */
  font-family: "BIZ UDPGothic", "BIZ UDGothic", "UDデジタル教科書体 NK-R", "Hiragino Sans", "ヒラギノ角ゴシック", "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN W4", "Meiryo", sans-serif;
  /* 地は 平らな クリーム 1色（サイトの --sh-bg と 同じ。グラデーションは 使わない。2026-11-17 C ポップ）。
     --theme-bg は もう 使わない（教材に のこって いても かまわない） */
  background: #fffbef;
  color: #3d3d5c;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   アプリコンテナ・画面管理
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
#app {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}

.screen { display: none; max-width: 900px; margin: 0 auto; }
.screen.active { display: block; animation: fadeIn 0.4s ease; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   アニメーション
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@keyframes fadeIn  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop     { 0% { transform: scale(0.8); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake   { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes bounce  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   タイトル画面
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.title-card {
  background: white;
  border-radius: 30px;
  padding: 40px 30px;
  box-shadow: 0 10px 40px var(--theme-card-shadow);
  text-align: center;
}

/* UD準拠：タイトル文字 */
.main-title {
  font-size: clamp(30px, 5.5vw, 48px);
  font-weight: 900;
  color: var(--theme-primary);
  margin-bottom: 10px;
  text-shadow: 3px 3px 0 #ffd93d;
  letter-spacing: 2px;
}

.sub-title {
  font-size: clamp(18px, 2.8vw, 24px);
  color: #6c7293;
  margin-bottom: 30px;
  font-weight: 700;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.menu-btn {
  border: none;
  border-radius: 24px;
  padding: 28px 16px;
  font-size: clamp(18px, 2.8vw, 24px);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  color: white;
  font-family: inherit;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
}
.menu-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.15); }
.menu-btn .emoji { display: block; font-size: 1.8em; margin-bottom: 8px; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   レッスンカード共通
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.lesson-card {
  background: white;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.lesson-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

/* UD準拠：レッスン見出し */
.lesson-title {
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 900;
  color: var(--theme-primary);
}

/* もどるボタン（全教材共通・完全一致） */
.back-btn {
  /* C ポップ（2026-11-17）：外わくの「← もどる」と 同じ 白い タイル（こい 紺の ふち ＋ 下の かげ）。
     ふちの 3px ぶん padding を へらして、前の 黄色の ボタンと 同じ 大きさ（横画面の 高さを かえない） */
  background: #fff;
  border: 3px solid #1b1b3a;
  border-radius: 50px;
  padding: 9px 21px;
  font-size: 19px;
  font-weight: 900;
  cursor: pointer;
  color: #1b1b3a;
  font-family: inherit;
  box-shadow: 0 4px 0 #1b1b3a;
  white-space: nowrap;
  min-height: 44px;   /* おしやすい 高さ（UD係 2026-11-17） */
  display: inline-flex; align-items: center; justify-content: center;
}
.back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1b1b3a; }
/* 🔈 れんしゅうの「おと」ボタン（共通JS の SH.renshu が ← もどる の 帯に 出す）。
   音 なし ＝ 白地に グレー、音 あり ＝ 水色。絵（スピーカーの 波／×）と 字「おと あり／なし」で、色 だけに しない（UD係） */
.sh-snd {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 3px solid #b9add6; border-radius: 50px;
  padding: 4px 16px 4px 12px; min-height: 44px;
  font-size: 18px; font-weight: 800; font-family: inherit; color: #6b6b85;
  cursor: pointer; white-space: nowrap; box-shadow: 0 3px 0 #b9add6;
}
.sh-snd.on { background: #d9f4f2; border-color: #2a9d93; color: #1d6e67; box-shadow: 0 3px 0 #2a9d93; }
.sh-snd:active { transform: translateY(2px); box-shadow: none; }
.sh-snd[hidden] { display: none; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   吹き出し（UD準拠）
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.speech {
  background: var(--theme-speech-bg);
  border-radius: 20px;
  padding: 24px 28px;       /* UD: 24px以上 */
  margin-bottom: 16px;
  font-size: clamp(22px, 3.2vw, 28px);  /* UD: 22px以上 */
  line-height: 2.0;          /* UD: 2.0以上 */
  position: relative;
  border: 4px solid var(--theme-speech-border);  /* UD: 4px以上 */
  letter-spacing: 0.05em;    /* UD: 0.05em */
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   読み上げボタン（SH.initSpeech が .speech の下に付ける）
   ※angles.html は 同名クラスを 教材内で 定義しており そちらが優先
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.speak-wrap { display: flex; justify-content: flex-end; margin: -8px 0 10px; }
.speak-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px; border: none; border-radius: 999px;
  background: var(--theme-ctrl-bg); color: #fff; font-weight: 900;
  font-size: clamp(15px, 2vw, 18px); font-family: inherit;
  cursor: pointer; box-shadow: 0 3px 0 var(--theme-ctrl-shadow);
}
.speak-btn:active { transform: translateY(2px); box-shadow: none; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ステージ（図・アニメーション表示エリア）
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.stage {
  background: #f4f8ff;
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  margin: 14px 0;
  border: 2px dashed #a8ccee;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   コントロール・ボタン
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 14px 0;
}

.ctrl-btn {
  background: var(--theme-ctrl-bg);
  border: none;
  border-radius: 50px;
  padding: 14px 26px;
  font-size: clamp(17px, 2.4vw, 21px);
  font-weight: 800;
  color: white;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 0 var(--theme-ctrl-shadow);
}
.ctrl-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--theme-ctrl-shadow); }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   クイズ選択肢（UD準拠）
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

/* UD準拠：選択肢ボタン */
.quiz-option {
  background: white;
  border: 5px solid #a8ccee;    /* UD: 4px以上 */
  border-radius: 18px;
  padding: 15px 22px;            /* 横の余白は キープ、縦を つめて 4択を 低くする */
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-align: center;
  font-size: clamp(20px, 3vw, 26px);  /* UD: 20px以上 */
  font-weight: 700;
  color: #3d3d5c;
  line-height: 1.6;             /* UD: 1.6以上 */
}
/* 選択肢が「図（角の絵など）」のとき、縦に 大きく なりすぎないよう 高さを おさえる */
.quiz-option svg { max-height: 108px; width: auto; display: block; margin: 0 auto; }
.quiz-option:active  { transform: scale(0.97); }
.quiz-option.correct { border-color: #4ecdc4; background: #d4f5ee; animation: pop 0.4s; }
.quiz-option.wrong   { border-color: #ff6b9d; background: #ffe0ec; animation: shake 0.4s; }
.quiz-option.disabled { pointer-events: none; opacity: 0.6; }

.quiz-option .label {
  display: inline-block;
  background: #ffd93d;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-weight: 900;
  color: #3d3d5c;
  margin-bottom: 10px;
  font-size: 22px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   フィードバック（UD準拠）
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.feedback {
  text-align: center;
  font-size: clamp(26px, 4.2vw, 36px);  /* UD: 26px以上 */
  font-weight: 900;
  margin: 14px 0;
  min-height: 50px;                       /* UD: 50px以上 */
}
.feedback.ok { color: #4ecdc4; animation: bounce 0.6s; }
.feedback.ng { color: #ff6b9d; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   スコアバー・進捗
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--theme-score-grad);
  color: white;
  border-radius: 50px;
  padding: 12px 24px;
  margin-bottom: 16px;
  font-weight: 800;
  font-size: clamp(17px, 2.4vw, 21px);
  box-shadow: 0 4px 0 rgba(0,0,0,0.12);
}

.progress {
  background: rgba(255,255,255,0.4);
  border-radius: 50px;
  height: 14px;
  flex: 1;
  margin: 0 14px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: white;
  border-radius: 50px;
  transition: width 0.4s;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   結果画面
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.result-card {
  background: white;
  border-radius: 30px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.result-card .big {
  font-size: clamp(50px, 10vw, 84px);
  font-weight: 900;
  color: var(--theme-primary);
  text-shadow: 3px 3px 0 #ffd93d;
  margin: 14px 0;
}
.stars { font-size: clamp(40px, 7vw, 60px); margin: 10px 0; letter-spacing: 6px; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ヒント・補足（UD準拠）
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.hint {
  font-size: clamp(18px, 2.6vw, 22px);  /* UD: 18px以上 */
  color: #4a4a6a;                         /* UD: 薄すぎない色 */
  margin-top: 8px;
  font-weight: 600;
  line-height: 1.9;                       /* UD: 1.9以上 */
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   iPad横画面（ランドスケープ）共通対応
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (orientation: landscape) {
  #app {
    padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  }
  .screen { max-width: 1100px; }

  /* タイトル画面 */
  .title-card  { padding: 22px 30px; }
  .main-title  { font-size: clamp(26px, 4.2vw, 42px); margin-bottom: 6px; }
  .sub-title   { font-size: clamp(15px, 2vw, 20px); margin-bottom: 14px; }
  .menu-grid   { grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
  .menu-btn    { padding: 18px 10px; font-size: clamp(15px, 2vw, 20px); }
  .menu-btn .emoji { font-size: 1.4em; margin-bottom: 4px; }

  /* レッスンカード */
  .lesson-card   { padding: 16px 22px; margin-bottom: 12px; border-radius: 22px; }
  .lesson-header { margin-bottom: 12px; }
  .lesson-title  { font-size: clamp(19px, 2.8vw, 28px); }
  .back-btn      { padding: 8px 18px; font-size: 19px; }   /* 横画面でも 字 19px・高さ 44px 以上（まちがえて おしにくく、おしたい ときは おしやすく。UD係 2026-11-17） */

  /* 字の 大きさ・行間は 横画面でも CLAUDE.md の UD の 下限を 下回らない（2026-11-05）
     （前は 横画面で 小さく して いた。教材は わくの 中で 出る ので、ふつうの iPad でも 15〜17px に なって いた） */

  /* 吹き出し */
  .speech {
    padding: 14px 20px;
    margin-bottom: 10px;
    font-size: clamp(22px, 2.4vw, 24px);  /* UD: 22px以上 */
    line-height: 2.0;                      /* UD: 2.0以上 */
    border-radius: 16px;
    letter-spacing: 0.05em;
  }

  /* ステージ */
  .stage { padding: 10px; margin: 8px 0; border-radius: 16px; }

  /* コントロール */
  .controls { margin: 8px 0; gap: 8px; }
  .ctrl-btn  { padding: 10px 20px; font-size: clamp(14px, 1.9vw, 18px); }

  /* クイズ */
  .quiz-options { gap: 10px; margin-top: 10px; }
  .quiz-option  { padding: 14px; border-width: 4px; font-size: clamp(20px, 2.2vw, 22px); line-height: 1.6; }  /* UD: 20px以上 */
  .quiz-option .label { width: 36px; height: 36px; line-height: 36px; font-size: 18px; margin-bottom: 5px; }

  /* フィードバック */
  .feedback { font-size: clamp(26px, 3vw, 30px); margin: 6px 0; min-height: 50px; }  /* UD: 26px以上 */

  /* スコアバー */
  .score-bar { padding: 9px 18px; margin-bottom: 10px; font-size: clamp(14px, 2vw, 18px); }
  .progress  { height: 11px; }

  /* ヒント */
  .hint { font-size: clamp(18px, 2vw, 20px); line-height: 1.9; }  /* UD: 18px以上 */

  /* 結果 */
  .result-card      { padding: 22px; }
  .result-card .big { font-size: clamp(40px, 7vw, 64px); margin: 8px 0; }
  .stars            { font-size: clamp(30px, 5.5vw, 48px); margin: 6px 0; }
}

/* 横画面で 高さが とくに せまい 場合
   教材は 外側ページの わくの 中で 出るので、ふつうの iPad の 横でも ここに 入る（わくの 高さ 約650px）。
   すきまだけ つめる。字の 大きさ・行間は 小さく しない（UD の 下限。2026-11-05） */
@media (orientation: landscape) and (max-height: 720px) {
  .speech   { padding: 10px 16px; }
  .menu-btn { padding: 12px 8px; }
  .ctrl-btn { padding: 7px 12px; }
}

/* ============================================================
   🔁 どんどん れんしゅう（共通。2026-11-12 3年 分数の ワールドから 共通に。動きは 共通JS の SH.renshu）
   教材ごとに 書くのは、左の 答えを 書く 場所と、パネルの 置き場所・大きさ だけ
   ============================================================ */
/* 数字の 字体（まるくて 太い 字。iPad は ui-rounded、ほかは Arial Rounded。日本語の 字は その あとの UD の 字体へ） */
:root { --num-font: ui-rounded, "Arial Rounded MT Bold", "BIZ UDPGothic", "BIZ UDGothic", "UDデジタル教科書体 NK-R", "Hiragino Sans", "ヒラギノ角ゴシック", "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN W4", "Meiryo", sans-serif; }

/* ホームの 入口（メニューの 下。menu-btn に しない ＝ check-strand の メニューの 数に 入れない） */
.renshu-entry {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 560px;
  margin: 16px auto 0; padding: 14px 18px; border: none; border-radius: 14px;
  background: #f1ebff; color: #5b3cc4; font-weight: 900; font-family: inherit;
  font-size: clamp(18px, 2.6vw, 22px); box-shadow: 0 4px 0 #d3c6f5; cursor: pointer; text-align: left;
}
.renshu-entry:active { transform: translateY(2px); box-shadow: 0 2px 0 #d3c6f5; }
.renshu-entry .emoji { font-size: 1.6em; flex-shrink: 0; }
/* 左の 絵：れんしゅうひろばの カケル（うつる 先を 前もって 見せる。UD係 2026-11-11） */
.renshu-entry .renshu-kakeru { flex-shrink: 0; display: inline-flex; background: #5baa3a; border-radius: 10px; padding: 3px; }
/* 下の 小さい 字：うつる 先を 知らせる ただ 1つの 文 なので 18px 以上（UD係 2026-11-11） */
.renshu-entry .sub { font-size: clamp(18px, 2.4vw, 20px); line-height: 1.6; font-weight: 700; color: #6a4fd0; }
/* 地図から 来た とき（#pk-）は、れんしゅうが はじまる まで ホームを 見せない（教材の <head> で pr-boot を つける） */
.pr-boot #screen-home { visibility: hidden; }

/* 上の 帯：もらった ⭐（メダル）の 数 */
.pr-meter { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: center; line-height: 1.3; }
.pr-txt { margin-left: 8px; font-weight: 900; font-size: clamp(18px, 2.2vw, 20px); color: #4a4a6a; white-space: nowrap; }
.pr-txt .sh-medal { vertical-align: -5px; margin-right: 4px; }

/* 右の パネル（モンスター・せいかい／おしい・テンキー・ボタン） */
.pr-panel { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px 16px 16px; background: #efe6fb; border-radius: 22px; }

/* 数字の ボタン（テンキー）。1 2 3／4 5 6／7 8 9／0 と ← けす（iPad の 数字の ならびと 同じ）。
   キーは しろ＋こい わく＋下の かげで「おせる ボタン」に（ユーザー 2026-11-09）。おすと 下に しずむ */
.dp-pad { display: grid; grid-template-columns: repeat(3, 66px); gap: 8px; justify-content: center; align-content: center; }
.dkey { min-width: 0; min-height: 60px; padding: 0 6px; border: 3px solid #7d84a8; border-radius: 16px; font-family: var(--num-font);
  font-size: clamp(26px, 3vw, 30px); font-weight: 900; background: linear-gradient(#ffffff 55%, #eceef6); color: #2f2f4a;
  box-shadow: 0 5px 0 #7d84a8; cursor: pointer; }
.dkey:active { transform: translateY(3px); box-shadow: 0 2px 0 #7d84a8; }
.dkey.del { grid-column: span 2; font-size: clamp(20px, 2.4vw, 22px); background: linear-gradient(#ffffff 55%, #fdecea); color: #b03229;
  border-color: #d9675c; box-shadow: 0 5px 0 #d9675c; }
.dkey.del:active { box-shadow: 0 2px 0 #d9675c; }
.dp-pad.off .dkey { opacity: 0.35; pointer-events: none; }

/* モンスター たいじ（ユーザー 2026-11-09）。上：体力の バー（5もん／10もん）／下：左に カケル、右に モンスター（ドット絵）。
   1もん とくと 光って バーが 1つ へる。まちがえても へらない。高さは きめて おく（テンキーが うごかない）。
   「視差効果を 減らす」では 動かさない */
.pr-mon { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: 18px 60px; row-gap: 6px; align-items: end;
  width: 0; min-width: 100%; height: 84px; position: relative; padding: 0 6px; }
.mon-hero { grid-column: 1; grid-row: 2; line-height: 0; display: inline-block; padding: 2px; }
/* なかまの まわりに こい 1ドットの ふち（前は みどりの わく。ユーザー 2026-11-13「緑の 枠は 必要？」→ わくを やめた。
   ふちが ないと レベル10 の しろい からだが うすい パネルに とけて 見えない） */
.mon-hero svg { filter: drop-shadow(1px 0 0 #3d3d5c) drop-shadow(-1px 0 0 #3d3d5c) drop-shadow(0 1px 0 #3d3d5c) drop-shadow(0 -1px 0 #3d3d5c); }
.mon-hero.atk { animation: heroAtk 0.45s; }
.mon-face { grid-column: 3; grid-row: 2; line-height: 0; display: inline-block; justify-self: end; }
.mon-face.new  { animation: monNew 0.5s ease-out; }
.mon-face.step { animation: monShake 0.35s; }
.mon-face.hit  { animation: monHit 0.55s; }
.mon-face.down { animation: monDown 1.1s ease-in forwards; }
.mon-hp { grid-column: 1 / -1; grid-row: 1; align-self: stretch; display: flex; gap: 3px; height: 18px; }
.mon-hp i { flex: 1 1 0; border-radius: 5px; background: #e6e0f2; border: 2px solid #b9add6; }
.mon-hp i.on { background: #8b6cf6; border-color: #5b3fc4; }   /* 赤は「まちがい」の 色 なので つかわない（UD係） */
.mon-hp i:nth-child(6) { margin-left: 9px; }   /* 10この ときは 5こ ずつ（数えやすく） */
.mon-hp i.lost { animation: hpLost 0.6s; }
.mon-boom { position: absolute; right: 46px; top: 28px; line-height: 0; pointer-events: none; opacity: 0; animation: boom 0.65s; }
@keyframes heroAtk { 0%, 100% { transform: translateX(0); } 40% { transform: translateX(16px); } }
/* びくっ：うしろ（右）へ 少し さがって もどる。左右に ゆれると 首を よこに ふる ＝「ちがう」に 見える（UD係 2026-11-11） */
@keyframes monShake { 0%, 100% { transform: translate(0, 0); } 40% { transform: translate(6px, -3px); } }
@keyframes monHit { 0% { transform: scale(1); } 30% { transform: scale(0.78) rotate(-14deg); } 100% { transform: scale(1); } }
@keyframes monDown { 0% { transform: scale(1) rotate(0); opacity: 1; } 100% { transform: scale(0.1) rotate(360deg); opacity: 0; } }
@keyframes monNew { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes boom { 0% { transform: scale(0.3); opacity: 1; } 60% { transform: scale(1.3); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes hpLost { 0% { background: #8b6cf6; transform: scaleY(1.5); } 100% { background: #e6e0f2; transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .mon-face, .mon-hp i, .mon-hero { animation: none !important; } .mon-boom { display: none; } .mon-face.down { opacity: 0; } }

/* ⭐ の おいわい：左の れつに ドット絵の メダルが ぽんと 出て、紙ふぶきが 1.6秒。テンキーと「まだ やる／おわる」（右の パネル）は かくさない。
   左の れつ（#pr-cele の 親）に position: relative を つける */
#pr-cele { display: none; position: absolute; inset: 0; z-index: 5; align-items: center; justify-content: center; pointer-events: none; overflow: hidden; }
#pr-cele.show { display: flex; }
.cele-card { background: #fff; border: 5px solid #ffd93d; border-radius: 28px; padding: 14px 34px 18px; text-align: center;
  box-shadow: 0 10px 30px rgba(61,61,92,0.2); animation: celePop 0.55s ease-out; }
.cele-st { line-height: 0; padding: 6px 0 4px; }
.cele-txt { font-size: clamp(26px, 3vw, 32px); font-weight: 900; color: #c47f00; line-height: 1.4; }
/* メダルで カケルの レベルが 上がった とき（見た目が かわる） */
.cele-lv { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 3px dashed #ffd93d;
  font-size: clamp(26px, 3vw, 32px); font-weight: 900; color: #3d3d5c; line-height: 1.4; text-align: left; }
.cele-lv .sh-kakeru { flex: 0 0 auto; background: #5baa3a; border-radius: 10px; padding: 3px; box-sizing: content-box; }
.cele-bit { position: absolute; top: -24px; width: 12px; height: 18px; border-radius: 3px; opacity: 0; animation: celeFall 1.6s ease-in forwards; }
@keyframes celePop { 0% { transform: scale(0.2) rotate(-14deg); opacity: 0; } 60% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes celeFall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(640px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cele-card { animation: none; } .cele-bit { display: none; } }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   C ポップ：教材の 入口（ホーム画面）。2026-11-17
   TOP・学年ページ（components/top.module.css・grade.module.css）と 同じ 形に そろえる。
   - おせる もの だけ タイル：こい ふち 3px（#1b1b3a）＋ 角の まる ＋ 下の かげ。
     教材の 中は 横画面の まどが 約650px なので、かげは 4px（おすと 3px へこむ）と 小さく（UD係 2026-11-15）
   - 地は 白 ＋ うすい 色。学年の 色は 入れない。絵文字・グラデーションは 使わない
   - 字は いつも こい 紺 #1b1b3a。番号は まるい 数字の 字体で 黄色の まる（<span class="num">1</span>）
   - 教材ごとの CSS（.btn-orange・.tool-entry など）より 強く する ため #screen-home を つける。
     ✓（できた）と じゅんびちゅうは 教材の 中の ルールより 強く する ため body を つける
   もんだいの 画面（ふきだし・図・4択・テンキー）は さわらない（ユーザー 2026-11-17 案A）
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
#screen-home .title-card { background: #fff; box-shadow: none; border: 2px solid #ece4cc; }
/* 題：こい 紺 ＋ 黄色の マーカー（TOP の ロゴと 同じ。影の 字は やめる） */
#screen-home .main-title {
  display: table; margin-left: auto; margin-right: auto; margin-bottom: 14px; padding: 0 8px;
  color: #1b1b3a; text-shadow: none; box-shadow: inset 0 -0.34em 0 #ffd84d;
}
#screen-home .sub-title { color: #4a4a6a; }

/* おせる タイル：メニュー・考える どうぐ・どんどん れんしゅう・まとめテスト */
#screen-home .menu-btn,
#screen-home .tool-entry,
#screen-home .renshu-entry,
#screen-home .goal-test-btn {
  position: relative;
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  background: #fff; color: #1b1b3a; text-shadow: none; text-align: left;
  border: 3px solid #1b1b3a; border-radius: 22px; box-shadow: 0 4px 0 #1b1b3a;
  padding-right: 52px; font-family: inherit; cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s;
}
#screen-home .menu-btn:active,
#screen-home .tool-entry:active,
#screen-home .renshu-entry:active,
#screen-home .goal-test-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1b1b3a; }
/* 右に →（つぎへ すすむ しるし。学年ページの カードと 同じ） */
#screen-home .menu-btn::after,
#screen-home .tool-entry::after,
#screen-home .renshu-entry::after,
#screen-home .goal-test-btn::after {
  content: '→'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 1.1em; font-weight: 900; color: #1b1b3a;
}
/* 考える どうぐ（うすい 黄）・どんどん れんしゅう（うすい むらさき）は 色で 分ける。字は こい 紺 */
#screen-home .tool-entry {
  width: 100%; max-width: 560px; margin: 12px auto 14px; padding: 12px 52px 12px 20px;
  background: #fff6cc; font-weight: 900; font-size: clamp(18px, 2.4vw, 22px); line-height: 1.5;
}
#screen-home .tool-entry .sub { display: inline-block; font-size: clamp(18px, 2.2vw, 19px); font-weight: 700; color: #4a4a6a; line-height: 1.6; }
#screen-home .renshu-entry { background: #ece6ff; }
#screen-home .renshu-entry .sub { color: #4a4a6a; }
#screen-home .goal-test-btn { justify-content: center; padding: 13px 52px; background: #fff6cc; font-weight: 900; }
#screen-home .menu-btn .emoji,
#screen-home .tool-entry .emoji { display: none; }   /* のこって いる 絵文字は 出さない（カケルの 絵は 出す） */
#screen-home .renshu-entry .emoji { display: inline; }

/* 番号の まる */
#screen-home .menu-btn .num {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75em; height: 1.75em; border-radius: 50%;
  border: 3px solid #1b1b3a; background: #ffd84d; color: #1b1b3a;
  font-family: var(--num-font); font-weight: 900; line-height: 1;
}

/* できた メニュー：→ の かわりに こい みどりの まるに 太い ✓（→ と 見分けやすく。UD係 2026-11-17。教材の .goal-ok::after より 強く） */
body #screen-home .menu-btn.goal-ok::after {
  content: '✓'; right: 10px; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #8fdca8; border: 3px solid #1b1b3a; color: #1b1b3a; font-size: 22px; font-weight: 900;
}
/* じゅんびちゅう（おせない）：はい色の 点線・かげ なし・→ なし */
body #screen-home .menu-btn.menu-locked {
  background: #f0f0f4; border: 3px dashed #9a9ab0; box-shadow: none; color: #4a4a6a;
  filter: none; opacity: 1; pointer-events: none;
}
body #screen-home .menu-btn.menu-locked::after { content: none; }
body #screen-home .menu-btn.menu-locked .num { background: #fff; border-color: #9a9ab0; color: #4a4a6a; }
/* じゅんばんの 小さな だん（2年 三角形と 四角形の ①〜⑦）：まるの 字 だけ（まるを 重ねない） */
#screen-home .menu-btn .num.num-maru { width: auto; height: auto; border: none; background: none; font-size: 1.45em; }
/* プリントの ボタン（角の 大きさ）：メニューの 右どなりの 小さな 白い タイル ＋ プリンターの 絵。→ は つけない */
#screen-home .menu-btn.print-btn { flex: 0 0 auto; justify-content: center; padding: 0 12px; background: #fff; }
#screen-home .menu-btn.print-btn::after { content: none; }
#screen-home .menu-btn .sub { display: inline-block; font-size: clamp(18px, 2.2vw, 19px); font-weight: 700; color: #4a4a6a; line-height: 1.6; }
/* → の 場所を あける（教材の 横画面の padding の 書きかえより 強く） */
body #screen-home .menu-btn,
body #screen-home .tool-entry,
body #screen-home .renshu-entry,
body #screen-home .goal-test-btn { padding-right: 52px; }
body #screen-home .menu-btn.print-btn { padding: 0 12px; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   C ポップ：メニューの 中（やりかた／じっくり／ふつう を えらぶ 画面）。2026-11-17
   ホームと 同じ 白い タイルの 形。色は モードの 色を うすく 平らに：
   やりかた＝うすい 黄（.mode-ls）・じっくり＝うすい みどり（.mode-sl）・ふつう＝うすい むらさき（.mode-qz）・ほか＝白（.mode-etc）。
   絵文字は 使わない（見出しの 先頭の 絵文字も とった）。字は こい 紺。
   考える どうぐの 画面（#screen-tool・#screen-toolbox）は 2026-11-15〜16 に C ポップに した ので ここでは さわらない
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
#app .sub-menu .menu-btn,
#app .unit-menu .menu-btn {
  position: relative;
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  background: #fff; color: #1b1b3a; text-shadow: none; text-align: left;
  border: 3px solid #1b1b3a; border-radius: 22px; box-shadow: 0 4px 0 #1b1b3a;
  padding-left: 22px; padding-right: 52px;
  transition: transform 0.06s, box-shadow 0.06s;
}
#app .sub-menu .menu-btn:active,
#app .unit-menu .menu-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1b1b3a; }
#app .sub-menu .menu-btn::after,
#app .unit-menu .menu-btn::after {
  content: '→'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 1.1em; font-weight: 900; color: #1b1b3a;
}
#app .sub-menu .menu-btn.mode-ls, #app .unit-menu .menu-btn.mode-ls { background: #fff6cc; }
#app .sub-menu .menu-btn.mode-sl, #app .unit-menu .menu-btn.mode-sl { background: #d6f5df; }
#app .sub-menu .menu-btn.mode-qz, #app .unit-menu .menu-btn.mode-qz { background: #e6dcff; }
#app .sub-menu .menu-btn .emoji,
#app .unit-menu .menu-btn .emoji { display: none; }
/* メニューの 中の カードと 見出し：説明の カードなので かげ なし・うすい ふち、見出しは こい 紺 */
.lesson-card:has(> .sub-menu), .lesson-card:has(> .unit-menu) { box-shadow: none; border: 2px solid #ece4cc; }
.lesson-card:has(> .sub-menu) .lesson-title,
.lesson-card:has(> .unit-menu) .lesson-title { color: #1b1b3a; }
/* 3つ組（やりかた・じっくり・ふつう）の あとの ほかの ボタン（どうぐ など）は 少し はなす（3つ組から はみ出す ことが わかる。UD係 2026-11-17） */
#app .sub-menu .menu-btn.mode-qz + .menu-btn.mode-etc,
#app .unit-menu .menu-btn.mode-qz + .menu-btn.mode-etc { margin-top: 12px; }
