:root {
  --bg: #f6f7f9; --card: #fff; --text: #1f2933; --muted: #5f6b7a; --line: #dde2e8;
  --accent: #1f6feb; --ninkei: #0e7c66; --kokuho: #b4541a; --win-bg: #e9f7f1; --warn: #8a5a00; --warn-bg: #fff7e0;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; line-height: 1.6; }
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.45rem; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: .95rem; }
.badge { display: inline-block; font-size: .75rem; background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d68a; border-radius: 4px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }
section.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 8px; margin-bottom: 16px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.row { display: grid; grid-template-columns: 220px 1fr; gap: 8px 14px; align-items: center; margin-bottom: 12px; }
.row > label { font-weight: 600; font-size: .92rem; }
.hint { grid-column: 2; color: var(--muted); font-size: .8rem; margin-top: -6px; }
input[type=number], select { font: inherit; padding: 7px 9px; border: 1px solid #c4ccd6; border-radius: 6px; width: 100%; max-width: 260px; background: #fff; }
.unit { display: flex; align-items: center; gap: 6px; }
.radios { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.radios label { font-weight: normal; }
table.fam { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 8px; }
table.fam th, table.fam td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; }
table.fam select, table.fam input { max-width: 100%; }
button { font: inherit; cursor: pointer; border-radius: 6px; }
.btn-sub { border: 1px solid #c4ccd6; background: #fff; padding: 5px 12px; font-size: .88rem; }
.btn-del { border: none; background: none; color: #c0392b; font-size: .85rem; }
.btn-main { display: block; width: 100%; max-width: 320px; margin: 4px auto 20px; padding: 12px; font-size: 1.05rem; font-weight: 700; color: #fff; background: var(--accent); border: none; }
.verdict { text-align: center; font-size: 1.15rem; font-weight: 700; padding: 14px; border-radius: 10px; background: var(--win-bg); margin-bottom: 14px; }
.verdict small { display: block; font-weight: normal; font-size: .85rem; color: var(--muted); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.res { border: 2px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; }
.res.win { border-color: var(--ninkei); }
.res.kokuho.win { border-color: var(--kokuho); }
.res h3 { margin: 0 0 6px; font-size: 1rem; }
.res.ninkei h3 { color: var(--ninkei); } .res.kokuho h3 { color: var(--kokuho); }
.big { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.sub { color: var(--muted); font-size: .85rem; }
.res table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: 8px; }
.res td { padding: 3px 0; border-top: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.res td:last-child { text-align: right; }
.note { font-size: .82rem; color: var(--muted); }
.note li { margin-bottom: 4px; }
.warnbox { background: var(--warn-bg); border: 1px solid #f0d68a; color: #5c4300; border-radius: 8px; padding: 10px 12px; font-size: .85rem; margin-bottom: 14px; }
.hidden { display: none; }
@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; gap: 4px; }
  .hint { grid-column: 1; margin-top: 0; }
  .cols { grid-template-columns: 1fr; }
  table.fam th:nth-child(3), table.fam td:nth-child(3) { min-width: 110px; }
}

/* サイト共通のナビゲーション */
.sitenav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; margin-bottom: 18px; }
.sitenav a { color: var(--accent); text-decoration: none; }
.sitenav a[aria-current] { color: var(--text); font-weight: 700; }

/* 料率の手入力表 */
table.rates { width: 100%; border-collapse: collapse; font-size: .85rem; margin: 4px 0 12px; }
table.rates th, table.rates td { border-bottom: 1px solid var(--line); padding: 5px 4px; text-align: left; vertical-align: middle; }
table.rates input { max-width: 110px; padding: 5px 6px; }
.scroll-x { overflow-x: auto; }

/* 解説ページ */
article h2 { font-size: 1.15rem; margin: 28px 0 10px; padding-left: 10px; border-left: 4px solid var(--accent); }
article h3 { font-size: 1rem; margin: 18px 0 6px; }
article p, article li { font-size: .95rem; }
table.cmp { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 8px 0 16px; background: var(--card); }
table.cmp th, table.cmp td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
table.cmp thead th { background: #eef2f6; }
.cta { display: block; text-align: center; margin: 24px auto; max-width: 360px; padding: 12px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; }
.src { font-size: .8rem; color: var(--muted); word-break: break-all; }

/* 比較表の列見出し（短い名前＋小さな補足、列ごとの色） */
table.cmp thead th.opt { font-size: .98rem; border-top: 4px solid var(--line); background: #fff; }
table.cmp thead th.opt span { display: block; margin-top: 2px; font-size: .75rem; font-weight: normal; color: var(--muted); }
table.cmp thead th.opt-ninkei { border-top-color: var(--ninkei); color: var(--ninkei); }
table.cmp thead th.opt-kokuho { border-top-color: var(--kokuho); color: var(--kokuho); }
table.cmp thead th.opt-fuyo { border-top-color: #6b4fbb; color: #6b4fbb; }
table.cmp tbody th { background: #f6f8fa; white-space: nowrap; font-weight: 600; }
table.cmp { table-layout: fixed; min-width: 560px; }
table.cmp thead th:first-child { width: 7.5em; background: transparent; border-top: none; border-left: none; }

.scroll-hint { display: none; font-size: .78rem; color: var(--muted); margin: 0 0 4px; text-align: right; }
@media (max-width: 640px) { .scroll-hint { display: block; } }

/* 概算の警告（判定に直結するため目立たせる） */
.verdict-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; font-size: .8rem; font-weight: 700; color: #fff; background: #c2410c; border-radius: 4px; vertical-align: middle; }
.estimate-alert { border: 2px solid #c2410c; background: #fff4ec; color: #4a1d06; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: .9rem; }
.estimate-alert p { margin: 4px 0; }
.estimate-alert .estimate-title { font-weight: 800; font-size: 1rem; color: #c2410c; }
.estimate-alert strong { color: #c2410c; }
.res td[colspan] { text-align: left; }

/* 家族の年齢欄が狭い画面でつぶれないように */
table.fam select.f-cat { min-width: 8.5em; }
.two-years h2 { margin-top: 0; }
.verdict2 { font-weight: 700; background: var(--win-bg); padding: 10px 12px; border-radius: 8px; }
.two-years table.rates td:not(:first-child), .two-years table.rates th:not(:first-child) { text-align: right; white-space: nowrap; }
.note a, .src, .sub a { overflow-wrap: anywhere; word-break: break-all; }
