/* ─── 全体レイアウト ── */

body {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-areas:
  "header header"
  "hero   hero"
  "main   sidebar"
  "footer footer";
  grid-template-columns: 1fr 320px;
  grid-template-rows: auto auto 1fr auto;
  gap: 1rem 2rem;
  min-height: 100vh;
  font-family: 'Rounded M+ 1c', sans-serif;
  font-size: 19px; /* PC時のフォントサイズ */
  overflow-x: hidden;  /* 横スクロールを強制的に無効化 */

}

/* PC のときだけ body の幅を広げる */
@media screen and (min-width: 1024px) {
  body {
    max-width: 1200px;
  }
}
/* ─── チェックリスト行間 ─────── */
/* ─── チェックリスト行間 ─────── */

.check-form {
  background-color: #f1f4f6; /* やさしいグリーン */
  border: 1px solid #b2dfdb; /* 薄いミント色の枠線 */
  border-radius: 10px; /* 角丸 */
  padding: 1em;
  margin: 1em 0;
}

.check-form label {
  display: block;
  padding: 0.5em 0;
  font-size: 1em;
}


/* ─── 画像 ─────── */

img {
  max-width: 100%;
  height: auto;
  margin-top: 1em;
  margin-bottom: 0.5em;
}
/* ─── 一般のテーブル ─────── */

  table.simple-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
  }

  table.simple-table th,
  table.simple-table td {
    border: 1px solid #ccc;
    padding: 0.5em;
    text-align: left;
  }

  table.simple-table th {
    background-color: #f2f2f2;
    font-weight: bold;
  }
/* ─── ヘッダー ─────── */

header {
  grid-area: header;
  background: #0097d3;
  color: #fff;
  text-align: center;
  padding: 5em 1em;
  position: relative;
  overflow: visible;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  box-sizing: border-box;
}

/* ─── 見出しスタイル ── */

header h1 {
  margin: 0;
  font-size: 1.5em;
}

header p {
  margin: 0.3em 0 0;
}

.styled_h2 {
  display: flex;
  align-items: center;
  font-size: 1.3em;
  color: #37474F;
  margin: 1.5em 0 1em;
  padding-bottom: 0.25em;
  border-bottom: 4px solid #0097d3;
}

.styled_h2 .sec-number {
  color: #0097d3;
  font-weight: bold;
  margin-right: 0.2em;
  white-space: nowrap;
}


.styled_h3 {
  font-size: 1.1em;
  color: #0a578c;
  margin-top: 2em;
}

/* ── ヒーロー（動画） ─────── */
.hero {
  grid-area: hero;
  position: relative;
  padding: 2em 0;
}
.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0; right: 0;
  height: 20%;
  /*background: #3aa100;*/
  z-index: 0;
}
.video-container {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin-top: -10%;
}
.video-container iframe {
  width: 100%;
  max-width: 860px;
  aspect-ratio: 860 / 514;
  /*border: 6px solid #00BCD4;*/
  border-radius: 8px;
  box-sizing: border-box;
  display: block;
}
/* ─── ふりがな ─────── */

rt {
  font-size: 0.6em;
}
.hide-ruby rt {
  display: none;
}

.ruby-toggle {
  display: inline-block;
  margin-bottom: 1em;
  padding: 0.75em 1.5em;
  background: #0a578c;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1em;
  line-height: 1.4;
}

.ruby-toggle:hover {
  background: #3aa100;
  color: #fff;
  opacity: 0.9; /* 少しだけ透明度を出して軽やかに */
}

/* ─── メイン ─────── */
main {
  grid-area: main;
  padding: 1.5em;
  background: #fff;
  /* 本文行間 */
  line-height: 1.8;
}

main p {
  margin-bottom: 1em;
}

/* ─── 鍵 ─────── */

.chapter-list a.locked {
  background: #eee;
  color: #aaa;
  pointer-events: none;
  border: 1px dashed #ccc;
}
/* ─── 各ページのリンクボタン制御 ─────── */
.chapter-link {
  transition: opacity 0.3s ease;
}

.chapter-link[style*="pointer-events: none"] {
  cursor: not-allowed;
}

/* ─── サイドエリア ── */

.toc {
  grid-area: sidebar;
  background:  #fff;/* #f1f4f6;*/
  border-radius: 8px;
  font-size: 18px;
  position: sticky;
  top: 1em;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  z-index: 0; /* ★ これを追加！ */
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding-bottom: 2em;
}


/* ─── 理解度チェックへ ── */

.chapter-progress {
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  padding: 1em;
  background: #fffbe0;
  border: 2px solid #f6a13c;
  border-radius: 12px;
  font-size: 0.95em;
  text-align: center;
  margin-bottom: 0.5em;
  position: relative;
  background: rgba(255, 255, 0, 0.3); /* 仮の背景色 */
  border: 2px dashed red;
}

/* ─── 目次 ── */

.chapter-progress2 {
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  padding: 1em;
  background: #f1f4f6;
  border: 2px solid #0a578c;
  border-radius: 12px;
  font-size: 0.95em;
  margin-bottom: 1.5em;
  position: relative;
  /*border: 2px dashed red;*/
}

@media (max-width: 600px) {
  .toc {
    padding: 0 1em;
  }
  .chapter-progress {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .chapter-progress2 {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

}
.chapter-progress p {
  margin: 0 0 0.8em 0;
  line-height: 1.4;
}

.chapter-progress a {
  display: inline-block;
  margin: 0.2em 0.4em;
  padding: 0.5em 1em;
  font-weight: bold;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9em;
}

.chapter-progress .quiz-button {
  background-color: #3aa100;
  color: white;
}

.chapter-progress .quiz-button:hover {
  background-color: #318400;
}

.chapter-progress .toc-link {
  background-color: #eee;
  color: #444;
}

.chapter-progress .toc-link:hover {
  background-color: #ccc;
}


/* ── 目次（TOC） ── */

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;

}

.toc-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}


.toc-header h2 {
  margin: 0;
  padding-left: 1em;
  font-size: 1.2em;
  color: #0a578c;
}


/* ── ツリー構造 ── */
.toc-list {
  list-style: none;
  margin: 0;
  margin-left: auto;
  margin-right: auto;
  width: fit-content;
  padding: 0 0 0 2.5em;
  counter-reset: toc;
  /*border-left: 2px solid #cfd8dc;*/
  
    position: relative;/*mikiadd*/
  padding-left: 2em; /* 番号分の余白だけ親にとっておく */
}

/*文字部分*/
.toc-list li {
  counter-increment: toc;
  position: relative;
  margin: 0.75em 0;
}

/*番号バッジ*/
.toc-list li::before {
  content: counter(toc);
  position: absolute;
  left: -2em; /* ←親に対して固定、はみ出さない範囲 */
  top: 50%;
  transform: translateY(-50%);
  width: 1.6em;
  height: 1.6em;
  line-height: 1.6em;
  text-align: center;
  background: #fff;
  border: 2px solid #0a578c;
  border-radius: 50%;
  color: #0a578c;
  font-size: 0.9em;
  font-weight: bold;
  z-index: 2;
}

/*横棒*/
.toc-list li::after {
  content: "";
  position: absolute;
  left: -0.3em;;
  top: 50%; /* ← バッジの中央に揃える */
  transform: translateY(-50%); /* ← 垂直方向に中央揃え */
  width: 0.6em;
  height: 2px;
  background: #cfd8dc;
  z-index: 1;
}
/*縦棒*/
.toc-list::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 1em; /* ← バッジの中央に合わせる（必要なら微調整） */
  width: 2px;
  background: #cfd8dc;
  z-index: 0;
}

.toc-list a {
  display: block;
  padding: 0.25em 0.5em;
  color: #0a578c;
  text-decoration: none;
  line-height: 1.4;
  word-break: break-word;
  width: 100%;
  box-sizing: border-box;
}

.toc-list a:hover {
  text-decoration: none;
}

.toc-list li.active > a {
  background: #fff;
  border-radius: 4px;
  color: #0a578c;
}

/* li 自身をハイライト */
.toc-list li.active {
  background: #fff;
  border-radius: 4px;
  position: relative;
  z-index: 1;
}

.toc-list li.active > a {
  color: #0a578c;
}

.toc-list li.active::before {
  background: #0a578c;
  color: #fff;
  border-color: #00bcd4;
}


/* ── フッター ── */
footer {
  grid-area: footer;
  background: #f3f9ff;
  text-align: center;
  padding: 1em;
  border-top: 2px solid #ddd;
  font-size: 0.9em;
  color: #666;
}

/* ─── 背景色 ─────── */
.yellow-text {
  background-color: #fff9cc; /* やわらかい黄色 */
  padding: 1em;
  border-radius: 8px;
  margin-bottom: 1.5em;
}
.yellow-text h3 {
  font-size: 1.0em;
  margin-top: 0;
  margin-bottom: 0.3em;
  color: #997100; /* やや落ち着いた黄色系の文字色 */
  text-align: center; /* 中央寄せ */
}
.yellow-text ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.yellow-text ul li {
  padding: 0.5em 0;
  border-bottom: 1px solid #ffe89c;
}
.yellow-text ul li:last-child {
  border-bottom: none;
}

/*青*/
.blue-text {
  background-color: #f0f8ff;
  padding: 1em;
  border-radius: 8px;
  margin-bottom: 1.5em;
}
.blue-text h3 {
  font-size: 1.2em;
  margin-bottom: 0.7em;
  /*padding-left: 20px;*/
  color: #0a578c;
  /*border-left: 6px solid #0a578c;*/

}
/* ── 見出し ── */
.blue-text h3 {
  font-size: 1.0em;
  margin-top: 0;
  margin-bottom: 0.3em;
  color: #0a578c;
}

/* ── リスト ── */
.blue-text ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* li に直接下線 */
.blue-text ul li {
  padding: 0.5em 0;                  /* お好みの上下余白 */
  border-bottom: 1px solid #cce5f5; /* 下線の太さ・色 */
}

/* 最後の項目は線を消す */
.blue-text ul li:last-child {
  border-bottom: none;
}

/* ─── もどるボタン ─────── */

.button-large {
  display: inline-block;
  padding: 1em 2em;
  background-color: #0097d3;
  color: white;
  font-size: 1.1em;
  font-weight: bold;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.button-large:hover {
  background-color: #0075c1;
  transform: translateY(-2px);
}

/* ─── 雲の枠スタイル ─────── */
.cloud-box {
  box-sizing: border-box;    /* padding を含めた幅計算 */
  width: 100%;               /* 親要素いっぱいに */
  max-width: 100%;           /* それ以上にはならない */
  overflow-wrap: break-word; /* 長い文字列も折り返す */
  word-break: break-word;
  /* 元々のスタイル */
  background: #fffaf0;
  padding: 0.8em 1.5em;
  border-radius: 2em;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
  margin: 1em 0;
  border: 2px solid #0a578c;
}
/* ── 雲見出し ── */

.cloud-box h3 {
  font-size: 1.0em;
  margin-top: 0;
  margin-bottom: 0.3em;
  color: #0a578c;
}

/* ── 雲リスト ── */

/* .cloud-box 内のリストだけに適用 */
.cloud-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* li に直接下線 */
.cloud-box ul li {
  padding: 0.5em 0;                  /* お好みの上下余白 */
  border-bottom: 1px solid #cce5f5; /* 下線の太さ・色 */
}

/* 最後の項目は線を消す */
.cloud-box ul li:last-child {
  border-bottom: none;
}


/*まとめボックス*/
.box {
  /*font-size: 18px; !important;*/
  border: 2px solid #0075c1;
  background-color: #fff8e7;
  padding: 20px;
  border-radius: 12px;
  margin: 30px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.box h2 {
  font-size: 1.2em;
  margin-bottom: 0.7em;
  padding-left: 20px;
  color: #0075c1;
  border-left: 6px solid #0075c1;
}

/* === ポイントテーブルスタイル === */
.point-box {
  border: 3px solid #0a578c;
  border-radius: 12px;
  background: #fffaf0; /* ← テーブルと同じ背景にする */
  overflow: hidden;
  width: 100%;
  margin: 1em 0;
}

/* タイトル部分だけ上を丸くする */
.point-title {
  background: #0097d3;
  color: white;
  font-size: 1.2em;
  padding: 0.8em 1em;
  border-bottom: 1px solid #0a578c;
}

/* テーブル本体 */
.point-table {
  width: 100%;
  border-collapse: collapse;
  background: #fffaf0;
}

.point-table td {
  border-bottom: 1px solid #cce5f5;
  padding: 0.4em 1em; /* ← 上下を少し縮める */
  font-size: 1em;
  line-height: 1.6;

  /* 幅を超えたらどこでも折り返す */
  white-space: normal;
  word-break: break-all;
  overflow-wrap: normal;
}
.point-table tr:first-child td {
  border-top: none;
}

.point-table tr:last-child td {
  border-bottom: none;
}

/* === クイズ・選択ボタン系 === */

.result {
  font-size: 18px;
  font-weight: bold;
  margin-top: 10px;
}

.quiz-answer {
  margin-top: 1em;
  font-weight: bold;
  font-size: 1em;
}

.quiz-answer.correct {
  color: green;
}

.quiz-answer.incorrect {
  color: red;
}

.quiz-buttons button {
  display: block;
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 18px;
  text-align: center;
  margin: 16px auto;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  background-color: #0097d3;
  color: #fff;
}

.quiz-buttons button:hover {
  background-color: #ff914d;
}

/* === 吹き出しスタイル === */
.chat {
  display: flex;
  align-items: flex-start;
  margin: 1em 0;
}

.chat.left {
  flex-direction: row;
}

.chat.right {
  flex-direction: row-reverse;
}

.icon {
  width: 64px;
  height: 64px;
  border-radius: 0;
  margin: 0 10px;
}

.bubble {
  max-width: 90%;
  background: #f1f4f6;
  padding: 1.2em 1.5em; /* ← ここがポイント */
  border-radius: 15px;
  position: relative;
  font-size: 0.95em;
  line-height: 1.6;
  border: 2px dashed #0097d3; /* ← 一時確認用 */
}

/* 吹き出しの矢印（左） */
.chat.left .bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 10px;
  border: 10px solid transparent;
  border-right-color: #f0f0f0;
}

/* 吹き出しの矢印（右） */
.chat.right .bubble::before {
  content: "";
  position: absolute;
  right: -10px;
  top: 10px;
  border: 10px solid transparent;
  border-left-color: #f0f0f0;
}

/* クイズ結果表示エリア*/
<div id="quiz-result" style="margin-top: 2em;"></div>
#quiz-result {
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin-top: 2em;
}

.result-area {
  text-align: center;
  margin-top: 2em;
  padding: 1.5em;
  font-size: 1em;
  background: #fffaf0; /* 雲っぽい淡い水色 */
  border-radius: 2em; /* 角を丸く＝雲っぽさのコツ */
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05); /* ふわっとした影 */
  list-style-type: none;
  margin: 1em 0;
  border: 2px solid  #0097d3;

/*
  text-align: center;
  margin-top: 2em;
  padding: 1.5em;
  background-color: #f9f9f9;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
  font-size: 1em;
  */
}

.result-area h2 {
  font-size: 1.2em;
  text-align: center;
  color: #3aa100;
  margin-bottom: 0.5em;
}

.result-area p {
  font-size: 0.95em;
  margin-bottom: 1em;
}

.result-area a {
  display: inline-block;
  margin-top: 1em;
  font-size: 0.9em;
  text-decoration: none;
  background-color: #3aa100;
  color: white;
  padding: 0.6em 1.2em;
  border-radius: 8px;
  font-weight: bold;
}

/**/

.quiz-answer {
  text-align: center;
  margin-top: 1em;
}
/* === 画像レイアウト === */

.image-grid {
  display: grid;
  /*grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));*/
  grid-template-columns: repeat(2, 1fr); /* ← 横2列に固定！ */
  gap: 1em;
  max-width: 800px;
  margin: 0 auto;
}

.image-grid figure {
  margin: 0;
  text-align: center;
}

.image-grid img {
  width: 100%;
  border-radius: 12px;
}

.image-grid figcaption {
  margin-top: 0.5em;
  font-size: 0.9em;
  color: #444;
}

/* === フッダーレイアウト🌟 === */

footer {
  background: #f1f4f6;
  color: #0a578c;
  text-align: center;
  padding: 2em 1em;
  position: relative;
  overflow: visible;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  box-sizing: border-box;
  border-top: 1px solid #ccc;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}

.footer-logo {
  width: 120px;
  height: auto;
  margin-bottom: 1em;
}

.footer-links a {
  color: #0a578c;
  text-decoration: none;
  margin: 0 0.5em;
}

.footer-links a:hover {
  text-decoration: underline;
}

.copyright {
  font-size: 0.85em;
  margin-top: 1em;
  color: #777;
}
/* === フッダー各ページ用追加 === */

footer .chapter-nav {
  font-size: 0.85em; /* または 14px などでもOK */
  text-align: center;
  margin-bottom: 12px;
  margin-bottom: 0.5em;
  line-height: 1.8; /* ← ここを追加！ */

}

footer .chapter-nav a {
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  background-color: #3aa100;
  /*margin: 0 0.3em;*/
  padding: 0.3em 0.6em;
  text-decoration: none;
  border-radius: 0.5em;
  transition: background-color 0.3s;
  display: inline-block; /* 安定表示 */
  margin: 4px 6px;        /* ← 縦方向にも少し余白を追加 */
}

footer .nav-links {
  margin-bottom: 3em;
}

footer .nav-links a:hover {
  background-color: #ef6c00;
}
footer .chapter-nav a:hover {
  background-color: #e0f0ff;
  text-decoration: underline;
}

footer .chapter-nav a.active {
  background-color: #0077cc;
  color: #fff;
  font-weight: bold;
}

/* ── レスポンシブ調整（768px 以下） ────────────── */
@media screen and (max-width: 768px) {
  body {
    grid-template-areas:
      "header"
      "hero"
      "sidebar"
      "main"
      "footer";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    font-size: 19px;
    max-width: 96%;

  }
  /* 見出しサイズ ─────*/
  header h1 {
    margin: 0;
    font-size: 1.3em;
  }
  header p {
    margin: 0.1em 0 0;
  }
  .styled_h2 {
    font-size: 1.2em;
  }
  /* ヒーロー ─────*/
  .hero {
    position: static;
    width: 100%;
    padding: 0 0 0; /* 上を少し狭くして動画を上寄せに */
    box-sizing: border-box;
  }
  .video-container {
    margin-top: 0;/*-2em;*/
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
  }

  .video-container iframe,
  .video-container #youtube-player {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 8;
    display: block;
  }

  /* 目次 ─────*/
  .toc {
    /*margin: 1em auto;*/
    /*padding: 1em 1.2em;*/
    /*max-width: 90%;*/
    box-sizing: border-box;
    position: static !important;
    top: auto !important;
    align-self: auto !important;
  }

  header, main, footer {
    padding: 1em;
  }
}
