body {
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  line-height: 1.8;
  background: #f9f9f9;
  color: #333;
  margin: 0;
  padding: 0;
}

header {
  background-color: #0078d4;
  color: white;
  padding: 1.5em;
  text-align: center;
}

nav {
  background-color: #eee;
  padding: 0.5em 1em;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}

nav li a {
  color: #0078d4;
  text-decoration: none;
  font-weight: bold;
}

nav li a:hover {
  text-decoration: underline;
}

main {
  padding: 2em;
  max-width: 900px;
  margin: auto;
}

h2 {
  border-bottom: 2px solid #0078d4;
  padding-bottom: 0.3em;
  margin-top: 2em;
}

pre {
  background-color: #0078d4;
  color: #dcdcdc;
  padding: 1em;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
  font-family: 'Fira Code', Menlo, Consolas, monospace;
  font-size: 0.95em;
  box-shadow: 0 2px 6px rgba(0, 0, 140, 0.721);
  margin: 1.5em 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

pre:hover {
  transform: scale(1.02);
  background-color: #2a2a2a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* <code> を単体で使うときのインライン表示 */
code {
  background-color: #f4f4f4;
  color: #c7254e;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: Consolas, monospace;
  font-size: 0.95em;
}

/* <pre><code> 用のハイライト用 */
pre code {
  display: block;
  white-space: pre;
  color: #2e2e2e;
}

/* スクロールバーを控えめに */
pre::-webkit-scrollbar {
  height: 8px;
}
pre::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}
pre::-webkit-scrollbar-track {
  background: #0078d4;
}


footer {
  background: #f0f0f0;
  text-align: center;
  padding: 1em;
  font-size: 0.9em;
  color: #555;
}
/* === TOC（Table of Contents） === */
#toc {
  position: fixed;
  top: 100px;
  right: 0;
  width: 260px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  background: linear-gradient(180deg, #13007e 0%, #1000c5ab 100%);
  color: #e0e0ff;
  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: #bcb8ff;
  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: #c5cfff;
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

#toc a:hover,
#toc a:focus {
  background: rgba(140, 110, 210, 0.3);
  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;
}

/* === モバイル対応 === */
@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: #0c007575;
    display: none;
    z-index: 2000;
  }

  #toc.active {
    display: block;
  }

  #toc-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    background: #5a4ca0;
    color: #fff;
    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;
  }
}
