/* ========== 基本レイアウト ========== */
body {
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  line-height: 1.8;
  background: #fcfcfc;
  color: #222;
  max-width: 900px;
  margin: 0 auto;
  padding: 2em;
}

/* ========== 見出し ========== */
h1, h2, h3 {
  color: #0070c9;
  margin-top: 1.5em;
}

/* ========== 段落・リスト ========== */
p {
  margin-bottom: 1em;
}

ul {
  margin: 1em 0 2em 1.2em;
}

/* ========== コードブロック ========== */
pre {
  background: #f4f4f4;
  padding: 1em;
  border-radius: 6px;
  overflow-x: auto;
  font-family: Menlo, Consolas, monospace;
  font-size: 0.95em;
}

code {
  background: #eee;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: Menlo, Consolas, monospace;
  font-size: 0.95em;
}

/* ========== テーブル ========== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}

th, td {
  border: 1px solid #ccc;
  padding: 0.6em 0.8em;
  text-align: left;
}

th {
  background-color: #f0f8ff;
  color: #003366;
}

/* ========== リンク ========== */
a {
  color: #0066cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ========== ボタン風リンク ========== */
.button-link {
  display: inline-block;
  padding: 0.6em 1em;
  background-color: #0070c9;
  color: white;
  border-radius: 6px;
  text-decoration: none;
  margin-top: 1em;
}

.button-link:hover {
  background-color: #005fa3;
}

/* ========== 区切り線 ========== */
hr {
  margin: 2.5em 0;
  border: none;
  border-top: 1px solid #ddd;
}


/* === TOC（Table of Contents） === */
#toc {
  position: fixed;
  top: 100px;
  left: 0;
  width: 260px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  background: linear-gradient(180deg, #ffffff 0%, #ffffffab 100%);
  color: #000049;
  padding: 1.2em;
  box-shadow: inset -2px 0 5px rgba(0, 0, 0, 0.3);
  border-right: 1px solid #2c2440;
  z-index: 1000;
  font-family: "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 0 12px 12px 0;
}

#toc.active {
  display: block;
}

#toc h2 {
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 0.8em;
  color: #000000;
  border-bottom: 1px solid #3a3350;
  padding-bottom: 0.3em;
}

#toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#toc li {
  margin: 0.4em 0;
}

#toc a {
  text-decoration: none;
  color: #000935;
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

#toc a:hover,
#toc a:focus {
  background: rgba(12, 0, 74, 0.614);
  color: #ffffff;
  outline: none;
}

/* 階層ごとのインデント */
.toc-h1 { margin-left: 0em; font-weight: bold; }
.toc-h2 { margin-left: 1em; }
.toc-h3 { margin-left: 2em; }
.toc-h4 { margin-left: 3em; }
.toc-h5 { margin-left: 4em; }
.toc-h6 { margin-left: 5em; }

/* === スクロールバー（ダーク調）=== */
#toc::-webkit-scrollbar {
  width: 8px;
}

#toc::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

#toc::-webkit-scrollbar-track {
  background: #1a182c;
}


#toc-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    background: #ffffff;
    color: #000038;
    border: none;
    padding: 0.6em 1.2em;
    font-size: 1em;
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(150, 120, 255, 0.3);
    z-index: 2001;
    cursor: pointer;
}

#toc-toggle:focus {
  outline: 2px solid #fff;
}
/* === モバイル対応 === */
@media screen and (max-width: 768px) {
  #toc {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 2em 1.5em;
    border-radius: 0;
    box-shadow: none;
    background: #ffffff;
    display: none;
    z-index: 2000;
  }

  #toc.active {
    display: block;
  }

  #toc-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    background: #ffffff;
    color: #000038;
    border: none;
    padding: 0.6em 1.2em;
    font-size: 1em;
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(150, 120, 255, 0.3);
    z-index: 2001;
    cursor: pointer;
  }

  #toc-toggle:focus {
    outline: 2px solid #fff;
  }
}
