:root {
  --accent: #0078ff;
  --accent-light: #e7f1ff;
  --bg: #f9fbfd;
  --card-bg: #fff;
  --border: #ddd;
  --text: #333;
  --shadow: 0 3px 8px rgba(0,0,0,0.15);
  --transition: 0.25s ease;
}

/* =========================
   全体基本スタイル
========================= */
body {
  font-family: 'Noto Sans JP', sans-serif;
  background-color: #f8fafc;
  color: #333;
  margin: 0;
  padding: 0;
  line-height: 1.7;
}

/* ===== ヘッダー ===== */
.header {
  position: relative;        /* ホームリンク絶対配置のため */
  text-align: center;        /* タイトル中央 */
  padding: 1rem 2rem;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.header h1 {
  margin: 0;
  font-size: 1.8rem;
}

/* ホームリンク左上固定 */
.header .home-link {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--card-bg);
  border: 1px solid var(--accent);
  text-decoration: none;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.header .home-link:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-50%) translateY(-2px);
}

/* ===== SP対応 ===== */
@media (max-width: 600px) {
  .header {
    text-align: center;
    padding: 0.5rem 1rem;
  }
  .header .home-link {
    position: static;
    transform: none;
    margin-bottom: 0.5rem;
  }
}

/* =========================
   メインコンテンツ
========================= */
main {
  max-width: 900px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

section {
  margin-bottom: 2rem;
}

.howto h2 {
  color: #1e40af;
  border-left: 4px solid #3b82f6;
  padding-left: 0.5rem;
  margin-top: 0;
}

/* =========================
   ツールの使い方
========================= */
.howto ol {
  padding-left: 1.5rem;
}

.howto li {
  margin-bottom: 0.6rem;
}

.notice {
  font-size: 0.9rem;
  color: #666;
  margin-top: 1rem;
}

/* =========================
   入力フォーム
========================= */
.input-section fieldset {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  background: #f9fafb;
}

.input-section legend {
  font-weight: bold;
  color: #2563eb;
  padding: 0 0.4rem;
}

.input-section input[type="text"],
.input-section select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin: 4px;
  font-size: 1rem;
}

.input-section button {
  display: inline-block;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.95rem;
  margin-top: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.input-section button:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* ボタンを中央揃えに */
.center-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 1.5rem 0;
}

/* =========================
   関係図（SVG）
========================= */
#familyTree {
  width: 100%;
  height: 480px;
  border: 1px dashed #9ca3af;
  border-radius: 10px;
  background: #f8fafc;
  margin-top: 1rem;
}

/* =========================
   フッター
========================= */
footer {
  text-align: center;
  padding: 1.5rem 0;
  background-color: #f1f5f9;
  color: #555;
  font-size: 0.9rem;
  border-top: 1px solid #e2e8f0;
}

/* =========================
   レスポンシブ対応
========================= */
@media (max-width: 640px) {
  main {
    padding: 1.2rem;
  }

  .input-section input[type="text"],
  .input-section select {
    width: 100%;
    margin-top: 6px;
  }

  .center-buttons {
    flex-direction: column;
    gap: 10px;
  }

  #familyTree {
    height: 380px;
  }
}

/* ===== 関連ツールセクション ===== */
.related-tools {
  margin: 3rem auto;
  padding: 1.5rem;
  max-width: 900px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: center;
}

.related-tools h2 {
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
  color: var(--accent);
}

.related-tools p {
  color: #555;
  margin-bottom: 1rem;
}

.tool-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tool-card {
  display: inline-block;
  padding: 0.8rem 1.2rem;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 10px;
  text-decoration: none;
  color: var(--accent);
  font-weight: 500;
  transition: var(--transition);
}

.tool-card:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

.more-tools a {
  color: var(--accent);
  text-decoration: none;
}

.more-tools a:hover {
  text-decoration: underline;
}