/* ===== Base ===== */
:root {
  --accent: #1a6dd4;
  --accent-light: #eef4fc;
  --accent-border: #bad4f5;
  --black: #222;
  --gray-dark: #444;
  --gray: #777;
  --gray-light: #ccc;
  --gray-bg: #fafafa;
  --warm-bg: #f9f8f6;
  --white: #fff;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --naze-color: #c0392b;
  --naze-bg: #fdf2f0;
  --naze-border: #f0c0b8;
  --rekiso-color: #2e7d32;
  --rekiso-bg: #f0f7f0;
  --rekiso-border: #a5d6a7;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--black);
  background: var(--warm-bg);
  line-height: 1.95;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 760px; margin: 0 auto; padding: 32px 20px 80px; }

/* ===== Breadcrumb ===== */
.breadcrumb { font-size: 12px; color: var(--gray); margin-bottom: 24px; }
.breadcrumb a { color: var(--gray-dark); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

/* ===== Article Card ===== */
.article-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 36px 48px;
  margin-bottom: 20px;
}
@media (max-width: 640px) { .article-card { padding: 28px 18px 36px; } }

/* ===== Header ===== */
.article-header { margin-bottom: 40px; }
.article-chapter {
  display: inline-block; font-size: 12px; font-weight: 700;
  color: var(--white); background: var(--accent);
  padding: 3px 12px; border-radius: 3px;
  letter-spacing: 0.08em; margin-bottom: 12px;
}
.article-header h1 { font-size: 28px; font-weight: 900; line-height: 1.5; margin-bottom: 20px; }
.article-lead { font-size: 15.5px; color: var(--gray-dark); line-height: 2; }

/* ===== TOC ===== */
.toc { background: var(--gray-bg); border-radius: var(--radius); padding: 24px 28px; margin-bottom: 44px; }
.toc-title { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--gray); margin-bottom: 12px; }
.toc ol { padding-left: 20px; }
.toc li { margin-bottom: 4px; font-size: 14px; line-height: 1.8; }
.toc a { color: var(--black); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* ===== Key Points ===== */
.key-points {
  background: var(--accent-light); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 48px;
  border: 1px solid var(--accent-border);
}
.key-points-title {
  font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 10px;
}
.key-points ul { padding-left: 20px; margin: 0; }
.key-points li { font-size: 14.5px; line-height: 1.8; margin-bottom: 4px; }

/* ===== Section ===== */
.section { margin-bottom: 48px; }
.section h2 {
  font-size: 20px; font-weight: 900; color: var(--black);
  margin-bottom: 24px; padding-bottom: 10px;
  border-bottom: 2px solid var(--black);
  display: flex; align-items: center; gap: 10px;
}
.section h2 .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent); color: var(--white);
  font-size: 15px; font-weight: 700; border-radius: 50%; flex-shrink: 0;
}
.section h3 {
  font-size: 17px; font-weight: 700; margin-top: 32px; margin-bottom: 14px;
  padding-left: 14px; border-left: 4px solid var(--accent);
}
.section p { margin-bottom: 18px; }
.section ul, .section ol { margin-bottom: 18px; padding-left: 24px; }
.section li { margin-bottom: 6px; }
.kw { color: var(--accent); font-weight: 700; }

/* ===== Table ===== */
table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 14px; }
th, td { padding: 10px 14px; border: 1px solid #ddd; text-align: left; line-height: 1.6; }
th { background: var(--black); color: var(--white); font-weight: 600; font-size: 13px; }
tr:nth-child(even) { background: #f7f7f5; }

/* ===== Timeline ===== */
.timeline {
  margin: 28px 0; padding: 24px;
  background: var(--gray-bg); border-radius: var(--radius);
  border: 1px solid #e0deda;
}
.timeline h4 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.timeline-bar {
  display: flex; align-items: stretch;
  border-radius: 6px; overflow: hidden;
  font-size: 12px; font-weight: 600;
  margin-bottom: 12px;
  min-height: 36px;
}
.timeline-bar > div {
  display: flex; align-items: center; justify-content: center;
  padding: 6px 8px; color: var(--white);
  text-align: center; line-height: 1.3;
}
.timeline-label {
  font-size: 11px; color: var(--gray-dark);
  display: flex; justify-content: space-between;
  margin-top: 4px;
}

/* ===== Boxes ===== */
.box-c {
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  margin: 28px 0;
}
.box-c .box-title {
  font-size: 16px; font-weight: 900; color: var(--accent); margin-bottom: 10px;
}
.box-c p, .box-c ul { font-size: 15px; line-height: 1.9; margin-bottom: 8px; }
.box-c ul { padding-left: 20px; }
.box-c li { margin-bottom: 4px; }
.box-c-gray { border-left-color: var(--gray); }
.box-c-gray .box-title { color: var(--gray-dark); }

/* ===== なぜ？ Box ===== */
.naze-box {
  margin: 28px 0; padding: 20px 24px;
  background: var(--naze-bg);
  border: 1px solid var(--naze-border);
  border-radius: var(--radius);
}
.naze-box .naze-title {
  font-size: 15px; font-weight: 700; color: var(--naze-color);
  margin-bottom: 12px;
}
.naze-box .naze-title::before { content: "なぜ？ "; font-size: 14px; }
.naze-chain {
  display: flex; flex-direction: column; gap: 0; margin: 12px 0;
}
.naze-chain .chain-item {
  padding: 10px 16px;
  background: var(--white);
  border: 1px solid var(--naze-border);
  border-radius: 6px;
  font-size: 14px; line-height: 1.7;
}
.naze-chain .chain-arrow {
  text-align: center;
  font-size: 18px;
  color: var(--naze-color);
  line-height: 1;
  padding: 2px 0;
}
.naze-box p { font-size: 14.5px; line-height: 1.85; margin-bottom: 8px; }
.naze-box .naze-source { font-size: 12px; color: var(--gray); margin-top: 8px; }

/* ===== 発展 Box ===== */
.hatten-box {
  margin: 28px 0; padding: 20px 24px;
  background: linear-gradient(135deg, #f8f6ff 0%, #f0edff 100%);
  border: 1px solid #d4cef5;
  border-radius: var(--radius);
}
.hatten-box .hatten-title {
  font-size: 14px; font-weight: 700; color: #5b4fa8;
  margin-bottom: 10px;
}
.hatten-box p { font-size: 14.5px; line-height: 1.85; margin-bottom: 8px; }
.hatten-box p:last-child { margin-bottom: 0; }

/* ===== 歴史総合リンク ===== */
.rekiso-box {
  margin: 28px 0; padding: 16px 20px;
  background: var(--rekiso-bg);
  border: 1px solid var(--rekiso-border);
  border-radius: var(--radius);
}
.rekiso-box .rekiso-title {
  font-size: 13px; font-weight: 700; color: var(--rekiso-color);
  margin-bottom: 6px;
}
.rekiso-box p { font-size: 14px; line-height: 1.8; margin-bottom: 0; }

/* ===== 章の要約 ===== */
.chapter-summary-box {
  margin: 36px 0;
  padding: 20px 24px;
  background: var(--accent-light);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
}
.chapter-summary-box .cs-label {
  font-size: 16px; font-weight: 900; color: var(--accent);
  margin-bottom: 12px;
}
.chapter-summary-box p {
  font-size: 15px; line-height: 2; font-weight: 500;
}

/* ===== 史料引用ボックス ===== */
.source-box {
  margin: 28px 0; padding: 20px 24px;
  background: #f5f0e8;
  border-radius: var(--radius);
  border: 1px solid #d4c9b0;
}
.source-box .source-title {
  font-size: 13px; font-weight: 700; color: #8b7355; margin-bottom: 10px;
}
.source-box blockquote {
  font-size: 15px; font-style: italic; line-height: 1.9;
  margin: 0 0 8px 0; padding-left: 16px;
  border-left: 3px solid #c4a97d;
}
.source-box .source-meta {
  font-size: 13px; color: var(--gray); line-height: 1.6;
}

/* ===== 切り口で整理 ===== */
.kirikuchi { margin: 36px 0; }
.kirikuchi h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
  padding-left: 14px; border-left: 4px solid var(--accent);
}
.kirikuchi-item {
  margin-bottom: 24px; padding: 18px 20px;
  background: var(--gray-bg); border-radius: var(--radius); border-left: 3px solid var(--accent);
}
.ki-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.ki-prefix { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.05em; }
.kirikuchi-item .ki-q { font-size: 16px; font-weight: 700; line-height: 1.6; }
.ki-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 3px;
  border: 1px solid var(--accent-border); color: var(--accent);
  background: var(--accent-light);
}

/* ===== Term Tooltip ===== */
.term { border-bottom: 1px dotted var(--gray); cursor: help; position: relative; }
.term:hover::after {
  content: attr(data-def);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--black); color: var(--white);
  padding: 8px 14px; border-radius: 6px; font-size: 13px;
  max-width: 280px; white-space: normal; z-index: 10; line-height: 1.6;
  box-shadow: var(--shadow-md); font-weight: 400;
}

/* ===== つながりマップ ===== */
.connection-list { list-style: none; padding-left: 0 !important; }
.connection-list li {
  padding: 14px 18px; margin-bottom: 10px;
  background: var(--gray-bg); border-radius: 6px;
  font-size: 14.5px; line-height: 1.8;
  border-left: 3px solid var(--accent);
}
.connection-list li strong { color: var(--accent); }

/* ===== Summary ===== */
.summary { border: 2px solid var(--black); border-radius: var(--radius); padding: 28px; margin: 36px 0; }
.summary h3 { border: none; padding: 0; margin-top: 0; margin-bottom: 16px; font-size: 16px; font-weight: 900; }
.summary ul { padding-left: 20px; }
.summary li { margin-bottom: 6px; font-size: 15px; }

/* ===== Quiz ===== */
.quiz { background: var(--gray-bg); border-radius: var(--radius); padding: 28px; margin: 36px 0; }
.quiz h3 { border: none; padding: 0; margin-top: 0; font-size: 16px; font-weight: 900; margin-bottom: 20px; }
.quiz-item { margin-bottom: 20px; }
.quiz-item p { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.quiz-answer {
  background: var(--white); border: 1px solid #e0deda; border-radius: 6px;
  padding: 12px 16px; font-size: 14px; cursor: pointer; line-height: 1.7; transition: all 0.15s;
}
.quiz-answer:hover { border-color: var(--accent); background: var(--accent-light); }
.quiz-answer .answer-text { display: none; }

/* ===== 入試問題 ===== */
.mondai {
  margin: 28px 0; padding: 24px;
  border: 1px solid #e0deda; border-radius: var(--radius);
  background: var(--white);
}
.mondai-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid #e0deda;
}
.mondai-number { font-size: 18px; font-weight: 900; color: var(--black); margin-right: 8px; }
.level-badge {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 3px;
  letter-spacing: 0.05em; margin-right: 8px;
}
.level-a { background: var(--accent); color: var(--white); }
.level-b { background: var(--black); color: var(--white); }
.level-c { background: var(--gray-dark); color: var(--white); }
.tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 3px;
  border: 1px solid var(--gray-light); color: var(--gray-dark);
  margin-left: 6px; vertical-align: middle;
}
.mondai-body { margin-bottom: 20px; }
.mondai-body p { margin-bottom: 12px; line-height: 1.9; font-size: 15px; }
.mondai-body .choices { padding-left: 8px; margin: 12px 0; list-style: none; }
.mondai-body .choices li { margin-bottom: 6px; padding-left: 0; line-height: 1.8; font-size: 15px; }
.mondai-body .sub-q { margin-top: 16px; padding-left: 4px; }
.mondai-body .sub-q p { font-size: 15px; }
.mondai-body table { margin: 16px 0; }
.mondai-answer {
  background: var(--gray-bg); border-radius: 6px;
  padding: 14px 18px; cursor: pointer; transition: all 0.15s;
}
.mondai-answer:hover { background: var(--accent-light); }
.mondai-answer .answer-content { display: none; }
.mondai-answer .answer-prompt { color: var(--gray); font-size: 13px; }
.answer-box, .explain-box {
  margin-top: 16px; padding: 16px;
  background: var(--white); border-radius: 6px;
  border: 1px solid #e0deda;
}
.answer-label {
  font-size: 13px; font-weight: 700; color: var(--accent);
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 2px solid var(--accent); display: inline-block;
}
.explain-label {
  font-size: 13px; font-weight: 700; color: var(--gray-dark);
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 2px solid var(--gray-light); display: inline-block;
}
.answer-box p, .explain-box p { font-size: 15px; line-height: 1.9; margin-bottom: 8px; }
.answer-box p:last-child, .explain-box p:last-child { margin-bottom: 0; }
.scoring-points {
  margin-top: 12px; padding: 12px 16px;
  border-left: 3px solid var(--accent);
  font-size: 14px; line-height: 1.8;
}
.scoring-points strong { color: var(--accent); display: block; margin-bottom: 4px; }
.scoring-points ul { padding-left: 20px; margin: 0; }
.scoring-points li { margin-bottom: 2px; }

/* ===== Nav ===== */
.page-nav { display: flex; justify-content: space-between; margin-top: 32px; font-size: 14px; }
.page-nav a {
  color: var(--gray-dark); text-decoration: none;
  padding: 10px 16px; border: 1px solid var(--gray-light); border-radius: 6px; transition: all 0.15s;
}
.page-nav a:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Impact Box ===== */
.impact-box {
  border-left: 4px solid #27ae60;
  padding: 16px 20px;
  margin: 28px 0;
}
.impact-title {
  font-size: 14px; font-weight: 700; color: #1e8449; margin-bottom: 10px;
}
.impact-box ul { padding-left: 20px; }
.impact-box li { font-size: 15px; line-height: 1.9; margin-bottom: 6px; }

/* ===== Image ===== */
.figure { text-align: center; margin: 28px 0; }
.figure img { max-width: 100%; border-radius: 6px; box-shadow: var(--shadow-sm); }
.figure-caption { font-size: 12.5px; color: var(--gray); margin-top: 10px; line-height: 1.6; }
