/* 政策優先度チェッカー｜明るく中立的なデータ診断ツール調 light theme */
:root {
  /* レイアウト */
  --bg:           #F5F7FB;
  --bg-soft:      #EEF2F7;
  --card:         #FFFFFF;
  --text:         #111827;
  --text-soft:    #1F2937;
  --muted:        #64748B;
  --line:         #E5E7EB;
  --line-strong:  #CBD5E1;

  /* アクセント */
  --primary:      #2563EB;
  --primary-dark: #1D4ED8;
  --primary-soft: #DBEAFE;
  --secondary:    #7C3AED;
  --accent:       #2563EB;

  --link:         #1D4ED8;
  --shadow:       0 12px 30px rgba(15, 23, 42, 0.08);
  --shadow-soft:  0 6px 16px rgba(15, 23, 42, 0.05);
  --radius:       18px;
  --radius-sm:    12px;

  /* 6分野（指定パレット） */
  --c-economy:     #2563EB;
  --c-welfare:     #16A34A;
  --c-childcare:   #F97316;
  --c-education:   #7C3AED;
  --c-security:    #DC2626;
  --c-immigration: #0891B2;

  /* 状態 */
  --pos: #16A34A;
  --neg: #DC2626;
  --neutral: #64748B;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  background-image:
    linear-gradient(180deg, #F8FAFD 0%, var(--bg) 30%, var(--bg) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.7;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}

/* ヘッダー（プロフェッショナル明朝×幾何ロゴ） */
.app-header {
  text-align: center;
  padding: 32px 8px 22px;
  position: relative;
}
.app-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}
.app-header .brand:hover { text-decoration: none; }
.app-header .brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  box-shadow:
    0 6px 14px rgba(30, 58, 138, 0.18),
    0 1px 2px rgba(15, 23, 42, 0.08);
  flex: 0 0 auto;
}
.app-header .brand-mark img {
  width: 40px; height: 40px; display: block;
}
.app-header .brand-text {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1;
}
.app-header .brand-eyebrow {
  display: inline-block;
  font-family: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
  padding-left: 1px;
  text-transform: uppercase;
}
.app-header h1 {
  margin: 0;
  font-family: 'Noto Serif JP', 'Yu Mincho', 'YuMincho', 'Hiragino Mincho ProN',
    'Hiragino Mincho Pro', 'MS PMincho', serif;
  font-weight: 900;
  font-size: clamp(1.55rem, 4.6vw, 2.15rem);
  letter-spacing: 0.06em;
  line-height: 1.18;
  color: var(--text);
  background: linear-gradient(135deg, #0F1E45 0%, #1E3A8A 45%, #2563EB 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  padding-bottom: 8px;
}
.app-header h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-text-fill-color: initial;
}
.app-header h1 .brand-suffix {
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin-left: 0.4em;
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}
.subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  font-weight: 500;
  font-feature-settings: "palt";
}
@media (max-width: 480px) {
  .app-header { padding: 24px 6px 16px; }
  .app-header .brand { gap: 10px; }
  .app-header .brand-mark { width: 40px; height: 40px; border-radius: 10px; }
  .app-header .brand-mark img { width: 32px; height: 32px; }
  .app-header .brand-eyebrow { font-size: 0.6rem; letter-spacing: 0.26em; margin-bottom: 4px; }
  .subtitle { font-size: 0.8rem; letter-spacing: 0.14em; }
}
.app-footer {
  margin-top: 40px;
  padding: 22px 18px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  color: var(--text-soft);
}
.footer-details {
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.footer-details + .footer-details { margin-top: 8px; }
.footer-details > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-soft);
  font-size: 0.92rem;
  list-style: none;
  position: relative;
  padding: 4px 0 4px 20px;
}
.footer-details > summary::-webkit-details-marker { display: none; }
.footer-details > summary::before {
  content: "+";
  position: absolute;
  left: 2px; top: 4px;
  width: 16px; height: 16px;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--primary);
  font-weight: 800;
  transition: transform .15s;
}
.footer-details[open] > summary::before { content: "−"; }
.footer-details > p {
  margin: 8px 0 4px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-soft);
}
.footer-bottom {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.footer-bottom p { margin: 4px 0; }
@media (max-width: 480px) {
  .app-footer { padding: 18px 14px 12px; border-radius: 14px; }
}

/* カード */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 16px 0;
  position: relative;
}
.card h2, .card h3 {
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 12px;
  font-weight: 700;
}
.card h2 { font-size: 1.18rem; }
.card h3 { font-size: 1.02rem; margin-top: 18px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.hidden { display: none !important; }

/* 送信制限の通知 */
.limit-notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #FEF3C7;
  border: 1px solid #FBBF24;
  color: #92400E;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ボタン */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 0.97rem;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  font-family: inherit;
  font-weight: 600;
  min-height: 44px;
}
.btn:hover  { background: var(--bg-soft); border-color: #94A3B8; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.20);
}
.btn.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn.secondary {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}
.btn.secondary:hover { filter: brightness(0.95); }
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-soft);
}
.btn.ghost:hover { background: var(--bg-soft); }
.btn.small { padding: 7px 13px; font-size: 0.85rem; min-height: 36px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.actions .btn { flex: 1 1 auto; min-width: 140px; text-align: center; }

.bullets { padding-left: 1.2em; color: var(--text-soft); }
.small  { font-size: 0.85rem; }
.muted  { color: var(--muted); }
.notice {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-soft);
}
.link { color: var(--link); }

/* 進捗バー */
.progress { margin-bottom: 14px; }
.progress-bar {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar > div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width .3s ease;
}
.progress-text {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
  letter-spacing: 0.04em;
}

.q-text {
  font-size: 1.10rem;
  line-height: 1.75;
  margin: 14px 0 16px;
  color: var(--text);
  font-weight: 600;
}

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
  min-height: 48px;
}
.choice:hover {
  background: var(--bg-soft);
  border-color: #94A3B8;
}
.choice:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15) inset;
  color: var(--primary-dark);
  font-weight: 600;
}

.quiz-nav { display: flex; justify-content: flex-end; margin-top: 14px; }

/* 結果 */
.result-card { padding: 26px; }
.result-brand {
  font-size: 0.78rem;
  color: var(--primary);
  letter-spacing: 0.22em;
  font-weight: 700;
  text-transform: uppercase;
}
.result-type {
  margin: 14px 0 16px;
  padding: 20px 22px;
  background: linear-gradient(180deg, #F0F5FF 0%, #FFFFFF 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  position: relative;
}
.result-detail-name {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: 0.02em;
}
.result-main-line {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.result-main-line span { color: var(--text); font-weight: 700; }
.result-type-desc { margin: 12px 0 0; color: var(--text-soft); }
.shift-line { margin-top: 14px; font-size: 0.95rem; color: var(--text-soft); }
.shift-label { color: var(--primary); margin-right: 6px; font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.badge {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 99px;
  font-size: 0.85rem; color: #fff; font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,0.10);
}
.badge .badge-key { opacity: 0.85; margin-right: 4px; font-weight: 500; }

.bars { display: flex; flex-direction: column; gap: 9px; margin: 12px 0; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 56px; align-items: center; gap: 10px; }
.bar-label { font-size: 0.92rem; color: var(--text-soft); }
.bar-track {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  height: 14px;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s ease;
}
.bar-pct {
  font-size: 0.92rem;
  text-align: right;
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 脳内マップ */
.grid-wrap { margin: 12px 0; }
.brain-dot-map-container {
  width: 100%;
  max-width: 520px;
  margin: 16px auto 8px;
  display: block;
  text-align: center;
}
.brain-dot-map-svg {
  width: 100%;
  max-width: 460px;
  height: auto;
  aspect-ratio: 460 / 400;
  display: block;
  margin: 0 auto;
}
.brain-dot-map-caption {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 8px;
}
.brain-dot-brain-bg { fill: #EEF2F7; opacity: 0.95; }
.brain-dot-brain-outline {
  fill: none;
  stroke: #CBD5E1;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brain-fill-dot { opacity: 0.96; stroke: none; }
.brain-dot-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  max-width: 420px;
  margin: 10px auto 0;
  font-size: 13px;
  color: var(--text-soft);
}
.brain-dot-legend-item { display: flex; align-items: center; gap: 8px; }
.brain-dot-legend-swatch {
  width: 12px; height: 12px; border-radius: 999px; flex: 0 0 12px;
}

@media (max-width: 520px) {
  .brain-dot-map-container { max-width: 390px; margin-top: 12px; }
  .brain-dot-map-svg { max-width: 380px; }
  .brain-dot-legend {
    grid-template-columns: 1fr 1fr;
    max-width: 340px;
    font-size: 12.5px;
  }
}

.anim-controls {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px auto 0; max-width: 360px; gap: 8px;
}
.anim-label { font-size: 0.85rem; color: var(--muted); }

.shift-desc {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0;
  color: var(--text-soft);
}
.site-url { text-align: right; margin-top: 8px; font-size: 0.78rem; color: var(--muted); }
.site-url a { color: var(--primary); }

/* compare card */
.compare-card .compare-line { margin: 6px 0; color: var(--text-soft); }
.compare-card .compare-line strong { color: var(--primary); font-weight: 700; }

/* 全体平均との比較表 */
.avg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin-top: 8px;
}
.avg-table th, .avg-table td {
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.avg-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.avg-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.avg-diff-pos { color: var(--neg); font-weight: 700; }   /* 平均より高い→暖色 */
.avg-diff-neg { color: var(--primary); font-weight: 700; }
.avg-diff-zero { color: var(--muted); }

/* 今回 vs 前回 */
.prev-card .prev-row {
  display: grid;
  grid-template-columns: 96px 1fr 80px;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92rem;
}
.prev-card .prev-row:last-child { border-bottom: none; }
.prev-card .prev-label { color: var(--text-soft); }
.prev-card .prev-bar {
  position: relative;
  height: 8px;
  background: var(--bg-soft);
  border-radius: 99px;
  overflow: hidden;
}
.prev-card .prev-bar i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--primary);
  opacity: 0.8;
}
.prev-card .prev-delta { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.prev-card .delta-up   { color: var(--pos); }
.prev-card .delta-down { color: var(--neg); }
.prev-card .delta-zero { color: var(--muted); }
.prev-card .prev-summary {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}
.prev-card .prev-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 8px;
}

/* 履歴ミニチャート */
.history-card .hist-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 10px 0 6px;
}
.history-card .hist-col {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--muted);
}
.history-card .hist-col-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
}
.history-card .hist-bars {
  display: flex; align-items: flex-end; gap: 3px;
  width: 100%;
  height: 64px;
}
.history-card .hist-bar {
  flex: 1 1 auto;
  background: var(--bg-soft);
  border-radius: 3px 3px 0 0;
  position: relative;
  min-height: 1px;
}
.history-card .hist-bar > i {
  position: absolute; bottom: 0; left: 0; right: 0;
  border-radius: 3px 3px 0 0;
}
.history-card .hist-num {
  font-size: 0.70rem;
  color: var(--muted);
  margin-top: 2px;
}
.history-card .hist-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 10px 0;
}

/* バッジ「平均より高い/低い」 */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 99px;
  margin-left: 6px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  word-break: keep-all;
  flex-shrink: 0;
}
.tag.up   { background: #FEF2F2; color: var(--neg); }
.tag.down { background: #EFF6FF; color: var(--primary); }
.tag.same { background: var(--bg-soft); color: var(--muted); }

/* 改行禁止ユーティリティ（ボタン・ラベル用） */
.nowrap { white-space: nowrap; word-break: keep-all; }

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
  .progress-bar > div { transition: none; }
}

@media (min-width: 600px) {
  .app-header h1 { font-size: 2rem; }
  .q-text { font-size: 1.2rem; }
  .result-detail-name { font-size: 1.85rem; }
}
@media (max-width: 400px) {
  .app { padding: 12px 10px 40px; }
  .card { padding: 18px; border-radius: 14px; }
  .bar-row { grid-template-columns: 76px 1fr 50px; gap: 8px; }
  .actions .btn { min-width: calc(50% - 5px); }
}
