/* ===================================================
   素質診断システム — ライトテーマ CSS
   ai-compat-php のデザインシステム踏襲 + 数理盤SVG専用スタイル追加
   ==================================================*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&family=Noto+Serif+JP:wght@400;600;700&display=swap');

:root {
  --dark:    #1a1a2e;
  --accent:  #e91e8c;
  --gold:    #c9a84c;
  --gold2:   #b8943c;
  --bg:      #f8f4ee;
  --purple:  #f0e6f4;
  --gray:    #666666;
  --white:   #ffffff;
  --border:  rgba(26,26,46,.13);
  --shadow:  0 4px 24px rgba(26,26,46,.10);
  --radius:  14px;
  --radius-sm: 9px;
  /* 素質診断システム固有カラー */
  --insight: #5b3fa6;    /* インディゴパープル */
  --insight2: #7c5abf;
  --insight-bg: #f3eeff;
  --five-wood:  #4caf6a;
  --five-fire:  #e05a3a;
  --five-earth: #d4a330;
  --five-metal: #8ab4d0;
  --five-water: #4e88c7;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
  line-height: 1.7;
}

/* ── コンテナ ────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ── ヘッダー ────────────────────────────────────── */
.site-header {
  background: var(--dark);
  color: var(--white);
  text-align: center;
  padding: 44px 20px 32px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(91,63,166,.25) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(201,168,76,.15) 0%, transparent 60%);
  pointer-events: none;
}

.site-logo {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 900;
  color: var(--white);
  letter-spacing: .1em;
  margin-bottom: 6px;
  position: relative;
}
.site-logo span { color: var(--gold); }
.site-tagline {
  font-size: .88rem;
  color: rgba(255,255,255,.6);
  letter-spacing: .05em;
  position: relative;
}

/* ── カード ─────────────────────────────────────── */
.glass-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* ── セクションタイトル ──────────────────────────── */
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: .04em;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
.section-title::before {
  content: '';
  width: 4px;
  height: 1.1em;
  background: linear-gradient(to bottom, var(--insight), var(--gold));
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── 入力フォーム ────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
.form-group { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: .78rem;
  color: var(--gray);
  margin-bottom: 5px;
  font-weight: 500;
}
.form-input {
  width: 100%;
  background: var(--white);
  border: 1.5px solid #d9d4cc;
  border-radius: 7px;
  color: var(--dark);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .95rem;
  padding: 9px 13px;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--insight);
  box-shadow: 0 0 0 3px rgba(91,63,166,.12);
}
.form-input::placeholder { color: #bbb; }

.form-hint {
  font-size: .74rem;
  color: var(--gray);
  margin-top: 4px;
  opacity: .8;
}

/* ── 送信ボタン ─────────────────────────────────── */
.btn-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--dark), #2e2a52);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .1em;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  box-shadow: 0 4px 18px rgba(26,26,46,.3);
  margin-top: 8px;
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(26,26,46,.4); }
.btn-submit:active { transform: translateY(0); }

/* ── 四柱カード ─────────────────────────────────── */
.pillars-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.pillar-card {
  flex: 1;
  min-width: 80px;
  max-width: 120px;
  background: var(--insight-bg);
  border: 1px solid rgba(91,63,166,.2);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
}
.pillar-label {
  font-size: .7rem;
  color: var(--insight2);
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: .05em;
}
.pillar-gan {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--dark);
  line-height: 1;
}
.pillar-zhi {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--insight);
}
.pillar-element {
  font-size: .7rem;
  color: var(--gray);
  margin-top: 4px;
}

/* ── インフォバッジ ────────────────────────────── */
.info-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .82rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--purple);
  color: var(--insight);
  border: 1px solid rgba(91,63,166,.2);
}
.badge.gold {
  background: rgba(201,168,76,.12);
  color: var(--gold2);
  border-color: rgba(201,168,76,.3);
}
.badge.danger {
  background: rgba(224,90,58,.08);
  color: #c04520;
  border-color: rgba(224,90,58,.25);
}
.badge.success {
  background: rgba(76,175,106,.1);
  color: #3d8b56;
  border-color: rgba(76,175,106,.3);
}

/* 名響力バッジ（大きめ） */
.tenun-badge {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 8px 22px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(201,168,76,.2), rgba(91,63,166,.12));
  color: var(--dark);
  border: 2px solid var(--gold);
  letter-spacing: .05em;
}

/* ── 五行バーグラフ ──────────────────────────────── */
.gogyo-bars { display: flex; flex-direction: column; gap: 8px; }
.gogyo-row { display: flex; align-items: center; gap: 10px; }
.gogyo-label {
  font-size: .82rem;
  font-weight: 700;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.gogyo-bar-bg {
  flex: 1;
  height: 10px;
  background: #e8e4de;
  border-radius: 5px;
  overflow: hidden;
}
.gogyo-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .6s ease;
  min-width: 4px;
}
.gogyo-val { font-size: .75rem; color: var(--gray); width: 28px; text-align: right; flex-shrink: 0; }
.gogyo-bar-fill.wood  { background: var(--five-wood); }
.gogyo-bar-fill.fire  { background: var(--five-fire); }
.gogyo-bar-fill.earth { background: var(--five-earth); }
.gogyo-bar-fill.metal { background: var(--five-metal); }
.gogyo-bar-fill.water { background: var(--five-water); }
.gogyo-label.wood  { color: var(--five-wood); }
.gogyo-label.fire  { color: var(--five-fire); }
.gogyo-label.earth { color: var(--five-earth); }
.gogyo-label.metal { color: var(--five-metal); }
.gogyo-label.water { color: var(--five-water); }

/* ── 姓名判断テーブル ────────────────────────────── */
.seimei-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.seimei-cell {
  background: var(--insight-bg);
  border: 1px solid rgba(91,63,166,.15);
  border-radius: 9px;
  padding: 11px 14px;
  display: grid;
  grid-template-columns: 52px 44px auto 1fr;
  align-items: center;
  gap: 4px 12px;
}
.seimei-cell-label {
  font-size: .78rem;
  color: var(--insight2);
  font-weight: 700;
  letter-spacing: .05em;
  white-space: nowrap;
}
.seimei-cell-value {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--dark);
  text-align: center;
}
.seimei-cell-luck {
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.seimei-cell-desc {
  font-size: .78rem;
  color: var(--gray);
  line-height: 1.5;
}

/* 吉凶カラー */
.luck-大吉 { color: var(--gold2); }
.luck-吉   { color: #4a8a5a; }
.luck-半吉 { color: #7a6aaa; }
.luck-凶   { color: #c07030; }
.luck-大凶 { color: #c03030; }

.sansai-block {
  background: var(--purple);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.sansai-label { font-size: .78rem; color: var(--gray); font-weight: 500; }
.sansai-elements {
  font-size: 1rem;
  font-weight: 700;
  color: var(--insight);
}
.sansai-luck {
  font-size: .82rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 12px;
}

/* ── 数理盤 SVG ─────────────────────────────────── */
.boards-wrap {
  display: flex;
  flex-wrap: nowrap;        /* PC: 4つ横並び */
  gap: 8px;
  justify-content: center;
  align-items: flex-start;
  margin-top: 8px;
  overflow-x: auto;         /* 万が一はみ出す場合はスクロール */
}
.board-panel {
  flex: 1 1 0;              /* 4等分 */
  min-width: 0;
  text-align: center;
}
.board-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--insight2);
  margin-bottom: 6px;
  letter-spacing: .04em;
}
.board-svg {
  display: block;
  margin: 0 auto;
  /* ボーダーはSVG内で描画 */
}

/* SVG内の要素はSVGスタイルで制御（PHPからinline SVGで出力） */
.board-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: var(--gray);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── 開運合局 凡例カラー定義 ─────────────────────── */
.legend-dot.shukumei  { background: #5b3fa6; }
.legend-dot.seimei    { background: #c9a84c; }
.legend-dot.mei       { background: #e91e8c; }
.legend-dot.suuri     { background: #4e88c7; }
.legend-dot.anken     { background: #e05a3a; }
.legend-dot.ha        { background: #c07030; }
.legend-dot.gokyoku   { background: #4caf6a; }
.legend-dot.jungokyoku { background: #7ac060; border: 1px dashed #4caf6a; }

/* ── 名響力テキストカード ────────────────────────── */
.fortune-power-card {
  background: linear-gradient(135deg, var(--insight-bg), rgba(201,168,76,.06));
  border: 1px solid rgba(91,63,166,.18);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
}
.fortune-power-label {
  font-size: .78rem;
  color: var(--insight2);
  font-weight: 700;
  letter-spacing: .06em;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.fortune-power-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--dark);
  margin-bottom: 14px;
}
.fortune-power-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: .88rem;
  line-height: 1.7;
  margin-bottom: 6px;
  align-items: start;
}
.fortune-power-key {
  font-weight: 700;
  color: var(--insight2);
  font-size: .82rem;
  white-space: nowrap;
}
.fortune-power-val { color: var(--dark); }
.ことわざ-box {
  margin-top: 12px;
  background: rgba(201,168,76,.1);
  border-left: 3px solid var(--gold);
  padding: 8px 14px;
  border-radius: 0 6px 6px 0;
  font-size: .87rem;
  color: var(--gold2);
  font-style: italic;
}

/* ── 10年運勢テーブル ────────────────────────────── */
.forecast-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.forecast-table th {
  background: var(--dark);
  color: var(--white);
  padding: 10px 12px;
  font-size: .85rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: .04em;
}
.forecast-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  text-align: center;
  vertical-align: middle;
}
.forecast-table td:last-child {
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}
.forecast-table tr:nth-child(even) td { background: #faf8f5; }
.forecast-table tr:last-child td { border-bottom: none; }
.forecast-table tr:hover td { background: var(--insight-bg); }
.forecast-ganzhi {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
}
.forecast-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; min-height: 22px; }
.fc-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.fc-badge.kuubou     { background: rgba(26,26,46,.1); color: var(--gray); }
.fc-badge.gangou     { background: rgba(76,175,106,.12); color: #3d8b56; }
.fc-badge.zhigou     { background: rgba(76,175,106,.12); color: #3d8b56; }
.fc-badge.tenkoku    { background: rgba(224,90,58,.12); color: #c04520; }

/* ── アニメーション ──────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp .45s ease both; }
.fade-in:nth-child(2) { animation-delay: .07s; }
.fade-in:nth-child(3) { animation-delay: .14s; }
.fade-in:nth-child(4) { animation-delay: .21s; }
.fade-in:nth-child(5) { animation-delay: .28s; }
.fade-in:nth-child(6) { animation-delay: .35s; }
.fade-in:nth-child(7) { animation-delay: .42s; }

/* ── 戻るリンク ─────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  transition: color .2s;
  position: relative;
}
.back-link:hover { color: var(--white); }

/* ── フッター ────────────────────────────────────── */
.site-footer {
  background: var(--dark);
  text-align: center;
  padding: 24px 20px;
  font-size: .75rem;
  color: rgba(255,255,255,.35);
  line-height: 1.8;
  margin-top: 40px;
}

/* ── 理論説明 ────────────────────────────────────── */
.theory-banner {
  background: var(--insight-bg);
  border: 1px solid rgba(91,63,166,.18);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: .87rem;
  color: var(--dark);
  line-height: 1.8;
}
.theory-banner summary {
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  font-size: .93rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--insight);
}
.theory-banner summary::after { content: ' ▼'; font-size: .7em; opacity: .6; }
.theory-banner[open] summary::after { content: ' ▲'; }
.theory-body { margin-top: 12px; }
.theory-body p { margin-bottom: 8px; }

/* ── レスポンシブ ────────────────────────────────── */
@media (max-width: 640px) {
  .glass-card { padding: 18px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .seimei-grid { gap: 6px; }
  .seimei-cell { grid-template-columns: 42px 36px auto 1fr; gap: 3px 8px; padding: 9px 10px; }
  .seimei-cell-desc { font-size: .72rem; }

  .pillars-row { gap: 6px; }
  .pillar-card { min-width: 64px; padding: 10px 6px; }
  /* 数理盤: スマホは縦並び */
  .boards-wrap {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 20px;
  }
  .board-panel {
    flex: 0 0 auto;
    width: 100%;
  }
  .forecast-table { font-size: .8rem; }
  .forecast-table th, .forecast-table td { padding: 8px 6px; }
  .site-header { padding: 28px 16px 22px; }
}
