/* 目次全般のスタイル */
#toc-container ul, #popup-toc-container ul {
  list-style: none;
  padding: 0;
  margin: 0;
}


/* レベル1のスタイル */
#toc-container > ul > li > a,
#popup-toc-container > ul > li > a {
  font-weight: bold;
  color: #4b3b2b;
  text-decoration: none;
  display: block;
  padding: 5px 0;
}
#toc-container > ul > li > a:hover,
#popup-toc-container > ul > li > a:hover {
  text-decoration: underline;
}

/* レベル2以降のスタイル（入れ子のulに適用） */
#toc-container ul ul,
#popup-toc-container ul ul {
  margin-left: 20px; /* インデント */
}

#toc-container ul ul li a,
#popup-toc-container ul ul li a {
  font-weight: normal;
  color: #4b3b2b;
  text-decoration: none;
  display: block;
  padding: 3px 0;
}
#toc-container ul ul li a:hover,
#popup-toc-container ul ul li a:hover {
  text-decoration: underline;
}

/* --- PC表示時のスタイル --- */
/* デフォルトはPC表示 (インライン表示) を想定 */
#toc-container {
  padding: 15px;
  display: block; /* PCでは表示 */
  background-color: #ffffff80;
}

#open-toc-button,
#toc-popup {
  display: none; /* PCでは非表示 */
}

/* --- スマートフォン表示時のスタイル --- */
@media (max-width: 768px) { /* 例: 768px以下をスマホとする */
  #toc-container {
    display: none; /* スマホでは非表示 */
  }

  #open-toc-button {
    display: block; /* スマホでは表示 */
    padding: 10px 15px;
    background-color: #5079a3;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
  }
  #open-toc-button:hover {
    background-color: #5079a3;
  }

  /* ポップアップコンテナは初期状態では非表示（JavaScriptで表示を制御） */
  #toc-popup {
    display: none; /* JavaScriptでflexに変更して表示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
  }

  .toc-popup-content {
    background: white;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
  }

  #close-toc-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
  }
  #close-toc-button:hover {
    color: #333;
  }
}