/* ===== 共通設定（CSS変数） ===== */
:root {
  --main-color: #4a90e2;       /* メインの青色 */
  --main-color-hover: #eef5ff; /* リンク等のホバー時の薄い青 */
  --bg-color: #f5f6f8;         /* 全体の背景色 */
  --text-color: #333333;       /* 文字色 */
  --border-color: #e0e0e0;     /* 枠線の色 */
}

/* ===== 全体 ===== */
body {
  font-family: "Helvetica Neue", Arial, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-color);
  scroll-behavior: smooth;
}

/* 画面最上部のアクセントライン（bodyのグラデーションから変更） */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--main-color);
  z-index: 9999;
}

/* ===== 言語表示（日英併記用） ===== */
.jp { 
  display: inline; 
}

.en {
  display: block;
  font-size: 0.85rem;
  color: #777;
  margin-top: 2px;
  font-weight: normal; /* 親要素が太字の場合の対策 */
}

h2 .en {
  font-size: 0.8rem;
  color: #999;
}

/* ===== メインコンテンツ ===== */
#main {
  max-width: 980px;
  margin: 0 auto;
  background: #ffffff;
  padding: 30px; /* 上下の余白を少し広げて読みやすく */
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  border-radius: 0 0 8px 8px;
}

/* ===== サイドバー（左・右） ===== */
#left, #right {
  position: sticky;
  top: 20px; /* 少し余裕を持たせる */
  max-height: 85vh;
  overflow-y: auto;
  background: #ffffff;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

#left h2, #right h2 {
  font-size: 0.9rem;
  background: var(--main-color);
  color: #ffffff;
  padding: 8px 10px;
  border-radius: 4px;
  border: none; /* 元のh2のボーダーを消す */
}

/* ===== 見出し ===== */
h1 {
  font-size: 1.75rem;
  margin-bottom: 15px;
  color: #111;
}

h2 {
  font-size: 1.4rem;
  border-left: 5px solid var(--main-color);
  padding-left: 12px;
  margin-top: 40px; /* 次のセクションとの間隔を確保 */
  margin-bottom: 15px;
}

h3 {
  font-size: 1.15rem;
  border-left: 3px solid #b0b0b0;
  padding-left: 10px;
  margin-top: 25px;
  margin-bottom: 10px;
}

/* ===== テーブル ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
}

th {
  background: var(--main-color);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
  font-weight: bold;
}

td, th {
  padding: 10px 12px; /* 少しだけセル内を広く */
  border: 1px solid #dddddd;
}

tr:nth-child(even) {
  background-color: #fafbfc; /* 1行おきに背景色を変えて視認性UP */
}

tr:hover {
  background-color: #f0f6ff;
}

/* ===== コードブロック ===== */
pre {
  background: #1e1e1e;
  color: #dcdcdc;
  padding: 18px;
  overflow-x: auto;
  border-radius: 8px;
  font-size: 0.9rem;
  position: relative;
  font-family: Consolas, Monaco, "Courier New", Courier, monospace;
}

/* COPYから変更（コピーできない誤解を防ぐため） */
pre::after {
  content: "CODE";
  position: absolute;
  top: 6px;
  right: 12px;
  font-size: 0.7rem;
  color: #777;
  letter-spacing: 1px;
}

/* ===== リンク ===== */
a {
  color: var(--main-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #2a6fb8; /* ホバー時は少し濃い青に */
  text-decoration: underline;
}

/* ===== 目次 (TOC) ===== */
#toc {
  position: sticky;
  top: 20px;
  background: #ffffff;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

#toc a {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
}

#toc a:hover {
  background: var(--main-color-hover);
  text-decoration: none;
}

/* ===== その他リスト・装飾 ===== */
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 35px 0;
}

ul, ol {
  padding-left: 20px;
}

ul li, ol li {
  margin-bottom: 6px;
}

/* 折りたたみ (details) */
details {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 15px 0;
  background: #fafafa;
  transition: background 0.2s ease;
}

summary {
  cursor: pointer;
  font-weight: bold;
  outline: none;
}

details[open] {
  background: #ffffff;
  border-color: #cccccc;
}

/* ===== スクロールバー（モダンブラウザ対応含む） ===== */
/* Chrome, Safari, Edge用 */
::-webkit-scrollbar { 
  width: 8px; 
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #aaaaaa;
}
/* Firefox用 */
* {
  scrollbar-width: thin;
  scrollbar-color: #cccccc transparent;
}

/* ===== レスポンシブ（スマホ・タブレット対応） ===== */
@media screen and (max-width: 900px) {
  #left, #right {
    position: static;
    max-height: none;
    width: 100% !important;
    box-sizing: border-box;
    margin-bottom: 20px;
  }

  #main {
    padding: 20px 15px;
  }
  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
}