/* =========================================================
   Web担当者のガイドブック — main.css
   - 古書(古い洋書 / 革表紙 / 古紙)を意識した暖色アンティーク UI
   - パレット: 古紙 #f4ead5 / 古革 #2a1b0d-#3e2c1c / 沈墨 #7a3e1f / 古金 #d4b878-#a37d2c
   - モバイルファースト、PC では 2 カラム(サイドバー + 本文)
   - 本文フォント:Noto Sans JP(意図的に古書テーマでも変更しない)
   ========================================================= */

/* ----- 0. リセット & 基本 ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}
body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  color: #3e2c1c;
  background: #f4ead5;
  /* 古紙風の極薄テクスチャ(放射状の濃淡) */
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(255, 251, 235, 0.55), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(122, 62, 31, 0.05), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "palt";
}
img,
svg {
  max-width: 100%;
  height: auto;
}
a {
  color: #7a3e1f;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover {
  color: #5a2c14;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  padding: 0.5rem 1rem;
  background: #2a1b0d;
  color: #f0e5cd;
  text-decoration: none;
  z-index: 100;
}
.skip-link:focus {
  top: 0;
}

/* ----- 1. ヘッダー ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #2a1b0d;
  color: #ede2c8;
  border-bottom: 1px solid #3e2c1c;
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
}
.site-header__brand {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.site-header__brand a {
  color: inherit;
  text-decoration: none;
}
.site-header__nav {
  display: none;
}
.site-header__nav ul {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin: 0 0 0 auto;
  padding: 0;
  font-size: 0.875rem;
}
.site-header__nav a {
  color: #ede2c8;
  text-decoration: none;
}
.site-header__nav a:hover {
  color: #d4b878;
  text-decoration: underline;
}
.site-header__menu-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: transparent;
  border: 1px solid #5a4a32;
  border-radius: 4px;
  color: #ede2c8;
  cursor: pointer;
}
.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  position: relative;
}
.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}
.hamburger::before { top: -6px; }
.hamburger::after  { top: 6px; }
.site-header__menu-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}
.site-header__menu-toggle[aria-expanded="true"] .hamburger::before {
  top: 0; transform: rotate(45deg);
}
.site-header__menu-toggle[aria-expanded="true"] .hamburger::after {
  top: 0; transform: rotate(-45deg);
}

/* ----- 2. レイアウト(shell) ----- */
.site-shell {
  display: block;
  max-width: 1280px;
  margin: 0 auto;
}

/* ----- 3. サイドバー ----- */
.site-sidebar {
  display: none;
  padding: 1.5rem 1rem;
  background: #ebdcc2;
  border-right: 1px solid #c8b894;
}
.site-sidebar.is-open {
  display: block;
}
.toc__heading {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #2a1b0d;
}
.toc__heading a {
  color: inherit;
  text-decoration: none;
}
.toc__chapters,
.toc__lessons {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc__chapter {
  margin-bottom: 1rem;
}
.toc__chapter-title {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: #6b4f31;
}
.toc__chapter-no {
  display: inline-block;
  margin-right: 0.4rem;
  font-weight: 700;
  color: #7a3e1f;
}
.toc__chapter-name {
  font-weight: 600;
  color: #2a1b0d;
}
.toc__chapter.is-current .toc__chapter-name {
  color: #7a3e1f;
}
.toc__lessons {
  padding-left: 0.5rem;
  border-left: 2px solid #c8b894;
}
.toc__chapter.is-current .toc__lessons {
  border-left-color: #7a3e1f;
}
.toc__lesson a {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  color: #3e2c1c;
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.55;
  border-radius: 3px;
}
.toc__lesson a:hover {
  background: #faf3df;
  color: #7a3e1f;
}
.toc__lesson.is-current a {
  background: #faf3df;
  color: #7a3e1f;
  font-weight: 700;
}
.toc__lesson-no {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: #a08c6e;
}
.toc__lesson.is-current .toc__lesson-no {
  color: #7a3e1f;
}
.toc__supplement {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #c8b894;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
}

/* ----- 4. 本文 ----- */
.site-main {
  padding: 1.5rem 1rem 3rem;
  outline: none;
}

.lesson {
  max-width: 720px;
  margin: 0 auto;
}

.lesson-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 4px double #c8b894;
}
.lesson-meta {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: #7d6447;
  letter-spacing: 0.02em;
}
.lesson-header h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.4;
  color: #2a1b0d;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.lesson-subtitle {
  display: block;
  margin-top: 0.5rem;
  font-size: 1.05rem;
  color: #7d6447;
  font-weight: 600;
}

/* TL;DR ボックス */
.lesson-tldr {
  margin: 0 0 2.5rem;
  padding: 1.25rem 1.4rem;
  background: #faf3df;
  border: 1px solid #c8b894;
  border-left: 4px solid #7a3e1f;
  border-radius: 4px;
}
.lesson-tldr h2 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: #5a2c14;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.lesson-tldr ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.95rem;
}
.lesson-tldr li + li {
  margin-top: 0.4rem;
}

/* H2 / H3 */
.lesson h2 {
  margin: 2.8rem 0 1rem;
  padding-bottom: 0.4rem;
  font-size: 1.4rem;
  line-height: 1.45;
  color: #2a1b0d;
  font-weight: 800;
  letter-spacing: 0.01em;
  border-bottom: 4px double #7a3e1f;
}
.lesson h3 {
  margin: 2rem 0 0.7rem;
  font-size: 1.1rem;
  line-height: 1.5;
  color: #2a1b0d;
  font-weight: 700;
}
.lesson p {
  margin: 0 0 1.2em;
  font-size: 1rem;
}
.lesson ul,
.lesson ol {
  margin: 0 0 1.4em;
  padding-left: 1.4em;
}
.lesson li {
  margin-bottom: 0.4em;
}
.lesson li > ul,
.lesson li > ol {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}
.lesson strong {
  color: #2a1b0d;
  font-weight: 700;
}
.lesson em {
  font-style: normal;
  background: linear-gradient(transparent 60%, #d4b878 60%);
  padding: 0 0.1em;
}

/* 通底テーマ用の補足 / 注意枠 */
.lesson-note {
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  background: #ebdcc2;
  border-left: 4px solid #a08c6e;
  border-radius: 4px;
  font-size: 0.95rem;
}
.lesson-note p:last-child { margin-bottom: 0; }

/* 一言アドバイス枠(旧称:山下の POV) */
.pov-box {
  margin: 1.8rem 0;
  padding: 1.2rem 1.4rem 1.3rem;
  background: #faf3df;
  border-left: 4px solid #7a3e1f;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(2, 132, 199, 0.08);
}
.pov-box__label {
  display: inline-block;
  margin-bottom: 0.4rem;
  padding: 0.18rem 0.6rem;
  background: #7a3e1f;
  color: #faf3df;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.pov-box__quote {
  margin: 0;
  font-size: 1rem;
  line-height: 1.85;
  color: #2a1b0d;
  font-weight: 500;
}
.pov-box__quote::before {
  content: "";
}

/* H2 セクション直下のリード文 */
.lesson-section-lead {
  margin-bottom: 1.2rem;
  padding-left: 0.9rem;
  border-left: 3px solid #c8b894;
  color: #6b4f31;
  font-size: 0.95rem;
}

/* 一覧表 */
.lesson table {
  width: 100%;
  margin: 1.4rem 0;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.lesson th,
.lesson td {
  padding: 0.55rem 0.75rem;
  border: 1px solid #c8b894;
  text-align: left;
  vertical-align: top;
}
.lesson th {
  background: #ebdcc2;
  font-weight: 700;
}
.lesson tbody tr:nth-child(2n) td {
  background: #f4ead5;
}

/* TL;DR 後の本文オープニング段落 */
.lesson-opening {
  margin-bottom: 2rem;
  font-size: 1.02rem;
  color: #3e2c1c;
}

/* 関連リンク */
.lesson-related {
  margin: 3rem 0 0;
  padding: 1.5rem;
  background: #ebdcc2;
  border-radius: 6px;
}
.lesson-related h2 {
  margin: 0 0 1rem;
  padding: 0;
  font-size: 1.1rem;
  border-bottom: none;
}
.lesson-related dl {
  margin: 0;
}
.lesson-related dt {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: #7d6447;
  font-weight: 700;
}
.lesson-related dt:first-child {
  margin-top: 0;
}
.lesson-related dd {
  margin: 0.2rem 0 0 0;
  font-size: 0.95rem;
}
.lesson-related dd ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* ----- 5. 前 / 次 Lesson ナビ ----- */
.lesson-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  max-width: 720px;
  margin: 3rem auto 0;
}
.lesson-nav__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.2rem;
  background: #faf3df;
  border: 1px solid #c8b894;
  border-radius: 4px;
  text-decoration: none;
  color: #3e2c1c;
  transition: border-color .15s ease, background .15s ease;
}
.lesson-nav__item:hover {
  border-color: #7a3e1f;
  background: #faf3df;
}
.lesson-nav__item--placeholder {
  background: transparent;
  border: 1px dashed #c8b894;
  visibility: hidden;
}
.lesson-nav__label {
  font-size: 0.78rem;
  color: #7d6447;
  letter-spacing: 0.04em;
}
.lesson-nav__no {
  font-size: 0.82rem;
  font-weight: 700;
  color: #7a3e1f;
}
.lesson-nav__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #2a1b0d;
}
.lesson-nav__item--next {
  text-align: right;
}

/* ----- 6. フッター ----- */
.site-footer {
  margin-top: 3rem;
  background: #2a1b0d;
  color: #c8b894;
  padding: 2rem 1rem 2.5rem;
}
.site-footer__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}
.site-footer__contact { order: -1; }
.site-footer__main { order: 0; }
.site-footer__brand {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
  color: #f0e5cd;
}
.site-footer__sub {
  margin: 0 0 1.2rem;
  font-size: 0.85rem;
  color: #a08c6e;
}
.site-footer__nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.4rem;
  margin: 0 0 1.2rem;
  padding: 0;
  font-size: 0.85rem;
}
.site-footer__nav a {
  color: #c8b894;
  text-decoration: none;
}
.site-footer__nav a:hover {
  color: #d4b878;
  text-decoration: underline;
}
.site-footer__copyright {
  margin: 0;
  font-size: 0.8rem;
  color: #7d6447;
}
.site-footer__copyright a {
  color: inherit;
  text-decoration: underline;
}
.site-footer__contact {
  padding: 1.25rem 1.25rem 1.4rem;
  background: #3e2c1c;
  border: 1px solid #5a4a32;
  border-radius: 0.5rem;
}
.site-footer__contact-text {
  margin: 0 0 0.9rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: #c8b894;
}
.site-footer__contact-cta {
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 0.7rem 1.3rem;
  background: #7a3e1f;
  color: #faf3df;
  border-radius: 0.4rem;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s;
}
.site-footer__contact-cta:hover {
  background: #5a2c14;
  color: #faf3df;
}
.site-footer__contact-cta-arrow {
  display: inline-block;
  margin-left: 0.5em;
  font-size: 0.65em;
  line-height: 1;
  vertical-align: middle;
  position: relative;
  top: -0.05em;
}

/* ----- 7. ブレークポイント ----- */
@media (min-width: 768px) {
  .site-header__nav { display: block; }
  .site-header__menu-toggle { display: none; }
  .site-sidebar { display: block; }
  .site-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 0;
  }
  .site-main { padding: 2rem 1.5rem 4rem; }
  .lesson-nav { grid-template-columns: 1fr 1fr; }
  .lesson-header h1 { font-size: 2rem; }
  .lesson h2 { font-size: 1.55rem; }
  .lesson h3 { font-size: 1.18rem; }
  .site-footer__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
  }
  .site-footer__main { order: 0; }
  .site-footer__contact { order: 0; }
}
@media (min-width: 1024px) {
  .site-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .site-main { padding: 2.5rem 2.5rem 4rem; }
}

/* ----- 8. 印刷 ----- */
@media print {
  .site-header,
  .site-sidebar,
  .site-footer,
  .lesson-nav { display: none !important; }
  body { background: #fff; color: #000; }
  .site-shell { display: block; }
  .pov-box {
    background: #fff;
    border: 1.5px solid #000;
  }
}

/* ----- 本書トップ キービジュアル ----- */
.study-hero {
  margin: 0 0 2rem;
  background: #3e2c1c;
  border-radius: 0.5rem;
  overflow: hidden;
  line-height: 0;
}
.study-hero img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}
@media (max-width: 768px) {
  .study-hero {
    margin: -1.5rem -1rem 1.5rem;
    border-radius: 0;
  }
}

/* ----- 用語集(/study/glossary/) ----- */
.glossary-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem 0 2.5rem;
  padding: 1rem 1.25rem;
  background: #faf3df;
  border: 1px solid #d4b878;
  border-radius: 0.5rem;
  position: sticky;
  top: 3rem; /* サイトヘッダー(sticky)の高さ分オフセット */
  z-index: 10;
  backdrop-filter: blur(4px);
}
.glossary-index a {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: #faf3df;
  border: 1px solid #d4b878;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #5a2c14;
  text-decoration: none;
  white-space: nowrap;
}
.glossary-index a:hover {
  background: #7a3e1f;
  color: #faf3df;
  border-color: #7a3e1f;
}

.glossary-section {
  margin: 3rem 0 2rem;
  scroll-margin-top: 9rem;
}
.glossary-section > h2 {
  font-size: 1.75rem;
  color: #2a1b0d;
  padding: 0.5rem 0 0.5rem 1rem;
  margin: 0 0 1.5rem;
  border-left: 6px solid #7a3e1f;
  background: linear-gradient(to right, #f0e5cd, transparent);
  scroll-margin-top: 9rem; /* サイトヘッダー(3rem)+ sticky 索引バー(~5rem)+ 余白 */
}
.glossary-subsection {
  font-size: 1.1rem;
  font-weight: 700;
  color: #5a2c14;
  padding: 0.25rem 0 0.25rem 0.65rem;
  margin: 1.75rem 0 0.6rem;
  border-left: 4px solid #d4b878;
}
.glossary-subsection:first-of-type {
  margin-top: 0.5rem;
}
.glossary-term__reading {
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
  color: #6b4f31;
}
.glossary-term__reading-label {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  margin-right: 0.4rem;
  background: #f0e5cd;
  color: #5a2c14;
  border-radius: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  vertical-align: middle;
}

.glossary-list {
  margin: 0;
  padding: 0;
}
.glossary-list dt {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2a1b0d;
  margin: 1.75rem 0 0.5rem;
  padding: 0.4rem 0 0.4rem 0.85rem;
  border-left: 4px solid #7a3e1f;
  background: #faf3df;
  scroll-margin-top: 5rem;
}
.glossary-list dt:target {
  background: #f0e5b8;
  border-left-color: #a37d2c;
  animation: glossary-flash 1.5s ease-out;
}
@keyframes glossary-flash {
  0% { background: #e0c878; }
  100% { background: #f0e5b8; }
}
.glossary-list dd {
  margin: 0 0 1rem 1rem;
  padding: 0.25rem 0 0.5rem;
  line-height: 1.85;
}
.glossary-list dd p {
  margin: 0 0 0.5rem;
}
.glossary-list dd p:last-child {
  margin-bottom: 0;
}
.glossary-related {
  display: block;
  margin-top: 0.4rem !important;
  padding: 0.4rem 0.75rem;
  background: #f0e5cd;
  border-left: 3px solid #7d6447;
  font-size: 0.9rem;
  color: #6b4f31;
}

.lesson-footer-note {
  margin: 4rem 0 0;
  padding: 1.5rem;
  background: #faf3df;
  border-top: 2px solid #ede2c8;
  font-size: 0.9rem;
  color: #7d6447;
}
.lesson-footer-note p {
  margin: 0;
}

@media (max-width: 768px) {
  .glossary-index {
    padding: 0.75rem;
    gap: 0.35rem;
    position: static;
  }
  .glossary-index a {
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
  }
  .glossary-section > h2 {
    font-size: 1.4rem;
    scroll-margin-top: 4rem; /* モバイルは索引バー非 sticky のためヘッダー分のみ */
  }
  .glossary-section {
    scroll-margin-top: 4rem;
  }
  .glossary-list dt {
    font-size: 1.05rem;
  }
}

/* ----- 章末クイズ(/study/chapter-XX-yyy/quiz/) ----- */
.quiz-page {
  max-width: 760px;
  margin: 0 auto;
}
.quiz-header {
  margin: 0 0 1.5rem;
  padding: 0 0 1rem;
  border-bottom: 2px solid #ede2c8;
}
.quiz-header__meta {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #7d6447;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.quiz-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.85rem;
  line-height: 1.4;
  color: #2a1b0d;
}
.quiz-header__lead {
  margin: 1rem 0 0;
  font-size: 1rem;
  line-height: 1.85;
  color: #5a4a32;
}
.quiz-header__notice {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.9rem;
  background: #f0e5cd;
  border-left: 3px solid #a08c6e;
  font-size: 0.88rem;
  color: #6b4f31;
}

.quiz-progress {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0 0 1.5rem;
  padding: 0.7rem 1rem;
  background: #2a1b0d;
  color: #faf3df;
  border-radius: 0 0 0.5rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
}
.quiz-progress__count strong {
  font-size: 1.05rem;
  color: #d4b878;
}
.quiz-progress__bar {
  flex: 1;
  margin: 0 1rem;
  height: 6px;
  background: #5a4a32;
  border-radius: 999px;
  overflow: hidden;
}
.quiz-progress__bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #a37d2c, #7a3e1f);
  transition: width 0.3s ease-out;
}

.quiz-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.quiz-question {
  margin: 0 0 1.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.6rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  scroll-margin-top: 5rem;
}
.quiz-question__head {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin: 0 0 0.85rem;
}
.quiz-question__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.6rem;
  background: #7a3e1f;
  color: #faf3df;
  border-radius: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.quiz-question__tag {
  display: inline-block;
  margin-left: auto;
  padding: 0.2rem 0.6rem;
  background: #f0e5cd;
  color: #5a2c14;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.quiz-question__text {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.7;
  color: #2a1b0d;
}

.quiz-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quiz-options li {
  margin: 0;
}
.quiz-option {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: #faf3df;
  border: 1.5px solid #c8b894;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.quiz-option:hover {
  background: #f0e5cd;
  border-color: #d4b878;
}
.quiz-option input[type="radio"] {
  margin-top: 0.25rem;
  flex-shrink: 0;
  accent-color: #7a3e1f;
}
.quiz-option__letter {
  font-weight: 700;
  color: #7a3e1f;
  flex-shrink: 0;
}
.quiz-option__text {
  flex: 1;
  line-height: 1.65;
  color: #3e2c1c;
}
.quiz-option input[type="radio"]:checked + .quiz-option__letter {
  color: #3e1f0a;
}
.quiz-option:has(input[type="radio"]:checked) {
  background: #f0e5cd;
  border-color: #7a3e1f;
}

/* 採点後の選択肢色分け */
.quiz-question.is-correct {
  border-left: 4px solid #16a34a;
  background: #f0fdf4;
}
.quiz-question.is-wrong {
  border-left: 4px solid #dc2626;
  background: #fef2f2;
}
.quiz-question.is-scored .quiz-option {
  cursor: default;
}
.quiz-question.is-scored .quiz-option:hover {
  background: #faf3df;
  border-color: #c8b894;
}
.quiz-question.is-scored .quiz-option.is-answer {
  background: #dcfce7;
  border-color: #16a34a;
}
.quiz-question.is-scored .quiz-option.is-answer .quiz-option__letter {
  color: #15803d;
}
.quiz-question.is-scored .quiz-option.is-user-wrong {
  background: #fee2e2;
  border-color: #dc2626;
}
.quiz-question.is-scored .quiz-option.is-user-wrong .quiz-option__letter {
  color: #b91c1c;
}
.quiz-question.is-scored .quiz-option input[type="radio"] {
  pointer-events: none;
}

.quiz-result-mark {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.quiz-result-mark.is-correct {
  background: #16a34a;
  color: #faf3df;
}
.quiz-result-mark.is-wrong {
  background: #dc2626;
  color: #faf3df;
}

.quiz-explanation {
  display: none;
  margin: 1rem 0 0;
  padding: 0.9rem 1.1rem;
  background: #faf3dfbeb;
  border: 1px solid #e0c878;
  border-radius: 0.4rem;
  font-size: 0.95rem;
  line-height: 1.8;
  color: #422006;
}
.quiz-question.is-scored .quiz-explanation {
  display: block;
}
.quiz-explanation__label {
  display: block;
  font-weight: 700;
  color: #b45309;
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.quiz-explanation__related {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}
.quiz-explanation__related a {
  color: #5a2c14;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.5rem;
  align-items: center;
  justify-content: center;
}
.quiz-actions__note {
  width: 100%;
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: 0.88rem;
  color: #7d6447;
}
.quiz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  text-decoration: none;
  font-family: inherit;
}
.quiz-btn:active {
  transform: translateY(1px);
}
.quiz-btn--primary {
  background: #7a3e1f;
  color: #faf3df;
}
.quiz-btn--primary:hover {
  background: #5a2c14;
}
.quiz-btn--primary:disabled {
  background: #a08c6e;
  cursor: not-allowed;
}
.quiz-btn--ghost {
  background: #faf3df;
  color: #5a2c14;
  border: 1.5px solid #7a3e1f;
}
.quiz-btn--ghost:hover {
  background: #f0e5cd;
}
.quiz-btn--subtle {
  background: #ede2c8;
  color: #5a4a32;
}
.quiz-btn--subtle:hover {
  background: #c8b894;
}

.quiz-summary {
  display: none;
  margin: 0 0 2rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, #3e1f0a 0%, #075985 100%);
  color: #faf3df;
  border-radius: 0.6rem;
  text-align: center;
}
.quiz-summary.is-visible {
  display: block;
}
.quiz-summary__label {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: #d4b878;
  letter-spacing: 0.05em;
}
.quiz-summary__score {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
}
.quiz-summary__score strong {
  color: #d4b878;
  font-size: 3.5rem;
}
.quiz-summary__comment {
  margin: 0.85rem 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #f0e5cd;
}

.quiz-unanswered-notice {
  display: none;
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  color: #991b1b;
  font-size: 0.92rem;
  border-radius: 0.3rem;
}
.quiz-unanswered-notice.is-visible {
  display: block;
}

.quiz-finale {
  display: none;
  margin: 2rem 0 0;
  padding: 1.5rem;
  background: #f0e5b8;
  border: 1.5px dashed #a37d2c;
  border-radius: 0.5rem;
  text-align: center;
}
.quiz-finale.is-visible {
  display: block;
}
.quiz-finale h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  color: #78350f;
}
.quiz-finale p {
  margin: 0 0 1rem;
  line-height: 1.85;
  color: #422006;
}
.quiz-finale__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.quiz-loading,
.quiz-error {
  margin: 2rem 0;
  padding: 1.5rem;
  text-align: center;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.5rem;
  color: #7d6447;
}
.quiz-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

@media (max-width: 768px) {
  .quiz-header h1 { font-size: 1.45rem; }
  .quiz-progress { padding: 0.55rem 0.85rem; font-size: 0.82rem; }
  .quiz-progress__bar { margin: 0 0.6rem; }
  .quiz-question { padding: 1rem 1rem 1.1rem; }
  .quiz-question__num { min-width: 2rem; height: 2rem; font-size: 0.85rem; }
  .quiz-question__text { font-size: 0.98rem; }
  .quiz-option { padding: 0.65rem 0.8rem; }
  .quiz-summary__score { font-size: 1.85rem; }
  .quiz-summary__score strong { font-size: 2.6rem; }
  .quiz-btn { padding: 0.7rem 1.1rem; font-size: 0.95rem; }
  .quiz-actions { padding: 1rem; }
}

@media print {
  .quiz-progress, .quiz-actions, .quiz-finale, .site-sidebar, .site-header__menu-toggle { display: none !important; }
  .quiz-question { break-inside: avoid; box-shadow: none; }
  .quiz-explanation { display: block !important; }
  .quiz-question.is-scored .quiz-option.is-answer { background: #fff !important; border: 2px solid #000 !important; }
}

/* ----- 本文中の用語集オートリンク(Lesson のみ) ----- */
.auto-glossary-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted #a08c6e;
  transition: color 0.12s ease-out, border-bottom-color 0.12s ease-out, border-bottom-style 0.12s ease-out;
  text-underline-offset: 0.18em;
}
.auto-glossary-link:hover,
.auto-glossary-link:focus-visible {
  color: #7a3e1f;
  border-bottom-color: #7a3e1f;
  border-bottom-style: solid;
  outline: none;
}
@media print {
  .auto-glossary-link { color: inherit; border-bottom: none; }
}

/* ----- 用語集 個別ページ(/study/glossary/<id>/) ----- */
.glossary-term .lesson-meta a { color: #5a2c14; }
.glossary-term__body {
  margin: 1.5rem 0 2rem;
  font-size: 1.02rem;
  line-height: 1.95;
}
.glossary-term__body p { margin: 0 0 1rem; }
.glossary-term__body code {
  background: #f0e5cd;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}
.glossary-term__body .glossary-related {
  margin: 1.25rem 0 0;
  padding: 0.6rem 0.95rem;
  background: #f0e5cd;
  border-left: 3px solid #7d6447;
  border-radius: 0.25rem;
  font-size: 0.95rem;
}

.glossary-term__nav {
  margin: 3rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 2px solid #ede2c8;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}
.glossary-term__nav-link {
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
  min-height: 4rem;
}
.glossary-term__nav-link:hover {
  background: #faf3df;
  border-color: #d4b878;
}
.glossary-term__nav-link--index { background: #faf3df; }
.glossary-term__nav-link--disabled {
  visibility: hidden;
  pointer-events: none;
}
.glossary-term__nav-link--prev   { text-align: left; }
.glossary-term__nav-link--index  { text-align: center; }
.glossary-term__nav-link--next   { text-align: right; }
.glossary-term__nav-arrow {
  font-size: 0.78rem;
  color: #7d6447;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.2rem;
}
.glossary-term__nav-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2a1b0d;
  line-height: 1.4;
}

/* ----- 用語集 索引ページ ----- */
.glossary-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.4rem 0.8rem;
}
.glossary-index-list li { margin: 0; }
.glossary-index-list a {
  display: block;
  padding: 0.5rem 0.75rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-left: 3px solid #7a3e1f;
  border-radius: 0.3rem;
  font-size: 0.95rem;
  color: #2a1b0d;
  text-decoration: none;
  line-height: 1.5;
  transition: background 0.15s, border-color 0.15s;
}
.glossary-index-list a:hover {
  background: #f0e5cd;
  border-color: #7a3e1f;
  border-left-color: #3e1f0a;
}

@media (max-width: 600px) {
  .glossary-term__nav { grid-template-columns: 1fr; }
  .glossary-term__nav-link--disabled { display: none; }
  .glossary-index-list { grid-template-columns: 1fr; }
}

/* ----- 章末 Lesson からの「章末クイズへ」CTA ----- */
.lesson-quiz-cta {
  margin: 3rem 0 0;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, #3e1f0a 0%, #5a2c14 100%);
  color: #faf3df;
  border-radius: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}
.lesson-quiz-cta__body {
  flex: 1;
  min-width: 220px;
}
.lesson-quiz-cta__label {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  color: #d4b878;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.lesson-quiz-cta__title {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #faf3df;
}
.lesson-quiz-cta__desc {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #f0e5cd;
}
.lesson-quiz-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.5rem;
  background: #faf3df;
  color: #5a2c14;
  border-radius: 0.4rem;
  font-weight: 700;
  text-decoration: none;
  font-size: 1rem;
  white-space: nowrap;
  border: 2px solid #faf3df;
  transition: background 0.15s, color 0.15s;
}
.lesson-quiz-cta__btn:hover {
  background: #7a3e1f;
  color: #faf3df;
}

@media (max-width: 768px) {
  .lesson-quiz-cta { padding: 1.25rem 1.25rem; }
  .lesson-quiz-cta__title { font-size: 1.05rem; }
  .lesson-quiz-cta__btn { width: 100%; justify-content: center; }
}

/* ----- メタページ共通(About / Author / Sitemap) ----- */
.about-toc {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
  font-size: 0.95rem;
}
.about-toc th,
.about-toc td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid #ede2c8;
  vertical-align: top;
}
.about-toc th {
  background: #f0e5cd;
  color: #2a1b0d;
  font-weight: 700;
  border-bottom: 2px solid #c8b894;
}
.about-toc td:first-child {
  white-space: nowrap;
  font-weight: 600;
  color: #5a2c14;
}
.about-toc td:last-child {
  white-space: nowrap;
  text-align: center;
  color: #7d6447;
}
.about-toc a { color: #2a1b0d; }

.about-howto {
  margin: 1rem 0 2rem;
  padding: 0;
}
.about-howto dt {
  margin: 1.25rem 0 0.4rem;
  padding: 0.4rem 0.85rem;
  background: #faf3df;
  border-left: 4px solid #7a3e1f;
  font-weight: 700;
  color: #3e1f0a;
}
.about-howto dd {
  margin: 0 0 0 1rem;
  line-height: 1.85;
}

.about-cta {
  display: inline-block;
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1.4rem;
  background: #7a3e1f;
  color: #faf3df;
  border-radius: 0.4rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.about-cta:hover { background: #5a2c14; }
.about-cta--ghost {
  background: #faf3df;
  color: #5a2c14;
  border: 1.5px solid #7a3e1f;
}
.about-cta--ghost:hover { background: #f0e5cd; }

/* ----- 著者紹介ページ ----- */
.author-profile {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1rem 0 2rem;
  padding: 1.25rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.5rem;
}
.author-profile__photo {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0e5cd 0%, #d4b878 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a2c14;
  font-size: 2rem;
  font-weight: 800;
  overflow: hidden;
}
.author-profile__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.author-profile__body { flex: 1; min-width: 220px; }
.author-profile__name {
  margin: 0 0 0.3rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: #2a1b0d;
}
.author-profile__role {
  margin: 0 0 0.85rem;
  color: #7d6447;
  font-size: 0.95rem;
}
.author-profile__lead {
  margin: 0;
  line-height: 1.85;
  color: #3e2c1c;
}

.author-placeholder {
  margin: 1rem 0 2rem;
  padding: 1rem 1.25rem;
  background: #f0e5b8;
  border-left: 4px solid #a37d2c;
  border-radius: 0.3rem;
  color: #78350f;
  font-size: 0.92rem;
  line-height: 1.85;
}
.author-placeholder strong { color: #b45309; }

/* ----- HTML サイトマップ ----- */
.sitemap-tree {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sitemap-tree > li {
  margin: 0 0 2rem;
  padding: 0;
}
.sitemap-tree__heading {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0 0.5rem 1rem;
  font-size: 1.25rem;
  color: #2a1b0d;
  border-left: 6px solid #7a3e1f;
  background: linear-gradient(to right, #f0e5cd, transparent);
  font-weight: 700;
}
.sitemap-chapters {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sitemap-chapter {
  margin: 0 0 1.5rem;
  padding: 0;
}
.sitemap-chapter__title {
  margin: 0 0 0.4rem;
  padding: 0.4rem 0.85rem;
  background: #f0e5cd;
  border-left: 4px solid #7d6447;
  font-weight: 700;
  color: #2a1b0d;
  font-size: 1rem;
}
.sitemap-lessons {
  margin: 0;
  padding: 0 0 0 1.5rem;
  list-style: none;
}
.sitemap-lessons li {
  margin: 0.3rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  position: relative;
  line-height: 1.65;
}
.sitemap-lessons li::before {
  content: '└';
  position: absolute;
  left: 0;
  color: #a08c6e;
}
.sitemap-lessons a { color: #2a1b0d; }
.sitemap-lessons a:hover { color: #7a3e1f; }
.sitemap-lesson-no {
  display: inline-block;
  min-width: 2.3rem;
  margin-right: 0.4rem;
  color: #7d6447;
  font-weight: 600;
  font-size: 0.9rem;
}
.sitemap-quiz-link {
  margin-top: 0.5rem !important;
  padding-left: 1rem !important;
  font-size: 0.9rem;
}
.sitemap-quiz-link::before { content: '★' !important; color: #a37d2c !important; }
.sitemap-quiz-link a { color: #5a2c14; font-weight: 600; }

@media (max-width: 768px) {
  .about-toc { font-size: 0.88rem; }
  .about-toc th, .about-toc td { padding: 0.5rem 0.6rem; }
  .author-profile { padding: 1rem; gap: 1rem; }
  .author-profile__photo { width: 100px; height: 100px; }
  .sitemap-tree__heading { font-size: 1.1rem; }
  .sitemap-lessons { padding-left: 1rem; }
}

/* ===== テンプレート集 ===== */
/* ---- 一覧トップ ---- */
.templates-quickjump {
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.25rem;
  background: #faf3df;
  border: 1px solid #d4b878;
  border-radius: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.templates-quickjump__label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #3e1f0a;
  letter-spacing: 0.04em;
}
.templates-quickjump ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.templates-quickjump li { margin: 0; }
.templates-quickjump a {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: #faf3df;
  border: 1px solid #d4b878;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #5a2c14;
  text-decoration: none;
}
.templates-quickjump a:hover { background: #7a3e1f; color: #faf3df; }

.templates-chapter {
  margin: 2.5rem 0 2rem;
  scroll-margin-top: 5rem;
}
.templates-chapter__title {
  margin: 0 0 1rem;
  padding: 0.5rem 0 0.5rem 1rem;
  font-size: 1.4rem;
  color: #2a1b0d;
  border-left: 6px solid #7a3e1f;
  background: linear-gradient(to right, #f0e5cd, transparent);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.85rem;
}
.templates-chapter__count {
  font-size: 0.85rem;
  font-weight: 600;
  color: #7d6447;
}

.templates-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}
@media (min-width: 720px) {
  .templates-list { grid-template-columns: 1fr 1fr; }
}
.templates-item { margin: 0; }
.templates-item__link {
  display: block;
  padding: 0.85rem 1rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.templates-item__link:hover {
  background: #faf3df;
  border-color: #d4b878;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
}
.templates-item--ready .templates-item__link { border-left: 4px solid #7a3e1f; }
.templates-item--coming-soon .templates-item__link {
  border-left: 4px solid #c8b894;
  background: #faf3df;
}
.templates-item--coming-soon .templates-item__title { color: #7d6447; }
.templates-item__cat {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: #f0e5cd;
  color: #5a2c14;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.templates-item--coming-soon .templates-item__cat { background: #ede2c8; color: #7d6447; }
.templates-item__title {
  display: block;
  margin: 0.5rem 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: #2a1b0d;
  line-height: 1.5;
}
.templates-item__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #7d6447;
}
.templates-item__badge {
  margin-left: auto;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.templates-item__badge--ready { background: #dcfce7; color: #15803d; }
.templates-item__badge--soon  { background: #f0e5b8; color: #92400e; }

.templates-license {
  margin: 3rem 0 0;
  padding: 1.25rem 1.5rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.85;
  color: #6b4f31;
}
.templates-license h2 { margin-top: 0; font-size: 1.1rem; color: #2a1b0d; }

/* ---- テンプレ詳細ページ ---- */
.template-page .lesson-header { border-bottom: 1px solid #c8b894; }
.template-relation {
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
  color: #6b4f31;
}
.template-relation a { color: #5a2c14; font-weight: 600; }

.template-status {
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
}
.template-status--soon {
  background: #f0e5b8;
  border: 1.5px dashed #a37d2c;
  color: #78350f;
}
.template-status__label {
  margin: 0 0 0.4rem;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: #b45309;
}
.template-status__body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.8;
}

.template-usage {
  margin: 1rem 0 2rem;
  padding: 1.25rem 1.5rem;
  background: #faf3df;
  border-left: 4px solid #7a3e1f;
  border-radius: 0.4rem;
}
.template-usage h2 { margin-top: 0; font-size: 1.1rem; color: #3e1f0a; }
.template-usage dl { margin: 0; }
.template-usage dt {
  margin: 0.6rem 0 0.15rem;
  font-weight: 700;
  color: #3e1f0a;
  font-size: 0.92rem;
}
.template-usage dd { margin: 0 0 0 0.5rem; line-height: 1.85; color: #3e2c1c; }

.template-form {
  margin: 1rem 0 2rem;
  padding: 0;
}
.template-form__row {
  margin: 0 0 1.25rem;
  padding: 0;
}
.template-form__label {
  display: block;
  margin: 0 0 0.4rem;
  font-weight: 700;
  color: #2a1b0d;
  font-size: 0.95rem;
}
.template-form__hint {
  display: block;
  margin: 0.15rem 0 0.4rem;
  font-size: 0.83rem;
  color: #7d6447;
  line-height: 1.7;
  font-weight: 400;
}
.template-form__input,
.template-form__select,
.template-form__textarea {
  display: block;
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.98rem;
  line-height: 1.6;
  color: #3e2c1c;
  background: #faf3df;
  border: 1.5px solid #c8b894;
  border-radius: 0.4rem;
  box-sizing: border-box;
}
.template-form__textarea { min-height: 80px; resize: vertical; }
.template-form__input:focus,
.template-form__select:focus,
.template-form__textarea:focus {
  outline: none;
  border-color: #7a3e1f;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.template-checklist {
  margin: 1rem 0 1.5rem;
  padding: 0;
  list-style: none;
}
.template-checklist li {
  margin: 0 0 0.5rem;
  padding: 0;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.4rem;
  padding: 0.7rem 0.9rem;
}
.template-checklist li.is-checked {
  background: #f0fdf4;
  border-color: #86efac;
}
.template-checklist input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: #7a3e1f;
  cursor: pointer;
}
.template-checklist label {
  flex: 1;
  cursor: pointer;
  line-height: 1.7;
  color: #3e2c1c;
}
.template-checklist label strong { color: #2a1b0d; font-weight: 700; }
.template-checklist__no {
  display: inline-block;
  min-width: 2.5rem;
  font-weight: 700;
  color: #5a2c14;
  font-size: 0.9rem;
}
.template-checklist__note {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #7d6447;
  line-height: 1.7;
}

.template-checklist-progress {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0 0 1.5rem;
  padding: 0.7rem 1rem;
  background: #2a1b0d;
  color: #faf3df;
  border-radius: 0 0 0.5rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  gap: 1rem;
}
.template-checklist-progress strong { color: #d4b878; font-size: 1.05rem; }
.template-checklist-progress__bar {
  flex: 1;
  height: 6px;
  background: #5a4a32;
  border-radius: 999px;
  overflow: hidden;
}
.template-checklist-progress__fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #a37d2c, #7a3e1f);
  transition: width 0.3s ease-out;
}

.template-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.92rem;
}
.template-table th,
.template-table td {
  padding: 0.5rem 0.7rem;
  border: 1px solid #c8b894;
  text-align: left;
  vertical-align: top;
}
.template-table thead th {
  background: #f0e5cd;
  color: #2a1b0d;
  font-weight: 700;
}
.template-table td input,
.template-table td textarea {
  width: 100%;
  padding: 0.4rem 0.55rem;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid #c8b894;
  border-radius: 0.3rem;
  box-sizing: border-box;
}
.template-table td textarea { min-height: 56px; resize: vertical; }

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.5rem;
  align-items: center;
}
.template-actions__note {
  width: 100%;
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: #7d6447;
}
.template-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s;
}
.template-btn--primary { background: #7a3e1f; color: #faf3df; }
.template-btn--primary:hover { background: #5a2c14; }
.template-btn--ghost { background: #faf3df; color: #5a2c14; border: 1.5px solid #7a3e1f; }
.template-btn--ghost:hover { background: #f0e5cd; }
.template-btn--subtle { background: #ede2c8; color: #5a4a32; }
.template-btn--subtle:hover { background: #c8b894; }
.template-btn--danger { background: #fef2f2; color: #b91c1c; border: 1.5px solid #fecaca; }
.template-btn--danger:hover { background: #fee2e2; }

.template-saved-flash {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.6rem 1rem;
  background: #2a1b0d;
  color: #faf3df;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 999;
}
.template-saved-flash.is-visible { opacity: 1; transform: translateY(0); }

.template-footer-nav {
  margin: 3rem 0 0;
  padding: 1.25rem 0;
  border-top: 2px solid #ede2c8;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}
.template-back {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: #faf3df;
  color: #5a2c14;
  border: 1.5px solid #7a3e1f;
  border-radius: 0.4rem;
  font-weight: 700;
  text-decoration: none;
}
.template-back:hover { background: #f0e5cd; }
.template-back--lesson { background: #7a3e1f; color: #faf3df; border-color: #7a3e1f; }
.template-back--lesson:hover { background: #5a2c14; }

@media (max-width: 768px) {
  .templates-list { grid-template-columns: 1fr; }
  .templates-chapter__title { font-size: 1.15rem; }
  .template-form__input, .template-form__select, .template-form__textarea { font-size: 0.92rem; }
  .template-table { font-size: 0.85rem; }
  .template-actions { padding: 0.85rem; }
  .template-btn { padding: 0.55rem 0.9rem; font-size: 0.88rem; }
}

@media print {
  .template-actions, .template-checklist-progress, .template-footer-nav,
  .templates-quickjump, .templates-license,
  .site-sidebar, .site-header__menu-toggle, .template-saved-flash { display: none !important; }
  .template-checklist li { break-inside: avoid; }
  .template-form__input, .template-form__textarea, .template-form__select { border: 1px solid #000 !important; background: #fff !important; }
  .template-table th, .template-table td { border: 1px solid #000 !important; }
}

/* ============================================================
   用語集 個別ページ — 拡充セクション(② フェーズで追加)
   ------------------------------------------------------------
   description_html(拡充本文)/ used_by_roles / usage_examples /
   related_ids / related_lesson 用のスタイル。
   ============================================================ */

.glossary-term__roles,
.glossary-term__examples,
.glossary-term__related,
.glossary-term__lesson {
  margin: 2.25rem 0 0;
}

.glossary-term__roles h2,
.glossary-term__examples h2,
.glossary-term__related h2,
.glossary-term__lesson h2 {
  margin: 0 0 0.85rem;
  padding: 0.45rem 0 0.45rem 0.9rem;
  font-size: 1.1rem;
  color: #2a1b0d;
  border-left: 4px solid #7a3e1f;
  background: #f0e5cd;
}

/* 主に使う役割 */
.glossary-term__role-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 0.45rem 0.55rem;
}
.glossary-term__role-list li {
  padding: 0.3rem 0.75rem;
  background: #f0e5cd;
  color: #5a2c14;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

/* 会話上での使用例(LINE 風の左右吹き出し) */
.glossary-example {
  margin: 0 0 1.5rem;
  padding: 1.1rem 1rem 1.2rem;
  background: #faf3df;
  border: 1px solid #ede2c8;
  border-radius: 0.5rem;
}
.glossary-example:last-child { margin-bottom: 0; }
.glossary-example__situation {
  margin: 0 0 1rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  color: #6b4f31;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: #ede2c8;
  border-radius: 999px;
  display: inline-block;
}
.glossary-example__turns {
  list-style: none;
  padding: 0;
  margin: 0;
}
.glossary-example__turn {
  display: flex;
  flex-direction: column;
  margin: 0 0 1.2rem;
}
.glossary-example__turn:last-child { margin-bottom: 0; }
.glossary-example__turn--left {
  align-items: flex-start;
}
.glossary-example__turn--right {
  align-items: flex-end;
}
/* ロール名はターンの先頭(アバターの上)に独立した行で表示 */
.glossary-example__role {
  font-size: 0.86rem;
  color: #7a3e1f;
  font-weight: 700;
  margin: 0 0 0.3rem;
  letter-spacing: 0.02em;
  padding: 0 4px;
}
/* アバター + バブルの横並び行。右ターンは row-reverse でバブル ← アバターの順に */
.glossary-example__row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  max-width: 100%;
}
.glossary-example__turn--right .glossary-example__row {
  flex-direction: row-reverse;
}
.glossary-example__avatar {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: transparent;
}
.glossary-example__bubble {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  padding: 0.7rem 1rem;
  border-radius: 1.05rem;
  line-height: 1.75;
  font-size: 0.95rem;
  word-break: break-word;
}
.glossary-example__turn--left .glossary-example__bubble {
  background: #faf3dffff;
  color: #3e2c1c;
  border: 1px solid #c8b894;
  margin-left: 8px;
}
/* 左バブル尾ひれ:アバターの中心高さに合わせて横向き三角形 */
.glossary-example__turn--left .glossary-example__bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 17px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 9px solid #c8b894;
}
.glossary-example__turn--left .glossary-example__bubble::after {
  content: "";
  position: absolute;
  left: -7px;
  top: 18px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid #faf3dffff;
}
.glossary-example__turn--right .glossary-example__bubble {
  background: #d8efff;
  color: #0c2942;
  border: 1px solid #d4b878;
  margin-right: 8px;
}
.glossary-example__turn--right .glossary-example__bubble::before {
  content: "";
  position: absolute;
  right: -9px;
  top: 17px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 9px solid #d4b878;
}
.glossary-example__turn--right .glossary-example__bubble::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 18px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid #d8efff;
}
.glossary-example__bubble strong {
  color: inherit;
  font-weight: 700;
}

/* 関連用語 */
.glossary-term__related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.55rem;
}
.glossary-term__related-list a {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  background: #faf3df;
  border: 1px solid #c8b894;
  border-left: 3px solid #7a3e1f;
  border-radius: 0.3rem;
  color: #2a1b0d;
  text-decoration: none;
  font-size: 0.93rem;
  transition: background-color .15s ease, border-color .15s ease;
}
.glossary-term__related-list a:hover {
  background: #f0e5cd;
  border-color: #7a3e1f;
}

/* 関連 Lesson */
.glossary-term__lesson p {
  margin: 0;
}
.glossary-term__lesson a {
  display: inline-block;
  padding: 0.55rem 0.95rem;
  background: #7a3e1f;
  color: #faf3df;
  border-radius: 0.35rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.glossary-term__lesson a:hover { background: #5a2c14; }

@media (max-width: 600px) {
  .glossary-example__role {
    display: block;
    min-width: 0;
    margin: 0 0 0.35rem;
    width: fit-content;
  }
  .glossary-term__roles h2,
  .glossary-term__examples h2,
  .glossary-term__related h2,
  .glossary-term__lesson h2 {
    font-size: 1.02rem;
  }
}
