/* ==========================================================================
   stats3.css ― 統計検定3級コンテンツ用 読み物特化レイアウト
   ==========================================================================
   設計方針:
   - 本文の可読性を最優先（行間1.95、本文720px、中央配置）
   - 配色は無彩色ベース + ネイビーのアクセント + 教科書風マーカー
   - CSS変数でライト／ダーク両モードに対応
   - サイドバーに目次を配置し、視覚的バランスを確保
   ========================================================================== */

/* ============ CSS変数（ライトモード） ============ */
:root {
  /* テキスト */
  --s3-text:        #1a1a1a;
  --s3-text-sub:    #4a4a4a;
  --s3-text-mute:   #6b6b6b;
  --s3-text-faint:  #8a8a8a;

  /* 背景 */
  --s3-bg:          #ffffff;
  --s3-bg-soft:     #f7f5f0;
  --s3-bg-soft-2:   #fafaf7;

  /* 罫線 */
  --s3-border:      #e0d9c8;
  --s3-border-sub:  #ebe6d8;

  /* メインアクセント（フォレストグリーン） */
  --s3-accent:       #2d5e3f;
  --s3-accent-soft:  #e8f0ea;
  --s3-accent-mute:  #5d8a6f;

  /* マーカー（教科書のラインマーカー風） */
  --s3-marker:       #fef3c7;

  /* Excelカラー */
  --s3-excel:        #1e6e3d;
  --s3-excel-bg:     #1e6e3d;
}

/* ============ CSS変数（ダークモード） ============ */
:root[data-theme="dark"] {
  --s3-text:        #e8e8e3;
  --s3-text-sub:    #c4c4be;
  --s3-text-mute:   #9a9a92;
  --s3-text-faint:  #7a7a72;

  --s3-bg:          #1a1f2e;
  --s3-bg-soft:     #232838;
  --s3-bg-soft-2:   #1f2433;

  --s3-border:      #3a4256;
  --s3-border-sub:  #2e3447;

  --s3-accent:       #7fc89a;
  --s3-accent-soft:  #1f3a2a;
  --s3-accent-mute:  #5a8a6f;

  --s3-marker:       #5a4d28;

  --s3-excel:        #4ea870;
  --s3-excel-bg:     #1e6e3d;
}

/* ============================================================
   INDEXページ専用スタイル
   ============================================================ */

/* INDEX用1カラムラッパー */
.stats3-wrap-index {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

@media (max-width: 600px) {
  .stats3-wrap-index { padding: 32px 20px 64px; }
}

/* ヒーロー */
.stats3-index-hero {
  position: relative;
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--s3-border);
  margin-bottom: 40px;
}

.stats3-index-hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.stats3-index-hero-label {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--s3-accent);
  background: var(--s3-accent-soft);
  border: 1px solid var(--s3-accent);
  padding: 4px 12px;
  border-radius: 2px;
  font-weight: 600;
}

.stats3-index-hero h1 {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 18px;
  color: var(--s3-text);
}

@media (max-width: 600px) {
  .stats3-index-hero h1 { font-size: 26px; }
}

.stats3-index-hero-lead {
  font-size: 16px;
  line-height: 1.95;
  color: var(--s3-text-sub);
  margin: 0;
  max-width: 680px;
}

.stats3-index-hero-author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 8px 14px;
  background: var(--s3-bg-soft);
  border-radius: 30px;
  font-size: 13px;
  color: var(--s3-text-mute);
}

.stats3-index-hero-author strong {
  color: var(--s3-text);
  font-weight: 700;
}

/* 章 */
.stats3-index-chapter {
  margin-bottom: 56px;
}

.stats3-index-chapter-head {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--s3-accent);
}

.stats3-index-chapter-num {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--s3-accent);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 6px;
}

.stats3-index-chapter-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--s3-text);
}

@media (max-width: 600px) {
  .stats3-index-chapter-title { font-size: 19px; }
}

.stats3-index-chapter-desc {
  font-size: 14px;
  line-height: 1.85;
  color: var(--s3-text-mute);
  margin: 0;
}

/* 項目リスト */
.stats3-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stats3-index-list li {
  margin: 0 0 8px;
  padding: 0;
}

.stats3-index-list a {
  display: grid;
  grid-template-columns: 60px 1fr 24px;
  gap: 16px;
  align-items: start;
  padding: 16px 18px;
  background: var(--s3-bg);
  border: 1px solid var(--s3-border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--s3-text);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.stats3-index-list a:hover {
  border-color: var(--s3-accent);
  background: var(--s3-bg-soft);
  transform: translateX(2px);
  opacity: 1;
}

.stats3-index-item-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--s3-accent);
  letter-spacing: 0.04em;
  padding-top: 2px;
}

.stats3-index-item-body { min-width: 0; }

.stats3-index-item-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.5;
  color: var(--s3-text);
}

.stats3-index-item-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--s3-text-mute);
  margin: 0;
}

.stats3-index-item-arrow {
  align-self: center;
  font-size: 14px;
  color: var(--s3-accent);
  font-weight: 700;
  text-align: center;
}

/* 「準備中」の章 */
.stats3-index-coming {
  background: var(--s3-bg-soft);
  border: 1px dashed var(--s3-border);
  border-radius: 6px;
  padding: 28px 24px;
  text-align: center;
  margin-top: 40px;
}

.stats3-index-coming-label {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--s3-text-mute);
  background: var(--s3-bg);
  border: 1px solid var(--s3-border);
  padding: 3px 12px;
  border-radius: 30px;
  margin-bottom: 12px;
  font-weight: 700;
}

.stats3-index-coming-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--s3-text);
  margin: 0 0 6px;
}

.stats3-index-coming-desc {
  font-size: 13px;
  color: var(--s3-text-mute);
  line-height: 1.7;
  margin: 0;
}

/* ============ ベース ============ */
.stats3-page {
  background: var(--s3-bg);
  color: var(--s3-text);
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.9;
  padding-top: 80px;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ============ レイアウト（中央配置） ============ */
.stats3-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: grid;
  grid-template-columns: minmax(0, 720px) 300px;
  gap: 56px;
  justify-content: center;
  align-items: start;
}

@media (max-width: 1100px) {
  .stats3-wrap {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 36px;
    max-width: 1040px;
  }
}

@media (max-width: 960px) {
  .stats3-wrap {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 20px 64px;
    max-width: 720px;
  }
}

.stats3-main { min-width: 0; }

/* ============ パンくず・メタ・テーマトグル ============ */
.stats3-breadcrumb {
  font-size: 13px;
  color: var(--s3-text-mute);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}

.stats3-breadcrumb a {
  color: var(--s3-text-mute);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.stats3-breadcrumb a:hover {
  border-bottom-color: var(--s3-text-mute);
}

.stats3-breadcrumb .sep {
  margin: 0 8px;
  color: var(--s3-text-faint);
}

/* メタとテーマトグルを横並びに */
.stats3-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.stats3-meta {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--s3-accent);
  background: var(--s3-accent-soft);
  border: 1px solid var(--s3-accent);
  padding: 4px 12px;
  border-radius: 2px;
  font-weight: 600;
}

/* ============ テーマ切替ボタン ============ */
.theme-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--s3-border);
  background: var(--s3-bg);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s ease, background 0.2s ease;
  padding: 0;
  color: var(--s3-text);
}

.theme-toggle:hover {
  border-color: var(--s3-accent);
  background: var(--s3-bg-soft);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============ 見出し ============ */
.stats3-main h1 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.02em;
  margin: 0 0 24px;
  color: var(--s3-text);
}

@media (max-width: 600px) {
  .stats3-main h1 { font-size: 24px; }
}

.stats3-main h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.6;
  margin: 56px 0 20px;
  padding: 0 0 12px;
  border-bottom: 2px solid var(--s3-accent);
  color: var(--s3-text);
  scroll-margin-top: 100px; /* 目次からのジャンプ時に固定ヘッダーで隠れない */
}

@media (max-width: 600px) {
  .stats3-main h2 { font-size: 19px; margin: 40px 0 16px; }
}

.stats3-main h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  margin: 44px 0 18px;
  padding-left: 14px;
  border-left: 4px solid var(--s3-accent);
  color: var(--s3-text);
}

@media (max-width: 600px) {
  .stats3-main h3 { font-size: 16px; margin: 32px 0 14px; }
}

/* ============ 本文 ============ */
.stats3-main p {
  font-size: 16px;
  line-height: 2.05;
  margin: 0 0 1.7em;
  color: var(--s3-text-sub);
}

.stats3-main strong {
  font-weight: 700;
  background: linear-gradient(transparent 60%, var(--s3-marker) 60%);
  padding: 0 2px;
  color: var(--s3-text);
}

.stats3-main em {
  font-style: normal;
  color: var(--s3-accent);
  font-weight: 700;
  border-bottom: 2px solid var(--s3-accent);
  padding-bottom: 1px;
}

.stats3-main a {
  color: var(--s3-accent);
  border-bottom: 1px solid var(--s3-accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.stats3-main a:hover { opacity: 0.65; }

.stats3-main ul,
.stats3-main ol {
  margin: 0 0 1.4em;
  padding-left: 1.6em;
}

.stats3-main li {
  font-size: 16px;
  line-height: 2.0;
  margin-bottom: 0.7em;
  color: var(--s3-text-sub);
}

/* ============ リード文（このページで学ぶこと） ============ */
.stats3-lead {
  background: var(--s3-bg-soft);
  border-left: 4px solid var(--s3-accent);
  padding: 20px 24px;
  margin: 0 0 32px;
  border-radius: 2px;
}

.stats3-lead-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--s3-accent);
  margin: 0 0 8px;
}

.stats3-lead p {
  font-size: 15px;
  line-height: 1.85;
  margin: 0;
  color: var(--s3-text);
}

.stats3-lead p + p { margin-top: 0.6em; }

/* ============ 例示ブロック ============ */
.stats3-example {
  background: var(--s3-bg-soft-2);
  border: 1px solid var(--s3-border);
  padding: 18px 22px;
  margin: 0 0 1.6em;
  border-radius: 4px;
}

.stats3-example-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #ffffff;
  background: var(--s3-accent);
  padding: 3px 10px;
  border-radius: 2px;
  margin-bottom: 10px;
}

.stats3-example p:last-child { margin-bottom: 0; }

/* EXAMPLE枠内の箇条書き */
.stats3-example ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stats3-example li {
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 0.4em;
  padding-left: 1.1em;
  position: relative;
  color: var(--s3-text-sub);
}

.stats3-example li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 5px;
  height: 5px;
  background: var(--s3-accent);
  border-radius: 50%;
}

.stats3-example li:last-child { margin-bottom: 0; }

/* ============ テーブル ============ */
.stats3-table-wrap {
  overflow-x: auto;
  margin: 0 0 1.6em;
}

.stats3-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  background: var(--s3-bg);
}

.stats3-table th,
.stats3-table td {
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--s3-border);
  line-height: 1.7;
  color: var(--s3-text-sub);
}

.stats3-table th {
  background: var(--s3-bg-soft);
  font-weight: 700;
  color: var(--s3-text);
  white-space: nowrap;
}

.stats3-table tr:nth-child(even) td {
  background: var(--s3-bg-soft-2);
}

/* ============ ポイント枠 ============ */
.stats3-point {
  background: var(--s3-bg);
  border: 2px solid var(--s3-accent);
  padding: 18px 22px;
  margin: 1.6em 0;
  border-radius: 4px;
  position: relative;
}

.stats3-point-label {
  position: absolute;
  top: -12px;
  left: 16px;
  background: var(--s3-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 3px 12px;
  border-radius: 2px;
}

.stats3-point p:last-child { margin-bottom: 0; }

/* ============ さえちゃんのワンポイントアドバイス ============ */
.sae-advice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 28px 0;
}

.sae-advice-img {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
}

.sae-advice-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.sae-advice-bubble {
  flex: 1;
  position: relative;
  background: var(--s3-bg-soft);
  border: 1px solid var(--s3-border);
  border-radius: 12px;
  padding: 14px 18px;
  min-height: 56px;
}

.sae-advice-bubble::before {
  content: '';
  position: absolute;
  top: 22px;
  left: -9px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right: 9px solid var(--s3-border);
}

.sae-advice-bubble::after {
  content: '';
  position: absolute;
  top: 22px;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right: 9px solid var(--s3-bg-soft);
}

.sae-advice-name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--s3-accent);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.sae-advice-bubble p {
  margin: 0 0 0.6em;
  font-size: 15px;
  line-height: 1.85;
  color: var(--s3-text);
}

.sae-advice-bubble p:last-child { margin-bottom: 0; }

@media (max-width: 600px) {
  .sae-advice-img { width: 64px; height: 64px; }
  .sae-advice-bubble p { font-size: 14px; }
}

/* ============ Excel補助ファイルダウンロード ============ */
 .stats3-download {
   background: var(--s3-excel-bg);
   color: #fff;
   padding: 24px 28px;
   border-radius: 6px;
   margin: 48px 0 32px;
   display: flex;
   align-items: center;
   gap: 20px;
   flex-wrap: wrap;
 }

/* 内部のテキスト要素を白で確定（.stats3-main p の詳細度に勝つよう指定） */
.stats3-main .stats3-download .stats3-download-title,
.stats3-main .stats3-download .stats3-download-desc,
.stats3-download .stats3-download-label {
  color: #fff;
}

 .stats3-download-icon {
   flex-shrink: 0;
   width: 48px;
   height: 48px;
   background: rgba(255, 255, 255, 0.15);
   border: 1px solid rgba(255, 255, 255, 0.25);
   border-radius: 6px;
   display: grid;
   place-items: center;
   font-size: 22px;
   font-weight: 700;
   font-family: 'Instrument Serif', serif;
   color: #fff;
 }

 .stats3-download-body {
   flex: 1;
   min-width: 0;
 }

 .stats3-download-label {
   font-size: 11px;
   letter-spacing: 0.16em;
   opacity: 0.8;
   margin-bottom: 4px;
 }

 .stats3-download-title {
   font-size: 17px;
   font-weight: 700;
   margin: 0 0 4px;
   line-height: 1.5;
 }

 .stats3-download-desc {
   font-size: 13px;
   margin: 0;
   opacity: 0.9;
   line-height: 1.6;
 }

/* ダウンロードボタン（aタグ） */
.stats3-main a.stats3-download-btn,
.stats3-download-btn {
   background: #fff;
   color: var(--s3-excel-bg);
   padding: 10px 20px;
   border-radius: 4px;
   font-weight: 700;
   font-size: 14px;
   text-decoration: none;
   border-bottom: none;
   display: inline-flex;
   align-items: center;
   gap: 6px;
   transition: transform 0.2s ease, box-shadow 0.2s ease;
 }

.stats3-main a.stats3-download-btn:hover,
.stats3-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 1;
}

/* ============ 前後ナビ ============ */
.stats3-pagenav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--s3-border);
}

@media (max-width: 600px) {
  .stats3-pagenav { grid-template-columns: 1fr; }
}

.stats3-pagenav a {
  display: block;
  padding: 16px 20px;
  border: 1px solid var(--s3-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--s3-text);
  background: var(--s3-bg);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.stats3-pagenav a:hover {
  border-color: var(--s3-accent);
  background: var(--s3-bg-soft);
  opacity: 1;
}

.stats3-pagenav .pn-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--s3-accent);
  margin-bottom: 6px;
  font-weight: 700;
}

.stats3-pagenav .pn-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

.stats3-pagenav .pn-next { text-align: right; }

/* ============ サイドバー：目次 ============ */
.stats3-side {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (max-width: 960px) {
  .stats3-side {
    position: static;
    top: auto;
    margin-top: 24px;
  }
}

.stats3-toc {
  background: var(--s3-bg-soft);
  border: 1px solid var(--s3-border);
  border-radius: 6px;
  padding: 18px 20px;
}

.stats3-toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--s3-accent);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--s3-border);
}

.stats3-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}

.stats3-toc li {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  counter-increment: toc;
}

.stats3-toc li + li {
  border-top: 1px dashed var(--s3-border-sub);
}

.stats3-toc a {
  display: block;
  padding: 10px 0 10px 28px;
  color: var(--s3-text-sub);
  text-decoration: none;
  border-bottom: none;
  position: relative;
  transition: color 0.2s ease;
}

.stats3-toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--s3-text-faint);
  letter-spacing: 0;
}

.stats3-toc a:hover {
  color: var(--s3-accent);
  opacity: 1;
}

/* ============ 幹葉図（プレーンテキスト表示） ============ */
.stats3-stem-leaf {
  background: var(--s3-bg-soft);
  border: 1px solid var(--s3-border);
  border-radius: 4px;
  padding: 18px 22px;
  margin: 0 0 1.6em;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 15px;
  line-height: 1.85;
  color: var(--s3-text);
  white-space: pre;
  overflow-x: auto;
}

.stats3-stem-leaf-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--s3-accent);
  margin-bottom: 8px;
  font-family: 'Noto Sans JP', sans-serif;
}

/* ============ 練習問題 ============ */
.stats3-quiz {
  background: var(--s3-bg);
  border: 2px solid var(--s3-accent);
  border-radius: 6px;
  padding: 22px 24px;
  margin: 28px 0;
  position: relative;
}

.stats3-quiz-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.stats3-quiz-num {
  display: inline-block;
  background: var(--s3-accent);
  color: #fff;
  padding: 4px 14px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.stats3-quiz-tag {
  font-size: 12px;
  color: var(--s3-text-mute);
  letter-spacing: 0.06em;
}

.stats3-main .stats3-quiz .stats3-quiz-q {
  font-weight: 500;
  font-size: 16px;
  margin: 0 0 16px;
  color: var(--s3-text);
  line-height: 1.85;
}

.stats3-main .stats3-quiz .stats3-stem-leaf {
  margin-bottom: 18px;
}

/* 解答（details/summary） */
.stats3-quiz details {
  margin-top: 16px;
}

.stats3-quiz summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--s3-accent-soft);
  color: var(--s3-accent);
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.2s ease;
}

.stats3-quiz summary:hover {
  background: var(--s3-accent);
  color: #fff;
}

/* デフォルトの矢印を消す */
.stats3-quiz summary::-webkit-details-marker { display: none; }
.stats3-quiz summary::marker { content: ''; }

/* カスタム矢印 */
.stats3-quiz summary::before {
  content: '▶';
  font-size: 9px;
  transition: transform 0.2s ease;
}

.stats3-quiz details[open] summary::before {
  transform: rotate(90deg);
}

.stats3-quiz-answer-body {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--s3-bg-soft);
  border-left: 3px solid var(--s3-accent);
  border-radius: 0 4px 4px 0;
}

.stats3-main .stats3-quiz .stats3-quiz-answer-body p {
  font-size: 15px;
  line-height: 1.85;
  margin: 0 0 0.8em;
  color: var(--s3-text);
}

.stats3-main .stats3-quiz .stats3-quiz-answer-body p:last-child {
  margin-bottom: 0;
}

.stats3-quiz-answer-body strong {
  background: linear-gradient(transparent 60%, var(--s3-marker) 60%);
  padding: 0 2px;
}

/* ============ 図表（画像） ============ */
.stats3-figure {
  margin: 32px 0;
  text-align: center;
}

.stats3-figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--s3-border);
  border-radius: 4px;
  background: #ffffff; /* ダークモードでも画像が見やすいよう白固定 */
  padding: 8px;
  box-sizing: border-box;
}

.stats3-figure figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--s3-text-mute);
  text-align: center;
  line-height: 1.6;
}

.stats3-figure-source {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--s3-text-faint);
  letter-spacing: 0.04em;
}

/* ============ ミニヒストグラム（分布の形を示す） ============ */
.stats3-mini-hist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 1.8em 0;
}

@media (max-width: 600px) {
  .stats3-mini-hist-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.stats3-mini-hist {
  background: var(--s3-bg-soft);
  border: 1px solid var(--s3-border);
  border-radius: 4px;
  padding: 16px 12px 14px;
  text-align: center;
}

.stats3-mini-hist-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 84px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--s3-text);
  padding: 0 4px;
}

.stats3-mini-hist-bars span {
  flex: 1;
  background: var(--s3-accent);
  border-radius: 2px 2px 0 0;
  max-width: 16px;
  min-width: 6px;
}

.stats3-mini-hist-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--s3-text);
  margin-bottom: 4px;
}

.stats3-mini-hist-desc {
  font-size: 12px;
  color: var(--s3-text-mute);
  line-height: 1.5;
}

/* 大きめのヒストグラム（層別の例で使用） */
.stats3-hist-card {
  background: var(--s3-bg-soft);
  border: 1px solid var(--s3-border);
  border-radius: 6px;
  padding: 18px 20px 16px;
  margin: 1.6em 0;
}

.stats3-hist-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--s3-accent);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  text-align: center;
}

.stats3-hist-card-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 140px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--s3-text);
  padding: 0 6px;
}

.stats3-hist-card-bars span {
  flex: 1;
  background: var(--s3-accent);
  border-radius: 2px 2px 0 0;
  max-width: 28px;
  min-width: 10px;
}

/* 男女別の比較カラー */
.stats3-hist-card-bars .bar-male {
  background: var(--s3-accent);
}

.stats3-hist-card-bars .bar-female {
  background: var(--s3-accent-mute);
}

.stats3-hist-card-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--s3-text-mute);
  margin-top: 4px;
  padding: 0 6px;
}

.stats3-hist-card-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--s3-text);
}

.stats3-hist-card-legend > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats3-hist-card-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  font-style: normal;
}

.stats3-hist-card-legend i.male { background: var(--s3-accent); }
.stats3-hist-card-legend i.female { background: var(--s3-accent-mute); }

/* ============ SVG図表枠 ============ */
.stats3-svg-figure {
  margin: 1.8em 0;
  padding: 18px 16px 14px;
  background: var(--s3-bg-soft);
  border: 1px solid var(--s3-border);
  border-radius: 6px;
  text-align: center;
  color: var(--s3-text);
}

.stats3-svg-figure svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.stats3-svg-figure-caption {
  font-size: 13px;
  color: var(--s3-text-mute);
  margin-top: 10px;
  text-align: center;
  line-height: 1.5;
}

/* 累積度数分布グラフ（バーをくっつけて階段状に見せる） */
.stats3-cum-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  height: 140px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--s3-text);
  padding: 0 6px;
  position: relative;
}

.stats3-cum-bars span {
  flex: 1;
  background: var(--s3-accent-mute);
  border-top: 2px solid var(--s3-accent);
  border-right: 1px solid var(--s3-bg-soft);
  max-width: 50px;
  min-width: 10px;
}

.stats3-cum-bars span:last-child {
  border-right: none;
}

/* ============ 広告枠 ============ */
.ad-slot {
  margin: 32px 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot-side {
  margin: 0;
  min-height: 250px;
}

@media (max-width: 960px) {
  .ad-slot-side { display: none; }
}
