/* ============================================================
   中学社会テキスト 共通スタイル
   - 画面用 + 印刷用 (@media print)
   - 3分野: 地理(緑) / 歴史(茶) / 公民(紫)
   - 設計思想: 理科版 (rika/assets/style.css) を踏襲
   ============================================================ */

:root {
  --c-bg: #fbfaf6;
  --c-paper: #ffffff;
  --c-ink: #222;
  --c-sub: #555;
  --c-line: #d8d3c4;

  /* 共通アクセント（後で分野色で上書き） */
  --c-accent: #876200;
  --c-accent-light: #fdf3e2;
  --c-accent-dark: #5a4100;

  /* 3分野カラー */
  --c-geo:  #2a7a3a;   --c-geo-light:  #e7f5ea;   --c-geo-dark:  #176a44;
  --c-hist: #876200;   --c-hist-light: #fdf3e2;   --c-hist-dark: #5a4100;
  --c-civ:  #6b2d8a;   --c-civ-light:  #f3e8ff;   --c-civ-dark:  #4a1d63;

  /* 時代カラー（歴史用、年表ファイル準拠の13区分） */
  --era-jomon:    #8b6f47;
  --era-kofun:    #a0522d;
  --era-asuka:    #b8860b;
  --era-nara:     #cd853f;
  --era-heian:    #c71585;
  --era-kamakura: #2e8b57;
  --era-muromachi:#4682b4;
  --era-azuchi:   #800080;
  --era-edo:      #483d8b;
  --era-meiji:    #b22222;
  --era-taisho:   #ff8c00;
  --era-showa:    #696969;
  --era-heisei:   #008080;
  --era-reiwa:    #4169e1;

  --c-warn: #b94a48;
  --c-ok:   #2a7a3a;
  --c-note: #e0bb1f;

  --font-jp: "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-en: "Georgia", "Times New Roman", serif;
}

/* 分野ページごとのアクセント上書き */
body.subject-geo  { --c-accent: var(--c-geo);  --c-accent-light: var(--c-geo-light);  --c-accent-dark: var(--c-geo-dark); }
body.subject-hist { --c-accent: var(--c-hist); --c-accent-light: var(--c-hist-light); --c-accent-dark: var(--c-hist-dark); }
body.subject-civ  { --c-accent: var(--c-civ);  --c-accent-light: var(--c-civ-light);  --c-accent-dark: var(--c-civ-dark); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-jp);
  line-height: 1.8;
  font-size: 16px;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 28px 100px;
  background: var(--c-paper);
  min-height: 100vh;
  box-shadow: 0 0 24px rgba(0,0,0,.05);
}

/* ---------- ナビ ---------- */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--c-line);
  padding-bottom: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 8px;
}
.top-nav .home-link {
  color: var(--c-accent);
  text-decoration: none;
  font-weight: bold;
}
.top-nav .home-link:hover { text-decoration: underline; }
.subject-badge {
  background: var(--c-accent);
  color: white;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
}

h1.book-title { font-size: 28px; margin: 0 0 8px; letter-spacing: 1px; }
.book-sub { color: var(--c-sub); margin-top: 0; }

/* ---------- 目次 ---------- */
.toc {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin: 24px 0 40px;
}
.toc li a {
  display: block;
  padding: 14px 18px;
  background: var(--c-accent-light);
  border-left: 4px solid var(--c-accent);
  color: var(--c-ink);
  text-decoration: none;
  border-radius: 4px;
  transition: background .15s;
}
.toc li a:hover { filter: brightness(0.96); }
.toc .unit-no {
  display: inline-block;
  font-weight: bold;
  color: var(--c-accent);
  margin-right: 8px;
  font-family: var(--font-en);
  min-width: 60px;
}

/* 3分野カード */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.subject-card {
  display: block;
  padding: 24px 20px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--c-ink);
  border-left: 6px solid;
  transition: transform .15s;
}
.subject-card:hover { transform: translateY(-2px); }
.subject-card .name { font-size: 22px; font-weight: bold; margin-bottom: 6px; }
.subject-card .sub  { font-size: 13px; color: var(--c-sub); }
.subject-card.geo   { background: var(--c-geo-light);  border-color: var(--c-geo); }
.subject-card.geo .name   { color: var(--c-geo); }
.subject-card.hist  { background: var(--c-hist-light); border-color: var(--c-hist); }
.subject-card.hist .name  { color: var(--c-hist); }
.subject-card.civ   { background: var(--c-civ-light);  border-color: var(--c-civ); }
.subject-card.civ .name   { color: var(--c-civ); }

/* ---------- 単元本体 ---------- */
.unit {
  border-top: 3px solid var(--c-accent);
  padding-top: 24px;
  margin-top: 60px;
}
.unit h2 {
  font-size: 26px;
  margin: 0 0 8px;
  color: var(--c-accent);
}
.unit .goal {
  background: #fff8df;
  border-left: 4px solid var(--c-note);
  padding: 12px 16px;
  margin: 16px 0 28px;
  border-radius: 4px;
  font-size: 15px;
}
.unit .goal::before { content: "🎯 この単元のゴール: "; font-weight: bold; }

.unit h3 {
  font-size: 21px;
  margin: 40px 0 14px;
  padding: 8px 0 4px;
  border-bottom: 2px solid var(--c-accent);
}
.unit h4 { font-size: 17px; margin: 24px 0 10px; color: var(--c-accent-dark); }

/* ---------- 解説枠 ---------- */
.explain {
  background: #fafafa;
  padding: 16px 20px;
  border-radius: 8px;
  margin: 12px 0;
  border: 1px solid var(--c-line);
}
.explain p { margin: 8px 0; }

.lead { font-size: 16px; color: var(--c-sub); margin: 8px 0 16px; }

.note { font-size: 14px; color: var(--c-sub); margin-top: 8px; }
.note::before { content: "📝 "; }

/* ---------- 図カード（SVG主役） ---------- */
.figure {
  background: white;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  text-align: center;
}
.figure svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.figure .caption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--c-sub);
  text-align: center;
}
.figure .fig-no {
  display: inline-block;
  background: var(--c-accent);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  font-family: var(--font-en);
  margin-bottom: 8px;
}
.figure.wide { background: var(--c-accent-light); border-color: var(--c-accent); }

/* ---------- コラム（基本4種＋分野別「目」3種） ---------- */
.column {
  background: #fff8df;
  border-left: 6px solid var(--c-note);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 4px 8px 8px 4px;
}
.column h4 { margin: 0 0 8px; color: #876200; font-size: 17px; }
.column h4::before { content: "💡 "; }
.column p { margin: 6px 0; }

/* ✨ 目からウロコ（紫） */
.column.aha { background: #f3e8ff; border-left-color: #9a4ec0; }
.column.aha h4 { color: #6b2d8a; }
.column.aha h4::before { content: "✨ "; }

/* ⚠ よくある間違い（赤） */
.column.warn { background: #fff0f0; border-left-color: #b94a48; }
.column.warn h4 { color: #8a2a28; }
.column.warn h4::before { content: "⚠️ "; }

/* 📺 動画・博物館リンク（ピンク） */
.column.video { background: #fff0fa; border-left-color: #c879c8; }
.column.video h4 { color: #8a2a8a; }
.column.video h4::before { content: "📺 "; }
.column.video a { color: #8a2a8a; font-weight: bold; }

/* 🌏 地理学者の目（緑） */
.column.geo-eye { background: var(--c-geo-light); border-left-color: var(--c-geo); }
.column.geo-eye h4 { color: var(--c-geo-dark); }
.column.geo-eye h4::before { content: "🌏 "; }

/* 📜 歴史家の目（茶） */
.column.hist-eye { background: var(--c-hist-light); border-left-color: var(--c-hist); }
.column.hist-eye h4 { color: var(--c-hist-dark); }
.column.hist-eye h4::before { content: "📜 "; }

/* ⚖ 法律家の目（紫） */
.column.civ-eye { background: var(--c-civ-light); border-left-color: var(--c-civ); }
.column.civ-eye h4 { color: var(--c-civ-dark); }
.column.civ-eye h4::before { content: "⚖️ "; }

/* ---------- 用語ボックス ---------- */
.term-box {
  border: 1px solid var(--c-line);
  border-radius: 6px;
  padding: 14px 18px;
  margin: 16px 0;
  background: #fff;
}
.term-box h4 { margin-top: 0; color: var(--c-accent); }
.term-list { list-style: none; padding: 0; margin: 0; }
.term-list li {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--c-line);
}
.term-list li:last-child { border-bottom: none; }
.term-list .term {
  font-weight: bold;
  color: var(--c-accent);
  min-width: 120px;
}
.term-list .ruby { font-size: 11px; color: var(--c-sub); display: block; }
.term-list .desc { flex: 1; font-size: 14px; }

/* 人物カード（歴史用） */
.person-card {
  display: inline-block;
  background: var(--c-hist-light);
  border: 1px solid var(--c-hist);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 6px 4px;
  font-size: 13px;
  vertical-align: top;
  min-width: 160px;
}
.person-card .name { font-weight: bold; color: var(--c-hist-dark); display: block; }
.person-card .years { font-family: var(--font-en); font-size: 11px; color: var(--c-sub); }
.person-card .work { font-size: 12px; margin-top: 4px; }

/* 年号カード（歴史用） */
.nengo-card {
  display: inline-block;
  background: white;
  border: 2px solid var(--c-hist);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 6px 4px;
  text-align: center;
  min-width: 130px;
  vertical-align: top;
}
.nengo-card .year {
  font-family: var(--font-en);
  font-weight: bold;
  font-size: 20px;
  color: var(--c-hist-dark);
  display: block;
}
.nengo-card .event { font-size: 13px; }
.nengo-card .goro {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--c-warn);
}

/* 語呂合わせボックス */
.goro-box {
  background: linear-gradient(135deg, #fff8df, #fff0fa);
  border: 1px dashed var(--c-warn);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 14px;
}
.goro-box::before { content: "🎵 語呂合わせ: "; font-weight: bold; color: var(--c-warn); }

/* 比較カード（鎌倉幕府 vs 室町幕府、衆院 vs 参院 など） */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
.compare-card {
  background: white;
  border: 2px solid var(--c-accent-light);
  border-radius: 8px;
  padding: 14px 18px;
}
.compare-card h4 { margin-top: 0; color: var(--c-accent); }
.compare-card.alt { border-color: #d0bce8; }
.compare-card.alt h4 { color: #6b2d8a; }

/* 因果関係チェーン */
.cause-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 14px 0;
  padding: 12px;
  background: var(--c-accent-light);
  border-radius: 8px;
}
.cause-chain .node {
  background: white;
  border: 1.5px solid var(--c-accent);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
  color: var(--c-accent-dark);
}
.cause-chain .arrow {
  color: var(--c-accent);
  font-weight: bold;
  font-size: 18px;
}

/* ---------- 練習問題（紙ベース） ---------- */
.drill {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 18px 22px;
  margin: 20px 0;
}
.drill > h4 {
  margin-top: 0;
  color: var(--c-accent);
  border-bottom: 1px solid var(--c-accent-light);
  padding-bottom: 6px;
}
.drill ol { padding-left: 24px; }
.drill li { margin: 16px 0; line-height: 2.0; }
.drill .qid {
  display: inline-block;
  background: var(--c-accent-light);
  color: var(--c-accent);
  padding: 1px 8px;
  border-radius: 4px;
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: bold;
  margin-right: 4px;
  cursor: pointer;
}
.drill .qid:hover { background: var(--c-accent); color: white; }

/* インライン ○×❓ ボタン（各問題に自動挿入） */
.qid-actions {
  display: inline-flex;
  gap: 3px;
  margin-right: 8px;
  vertical-align: middle;
}
.qid-actions .qm {
  width: 26px;
  height: 22px;
  border: 1.5px solid;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
  transition: all .12s;
}
.qid-actions .qm-o { border-color: var(--c-ok); }
.qid-actions .qm-o:hover { background: var(--c-ok); }
.qid-actions .qm-x { border-color: var(--c-warn); }
.qid-actions .qm-x:hover { background: #fff0f0; }
.qid-actions .qm-q { border-color: #888; }
.qid-actions .qm-q:hover { background: #f5f5f5; }

/* タッチデバイス向け拡大 */
@media (pointer: coarse) {
  .qid-actions .qm { width: 34px; height: 30px; font-size: 14px; }
}

/* 記録済み問題行のハイライト */
.drill li.rec-o {
  background: linear-gradient(to right, #e7f5ea 0%, #e7f5ea 4px, transparent 4px);
  padding-left: 8px;
  margin-left: -8px;
  border-radius: 3px;
}
.drill li.rec-x {
  background: linear-gradient(to right, #fff0f0 0%, #fff0f0 4px, transparent 4px);
  padding-left: 8px;
  margin-left: -8px;
  border-radius: 3px;
}
.drill li.rec-q {
  background: linear-gradient(to right, #f5f5f5 0%, #f5f5f5 4px, transparent 4px);
  padding-left: 8px;
  margin-left: -8px;
  border-radius: 3px;
}

/* 戻りリンク（年表や白地図への戻り口） */
.return-link {
  display: inline-block;
  margin: 6px 0 0;
  padding: 4px 12px;
  background: #f3e8ff;
  border-left: 3px solid #9a4ec0;
  border-radius: 0 4px 4px 0;
  color: #6b2d8a;
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
}
.return-link:hover { background: #9a4ec0; color: white; }
.return-link::before { content: "💡 "; }

/* 入試頻出マーカー */
.exam-hot {
  display: inline-block;
  background: linear-gradient(135deg, #ffd54f, #ff8800);
  color: white;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  margin-right: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.exam-hot::before { content: "⭐ "; }

/* 再挑戦リスト（苦手マップ用） */
.retry-group {
  background: white;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
}
.retry-group h4 {
  margin: 0 0 10px;
  color: var(--c-warn);
  font-size: 14px;
  border-bottom: 1px solid #f8d7d3;
  padding-bottom: 6px;
}
.retry-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
}
.retry-list li { border-radius: 4px; }
.retry-list li.retry-stuck {
  background: #fff0f0;
  border-left: 3px solid var(--c-warn);
}
.retry-list li.retry-trying {
  background: #fff8df;
  border-left: 3px solid var(--c-note);
}
.retry-list li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  text-decoration: none;
  color: var(--c-ink);
  font-size: 13px;
}
.retry-list li a:hover { background: rgba(0,0,0,.04); }
.retry-list .retry-qid {
  font-family: var(--font-en);
  font-weight: bold;
  color: var(--c-warn);
}
.retry-list .retry-mark { font-size: 14px; }
.retry-list .retry-state {
  margin-left: auto;
  font-size: 11px;
  color: var(--c-sub);
}

/* 書き込み欄 */
.write-line {
  display: inline-block;
  border-bottom: 1.5px solid #333;
  min-width: 80px;
  height: 1.3em;
  vertical-align: bottom;
  margin: 0 4px;
}
.write-line.wide { display: block; width: 100%; margin: 6px 0; min-width: auto; }
.write-line.tall { height: 2.6em; }

.choice {
  display: inline-block;
  margin: 0 14px 0 0;
}
.choice::before { content: "(  ) "; }

.q-show {
  background: #888;
  color: white;
  border: none;
  padding: 4px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  margin-left: 4px;
}
.q-show:hover { background: #555; }

.answer-row {
  display: none;
  background: #f0f8f0;
  padding: 8px 12px;
  margin-top: 8px;
  border-left: 3px solid var(--c-ok);
  font-size: 14px;
  border-radius: 0 4px 4px 0;
}
.answer-row.show { display: block; }
.answer-row strong { color: var(--c-ok); }

/* ---------- ○×記録ウィジェット（フローティング） ---------- */
.record-toggle {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--c-accent);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  z-index: 999;
}
.record-toggle:hover { transform: scale(1.05); }

.record-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  background: white;
  border: 2px solid var(--c-accent);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  z-index: 1000;
  display: none;
}
.record-panel.show { display: block; }
.record-panel h4 {
  margin: 0 0 10px;
  color: var(--c-accent);
  font-size: 15px;
}
.record-panel .close-btn {
  position: absolute;
  top: 8px; right: 10px;
  background: none; border: none;
  font-size: 18px; cursor: pointer; color: #999;
}
.record-panel .qid-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-en);
  margin-bottom: 10px;
  box-sizing: border-box;
}
.record-panel .qid-hint {
  font-size: 11px;
  color: var(--c-sub);
  margin: -6px 0 8px;
}
.record-panel .result-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.record-panel .result-buttons button {
  padding: 10px;
  border: 2px solid;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}
.record-panel .btn-correct { border-color: var(--c-ok); color: var(--c-ok); }
.record-panel .btn-correct:hover { background: #e7f5ea; }
.record-panel .btn-wrong   { border-color: var(--c-warn); color: var(--c-warn); }
.record-panel .btn-wrong:hover { background: #fff0f0; }
.record-panel .btn-unknown { border-color: #888; color: #555; }
.record-panel .btn-unknown:hover { background: #f5f5f5; }

.record-panel .recent {
  border-top: 1px solid var(--c-line);
  padding-top: 8px;
  margin-top: 4px;
}
.record-panel .recent h5 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--c-sub);
}
.record-panel .recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 140px;
  overflow-y: auto;
}
.record-panel .recent-list li {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 12px;
  border-bottom: 1px dotted #eee;
}
.record-panel .recent-list .id { font-family: var(--font-en); color: var(--c-sub); }
.record-panel .recent-list .mark { font-weight: bold; }
.record-panel .recent-list .mark.o { color: var(--c-ok); }
.record-panel .recent-list .mark.x { color: var(--c-warn); }
.record-panel .recent-list .mark.q { color: #888; }
.record-panel .toast {
  font-size: 12px;
  color: var(--c-ok);
  text-align: center;
  height: 16px;
  margin-bottom: 4px;
}

.record-panel .panel-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
}
.record-panel .panel-actions a {
  color: var(--c-accent);
  text-decoration: none;
}
.record-panel .panel-actions a:hover { text-decoration: underline; }

/* 単元末の集計 */
.unit-summary {
  background: var(--c-accent-light);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 30px 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.unit-summary .label { font-weight: bold; color: var(--c-accent); }
.unit-summary .stat { font-family: var(--font-en); font-size: 17px; }
.unit-summary .stat .num { font-size: 24px; font-weight: bold; color: var(--c-accent); }
.unit-summary .retry-link {
  background: var(--c-accent);
  color: white;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
}
.unit-summary .retry-link:hover { background: var(--c-accent-dark); }

/* ---------- 苦手マップ ---------- */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  margin: 16px 0;
}
.map-cell {
  border: 1px solid var(--c-line);
  border-radius: 4px;
  padding: 8px 10px;
  background: #fafafa;
  text-align: center;
  font-size: 12px;
}
.map-cell.state-untouched { background: #f0f0f0; color: #999; }
.map-cell.state-trying    { background: #fff8df; border-color: #e0bb1f; }
.map-cell.state-once-ok   { background: #e7f5ea; border-color: var(--c-ok); }
.map-cell.state-mastered  { background: var(--c-ok); color: white; border-color: var(--c-ok); }
.map-cell.state-stuck     { background: #fff0f0; border-color: var(--c-warn); }
.map-cell .qid-label { font-family: var(--font-en); font-weight: bold; display: block; font-size: 11px; }
.map-cell .latest    { font-size: 18px; margin-top: 2px; }

.map-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  margin: 16px 0;
}
.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.map-legend .dot {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 3px;
  border: 1px solid #ccc;
}

/* ---------- 印刷モード切替パネル ---------- */
.print-panel-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: #666;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  z-index: 999;
}
.print-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: white;
  border: 2px solid var(--c-accent);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  z-index: 1000;
  font-size: 13px;
  display: none;
}
.print-panel.show { display: block; }
.print-panel h4 { margin: 0 0 8px; color: var(--c-accent); font-size: 14px; }
.print-panel label { display: block; margin: 4px 0; cursor: pointer; }
.print-panel input[type="radio"] { margin-right: 6px; }
.print-panel .print-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  background: var(--c-accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.print-panel .close-btn {
  position: absolute;
  top: 4px; right: 8px;
  background: none; border: none;
  font-size: 16px; cursor: pointer; color: #999;
}

/* 印刷モード：問題冊子 */
body.mode-questions .answer-row,
body.mode-questions .q-show {
  display: none !important;
}

/* 印刷モード：解答編 */
body.mode-answer-key .hero,
body.mode-answer-key .lead,
body.mode-answer-key .explain,
body.mode-answer-key .figure,
body.mode-answer-key .column,
body.mode-answer-key .term-box,
body.mode-answer-key .toc,
body.mode-answer-key .controls,
body.mode-answer-key .unit-summary,
body.mode-answer-key .unit > .goal,
body.mode-answer-key .unit > p,
body.mode-answer-key .unit > h3,
body.mode-answer-key .unit > h4 {
  display: none !important;
}
body.mode-answer-key .drill .write-line,
body.mode-answer-key .drill .q-show,
body.mode-answer-key .drill .choice,
body.mode-answer-key .qid-actions {
  display: none !important;
}

/* 問題冊子モードでもインラインボタンを隠す */
body.mode-questions .qid-actions {
  display: none !important;
}

/* 記録ハイライトは印刷時には消す（白黒で混乱しないよう） */
@media print {
  .drill li.rec-o, .drill li.rec-x, .drill li.rec-q {
    background: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
  }
}
body.mode-answer-key .drill .answer-row {
  display: inline-block !important;
  background: transparent !important;
  border: none !important;
  border-left: 2px solid var(--c-ok);
  padding: 0 8px !important;
  margin: 0 0 0 8px !important;
  font-weight: bold;
  color: var(--c-ok);
}
body.mode-answer-key .book-title::after {
  content: " — 解答編";
  color: var(--c-warn);
  font-size: 0.7em;
}

/* ---------- @media print ---------- */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: white; font-size: 11pt; }
  .page { box-shadow: none; max-width: none; padding: 0; }
  .top-nav, .q-show, .print-hide,
  .print-panel, .print-panel-toggle,
  .record-toggle, .record-panel { display: none !important; }
  .unit { page-break-before: always; }
  .unit:first-of-type { page-break-before: avoid; }
  h2, h3, h4 { page-break-after: avoid; }
  .figure, .drill li, .column { page-break-inside: avoid; }
  a { color: black; text-decoration: none; }
  .write-line { border-bottom: 1px solid black; }
  body:not(.mode-answer-key) .answer-row { display: none !important; }
}

/* ---------- ヒーロー（intro用） ---------- */
.hero {
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-dark) 100%);
  color: white;
  padding: 32px 28px;
  border-radius: 8px;
  margin-bottom: 32px;
}
.hero h1 { margin: 0 0 8px; font-size: 28px; }
.hero p { margin: 4px 0; opacity: .95; }

.big-section {
  margin: 56px 0;
  padding-top: 24px;
  border-top: 3px double var(--c-accent);
}
.big-section > h2 {
  font-size: 26px;
  color: var(--c-accent);
  margin: 0 0 8px;
}

/* 大きな表 */
.big-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.big-table th, .big-table td {
  border: 1px solid var(--c-line);
  padding: 8px 12px;
  vertical-align: top;
  font-size: 14px;
}
.big-table th {
  background: var(--c-accent-light);
  color: var(--c-accent);
  text-align: left;
}

/* ---------- 年表ファイル統合用ガード ----------
   既存の rekisi_nenpyo.html を timeline.html として組み込んだとき、
   スタイル衝突を避けるための名前空間 (.tl-scope) を将来用に確保。
   実際の年表ファイル統合時にここを拡張する。
   ---------------------------------------------- */
.tl-scope { all: initial; font-family: var(--font-jp); }
.tl-scope * { box-sizing: border-box; }

/* ---------- 白地図インタラクション（地理用） ---------- */
.map-japan path.pref,
.map-world path.country {
  fill: #f5f3ea;
  stroke: #876200;
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill .15s;
}
.map-japan path.pref:hover,
.map-world path.country:hover {
  fill: var(--c-geo-light);
}
.map-japan path.pref.revealed,
.map-world path.country.revealed {
  fill: var(--c-geo);
}
.map-japan .pref-label,
.map-world .country-label {
  font-size: 11px;
  fill: #333;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.map-japan .pref-label.show,
.map-world .country-label.show {
  opacity: 1;
}

@media (max-width: 600px) {
  .compare-grid { grid-template-columns: 1fr; }
  .record-panel { width: calc(100vw - 40px); right: 20px; }
  .cause-chain { font-size: 12px; }
}

/* ============================================================
   統計データ表示コンポーネント
   - 地理（人口・産業・農業）／公民（経済・財政）で頻出
   - 設計: 「数字より絵」が中学生には刺さる。表は最小限、図を主役に。
   - すべて宣言型: HTML に data-* を書くだけで描画される（JS が自動処理）
   ============================================================ */

/* ---------- 統計表 ---------- */
.stat-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-table caption {
  caption-side: top;
  text-align: left;
  font-weight: bold;
  color: var(--c-accent-dark);
  padding: 6px 4px;
  font-size: 15px;
}
.stat-table th, .stat-table td {
  border-bottom: 1px solid var(--c-line);
  padding: 8px 12px;
  font-size: 14px;
  vertical-align: middle;
}
.stat-table thead th {
  background: var(--c-accent-light);
  color: var(--c-accent);
  text-align: left;
  font-size: 13px;
}
.stat-table td.num, .stat-table td.pct, .stat-table th.num, .stat-table th.pct {
  text-align: right;
  font-family: var(--font-en);
  font-variant-numeric: tabular-nums;
}
.stat-table tbody tr:hover { background: #fafafa; }
.stat-table .rank {
  text-align: center;
  font-family: var(--font-en);
  font-weight: bold;
  width: 36px;
  color: var(--c-sub);
}
.stat-table .rank-1 { background: linear-gradient(135deg, #ffd54f, #ff8800); color: white; }
.stat-table .rank-2 { background: linear-gradient(135deg, #d0d0d0, #999); color: white; }
.stat-table .rank-3 { background: linear-gradient(135deg, #d49a6a, #a06030); color: white; }
.stat-table tfoot td {
  border-bottom: none;
  font-size: 11px;
  color: var(--c-sub);
  padding: 6px 12px;
  background: #fafafa;
}
.stat-table tfoot .source::before { content: "📚 出典: "; }

/* バーセル内に視覚バー（表の中で割合を見せる） */
.stat-table .bar-cell {
  position: relative;
  background: linear-gradient(to right,
    var(--c-accent) 0%, var(--c-accent) calc(var(--p, 0) * 1%),
    transparent calc(var(--p, 0) * 1%), transparent 100%);
  background-color: var(--c-accent-light);
  color: white;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(0,0,0,.4);
  padding-left: 8px;
  min-width: 60px;
}

/* ---------- 横棒グラフ（CSS のみ） ---------- */
.bar-chart {
  background: white;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
}
.bar-chart .chart-title {
  font-weight: bold;
  color: var(--c-accent-dark);
  margin-bottom: 10px;
  font-size: 15px;
}
.bar-chart .bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 70px;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  font-size: 13px;
}
.bar-chart .bar-row .label {
  text-align: right;
  color: var(--c-sub);
  font-weight: bold;
}
.bar-chart .bar-row .bar {
  height: 22px;
  background: var(--c-accent);
  border-radius: 3px;
  width: calc(var(--p, 0) * 1%);
  transition: width .4s ease-out;
  min-width: 2px;
}
.bar-chart .bar-row .val {
  font-family: var(--font-en);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--c-ink);
}
/* 順位付きカラー */
.bar-chart .bar-row.rank-1 .bar { background: linear-gradient(to right, #ffd54f, #ff8800); }
.bar-chart .bar-row.rank-2 .bar { background: linear-gradient(to right, #c0c0c0, #888); }
.bar-chart .bar-row.rank-3 .bar { background: linear-gradient(to right, #d49a6a, #a06030); }
.bar-chart .source {
  font-size: 11px;
  color: var(--c-sub);
  margin-top: 10px;
  text-align: right;
}
.bar-chart .source::before { content: "📚 "; }

/* ---------- 積み上げ100%棒（産業構成・選挙結果など） ---------- */
.stacked-bar {
  background: white;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
}
.stacked-bar .chart-title {
  font-weight: bold;
  color: var(--c-accent-dark);
  margin-bottom: 10px;
  font-size: 15px;
}
.stacked-bar .bar-track {
  display: flex;
  height: 36px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #ccc;
}
.stacked-bar .seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 13px;
  text-shadow: 0 0 2px rgba(0,0,0,.4);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.stacked-bar .seg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
}
.stacked-bar .seg-legend .dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ---------- SVG チャート共通 ---------- */
.pie-chart, .line-chart, .pop-pyramid {
  background: white;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
}
.pie-chart .chart-title,
.line-chart .chart-title,
.pop-pyramid .chart-title {
  font-weight: bold;
  color: var(--c-accent-dark);
  margin-bottom: 6px;
  font-size: 15px;
  text-align: center;
}
.pie-chart svg, .line-chart svg, .pop-pyramid svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.pie-chart .pie-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 4px 12px;
  margin-top: 10px;
  font-size: 12px;
}
.pie-chart .pie-legend .item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pie-chart .pie-legend .dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 2px;
}
.pie-chart .pie-legend .val {
  margin-left: auto;
  font-family: var(--font-en);
  font-variant-numeric: tabular-nums;
  color: var(--c-sub);
}
.line-chart .x-label, .line-chart .y-label,
.pop-pyramid .age-label {
  font-size: 11px;
  fill: var(--c-sub);
}
.line-chart .grid-line { stroke: #eee; stroke-width: 1; }
.line-chart .axis     { stroke: #888; stroke-width: 1; }
.line-chart .data-line {
  fill: none;
  stroke: var(--c-accent);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.line-chart .data-point {
  fill: white;
  stroke: var(--c-accent);
  stroke-width: 2;
}
.line-chart .point-label {
  font-size: 10px;
  font-family: var(--font-en);
  fill: var(--c-accent-dark);
}
.pop-pyramid .bar-male   { fill: #4a7fb8; }
.pop-pyramid .bar-female { fill: #c87fa8; }
.pop-pyramid .axis-line  { stroke: #888; stroke-width: 1; }
.pop-pyramid .pyramid-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  font-size: 12px;
}
.pop-pyramid .pyramid-legend .dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.chart-source {
  font-size: 11px;
  color: var(--c-sub);
  text-align: right;
  margin-top: 8px;
}
.chart-source::before { content: "📚 出典: "; }

/* ---------- 雨温図（地理 気候単元の主役） ---------- */
.climograph {
  background: white;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
}
.climograph .chart-title {
  font-weight: bold;
  color: var(--c-accent-dark);
  margin-bottom: 6px;
  font-size: 15px;
  text-align: center;
}
.climograph svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.climograph .bar-rain    { fill: #2c6fbb; opacity: .8; }
.climograph .line-temp   { fill: none; stroke: #c0392b; stroke-width: 2.5; stroke-linejoin: round; }
.climograph .dot-temp    { fill: white; stroke: #c0392b; stroke-width: 2; }
.climograph .axis-line   { stroke: #888; stroke-width: 1; }
.climograph .grid-line   { stroke: #eee; stroke-width: 1; }
.climograph .y-label-left  { font-size: 10px; fill: #2c6fbb; }
.climograph .y-label-right { font-size: 10px; fill: #c0392b; }
.climograph .x-label       { font-size: 10px; fill: var(--c-sub); }
.climograph .axis-title-left  { font-size: 11px; fill: #2c6fbb; font-weight: bold; }
.climograph .axis-title-right { font-size: 11px; fill: #c0392b; font-weight: bold; }
.climograph .stats-row {
  display: flex;
  justify-content: space-around;
  gap: 14px;
  margin-top: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.climograph .stats-row .item { color: var(--c-sub); }
.climograph .stats-row .item .v {
  font-family: var(--font-en);
  font-weight: bold;
  color: var(--c-ink);
}
.climograph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

/* ---------- JPG画像挿入（.figure-img） ----------
   著作権クリアの自作画像／PDF→JPG変換画像を貼るためのコンテナ。
   使用例：
   <figure class="figure-img">
     <div class="fig-no">図 4-D</div>
     <img src="assets/img/geo/japan-relief.jpg" alt="日本列島の起伏">
     <figcaption>日本列島の地形図（自作）<span class="source">出典：自作</span></figcaption>
   </figure>
   ---------------------------------------------- */
.figure-img {
  background: white;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  text-align: center;
}
.figure-img img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  background: #f5f3ea;
}
.figure-img figcaption,
.figure-img .caption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--c-sub);
  text-align: center;
  line-height: 1.5;
}
.figure-img figcaption .source,
.figure-img .caption .source {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #888;
}
.figure-img figcaption .source::before,
.figure-img .caption .source::before { content: "📚 "; }

/* 横並び画像（2枚比較） */
.figure-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

/* 拡大可能（クリックで原寸） */
.figure-img.zoomable img {
  cursor: zoom-in;
  transition: transform .2s;
}
.figure-img.zoomable img:hover { transform: scale(1.02); }
.figure-img.zoomable img.zoomed {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1);
  max-width: 95vw; max-height: 95vh;
  width: auto; height: auto;
  z-index: 10000;
  cursor: zoom-out;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.85);
}

/* 印刷時は画像も含めて改ページしない */
@media print {
  .figure-img { page-break-inside: avoid; }
  .figure-img.zoomable img.zoomed {
    position: static; transform: none; box-shadow: none;
  }
}

/* ---------- 白地図トレーニング用追加スタイル ---------- */
.prefmap {
  background: white;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 18px;
  margin: 20px 0;
}
.prefmap-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
.prefmap-controls button {
  padding: 6px 14px;
  background: white;
  border: 1.5px solid var(--c-accent);
  color: var(--c-accent);
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  font-weight: bold;
}
.prefmap-controls button:hover { background: var(--c-accent); color: white; }
.prefmap-controls .info {
  margin-left: auto;
  font-size: 13px;
  color: var(--c-sub);
}
.prefmap-controls .info .stat {
  font-family: var(--font-en);
  font-weight: bold;
  color: var(--c-accent);
}

/* グリッド型白地図のセル */
.prefcell {
  width: 56px;
  height: 44px;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  background: #f5f3ea;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  color: transparent;
  transition: all .15s;
  position: relative;
  user-select: none;
}
.prefcell:hover { transform: scale(1.08); z-index: 2; }
.prefcell.revealed { color: white; }
.prefcell.region-hokkaido  { background: #6b8e9e; }
.prefcell.region-tohoku    { background: #8b6f47; }
.prefcell.region-kanto     { background: #c0392b; }
.prefcell.region-chubu     { background: #2a7a3a; }
.prefcell.region-kinki     { background: #876200; }
.prefcell.region-chugoku   { background: #4a7fb8; }
.prefcell.region-shikoku   { background: #d97706; }
.prefcell.region-kyushu    { background: #6b2d8a; }
.prefcell.correct {
  outline: 3px solid #2a7a3a;
  outline-offset: 1px;
  color: white;
}
.prefcell.wrong {
  outline: 3px solid #b94a48;
  outline-offset: 1px;
}
/* 県庁所在地表示モード */
.prefcell .capital {
  display: none;
  position: absolute;
  bottom: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #555;
  white-space: nowrap;
  font-weight: normal;
}
.prefmap.show-capital .prefcell.revealed .capital { display: block; }

@media (max-width: 600px) {
  .bar-chart .bar-row { grid-template-columns: 70px 1fr 60px; font-size: 12px; }
  .stat-table th, .stat-table td { padding: 6px 8px; font-size: 12px; }
}

/* ============================================================
   歴史 history.html 拡張用クラス
   背景→動機→結果→勢力変動を視覚化するためのブロック類
   ============================================================ */

/* 📖 史料ブロック — 古い紙風 */
.historical-source {
  border: 2px solid #b08850;
  background: linear-gradient(180deg, #fbf3df 0%, #f5e8c4 100%);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  position: relative;
}
.historical-source h4 {
  color: #6b4810;
  font-size: 14px;
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed #b08850;
}
.historical-source blockquote.source-text {
  background: rgba(255,255,255,.55);
  border-left: 4px solid #876200;
  margin: 8px 0 12px;
  padding: 10px 14px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", serif;
  font-size: 14px;
  line-height: 1.75;
  color: #3a2810;
  white-space: pre-line;
}
.historical-source blockquote.source-text .src-emphasis {
  background: rgba(192,128,32,.25);
  font-weight: bold;
  padding: 0 3px;
  border-radius: 3px;
}
.historical-source ol.source-questions {
  margin: 8px 0 0 22px;
  padding: 0;
}
.historical-source ol.source-questions li {
  margin: 6px 0;
  font-size: 13.5px;
  line-height: 1.6;
}
.historical-source .src-meta {
  font-size: 11.5px;
  color: #765432;
  font-style: italic;
  margin-top: 6px;
}

/* 🌏 同時期の世界 */
.world-history {
  background: #e6f4ec;
  border: 1px solid #4a8a64;
  border-left: 6px solid #2a7a3a;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 14px 0;
}
.world-history h4 {
  color: #1f5e2c;
  font-size: 14.5px;
  margin: 0 0 6px;
}
.world-history h4::before { content: "🌏 "; }
.world-history .world-summary { font-size: 13px; line-height: 1.65; margin-bottom: 8px; }
.world-history .world-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.world-history .world-card {
  background: #fff;
  border: 1.5px solid #4a8a64;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  min-width: 110px;
  flex: 0 0 auto;
}
.world-history .world-card .wy { font-weight: bold; color: #1f5e2c; font-family: var(--font-en); display: block; font-size: 12px; }
.world-history .world-card .we { display: block; line-height: 1.4; }

/* 🎨 文化史ブロック */
.culture-block {
  background: #f4ebf9;
  border: 1px solid #8a4ec0;
  border-left: 6px solid #6b2d8a;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
}
.culture-block > h4 {
  color: #4a1f6b;
  font-size: 15px;
  margin: 0 0 8px;
}
.culture-block > h4::before { content: "🎨 "; }
.culture-block h5 {
  color: #6b2d8a;
  font-size: 13px;
  margin: 8px 0 4px;
  padding: 2px 8px;
  background: rgba(138,78,192,.15);
  border-radius: 3px;
  display: inline-block;
}
.culture-block .culture-items {
  margin: 0 0 6px 18px;
  padding: 0;
  font-size: 13px;
  line-height: 1.7;
}
.culture-block .culture-items li {
  margin: 2px 0;
}
.culture-block .culture-items strong { color: #4a1f6b; }

/* ⚖ 勢力変動 — 「誰が強くなり、誰が弱くなったか」 */
.power-flow {
  display: grid;
  grid-template-columns: 1fr 30px 1fr;
  gap: 8px;
  background: #fff8e8;
  border: 1px solid #d49a40;
  border-radius: 8px;
  padding: 12px;
  margin: 14px 0;
  align-items: center;
}
.power-flow .pf-arrow {
  text-align: center;
  font-size: 22px;
  color: #b07820;
  font-weight: bold;
}
.power-flow .pf-side { padding: 6px; }
.power-flow .pf-side h5 {
  font-size: 13px;
  margin: 0 0 4px;
  padding: 3px 6px;
  border-radius: 3px;
}
.power-flow .pf-up h5 {
  background: #2a7a3a;
  color: #fff;
}
.power-flow .pf-up h5::before { content: "↑強 "; }
.power-flow .pf-down h5 {
  background: #b03030;
  color: #fff;
}
.power-flow .pf-down h5::before { content: "↓弱 "; }
.power-flow .pf-side ul {
  margin: 4px 0 0 18px;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.5;
}
.power-flow .pf-side li { margin: 2px 0; }
.power-flow .pf-title {
  grid-column: 1 / -1;
  font-weight: bold;
  color: #6b4810;
  font-size: 14px;
  border-bottom: 1px dashed #d49a40;
  padding-bottom: 4px;
  margin-bottom: 4px;
}

/* 🎯 背景→動機→結果→影響 ミニ解説枠 */
.causality-box {
  border: 1.5px solid #c4956b;
  background: #fef7ec;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.65;
}
.causality-box .cb-title {
  font-weight: bold;
  color: #7a4e2e;
  font-size: 13.5px;
  margin-bottom: 6px;
}
.causality-box .cb-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 6px 10px;
  margin: 3px 0;
}
.causality-box .cb-label {
  background: #7a4e2e;
  color: #fff;
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 3px;
  text-align: center;
  font-weight: bold;
  align-self: start;
}
.causality-box .cb-label.bg { background: #6b6b6b; }    /* 背景 */
.causality-box .cb-label.mt { background: #5a7a3a; }    /* 動機 */
.causality-box .cb-label.rs { background: #b07820; }    /* 結果 */
.causality-box .cb-label.im { background: #b03030; }    /* 影響 */
.causality-box .cb-text { font-size: 13px; }

@media (max-width: 600px) {
  .power-flow { grid-template-columns: 1fr; }
  .power-flow .pf-arrow { transform: rotate(90deg); padding: 4px 0; }
  .causality-box .cb-row { grid-template-columns: 1fr; gap: 2px; }
  .causality-box .cb-label { justify-self: start; }
}

/* 印刷モード時の整形 */
@media print {
  .historical-source { break-inside: avoid; border-color: #888; }
  .world-history { break-inside: avoid; border-color: #888; }
  .culture-block { break-inside: avoid; border-color: #888; }
  .power-flow { break-inside: avoid; border-color: #888; }
  .causality-box { break-inside: avoid; border-color: #888; }
}

/* ============================================================
   記憶科学コンポーネント（認知心理学ベース）
   検索練習 / プレテスト効果 / 精緻化 / 二重符号化 / 間隔反復
   すべて JS 不要（<details> で開閉）
   ============================================================ */

/* --- メタ認知ガイド：この教材の使い方＝記憶の科学 --- */
.memory-science {
  border: 2px solid #5a4100;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff8ea 0%, #fdeed3 100%);
  padding: 16px 20px;
  margin: 18px 0;
}
.memory-science > h3 {
  margin: 0 0 6px;
  color: #5a4100;
  font-size: 17px;
}
.memory-science > h3::before { content: "🧠 "; }
.memory-science .ms-lead { font-size: 13.5px; line-height: 1.7; margin-bottom: 12px; color: #4a3a1a; }
.memory-science .ms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.memory-science .ms-card {
  background: #fff;
  border: 1px solid #d4b87a;
  border-left: 5px solid #b07820;
  border-radius: 6px;
  padding: 9px 12px;
}
.memory-science .ms-card .ms-num {
  display: inline-block;
  background: #b07820;
  color: #fff;
  font-weight: bold;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  font-size: 13px;
  margin-right: 6px;
}
.memory-science .ms-card h4 { display: inline; font-size: 14px; color: #6b4810; }
.memory-science .ms-card p { font-size: 12.5px; line-height: 1.55; margin: 6px 0 0; color: #444; }
.memory-science .ms-card .ms-sci { font-size: 11px; color: #8a6a3a; font-style: italic; margin-top: 4px; }

/* --- プレテスト：読む前の予想クイズ（Pretesting Effect） --- */
.pretest {
  border: 2px dashed #c8a020;
  border-radius: 8px;
  background: #fffbe9;
  padding: 12px 16px;
  margin: 14px 0;
}
.pretest > h4 {
  margin: 0 0 4px;
  color: #8a6a10;
  font-size: 14.5px;
}
.pretest > h4::before { content: "🔮 "; }
.pretest .pt-note { font-size: 12px; color: #7a6a3a; margin-bottom: 8px; }
.pretest ol { margin: 0 0 0 20px; padding: 0; font-size: 13.5px; line-height: 1.7; }
.pretest ol li { margin: 5px 0; }
.pretest details {
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e0c870;
  border-radius: 5px;
  padding: 2px 0;
}
.pretest summary {
  cursor: pointer;
  font-size: 12.5px;
  color: #b07820;
  padding: 5px 10px;
  list-style: none;
  user-select: none;
}
.pretest summary::-webkit-details-marker { display: none; }
.pretest summary::before { content: "▶ "; font-size: 10px; }
.pretest details[open] summary::before { content: "▼ "; }
.pretest details > div { padding: 6px 12px 8px; font-size: 13px; border-top: 1px dashed #e0c870; }

/* --- 段階想起ラダー：ヒントを出し惜しみ（検索練習＋望ましい困難） --- */
.recall-ladder {
  background: #eef4fb;
  border: 1px solid #5a7faf;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
}
.recall-ladder > .rl-q {
  font-size: 14px;
  font-weight: bold;
  color: #234a72;
  margin-bottom: 8px;
}
.recall-ladder > .rl-q::before { content: "🪜 "; }
.recall-ladder .rl-steps { display: flex; flex-direction: column; gap: 5px; }
.recall-ladder details {
  border: 1px solid #b6cae4;
  border-radius: 5px;
  background: #fff;
}
.recall-ladder summary {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 12.5px;
  color: #3a6ea5;
  list-style: none;
  user-select: none;
}
.recall-ladder summary::-webkit-details-marker { display: none; }
.recall-ladder summary::before { content: "💡 "; }
.recall-ladder details[open] summary { border-bottom: 1px dashed #b6cae4; color: #234a72; }
.recall-ladder details > .rl-body { padding: 7px 12px; font-size: 13px; line-height: 1.6; }
.recall-ladder .rl-answer summary { color: #1f6b3a; font-weight: bold; }
.recall-ladder .rl-answer summary::before { content: "✅ "; }
.recall-ladder .rl-answer { border-color: #7bbd92; }
.recall-ladder .rl-answer details[open] summary,
.recall-ladder .rl-answer[open] summary { border-bottom-color: #7bbd92; }
.recall-ladder .rl-tip { font-size: 11.5px; color: #5a7faf; margin-top: 6px; font-style: italic; }

/* --- 記憶フック：語呂＋イメージ＋物語（二重符号化） --- */
.memory-hook {
  background: linear-gradient(180deg, #fdeef4 0%, #fbe3ee 100%);
  border: 1px solid #c86a9a;
  border-left: 6px solid #b03070;
  border-radius: 8px;
  padding: 11px 15px;
  margin: 12px 0;
}
.memory-hook > h4 {
  margin: 0 0 6px;
  color: #8a1f56;
  font-size: 14px;
}
.memory-hook > h4::before { content: "🎬 "; }
.memory-hook .mh-goro {
  font-size: 15px;
  font-weight: bold;
  color: #b03070;
  background: #fff;
  display: inline-block;
  padding: 3px 10px;
  border-radius: 5px;
  margin-bottom: 6px;
}
.memory-hook .mh-image { font-size: 13px; line-height: 1.65; color: #4a2a3a; }
.memory-hook .mh-image strong { color: #8a1f56; }

/* --- ファインマン・チェック：自己説明（精緻化的質問） --- */
.feynman-check {
  background: #eaf6ee;
  border: 1px solid #4a9a64;
  border-left: 6px solid #2a7a3a;
  border-radius: 8px;
  padding: 11px 15px;
  margin: 14px 0;
}
.feynman-check > h4 {
  margin: 0 0 6px;
  color: #1f5e2c;
  font-size: 14.5px;
}
.feynman-check > h4::before { content: "🗣 "; }
.feynman-check .fc-note { font-size: 12.5px; color: #2a5a3a; margin-bottom: 8px; line-height: 1.6; }
.feynman-check ul { margin: 0 0 0 18px; padding: 0; font-size: 13.5px; line-height: 1.75; }
.feynman-check ul li { margin: 4px 0; }
.feynman-check details {
  margin-top: 8px;
  background: #fff;
  border: 1px solid #a8d8ba;
  border-radius: 5px;
}
.feynman-check summary {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 12.5px;
  color: #2a7a3a;
  list-style: none;
  user-select: none;
}
.feynman-check summary::-webkit-details-marker { display: none; }
.feynman-check summary::before { content: "📖 模範解答をひらく "; }
.feynman-check details[open] summary::before { content: "📖 とじる "; }
.feynman-check details > div { padding: 8px 12px; font-size: 13px; line-height: 1.7; border-top: 1px dashed #a8d8ba; }

/* --- 戻り設計：間隔反復（回数ベース・日付非依存） --- */
.comeback {
  background: #f2ecf9;
  border: 1px solid #8a4ec0;
  border-radius: 8px;
  padding: 11px 15px;
  margin: 14px 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.comeback .cb-icon { font-size: 28px; line-height: 1; }
.comeback .cb-main h4 { margin: 0 0 4px; color: #4a1f6b; font-size: 14px; }
.comeback .cb-main p { font-size: 12.5px; line-height: 1.6; color: #44324a; margin: 0; }
.comeback .cb-checks { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.comeback .cb-check {
  background: #fff;
  border: 1.5px solid #8a4ec0;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  color: #6b2d8a;
}
.comeback .cb-check b { font-size: 13px; }

/* --- つなぐ：既有知識・現代との接続（精緻化） --- */
.link-now {
  background: #fef3e8;
  border: 1px dashed #d08020;
  border-radius: 6px;
  padding: 9px 14px;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.65;
}
.link-now::before {
  content: "🔗 今でいうと…";
  display: block;
  font-weight: bold;
  color: #a05810;
  font-size: 12.5px;
  margin-bottom: 3px;
}
.link-now strong { color: #a05810; }

@media (max-width: 600px) {
  .memory-science .ms-grid { grid-template-columns: 1fr; }
  .comeback { flex-direction: column; gap: 6px; }
}

@media print {
  .memory-science, .pretest, .recall-ladder, .memory-hook,
  .feynman-check, .comeback, .link-now { break-inside: avoid; border-color: #888; }
  /* 印刷時はヒント・解答を開いた状態で出す */
  .pretest details > div,
  .recall-ladder details > .rl-body,
  .feynman-check details > div { display: block !important; }
  .pretest summary::before,
  .recall-ladder summary::before,
  .feynman-check summary::before { content: ""; }
}

/* ============================================================
   理解フレームコンポーネント
   「社会の動き方」を時代の流れ・地理・身分支配・経済で捉える
   横糸＝時代 × 縦糸＝テーマ史（土地/武士/権力/対外）
   ============================================================ */

/* --- 時代の見取り図：4レンズ俯瞰（支配者/経済/対外/変化） --- */
.era-frame {
  border: 2px solid #5a4100;
  border-radius: 10px;
  background: #fffdf7;
  padding: 12px 14px;
  margin: 14px 0;
}
.era-frame > h4 {
  margin: 0 0 8px;
  color: #5a4100;
  font-size: 15px;
}
.era-frame > h4::before { content: "🗺 "; }
.era-frame .ef-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.era-frame .ef-cell {
  background: #fff;
  border: 1px solid #d9c69a;
  border-top: 4px solid #b07820;
  border-radius: 6px;
  padding: 7px 10px;
}
.era-frame .ef-cell .ef-label {
  font-size: 11.5px;
  font-weight: bold;
  color: #8a6a1a;
  display: block;
  margin-bottom: 3px;
}
.era-frame .ef-cell.ef-ruler  { border-top-color: #b03030; }
.era-frame .ef-cell.ef-ruler .ef-label::before  { content: "👑 "; }
.era-frame .ef-cell.ef-econ   { border-top-color: #b07820; }
.era-frame .ef-cell.ef-econ .ef-label::before   { content: "💰 "; }
.era-frame .ef-cell.ef-foreign{ border-top-color: #2a7a8a; }
.era-frame .ef-cell.ef-foreign .ef-label::before{ content: "🌏 "; }
.era-frame .ef-cell.ef-change { border-top-color: #5a7a3a; }
.era-frame .ef-cell.ef-change .ef-label::before { content: "🔄 "; }
.era-frame .ef-cell .ef-text { font-size: 12.5px; line-height: 1.5; color: #3a3020; }

/* --- 縦糸テーマ史：全体地図（目次直後） --- */
.thread-overview {
  border: 2px solid #3a5a8a;
  border-radius: 10px;
  background: linear-gradient(135deg, #eef3fb 0%, #e3ecf8 100%);
  padding: 16px 20px;
  margin: 18px 0;
}
.thread-overview > h3 { margin: 0 0 4px; color: #234a72; font-size: 17px; }
.thread-overview > h3::before { content: "🧵 "; }
.thread-overview .to-lead { font-size: 13px; line-height: 1.65; color: #2a3a52; margin-bottom: 12px; }
.thread-overview .to-thread {
  background: #fff;
  border-radius: 7px;
  padding: 8px 12px;
  margin: 7px 0;
  border-left: 6px solid #3a5a8a;
}
.thread-overview .to-thread.th-a { border-left-color: #b07820; }
.thread-overview .to-thread.th-b { border-left-color: #b03030; }
.thread-overview .to-thread.th-c { border-left-color: #6b2d8a; }
.thread-overview .to-thread.th-d { border-left-color: #2a7a8a; }
.thread-overview .to-thread h4 { margin: 0 0 4px; font-size: 13.5px; color: #234a72; }
.thread-overview .to-thread .to-flow {
  font-size: 12px;
  line-height: 1.7;
  color: #444;
  font-family: var(--font-en), sans-serif;
}
.thread-overview .to-thread .to-flow b { color: #1a3a5a; }

/* --- 縦糸の現在地：単元内トラッカー --- */
.thread-tracker {
  background: #f5f8fc;
  border: 1px solid #aebfd6;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
}
.thread-tracker > .tt-head {
  font-size: 12.5px;
  color: #3a5a8a;
  font-weight: bold;
  margin-bottom: 6px;
}
.thread-tracker > .tt-head::before { content: "🧵 縦糸でみると、いまここ"; }
.thread-tracker .tt-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 6px 10px;
  align-items: baseline;
  margin: 4px 0;
  font-size: 12.5px;
}
.thread-tracker .tt-name {
  font-weight: bold;
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 3px;
  color: #fff;
  text-align: center;
}
.thread-tracker .tt-a .tt-name, .thread-tracker .tt-name.tt-a { background: #b07820; }
.thread-tracker .tt-b .tt-name, .thread-tracker .tt-name.tt-b { background: #b03030; }
.thread-tracker .tt-c .tt-name, .thread-tracker .tt-name.tt-c { background: #6b2d8a; }
.thread-tracker .tt-d .tt-name, .thread-tracker .tt-name.tt-d { background: #2a7a8a; }
.thread-tracker .tt-now { line-height: 1.5; color: #2a3a52; }
.thread-tracker .tt-now b { color: #b85020; }

/* --- 地理連動：なぜこの場所か --- */
.geo-why {
  background: #eaf6ec;
  border: 1px solid #4a9a64;
  border-left: 6px solid #2a7a3a;
  border-radius: 8px;
  padding: 11px 15px;
  margin: 14px 0;
}
.geo-why > h4 { margin: 0 0 6px; color: #1f5e2c; font-size: 14.5px; }
.geo-why > h4::before { content: "🗺 "; }
.geo-why p { font-size: 13px; line-height: 1.65; margin: 4px 0; color: #2a3a2a; }
.geo-why .gw-links { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.geo-why .gw-links a {
  background: #fff;
  border: 1.5px solid #2a7a3a;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: #1f5e2c;
  text-decoration: none;
}
.geo-why .gw-links a:hover { background: #2a7a3a; color: #fff; }

@media (max-width: 600px) {
  .era-frame .ef-grid { grid-template-columns: 1fr 1fr; }
  .thread-tracker .tt-row { grid-template-columns: 1fr; gap: 2px; }
  .thread-tracker .tt-name { justify-self: start; }
}

@media print {
  .era-frame, .thread-overview, .thread-tracker, .geo-why { break-inside: avoid; border-color: #888; }
}

/* --- 年表で深掘り：timeline.html の詳しい用語解説へ橋渡し --- */
.timeline-dive {
  background: linear-gradient(180deg, #fbf3df 0%, #f6e9c8 100%);
  border: 1.5px solid #b08850;
  border-left: 6px solid #876200;
  border-radius: 8px;
  padding: 11px 15px;
  margin: 14px 0;
}
.timeline-dive > h4 { margin: 0 0 4px; color: #6b4810; font-size: 14.5px; }
.timeline-dive > h4::before { content: "📜 "; }
.timeline-dive p { font-size: 12.5px; line-height: 1.6; color: #5a4a2a; margin: 0 0 8px; }
.timeline-dive .td-chips { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.timeline-dive .td-chips a {
  background: #fff;
  border: 1.5px solid #b08850;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12.5px;
  color: #6b4810;
  text-decoration: none;
}
.timeline-dive .td-chips a:hover { background: #876200; color: #fff; }
.timeline-dive .td-chips a.td-open {
  background: #876200;
  color: #fff;
  font-weight: bold;
}
.timeline-dive .td-chips a.td-open:hover { background: #6b4810; }

@media print {
  .timeline-dive { break-inside: avoid; border-color: #888; }
  .timeline-dive .td-chips { display: none; }
}

/* ============================================================
   地理 改訂コンポーネント
   場所→自然→産業→人の動きを、単元ごとに固定の読み方で支える
   ============================================================ */
.geo-memory {
  border-color: var(--c-geo);
  background: linear-gradient(135deg, #eef8f0 0%, #dff0e4 100%);
}
.geo-memory > h3 { color: var(--c-geo-dark); }
.geo-memory > h3::before { content: "🌏 "; }
.geo-memory .ms-card { border-color: #a8d8ba; border-left-color: var(--c-geo); }
.geo-memory .ms-card .ms-num { background: var(--c-geo); }
.geo-memory .ms-card h4 { color: var(--c-geo-dark); }

.geo-skill-map {
  border: 2px solid var(--c-geo);
  border-radius: 10px;
  background: #f7fcf8;
  padding: 14px 18px;
  margin: 18px 0;
}
.geo-skill-map > h3 {
  margin: 0 0 10px;
  color: var(--c-geo-dark);
  font-size: 17px;
}
.geo-skill-map > h3::before { content: "🧭 "; }
.geo-skill-map .gsm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 9px;
}
.geo-skill-map .gsm-grid div {
  background: #fff;
  border: 1px solid #b9dec4;
  border-radius: 7px;
  padding: 9px 11px;
}
.geo-skill-map b {
  display: block;
  color: var(--c-geo-dark);
  font-size: 13.5px;
  margin-bottom: 3px;
}
.geo-skill-map span {
  display: block;
  color: #3d4c40;
  font-size: 12.5px;
  line-height: 1.45;
}

.geo-frame {
  border: 2px solid var(--c-geo);
  border-radius: 9px;
  background: #f2faf4;
  padding: 12px 14px;
  margin: 14px 0;
}
.geo-frame > h4 {
  margin: 0 0 8px;
  color: var(--c-geo-dark);
  font-size: 15px;
}
.geo-frame > h4::before { content: "🗺 "; }
.geo-frame .gf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}
.geo-frame .gf-grid div {
  background: #fff;
  border: 1px solid #b9dec4;
  border-top: 4px solid var(--c-geo);
  border-radius: 6px;
  padding: 8px 10px;
  color: #2d3d31;
  font-size: 12.8px;
  line-height: 1.55;
}
.geo-frame .gf-grid span {
  display: block;
  color: var(--c-geo-dark);
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 3px;
}

.geo-decision {
  background: #eef8f0;
  border: 1px solid #8dc79c;
  border-left: 6px solid var(--c-geo);
  border-radius: 8px;
  padding: 11px 15px;
  margin: 14px 0;
}
.geo-decision > h4 {
  margin: 0 0 6px;
  color: var(--c-geo-dark);
  font-size: 14.5px;
}
.geo-decision > h4::before { content: "🎯 "; }
.geo-decision ul {
  margin: 6px 0 0 20px;
  padding: 0;
  font-size: 13px;
  line-height: 1.7;
}
.geo-decision li { margin: 3px 0; }
.geo-decision strong { color: var(--c-geo-dark); }

@media (max-width: 600px) {
  .geo-frame .gf-grid,
  .geo-skill-map .gsm-grid { grid-template-columns: 1fr; }
}

@media print {
  .geo-memory, .geo-skill-map, .geo-frame, .geo-decision {
    break-inside: avoid;
    border-color: #888;
  }
}

/* ============================================================
   公民 civics.html 理解フレームコンポーネント
   利害の対立→調整 / 6つの問い / しくみの見取り図 / 暮らしとつなぐ
   ============================================================ */
.civ-frame {
  border: 2px solid #4a1d63;
  border-radius: 10px;
  background: #fbf7ff;
  padding: 12px 14px;
  margin: 14px 0;
}
.civ-frame > h4 { margin: 0 0 8px; color: #4a1d63; font-size: 15px; }
.civ-frame > h4::before { content: "🗺 "; }
.civ-frame .cf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.civ-frame .cf-cell {
  background: #fff;
  border: 1px solid #cdb0e0;
  border-top: 4px solid #6b2d8a;
  border-radius: 6px;
  padding: 7px 10px;
}
.civ-frame .cf-cell .cf-label {
  font-size: 11.5px;
  font-weight: bold;
  color: #6b2d8a;
  display: block;
  margin-bottom: 3px;
}
.civ-frame .cf-cell.cf-who { border-top-color: #6b2d8a; }
.civ-frame .cf-cell.cf-who .cf-label::before { content: "👥 "; }
.civ-frame .cf-cell.cf-do { border-top-color: #2a7a8a; }
.civ-frame .cf-cell.cf-do .cf-label::before { content: "🏃 "; }
.civ-frame .cf-cell.cf-money { border-top-color: #b07820; }
.civ-frame .cf-cell.cf-money .cf-label::before { content: "💰 "; }
.civ-frame .cf-cell.cf-gainloss { border-top-color: #b03030; }
.civ-frame .cf-cell.cf-gainloss .cf-label::before { content: "⚖ "; }
.civ-frame .cf-cell .cf-text { font-size: 12.5px; line-height: 1.5; color: #3a2a44; }

.conflict-box {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  gap: 8px;
  background: #fff7ef;
  border: 1px solid #d49a40;
  border-radius: 8px;
  padding: 12px;
  margin: 14px 0;
  align-items: stretch;
}
.conflict-box .cb-title {
  grid-column: 1 / -1;
  font-weight: bold;
  color: #6b4810;
  font-size: 14px;
  border-bottom: 1px dashed #d49a40;
  padding-bottom: 4px;
  margin-bottom: 2px;
}
.conflict-box .cb-title::before { content: "⚖ 対立 → 調整："; }
.conflict-box .cf-side {
  background: #fff;
  border: 1.5px solid #c47;
  border-radius: 6px;
  padding: 7px 10px;
}
.conflict-box .cf-side.cf-a { border-color: #c0392b; }
.conflict-box .cf-side.cf-b { border-color: #2c6fbb; }
.conflict-box .cf-side h5 { margin: 0 0 4px; font-size: 12.5px; }
.conflict-box .cf-side.cf-a h5 { color: #c0392b; }
.conflict-box .cf-side.cf-b h5 { color: #2c6fbb; }
.conflict-box .cf-side p { font-size: 12px; line-height: 1.5; margin: 0; color: #444; }
.conflict-box .cf-vs {
  align-self: center;
  text-align: center;
  font-size: 13px;
  font-weight: bold;
  color: #b03030;
}
.conflict-box .cf-resolve {
  grid-column: 1 / -1;
  background: #eef6ec;
  border: 1px solid #4a9a64;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #1f5e2c;
}
.conflict-box .cf-resolve::before { content: "🤝 調整のしくみ："; font-weight: bold; }

.six-q {
  background: #f3ecf9;
  border: 1px solid #8a4ec0;
  border-left: 6px solid #6b2d8a;
  border-radius: 8px;
  padding: 11px 15px;
  margin: 14px 0;
}
.six-q > .sq-title {
  font-weight: bold;
  color: #4a1d63;
  font-size: 14px;
  margin-bottom: 6px;
}
.six-q > .sq-title::before { content: "🔍 6つの問いで分解： "; }
.six-q .sq-row {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 6px 10px;
  margin: 4px 0;
  align-items: start;
}
.six-q .sq-label {
  background: #6b2d8a;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  text-align: center;
}
.six-q .sq-text { font-size: 13px; line-height: 1.55; color: #36283f; }

.link-life {
  background: #eaf6ec;
  border: 1px solid #4a9a64;
  border-left: 6px solid #2a7a3a;
  border-radius: 8px;
  padding: 10px 15px;
  margin: 14px 0;
}
.link-life > h4 { margin: 0 0 4px; color: #1f5e2c; font-size: 14px; }
.link-life > h4::before { content: "🏠 自分の暮らしでいうと… "; }
.link-life p { font-size: 13px; line-height: 1.65; margin: 3px 0; color: #2a3a2a; }
.link-life strong { color: #1f5e2c; }

@media (max-width: 600px) {
  .civ-frame .cf-grid { grid-template-columns: 1fr 1fr; }
  .conflict-box { grid-template-columns: 1fr; }
  .conflict-box .cf-vs { transform: rotate(90deg); }
  .six-q .sq-row { grid-template-columns: 1fr; gap: 2px; }
  .six-q .sq-label { justify-self: start; }
}

@media print {
  .civ-frame, .conflict-box, .six-q, .link-life {
    break-inside: avoid;
    border-color: #888;
  }
}
