:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #1a2233;
  --ink-2: #4a5568;
  --line: #d8dde8;
  --accent: #0f62fe;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --surface: #1c2130;
    --ink: #eef1f8;
    --ink-2: #aab3c5;
    --line: #38405a;
    --accent: #6ea8ff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
}

main, .site-header, .site-footer {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header { padding-top: 32px; }

h1 { font-size: 30px; margin: 0 0 8px; }
h2 { font-size: 24px; margin: 40px 0 16px; }
h3 { font-size: 18px; margin: 0 0 8px; }

.lead { font-size: 17px; color: var(--ink-2); margin: 0 0 20px; }
.lead strong { color: var(--ink); }
.both-mark { font-size: 20px; }

/* ---- 図解 ---- */
.diagram-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 12px 12px;
}

.col-heads {
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--ink-2);
}

.diagram-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;
}

#diagram svg {
  display: block;
  min-width: 1240px;
  width: 100%;
  height: auto;
}

#diagram text {
  font-family: inherit;
  font-weight: 700;
}

.node-label { font-size: 18px; fill: #ffffff; }
.node-sub   { font-size: 13.5px; fill: rgba(255,255,255,0.85); }
.edge-label { font-size: 14.5px; fill: var(--ink); }
.edge-label-bg { fill: var(--surface); opacity: 0.92; }

.node { cursor: pointer; }
.edge, .edge-label-g, .node { transition: opacity 0.15s; }

/* ノードにホバー/タップしたとき: 関連ルート以外を薄く */
svg.focus .edge:not(.hl),
svg.focus .edge-label-g:not(.hl) { opacity: 0.06; }
svg.focus .node:not(.hl) { opacity: 0.22; }

.diagram-note {
  margin: 8px 8px 4px;
  font-size: 14px;
  color: var(--ink-2);
}

/* ---- 注意カード ---- */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.note-card p { margin: 0; font-size: 15px; color: var(--ink-2); }

/* ---- 表 ---- */
.table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  min-width: 640px;
}

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td:last-child { white-space: normal; min-width: 200px; font-size: 14px; color: var(--ink-2); }

thead th { font-size: 15px; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: none; }

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 15px;
}

.arrow-cell { font-size: 18px; color: var(--ink-2); }

/* ---- フッター ---- */
.site-footer {
  padding: 32px 16px 40px;
  font-size: 14px;
  color: var(--ink-2);
}
.site-footer a { color: var(--accent); }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .col-heads { display: none; }
}
